ASN1_OBJECT_free:
  348|    159|{
  349|    159|    if (a == NULL)
  ------------------
  |  Branch (349:9): [True: 0, False: 159]
  ------------------
  350|      0|        return;
  351|    159|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) {
  ------------------
  |  |  112|    159|# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
  ------------------
  |  Branch (351:9): [True: 0, False: 159]
  ------------------
  352|      0|#ifndef CONST_STRICT
  353|       |        /*
  354|       |         * Disable purely for compile-time strict const checking.  Doing this
  355|       |         * on a "real" compile will cause memory leaks
  356|       |         */
  357|      0|        OPENSSL_free((void*)a->sn);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  358|      0|        OPENSSL_free((void*)a->ln);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  359|      0|#endif
  360|      0|        a->sn = a->ln = NULL;
  361|      0|    }
  362|    159|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) {
  ------------------
  |  |  113|    159|# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
  ------------------
  |  Branch (362:9): [True: 0, False: 159]
  ------------------
  363|      0|        OPENSSL_free((void*)a->data);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  364|      0|        a->data = NULL;
  365|      0|        a->length = 0;
  366|      0|    }
  367|    159|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
  ------------------
  |  |  110|    159|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
  |  Branch (367:9): [True: 0, False: 159]
  ------------------
  368|      0|        OPENSSL_free(a);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  369|    159|}

EVP_PKEY_asn1_get_count:
   39|    745|{
   40|    745|    int num = OSSL_NELEM(standard_methods);
  ------------------
  |  |   14|    745|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   41|    745|    if (app_methods)
  ------------------
  |  Branch (41:9): [True: 0, False: 745]
  ------------------
   42|      0|        num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
   43|    745|    return num;
   44|    745|}
EVP_PKEY_asn1_get0:
   47|  11.1k|{
   48|  11.1k|    int num = OSSL_NELEM(standard_methods);
  ------------------
  |  |   14|  11.1k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   49|  11.1k|    if (idx < 0)
  ------------------
  |  Branch (49:9): [True: 0, False: 11.1k]
  ------------------
   50|      0|        return NULL;
   51|  11.1k|    if (idx < num)
  ------------------
  |  Branch (51:9): [True: 11.1k, False: 0]
  ------------------
   52|  11.1k|        return standard_methods[idx];
   53|      0|    idx -= num;
   54|      0|    return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
   55|  11.1k|}
EVP_PKEY_asn1_find:
   82|    875|{
   83|    875|    const EVP_PKEY_ASN1_METHOD *t;
   84|       |
   85|    875|    for (;;) {
   86|    875|        t = pkey_asn1_find(type);
   87|    875|        if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
  ------------------
  |  | 1606|      5|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (87:13): [True: 870, False: 5]
  |  Branch (87:19): [True: 5, False: 0]
  ------------------
   88|    875|            break;
   89|      0|        type = t->pkey_base_id;
   90|      0|    }
   91|    875|    if (pe) {
  ------------------
  |  Branch (91:9): [True: 875, False: 0]
  ------------------
   92|    875|#ifndef OPENSSL_NO_ENGINE
   93|    875|        ENGINE *e;
   94|       |        /* type will contain the final unaliased type */
   95|    875|        e = ENGINE_get_pkey_asn1_meth_engine(type);
   96|    875|        if (e) {
  ------------------
  |  Branch (96:13): [True: 0, False: 875]
  ------------------
   97|      0|            *pe = e;
   98|      0|            return ENGINE_get_pkey_asn1_meth(e, type);
   99|      0|        }
  100|    875|#endif
  101|    875|        *pe = NULL;
  102|    875|    }
  103|    875|    return t;
  104|    875|}
EVP_PKEY_asn1_find_str:
  108|    744|{
  109|    744|    int i;
  110|    744|    const EVP_PKEY_ASN1_METHOD *ameth = NULL;
  111|       |
  112|    744|    if (len == -1)
  ------------------
  |  Branch (112:9): [True: 80, False: 664]
  ------------------
  113|     80|        len = strlen(str);
  114|    744|    if (pe) {
  ------------------
  |  Branch (114:9): [True: 744, False: 0]
  ------------------
  115|    744|#ifndef OPENSSL_NO_ENGINE
  116|    744|        ENGINE *e;
  117|    744|        ameth = ENGINE_pkey_asn1_find_str(&e, str, len);
  118|    744|        if (ameth) {
  ------------------
  |  Branch (118:13): [True: 0, False: 744]
  ------------------
  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|    744|#endif
  129|    744|        *pe = NULL;
  130|    744|    }
  131|  11.9k|    for (i = EVP_PKEY_asn1_get_count(); i-- > 0; ) {
  ------------------
  |  Branch (131:41): [True: 11.1k, False: 744]
  ------------------
  132|  11.1k|        ameth = EVP_PKEY_asn1_get0(i);
  133|  11.1k|        if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
  ------------------
  |  | 1606|  11.1k|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (133:13): [True: 3.72k, False: 7.44k]
  ------------------
  134|  3.72k|            continue;
  135|  7.44k|        if ((int)strlen(ameth->pem_str) == len
  ------------------
  |  Branch (135:13): [True: 117, False: 7.32k]
  ------------------
  136|  7.44k|            && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0)
  ------------------
  |  Branch (136:16): [True: 0, False: 117]
  ------------------
  137|      0|            return ameth;
  138|  7.44k|    }
  139|    744|    return NULL;
  140|    744|}
EVP_PKEY_asn1_get0_info:
  199|     15|{
  200|     15|    if (!ameth)
  ------------------
  |  Branch (200:9): [True: 0, False: 15]
  ------------------
  201|      0|        return 0;
  202|     15|    if (ppkey_id)
  ------------------
  |  Branch (202:9): [True: 15, False: 0]
  ------------------
  203|     15|        *ppkey_id = ameth->pkey_id;
  204|     15|    if (ppkey_base_id)
  ------------------
  |  Branch (204:9): [True: 15, False: 0]
  ------------------
  205|     15|        *ppkey_base_id = ameth->pkey_base_id;
  206|     15|    if (ppkey_flags)
  ------------------
  |  Branch (206:9): [True: 15, False: 0]
  ------------------
  207|     15|        *ppkey_flags = ameth->pkey_flags;
  208|     15|    if (pinfo)
  ------------------
  |  Branch (208:9): [True: 0, False: 15]
  ------------------
  209|      0|        *pinfo = ameth->info;
  210|     15|    if (ppem_str)
  ------------------
  |  Branch (210:9): [True: 15, False: 0]
  ------------------
  211|     15|        *ppem_str = ameth->pem_str;
  212|     15|    return 1;
  213|     15|}
ameth_lib.c:pkey_asn1_find:
   58|    875|{
   59|    875|    EVP_PKEY_ASN1_METHOD tmp;
   60|    875|    const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
   61|       |
   62|    875|    tmp.pkey_id = type;
   63|    875|    if (app_methods) {
  ------------------
  |  Branch (63:9): [True: 0, False: 875]
  ------------------
   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|    875|    ret = OBJ_bsearch_ameth(&t, standard_methods, OSSL_NELEM(standard_methods));
  ------------------
  |  |   14|    875|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   70|    875|    if (ret == NULL || *ret == NULL)
  ------------------
  |  Branch (70:9): [True: 870, False: 5]
  |  Branch (70:24): [True: 0, False: 5]
  ------------------
   71|    870|        return NULL;
   72|      5|    return *ret;
   73|    875|}
ameth_lib.c:ameth_cmp:
   31|  3.49k|{
   32|  3.49k|    return ((*a)->pkey_id - (*b)->pkey_id);
   33|  3.49k|}

ossl_err_load_ASN1_strings:
  210|      1|{
  211|      1|#ifndef OPENSSL_NO_ERR
  212|      1|    if (ERR_reason_error_string(ASN1_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (212:9): [True: 1, False: 0]
  ------------------
  213|      1|        ERR_load_strings_const(ASN1_str_reasons);
  214|      1|#endif
  215|      1|    return 1;
  216|      1|}

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

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

bio_cleanup:
  947|      1|{
  948|      1|#ifndef OPENSSL_NO_SOCK
  949|      1|    bio_sock_cleanup_int();
  950|      1|    CRYPTO_THREAD_lock_free(bio_lookup_lock);
  951|      1|    bio_lookup_lock = NULL;
  952|      1|#endif
  953|      1|    CRYPTO_FREE_REF(&bio_type_count);
  954|      1|}

BIO_meth_new:
   38|      1|{
   39|      1|    BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|       |
   41|      1|    if (biom == NULL
  ------------------
  |  Branch (41:9): [True: 0, False: 1]
  ------------------
   42|      1|            || (biom->name = OPENSSL_strdup(name)) == NULL) {
  ------------------
  |  |  119|      1|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (42:16): [True: 0, False: 1]
  ------------------
   43|      0|        OPENSSL_free(biom);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   44|      0|        return NULL;
   45|      0|    }
   46|      1|    biom->type = type;
   47|      1|    return biom;
   48|      1|}
BIO_meth_free:
   51|      1|{
   52|      1|    if (biom != NULL) {
  ------------------
  |  Branch (52:9): [True: 1, False: 0]
  ------------------
   53|      1|        OPENSSL_free(biom->name);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   54|      1|        OPENSSL_free(biom);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   55|      1|    }
   56|      1|}
BIO_meth_set_write_ex:
  101|      1|{
  102|      1|    biom->bwrite_old = NULL;
  103|      1|    biom->bwrite = bwrite;
  104|      1|    return 1;
  105|      1|}
BIO_meth_set_read_ex:
  149|      1|{
  150|      1|    biom->bread_old = NULL;
  151|      1|    biom->bread = bread;
  152|      1|    return 1;
  153|      1|}
BIO_meth_set_puts:
  164|      1|{
  165|      1|    biom->bputs = bputs;
  166|      1|    return 1;
  167|      1|}
BIO_meth_set_gets:
  178|      1|{
  179|      1|    biom->bgets = bgets;
  180|      1|    return 1;
  181|      1|}
BIO_meth_set_ctrl:
  192|      1|{
  193|      1|    biom->ctrl = ctrl;
  194|      1|    return 1;
  195|      1|}
BIO_meth_set_create:
  205|      1|{
  206|      1|    biom->create = create;
  207|      1|    return 1;
  208|      1|}
BIO_meth_set_destroy:
  218|      1|{
  219|      1|    biom->destroy = destroy;
  220|      1|    return 1;
  221|      1|}

BIO_snprintf:
  932|  1.38k|{
  933|  1.38k|    va_list args;
  934|  1.38k|    int ret;
  935|       |
  936|  1.38k|    va_start(args, format);
  937|       |
  938|  1.38k|    ret = BIO_vsnprintf(buf, n, format, args);
  939|       |
  940|  1.38k|    va_end(args);
  941|  1.38k|    return ret;
  942|  1.38k|}
BIO_vsnprintf:
  945|  1.42k|{
  946|  1.42k|    size_t retlen;
  947|  1.42k|    int truncated;
  948|       |
  949|  1.42k|    if (!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
  ------------------
  |  Branch (949:9): [True: 0, False: 1.42k]
  ------------------
  950|      0|        return -1;
  951|       |
  952|  1.42k|    if (truncated)
  ------------------
  |  Branch (952:9): [True: 0, False: 1.42k]
  ------------------
  953|       |        /*
  954|       |         * In case of truncation, return -1 like traditional snprintf.
  955|       |         * (Current drafts for ISO/IEC 9899 say snprintf should return the
  956|       |         * number of characters that would have been written, had the buffer
  957|       |         * been large enough.)
  958|       |         */
  959|      0|        return -1;
  960|  1.42k|    return (retlen <= INT_MAX) ? (int)retlen : -1;
  ------------------
  |  Branch (960:12): [True: 1.42k, False: 0]
  ------------------
  961|  1.42k|}
bio_print.c:_dopr:
   91|  1.42k|{
   92|  1.42k|    char ch;
   93|  1.42k|    int64_t value;
   94|  1.42k|#ifndef OPENSSL_SYS_UEFI
   95|  1.42k|    LDOUBLE fvalue;
  ------------------
  |  |   28|  1.42k|# define LDOUBLE double
  ------------------
   96|  1.42k|#endif
   97|  1.42k|    char *strvalue;
   98|  1.42k|    int min;
   99|  1.42k|    int max;
  100|  1.42k|    int state;
  101|  1.42k|    int flags;
  102|  1.42k|    int cflags;
  103|  1.42k|    size_t currlen;
  104|       |
  105|  1.42k|    state = DP_S_DEFAULT;
  ------------------
  |  |   45|  1.42k|#define DP_S_DEFAULT    0
  ------------------
  106|  1.42k|    flags = currlen = cflags = min = 0;
  107|  1.42k|    max = -1;
  108|  1.42k|    ch = *format++;
  109|       |
  110|  14.9k|    while (state != DP_S_DONE) {
  ------------------
  |  |   52|  14.9k|#define DP_S_DONE       7
  ------------------
  |  Branch (110:12): [True: 13.5k, False: 1.42k]
  ------------------
  111|  13.5k|        if (ch == '\0' || (buffer == NULL && currlen >= *maxlen))
  ------------------
  |  Branch (111:13): [True: 1.42k, False: 12.1k]
  |  Branch (111:28): [True: 12.1k, False: 0]
  |  Branch (111:46): [True: 0, False: 12.1k]
  ------------------
  112|  1.42k|            state = DP_S_DONE;
  ------------------
  |  |   52|  1.42k|#define DP_S_DONE       7
  ------------------
  113|       |
  114|  13.5k|        switch (state) {
  115|  4.33k|        case DP_S_DEFAULT:
  ------------------
  |  |   45|  4.33k|#define DP_S_DEFAULT    0
  ------------------
  |  Branch (115:9): [True: 4.33k, False: 9.21k]
  ------------------
  116|  4.33k|            if (ch == '%')
  ------------------
  |  Branch (116:17): [True: 1.55k, False: 2.77k]
  ------------------
  117|  1.55k|                state = DP_S_FLAGS;
  ------------------
  |  |   46|  1.55k|#define DP_S_FLAGS      1
  ------------------
  118|  2.77k|            else
  119|  2.77k|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
  ------------------
  |  Branch (119:21): [True: 0, False: 2.77k]
  ------------------
  120|      0|                    return 0;
  121|  4.33k|            ch = *format++;
  122|  4.33k|            break;
  123|  1.55k|        case DP_S_FLAGS:
  ------------------
  |  |   46|  1.55k|#define DP_S_FLAGS      1
  ------------------
  |  Branch (123:9): [True: 1.55k, False: 11.9k]
  ------------------
  124|  1.55k|            switch (ch) {
  125|      0|            case '-':
  ------------------
  |  Branch (125:13): [True: 0, False: 1.55k]
  ------------------
  126|      0|                flags |= DP_F_MINUS;
  ------------------
  |  |   56|      0|#define DP_F_MINUS      (1 << 0)
  ------------------
  127|      0|                ch = *format++;
  128|      0|                break;
  129|      0|            case '+':
  ------------------
  |  Branch (129:13): [True: 0, False: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  138|      0|                flags |= DP_F_NUM;
  ------------------
  |  |   62|      0|#define DP_F_NUM        (1 << 3)
  ------------------
  139|      0|                ch = *format++;
  140|      0|                break;
  141|      0|            case '0':
  ------------------
  |  Branch (141:13): [True: 0, False: 1.55k]
  ------------------
  142|      0|                flags |= DP_F_ZERO;
  ------------------
  |  |   64|      0|#define DP_F_ZERO       (1 << 4)
  ------------------
  143|      0|                ch = *format++;
  144|      0|                break;
  145|  1.55k|            default:
  ------------------
  |  Branch (145:13): [True: 1.55k, False: 0]
  ------------------
  146|  1.55k|                state = DP_S_MIN;
  ------------------
  |  |   47|  1.55k|#define DP_S_MIN        2
  ------------------
  147|  1.55k|                break;
  148|  1.55k|            }
  149|  1.55k|            break;
  150|  1.55k|        case DP_S_MIN:
  ------------------
  |  |   47|  1.55k|#define DP_S_MIN        2
  ------------------
  |  Branch (150:9): [True: 1.55k, False: 11.9k]
  ------------------
  151|  1.55k|            if (ossl_isdigit(ch)) {
  ------------------
  |  Branch (151:17): [True: 0, False: 1.55k]
  ------------------
  152|      0|                min = 10 * min + char_to_int(ch);
  ------------------
  |  |   83|      0|#define char_to_int(p) (p - '0')
  ------------------
  153|      0|                ch = *format++;
  154|  1.55k|            } else if (ch == '*') {
  ------------------
  |  Branch (154:24): [True: 0, False: 1.55k]
  ------------------
  155|      0|                min = va_arg(args, int);
  156|      0|                ch = *format++;
  157|      0|                state = DP_S_DOT;
  ------------------
  |  |   48|      0|#define DP_S_DOT        3
  ------------------
  158|      0|            } else
  159|  1.55k|                state = DP_S_DOT;
  ------------------
  |  |   48|  1.55k|#define DP_S_DOT        3
  ------------------
  160|  1.55k|            break;
  161|  1.55k|        case DP_S_DOT:
  ------------------
  |  |   48|  1.55k|#define DP_S_DOT        3
  ------------------
  |  Branch (161:9): [True: 1.55k, False: 11.9k]
  ------------------
  162|  1.55k|            if (ch == '.') {
  ------------------
  |  Branch (162:17): [True: 0, False: 1.55k]
  ------------------
  163|      0|                state = DP_S_MAX;
  ------------------
  |  |   49|      0|#define DP_S_MAX        4
  ------------------
  164|      0|                ch = *format++;
  165|      0|            } else
  166|  1.55k|                state = DP_S_MOD;
  ------------------
  |  |   50|  1.55k|#define DP_S_MOD        5
  ------------------
  167|  1.55k|            break;
  168|      0|        case DP_S_MAX:
  ------------------
  |  |   49|      0|#define DP_S_MAX        4
  ------------------
  |  Branch (168:9): [True: 0, False: 13.5k]
  ------------------
  169|      0|            if (ossl_isdigit(ch)) {
  ------------------
  |  Branch (169:17): [True: 0, False: 0]
  ------------------
  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|      0|            } else if (ch == '*') {
  ------------------
  |  Branch (174:24): [True: 0, False: 0]
  ------------------
  175|      0|                max = va_arg(args, int);
  176|      0|                ch = *format++;
  177|      0|                state = DP_S_MOD;
  ------------------
  |  |   50|      0|#define DP_S_MOD        5
  ------------------
  178|      0|            } else
  179|      0|                state = DP_S_MOD;
  ------------------
  |  |   50|      0|#define DP_S_MOD        5
  ------------------
  180|      0|            break;
  181|  1.55k|        case DP_S_MOD:
  ------------------
  |  |   50|  1.55k|#define DP_S_MOD        5
  ------------------
  |  Branch (181:9): [True: 1.55k, False: 11.9k]
  ------------------
  182|  1.55k|            switch (ch) {
  183|      0|            case 'h':
  ------------------
  |  Branch (183:13): [True: 0, False: 1.55k]
  ------------------
  184|      0|                cflags = DP_C_SHORT;
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  185|      0|                ch = *format++;
  186|      0|                break;
  187|  1.38k|            case 'l':
  ------------------
  |  Branch (187:13): [True: 1.38k, False: 177]
  ------------------
  188|  1.38k|                if (*format == 'l') {
  ------------------
  |  Branch (188:21): [True: 0, False: 1.38k]
  ------------------
  189|      0|                    cflags = DP_C_LLONG;
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  190|      0|                    format++;
  191|      0|                } else
  192|  1.38k|                    cflags = DP_C_LONG;
  ------------------
  |  |   72|  1.38k|#define DP_C_LONG       2
  ------------------
  193|  1.38k|                ch = *format++;
  194|  1.38k|                break;
  195|      0|            case 'q':
  ------------------
  |  Branch (195:13): [True: 0, False: 1.55k]
  ------------------
  196|      0|            case 'j':
  ------------------
  |  Branch (196:13): [True: 0, False: 1.55k]
  ------------------
  197|      0|                cflags = DP_C_LLONG;
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  198|      0|                ch = *format++;
  199|      0|                break;
  200|      0|            case 'L':
  ------------------
  |  Branch (200:13): [True: 0, False: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  205|      0|                cflags = DP_C_SIZE;
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  206|      0|                ch = *format++;
  207|      0|                break;
  208|    177|            default:
  ------------------
  |  Branch (208:13): [True: 177, False: 1.38k]
  ------------------
  209|    177|                break;
  210|  1.55k|            }
  211|  1.55k|            state = DP_S_CONV;
  ------------------
  |  |   51|  1.55k|#define DP_S_CONV       6
  ------------------
  212|  1.55k|            break;
  213|  1.55k|        case DP_S_CONV:
  ------------------
  |  |   51|  1.55k|#define DP_S_CONV       6
  ------------------
  |  Branch (213:9): [True: 1.55k, False: 11.9k]
  ------------------
  214|  1.55k|            switch (ch) {
  215|     43|            case 'd':
  ------------------
  |  Branch (215:13): [True: 43, False: 1.51k]
  ------------------
  216|     43|            case 'i':
  ------------------
  |  Branch (216:13): [True: 0, False: 1.55k]
  ------------------
  217|     43|                switch (cflags) {
  218|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (218:17): [True: 0, False: 43]
  ------------------
  219|      0|                    value = (short int)va_arg(args, int);
  220|      0|                    break;
  221|      0|                case DP_C_LONG:
  ------------------
  |  |   72|      0|#define DP_C_LONG       2
  ------------------
  |  Branch (221:17): [True: 0, False: 43]
  ------------------
  222|      0|                    value = va_arg(args, long int);
  223|      0|                    break;
  224|      0|                case DP_C_LLONG:
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  |  Branch (224:17): [True: 0, False: 43]
  ------------------
  225|      0|                    value = va_arg(args, int64_t);
  226|      0|                    break;
  227|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (227:17): [True: 0, False: 43]
  ------------------
  228|      0|                    value = va_arg(args, ossl_ssize_t);
  229|      0|                    break;
  230|     43|                default:
  ------------------
  |  Branch (230:17): [True: 43, False: 0]
  ------------------
  231|     43|                    value = va_arg(args, int);
  232|     43|                    break;
  233|     43|                }
  234|     43|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min,
  ------------------
  |  Branch (234:21): [True: 0, False: 43]
  ------------------
  235|     43|                            max, flags))
  236|      0|                    return 0;
  237|     43|                break;
  238|     43|            case 'X':
  ------------------
  |  Branch (238:13): [True: 0, False: 1.55k]
  ------------------
  239|      0|                flags |= DP_F_UP;
  ------------------
  |  |   66|      0|#define DP_F_UP         (1 << 5)
  ------------------
  240|       |                /* FALLTHROUGH */
  241|      0|            case 'x':
  ------------------
  |  Branch (241:13): [True: 0, False: 1.55k]
  ------------------
  242|      0|            case 'o':
  ------------------
  |  Branch (242:13): [True: 0, False: 1.55k]
  ------------------
  243|  1.38k|            case 'u':
  ------------------
  |  Branch (243:13): [True: 1.38k, False: 177]
  ------------------
  244|  1.38k|                flags |= DP_F_UNSIGNED;
  ------------------
  |  |   68|  1.38k|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  245|  1.38k|                switch (cflags) {
  246|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (246:17): [True: 0, False: 1.38k]
  ------------------
  247|      0|                    value = (unsigned short int)va_arg(args, unsigned int);
  248|      0|                    break;
  249|  1.38k|                case DP_C_LONG:
  ------------------
  |  |   72|  1.38k|#define DP_C_LONG       2
  ------------------
  |  Branch (249:17): [True: 1.38k, False: 0]
  ------------------
  250|  1.38k|                    value = va_arg(args, unsigned long int);
  251|  1.38k|                    break;
  252|      0|                case DP_C_LLONG:
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  |  Branch (252:17): [True: 0, False: 1.38k]
  ------------------
  253|      0|                    value = va_arg(args, uint64_t);
  254|      0|                    break;
  255|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (255:17): [True: 0, False: 1.38k]
  ------------------
  256|      0|                    value = va_arg(args, size_t);
  257|      0|                    break;
  258|      0|                default:
  ------------------
  |  Branch (258:17): [True: 0, False: 1.38k]
  ------------------
  259|      0|                    value = va_arg(args, unsigned int);
  260|      0|                    break;
  261|  1.38k|                }
  262|  1.38k|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value,
  ------------------
  |  Branch (262:21): [True: 0, False: 1.38k]
  ------------------
  263|  1.38k|                            ch == 'o' ? 8 : (ch == 'u' ? 10 : 16),
  ------------------
  |  Branch (263:29): [True: 0, False: 1.38k]
  |  Branch (263:46): [True: 1.38k, False: 0]
  ------------------
  264|  1.38k|                            min, max, flags))
  265|      0|                    return 0;
  266|  1.38k|                break;
  267|  1.38k|#ifndef OPENSSL_SYS_UEFI
  268|  1.38k|            case 'f':
  ------------------
  |  Branch (268:13): [True: 0, False: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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|      0|            case 'c':
  ------------------
  |  Branch (311:13): [True: 0, False: 1.55k]
  ------------------
  312|      0|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen,
  ------------------
  |  Branch (312:21): [True: 0, False: 0]
  ------------------
  313|      0|                                 va_arg(args, int)))
  314|      0|                    return 0;
  315|      0|                break;
  316|    134|            case 's':
  ------------------
  |  Branch (316:13): [True: 134, False: 1.42k]
  ------------------
  317|    134|                strvalue = va_arg(args, char *);
  318|    134|                if (max < 0) {
  ------------------
  |  Branch (318:21): [True: 134, False: 0]
  ------------------
  319|    134|                    if (buffer)
  ------------------
  |  Branch (319:25): [True: 0, False: 134]
  ------------------
  320|      0|                        max = INT_MAX;
  321|    134|                    else
  322|    134|                        max = *maxlen;
  323|    134|                }
  324|    134|                if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue,
  ------------------
  |  Branch (324:21): [True: 0, False: 134]
  ------------------
  325|    134|                            flags, min, max))
  326|      0|                    return 0;
  327|    134|                break;
  328|    134|            case 'p':
  ------------------
  |  Branch (328:13): [True: 0, False: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  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: 1.55k]
  ------------------
  346|       |                /* not supported yet, treat as next char */
  347|      0|                format++;
  348|      0|                break;
  349|      0|            default:
  ------------------
  |  Branch (349:13): [True: 0, False: 1.55k]
  ------------------
  350|       |                /* unknown, skip */
  351|      0|                break;
  352|  1.55k|            }
  353|  1.55k|            ch = *format++;
  354|  1.55k|            state = DP_S_DEFAULT;
  ------------------
  |  |   45|  1.55k|#define DP_S_DEFAULT    0
  ------------------
  355|  1.55k|            flags = cflags = min = 0;
  356|  1.55k|            max = -1;
  357|  1.55k|            break;
  358|  1.42k|        case DP_S_DONE:
  ------------------
  |  |   52|  1.42k|#define DP_S_DONE       7
  ------------------
  |  Branch (358:9): [True: 1.42k, False: 12.1k]
  ------------------
  359|  1.42k|            break;
  360|      0|        default:
  ------------------
  |  Branch (360:9): [True: 0, False: 13.5k]
  ------------------
  361|      0|            break;
  362|  13.5k|        }
  363|  13.5k|    }
  364|       |    /*
  365|       |     * We have to truncate if there is no dynamic buffer and we have filled the
  366|       |     * static buffer.
  367|       |     */
  368|  1.42k|    if (buffer == NULL) {
  ------------------
  |  Branch (368:9): [True: 1.42k, False: 0]
  ------------------
  369|  1.42k|        *truncated = (currlen > *maxlen - 1);
  370|  1.42k|        if (*truncated)
  ------------------
  |  Branch (370:13): [True: 0, False: 1.42k]
  ------------------
  371|      0|            currlen = *maxlen - 1;
  372|  1.42k|    }
  373|  1.42k|    if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
  ------------------
  |  Branch (373:9): [True: 0, False: 1.42k]
  ------------------
  374|      0|        return 0;
  375|  1.42k|    *retlen = currlen - 1;
  376|  1.42k|    return 1;
  377|  1.42k|}
bio_print.c:doapr_outch:
  840|  8.87k|{
  841|       |    /* If we haven't at least one buffer, someone has done a big booboo */
  842|  8.87k|    if (!ossl_assert(*sbuffer != NULL || buffer != NULL))
  ------------------
  |  |   52|  8.87k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 8.87k, False: 0]
  |  |  |  Branch (52:43): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|  8.87k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (842:9): [True: 0, False: 8.87k]
  ------------------
  843|      0|        return 0;
  844|       |
  845|       |    /* |currlen| must always be <= |*maxlen| */
  846|  8.87k|    if (!ossl_assert(*currlen <= *maxlen))
  ------------------
  |  |   52|  8.87k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  8.87k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (846:9): [True: 0, False: 8.87k]
  ------------------
  847|      0|        return 0;
  848|       |
  849|  8.87k|    if (buffer && *currlen == *maxlen) {
  ------------------
  |  Branch (849:9): [True: 0, False: 8.87k]
  |  Branch (849:19): [True: 0, False: 0]
  ------------------
  850|      0|        if (*maxlen > INT_MAX - BUFFER_INC)
  ------------------
  |  |  835|      0|#define BUFFER_INC  1024
  ------------------
  |  Branch (850:13): [True: 0, False: 0]
  ------------------
  851|      0|            return 0;
  852|       |
  853|      0|        *maxlen += BUFFER_INC;
  ------------------
  |  |  835|      0|#define BUFFER_INC  1024
  ------------------
  854|      0|        if (*buffer == NULL) {
  ------------------
  |  Branch (854:13): [True: 0, False: 0]
  ------------------
  855|      0|            if ((*buffer = OPENSSL_malloc(*maxlen)) == NULL)
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (855:17): [True: 0, False: 0]
  ------------------
  856|      0|                return 0;
  857|      0|            if (*currlen > 0) {
  ------------------
  |  Branch (857:17): [True: 0, False: 0]
  ------------------
  858|      0|                if (!ossl_assert(*sbuffer != NULL))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (858:21): [True: 0, False: 0]
  ------------------
  859|      0|                    return 0;
  860|      0|                memcpy(*buffer, *sbuffer, *currlen);
  861|      0|            }
  862|      0|            *sbuffer = NULL;
  863|      0|        } else {
  864|      0|            char *tmpbuf;
  865|       |
  866|      0|            tmpbuf = OPENSSL_realloc(*buffer, *maxlen);
  ------------------
  |  |  109|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  867|      0|            if (tmpbuf == NULL)
  ------------------
  |  Branch (867:17): [True: 0, False: 0]
  ------------------
  868|      0|                return 0;
  869|      0|            *buffer = tmpbuf;
  870|      0|        }
  871|      0|    }
  872|       |
  873|  8.87k|    if (*currlen < *maxlen) {
  ------------------
  |  Branch (873:9): [True: 8.87k, False: 0]
  ------------------
  874|  8.87k|        if (*sbuffer)
  ------------------
  |  Branch (874:13): [True: 8.87k, False: 0]
  ------------------
  875|  8.87k|            (*sbuffer)[(*currlen)++] = (char)c;
  876|      0|        else
  877|      0|            (*buffer)[(*currlen)++] = (char)c;
  878|  8.87k|    }
  879|       |
  880|  8.87k|    return 1;
  881|  8.87k|}
bio_print.c:fmtint:
  436|  1.42k|{
  437|  1.42k|    int signvalue = 0;
  438|  1.42k|    const char *prefix = "";
  439|  1.42k|    uint64_t uvalue;
  440|  1.42k|    char convert[DECIMAL_SIZE(value) + 3];
  441|  1.42k|    int place = 0;
  442|  1.42k|    int spadlen = 0;
  443|  1.42k|    int zpadlen = 0;
  444|  1.42k|    int caps = 0;
  445|       |
  446|  1.42k|    if (max < 0)
  ------------------
  |  Branch (446:9): [True: 1.42k, False: 0]
  ------------------
  447|  1.42k|        max = 0;
  448|  1.42k|    uvalue = value;
  449|  1.42k|    if (!(flags & DP_F_UNSIGNED)) {
  ------------------
  |  |   68|  1.42k|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  |  Branch (449:9): [True: 43, False: 1.38k]
  ------------------
  450|     43|        if (value < 0) {
  ------------------
  |  Branch (450:13): [True: 0, False: 43]
  ------------------
  451|      0|            signvalue = '-';
  452|      0|            uvalue = 0 - (uint64_t)value;
  453|     43|        } else if (flags & DP_F_PLUS)
  ------------------
  |  |   58|     43|#define DP_F_PLUS       (1 << 1)
  ------------------
  |  Branch (453:20): [True: 0, False: 43]
  ------------------
  454|      0|            signvalue = '+';
  455|     43|        else if (flags & DP_F_SPACE)
  ------------------
  |  |   60|     43|#define DP_F_SPACE      (1 << 2)
  ------------------
  |  Branch (455:18): [True: 0, False: 43]
  ------------------
  456|      0|            signvalue = ' ';
  457|     43|    }
  458|  1.42k|    if (flags & DP_F_NUM) {
  ------------------
  |  |   62|  1.42k|#define DP_F_NUM        (1 << 3)
  ------------------
  |  Branch (458:9): [True: 0, False: 1.42k]
  ------------------
  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|  1.42k|    if (flags & DP_F_UP)
  ------------------
  |  |   66|  1.42k|#define DP_F_UP         (1 << 5)
  ------------------
  |  Branch (464:9): [True: 0, False: 1.42k]
  ------------------
  465|      0|        caps = 1;
  466|  2.63k|    do {
  467|  2.63k|        convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
  ------------------
  |  Branch (467:29): [True: 0, False: 2.63k]
  ------------------
  468|  2.63k|            [uvalue % (unsigned)base];
  469|  2.63k|        uvalue = (uvalue / (unsigned)base);
  470|  2.63k|    } while (uvalue && (place < (int)sizeof(convert)));
  ------------------
  |  Branch (470:14): [True: 1.21k, False: 1.42k]
  |  Branch (470:24): [True: 1.21k, False: 0]
  ------------------
  471|  1.42k|    if (place == sizeof(convert))
  ------------------
  |  Branch (471:9): [True: 0, False: 1.42k]
  ------------------
  472|      0|        place--;
  473|  1.42k|    convert[place] = 0;
  474|       |
  475|  1.42k|    zpadlen = max - place;
  476|  1.42k|    spadlen =
  477|  1.42k|        min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
  ------------------
  |  |   84|  1.42k|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 0, False: 1.42k]
  |  |  ------------------
  ------------------
  |  Branch (477:39): [True: 0, False: 1.42k]
  ------------------
  478|  1.42k|    if (zpadlen < 0)
  ------------------
  |  Branch (478:9): [True: 1.42k, False: 0]
  ------------------
  479|  1.42k|        zpadlen = 0;
  480|  1.42k|    if (spadlen < 0)
  ------------------
  |  Branch (480:9): [True: 1.42k, False: 0]
  ------------------
  481|  1.42k|        spadlen = 0;
  482|  1.42k|    if (flags & DP_F_ZERO) {
  ------------------
  |  |   64|  1.42k|#define DP_F_ZERO       (1 << 4)
  ------------------
  |  Branch (482:9): [True: 0, False: 1.42k]
  ------------------
  483|      0|        zpadlen = OSSL_MAX(zpadlen, spadlen);
  ------------------
  |  |   84|      0|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  484|      0|        spadlen = 0;
  485|      0|    }
  486|  1.42k|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|  1.42k|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (486:9): [True: 0, False: 1.42k]
  ------------------
  487|      0|        spadlen = -spadlen;
  488|       |
  489|       |    /* spaces */
  490|  1.42k|    while (spadlen > 0) {
  ------------------
  |  Branch (490:12): [True: 0, False: 1.42k]
  ------------------
  491|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (491:13): [True: 0, False: 0]
  ------------------
  492|      0|            return 0;
  493|      0|        --spadlen;
  494|      0|    }
  495|       |
  496|       |    /* sign */
  497|  1.42k|    if (signvalue)
  ------------------
  |  Branch (497:9): [True: 0, False: 1.42k]
  ------------------
  498|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  ------------------
  499|      0|            return 0;
  500|       |
  501|       |    /* prefix */
  502|  1.42k|    while (*prefix) {
  ------------------
  |  Branch (502:12): [True: 0, False: 1.42k]
  ------------------
  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|  1.42k|    if (zpadlen > 0) {
  ------------------
  |  Branch (509:9): [True: 0, False: 1.42k]
  ------------------
  510|      0|        while (zpadlen > 0) {
  ------------------
  |  Branch (510:16): [True: 0, False: 0]
  ------------------
  511|      0|            if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
  ------------------
  |  Branch (511:17): [True: 0, False: 0]
  ------------------
  512|      0|                return 0;
  513|      0|            --zpadlen;
  514|      0|        }
  515|      0|    }
  516|       |    /* digits */
  517|  4.06k|    while (place > 0) {
  ------------------
  |  Branch (517:12): [True: 2.63k, False: 1.42k]
  ------------------
  518|  2.63k|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
  ------------------
  |  Branch (518:13): [True: 0, False: 2.63k]
  ------------------
  519|      0|            return 0;
  520|  2.63k|    }
  521|       |
  522|       |    /* left justified spaces */
  523|  1.42k|    while (spadlen < 0) {
  ------------------
  |  Branch (523:12): [True: 0, False: 1.42k]
  ------------------
  524|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (524:13): [True: 0, False: 0]
  ------------------
  525|      0|            return 0;
  526|      0|        ++spadlen;
  527|      0|    }
  528|  1.42k|    return 1;
  529|  1.42k|}
bio_print.c:fmtstr:
  384|    134|{
  385|    134|    int padlen;
  386|    134|    size_t strln;
  387|    134|    int cnt = 0;
  388|       |
  389|    134|    if (value == 0)
  ------------------
  |  Branch (389:9): [True: 0, False: 134]
  ------------------
  390|      0|        value = "<NULL>";
  391|       |
  392|    134|    strln = OPENSSL_strnlen(value, max < 0 ? SIZE_MAX : (size_t)max);
  ------------------
  |  Branch (392:36): [True: 0, False: 134]
  ------------------
  393|       |
  394|    134|    padlen = min - strln;
  395|    134|    if (min < 0 || padlen < 0)
  ------------------
  |  Branch (395:9): [True: 0, False: 134]
  |  Branch (395:20): [True: 134, False: 0]
  ------------------
  396|    134|        padlen = 0;
  397|    134|    if (max >= 0) {
  ------------------
  |  Branch (397:9): [True: 134, False: 0]
  ------------------
  398|       |        /*
  399|       |         * Calculate the maximum output including padding.
  400|       |         * Make sure max doesn't overflow into negativity
  401|       |         */
  402|    134|        if (max < INT_MAX - padlen)
  ------------------
  |  Branch (402:13): [True: 134, False: 0]
  ------------------
  403|    134|            max += padlen;
  404|      0|        else
  405|      0|            max = INT_MAX;
  406|    134|    }
  407|    134|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|    134|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (407:9): [True: 0, False: 134]
  ------------------
  408|      0|        padlen = -padlen;
  409|       |
  410|    134|    while ((padlen > 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (410:12): [True: 0, False: 134]
  |  Branch (410:29): [True: 0, False: 0]
  |  Branch (410:40): [True: 0, False: 0]
  ------------------
  411|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (411:13): [True: 0, False: 0]
  ------------------
  412|      0|            return 0;
  413|      0|        --padlen;
  414|      0|        ++cnt;
  415|      0|    }
  416|  2.17k|    while (strln > 0 && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (416:12): [True: 2.03k, False: 134]
  |  Branch (416:26): [True: 0, False: 2.03k]
  |  Branch (416:37): [True: 2.03k, False: 0]
  ------------------
  417|  2.03k|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
  ------------------
  |  Branch (417:13): [True: 0, False: 2.03k]
  ------------------
  418|      0|            return 0;
  419|  2.03k|        --strln;
  420|  2.03k|        ++cnt;
  421|  2.03k|    }
  422|    134|    while ((padlen < 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (422:12): [True: 0, False: 134]
  |  Branch (422:29): [True: 0, False: 0]
  |  Branch (422:40): [True: 0, False: 0]
  ------------------
  423|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|            return 0;
  425|      0|        ++padlen;
  426|      0|        ++cnt;
  427|      0|    }
  428|    134|    return 1;
  429|    134|}

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

ossl_bio_core_globals_free:
   26|      1|{
   27|      1|    OPENSSL_free(vbcg);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   28|      1|}
ossl_bio_core_globals_new:
   31|      1|{
   32|      1|    return OPENSSL_zalloc(sizeof(BIO_CORE_GLOBALS));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   33|      1|}

BIO_new_file:
   58|      1|{
   59|      1|    BIO  *ret;
   60|      1|    FILE *file = openssl_fopen(filename, mode);
   61|      1|    int fp_flags = BIO_CLOSE;
  ------------------
  |  |   83|      1|# define BIO_CLOSE               0x01
  ------------------
   62|       |
   63|      1|    if (strchr(mode, 'b') == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 1]
  ------------------
   64|      0|        fp_flags |= BIO_FP_TEXT;
  ------------------
  |  |  218|      0|# define BIO_FP_TEXT             0x10
  ------------------
   65|       |
   66|      1|    if (file == NULL) {
  ------------------
  |  Branch (66:9): [True: 1, False: 0]
  ------------------
   67|      1|        ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      1|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      1|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   72|      1|# define ERR_LIB_SYS             2
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   30|      1|# define get_last_sys_error()    errno
  ------------------
   68|      1|                       "calling fopen(%s, %s)",
   69|      1|                       filename, mode);
   70|      1|        if (errno == ENOENT
  ------------------
  |  Branch (70:13): [True: 1, False: 0]
  ------------------
   71|      1|#ifdef ENXIO
   72|      1|            || errno == ENXIO
  ------------------
  |  Branch (72:16): [True: 0, False: 0]
  ------------------
   73|      1|#endif
   74|      1|            )
   75|      1|            ERR_raise(ERR_LIB_BIO, BIO_R_NO_SUCH_FILE);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
   76|      0|        else
   77|      1|            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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   78|      1|        return NULL;
   79|      1|    }
   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);
  ------------------
  |  |  565|      0|# define BIO_set_fp(b,fp,c)      BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp))
  |  |  ------------------
  |  |  |  |  437|      0|# define BIO_C_SET_FILE_PTR                      106
  |  |  ------------------
  ------------------
   88|      0|    return ret;
   89|      0|}

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

BN_free:
  227|    568|{
  228|    568|    if (a == NULL)
  ------------------
  |  Branch (228:9): [True: 568, False: 0]
  ------------------
  229|    568|        return;
  230|      0|    if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|      0|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  ------------------
  231|      0|        bn_free_d(a, 0);
  232|      0|    if (a->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|      0|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (232:9): [True: 0, False: 0]
  ------------------
  233|      0|        OPENSSL_free(a);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  234|      0|}

ossl_bsearch:
   16|  1.75k|{
   17|  1.75k|    const char *base_ = base;
   18|  1.75k|    int l, h, i = 0, c = 0;
   19|  1.75k|    const char *p = NULL;
   20|       |
   21|  1.75k|    if (num == 0)
  ------------------
  |  Branch (21:9): [True: 0, False: 1.75k]
  ------------------
   22|      0|        return NULL;
   23|  1.75k|    l = 0;
   24|  1.75k|    h = num;
   25|  14.0k|    while (l < h) {
  ------------------
  |  Branch (25:12): [True: 12.7k, False: 1.33k]
  ------------------
   26|  12.7k|        i = (l + h) / 2;
   27|  12.7k|        p = &(base_[i * size]);
   28|  12.7k|        c = (*cmp) (key, p);
   29|  12.7k|        if (c < 0)
  ------------------
  |  Branch (29:13): [True: 7.72k, False: 5.00k]
  ------------------
   30|  7.72k|            h = i;
   31|  5.00k|        else if (c > 0)
  ------------------
  |  Branch (31:18): [True: 4.59k, False: 414]
  ------------------
   32|  4.59k|            l = i + 1;
   33|    414|        else
   34|    414|            break;
   35|  12.7k|    }
   36|  1.75k|    if (c != 0 && !(flags & OSSL_BSEARCH_VALUE_ON_NOMATCH))
  ------------------
  |  |  152|  1.33k|# define OSSL_BSEARCH_VALUE_ON_NOMATCH            0x01
  ------------------
  |  Branch (36:9): [True: 1.33k, False: 414]
  |  Branch (36:19): [True: 1.33k, False: 0]
  ------------------
   37|  1.33k|        p = NULL;
   38|    414|    else if (c == 0 && (flags & OSSL_BSEARCH_FIRST_VALUE_ON_MATCH)) {
  ------------------
  |  |  153|    414|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  |  Branch (38:14): [True: 414, False: 0]
  |  Branch (38:24): [True: 3, False: 411]
  ------------------
   39|      3|        while (i > 0 && (*cmp) (key, &(base_[(i - 1) * size])) == 0)
  ------------------
  |  Branch (39:16): [True: 0, False: 3]
  |  Branch (39:25): [True: 0, False: 0]
  ------------------
   40|      0|            i--;
   41|      3|        p = &(base_[i * size]);
   42|      3|    }
   43|  1.75k|    return p;
   44|  1.75k|}

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

ossl_err_load_CMP_strings:
  199|      1|{
  200|      1|# ifndef OPENSSL_NO_ERR
  201|      1|    if (ERR_reason_error_string(CMP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (201:9): [True: 1, False: 0]
  ------------------
  202|      1|        ERR_load_strings_const(CMP_str_reasons);
  203|      1|# endif
  204|      1|    return 1;
  205|      1|}

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

ossl_err_load_CMS_strings:
  175|      1|{
  176|      1|# ifndef OPENSSL_NO_ERR
  177|      1|    if (ERR_reason_error_string(CMS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (177:9): [True: 1, False: 0]
  ------------------
  178|      1|        ERR_load_strings_const(CMS_str_reasons);
  179|      1|# endif
  180|      1|    return 1;
  181|      1|}

ossl_comp_brotli_cleanup:
  353|      1|{
  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|      1|}

COMP_zlib:
  311|      1|{
  312|      1|    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|      1|    return meth;
  320|      1|}
ossl_comp_zlib_cleanup:
  336|      1|{
  337|       |#ifdef ZLIB_SHARED
  338|       |    DSO_free(zlib_dso);
  339|       |    zlib_dso = NULL;
  340|       |#endif
  341|      1|}

ossl_comp_zstd_cleanup:
  428|      1|{
  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|      1|}

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

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

ossl_load_builtin_compressions:
   29|      1|{
   30|      1|    STACK_OF(SSL_COMP) *comp_methods = NULL;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
   31|      1|#ifndef OPENSSL_NO_COMP
   32|      1|    SSL_COMP *comp = NULL;
   33|      1|    COMP_METHOD *method = COMP_zlib();
   34|       |
   35|      1|    comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
  ------------------
  |  |   69|      1|#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
  ------------------
   36|       |
   37|      1|    if (COMP_get_type(method) != NID_undef && comp_methods != NULL) {
  ------------------
  |  |   18|      2|#define NID_undef                       0
  ------------------
  |  Branch (37:9): [True: 0, False: 1]
  |  Branch (37:47): [True: 0, False: 0]
  ------------------
   38|      0|        comp = OPENSSL_malloc(sizeof(*comp));
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|      0|        if (comp != NULL) {
  ------------------
  |  Branch (39:13): [True: 0, False: 0]
  ------------------
   40|      0|            comp->method = method;
   41|      0|            comp->id = SSL_COMP_ZLIB_IDX;
  ------------------
  |  |   18|      0|#define SSL_COMP_ZLIB_IDX       1
  ------------------
   42|      0|            comp->name = COMP_get_name(method);
   43|      0|            if (!sk_SSL_COMP_push(comp_methods, comp))
  ------------------
  |  |   77|      0|#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
  ------------------
  |  Branch (43:17): [True: 0, False: 0]
  ------------------
   44|      0|                OPENSSL_free(comp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|      0|        }
   46|      0|    }
   47|      1|#endif
   48|      1|    return comp_methods;
   49|      1|}
ossl_free_compression_methods_int:
   57|      1|{
   58|      1|    sk_SSL_COMP_pop_free(methods, cmeth_free);
  ------------------
  |  |   81|      1|#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))
  ------------------
   59|      1|}

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

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

NCONF_new_ex:
  183|      1|{
  184|      1|    CONF *ret;
  185|       |
  186|      1|    if (meth == NULL)
  ------------------
  |  Branch (186:9): [True: 1, False: 0]
  ------------------
  187|      1|        meth = NCONF_default();
  188|       |
  189|      1|    ret = meth->create(meth);
  190|      1|    if (ret == NULL) {
  ------------------
  |  Branch (190:9): [True: 0, False: 1]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  192|      0|        return NULL;
  193|      0|    }
  194|      1|    ret->libctx = libctx;
  195|       |
  196|      1|    return ret;
  197|      1|}
NCONF_free:
  205|      1|{
  206|      1|    if (conf == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 1]
  ------------------
  207|      0|        return;
  208|      1|    conf->meth->destroy(conf);
  209|      1|}
NCONF_load:
  252|      1|{
  253|      1|    if (conf == NULL) {
  ------------------
  |  Branch (253:9): [True: 0, False: 1]
  ------------------
  254|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  255|      0|        return 0;
  256|      0|    }
  257|       |
  258|      1|    return conf->meth->load(conf, file, eline);
  259|      1|}

CONF_modules_load_file_ex:
  193|      1|{
  194|      1|    char *file = NULL;
  195|      1|    CONF *conf = NULL;
  196|      1|    int ret = 0, diagnostics = OSSL_LIB_CTX_get_conf_diagnostics(libctx);
  197|       |
  198|      1|    ERR_set_mark();
  199|       |
  200|      1|    if (filename == NULL) {
  ------------------
  |  Branch (200:9): [True: 1, False: 0]
  ------------------
  201|      1|        file = CONF_get1_default_config_file();
  202|      1|        if (file == NULL)
  ------------------
  |  Branch (202:13): [True: 0, False: 1]
  ------------------
  203|      0|            goto err;
  204|      1|        if (*file == '\0') {
  ------------------
  |  Branch (204:13): [True: 0, False: 1]
  ------------------
  205|       |            /* Do not try to load an empty file name but do not error out */
  206|      0|            ret = 1;
  207|      0|            goto err;
  208|      0|        }
  209|      1|    } else {
  210|      0|        file = (char *)filename;
  211|      0|    }
  212|       |
  213|      1|    conf = NCONF_new_ex(libctx, NULL);
  214|      1|    if (conf == NULL)
  ------------------
  |  Branch (214:9): [True: 0, False: 1]
  ------------------
  215|      0|        goto err;
  216|       |
  217|      1|    if (NCONF_load(conf, file, NULL) <= 0) {
  ------------------
  |  Branch (217:9): [True: 1, False: 0]
  ------------------
  218|      1|        if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) &&
  ------------------
  |  |  110|      1|# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
  ------------------
  |  Branch (218:13): [True: 1, False: 0]
  ------------------
  219|      1|            (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) {
  ------------------
  |  |   36|      1|# define CONF_R_NO_SUCH_FILE                              114
  ------------------
  |  Branch (219:13): [True: 1, False: 0]
  ------------------
  220|      1|            ret = 1;
  221|      1|        }
  222|      1|        goto err;
  223|      1|    }
  224|       |
  225|      0|    ret = CONF_modules_load(conf, appname, flags);
  226|       |    /* CONF_modules_load() might change the diagnostics setting, reread it. */
  227|      0|    diagnostics = OSSL_LIB_CTX_get_conf_diagnostics(libctx);
  228|       |
  229|      1| err:
  230|      1|    if (filename == NULL)
  ------------------
  |  Branch (230:9): [True: 1, False: 0]
  ------------------
  231|      1|        OPENSSL_free(file);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  232|      1|    NCONF_free(conf);
  233|       |
  234|      1|    if ((flags & CONF_MFLAGS_IGNORE_RETURN_CODES) != 0 && !diagnostics)
  ------------------
  |  |  107|      1|# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
  ------------------
  |  Branch (234:9): [True: 1, False: 0]
  |  Branch (234:59): [True: 1, False: 0]
  ------------------
  235|      1|        ret = 1;
  236|       |
  237|      1|    if (ret > 0)
  ------------------
  |  Branch (237:9): [True: 1, False: 0]
  ------------------
  238|      1|        ERR_pop_to_mark();
  239|      0|    else
  240|      0|        ERR_clear_last_mark();
  241|       |
  242|      1|    return ret;
  243|      0|}
CONF_modules_unload:
  517|      1|{
  518|      1|    int i;
  519|      1|    CONF_MODULE *md;
  520|      1|    STACK_OF(CONF_MODULE) *old_modules;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  521|      1|    STACK_OF(CONF_MODULE) *new_modules;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  522|      1|    STACK_OF(CONF_MODULE) *to_delete;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  523|       |
  524|      1|    if (!conf_modules_finish_int()) /* also inits module list lock */
  ------------------
  |  Branch (524:9): [True: 0, False: 1]
  ------------------
  525|      0|        return;
  526|       |
  527|      1|    ossl_rcu_write_lock(module_list_lock);
  528|       |
  529|      1|    old_modules = ossl_rcu_deref(&supported_modules);
  ------------------
  |  |   30|      1|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  530|      1|    new_modules = sk_CONF_MODULE_dup(old_modules);
  531|       |
  532|      1|    if (new_modules == NULL) {
  ------------------
  |  Branch (532:9): [True: 0, False: 1]
  ------------------
  533|      0|        ossl_rcu_write_unlock(module_list_lock);
  534|      0|        return;
  535|      0|    }
  536|       |
  537|      1|    to_delete = sk_CONF_MODULE_new_null();
  538|       |
  539|       |    /* unload modules in reverse order */
  540|      1|    for (i = sk_CONF_MODULE_num(new_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (540:51): [True: 0, False: 1]
  ------------------
  541|      0|        md = sk_CONF_MODULE_value(new_modules, i);
  542|       |        /* If static or in use and 'all' not set ignore it */
  543|      0|        if (((md->links > 0) || !md->dso) && !all)
  ------------------
  |  Branch (543:14): [True: 0, False: 0]
  |  Branch (543:33): [True: 0, False: 0]
  |  Branch (543:46): [True: 0, False: 0]
  ------------------
  544|      0|            continue;
  545|       |        /* Since we're working in reverse this is OK */
  546|      0|        (void)sk_CONF_MODULE_delete(new_modules, i);
  547|      0|        sk_CONF_MODULE_push(to_delete, md);
  548|      0|    }
  549|       |
  550|      1|    if (sk_CONF_MODULE_num(new_modules) == 0) {
  ------------------
  |  Branch (550:9): [True: 1, False: 0]
  ------------------
  551|      1|        sk_CONF_MODULE_free(new_modules);
  552|      1|        new_modules = NULL;
  553|      1|    }
  554|       |
  555|      1|    ossl_rcu_assign_ptr(&supported_modules, &new_modules);
  ------------------
  |  |   31|      1|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  556|      1|    ossl_rcu_write_unlock(module_list_lock);
  557|      1|    ossl_synchronize_rcu(module_list_lock);
  558|      1|    sk_CONF_MODULE_free(old_modules);
  559|      1|    sk_CONF_MODULE_pop_free(to_delete, module_free);
  560|       |
  561|      1|}
ossl_config_modules_free:
  632|      1|{
  633|      1|    CONF_modules_unload(1); /* calls CONF_modules_finish */
  634|      1|    module_lists_free();
  635|      1|}
CONF_get1_default_config_file:
  686|      1|{
  687|      1|    const char *t;
  688|      1|    char *file, *sep = "";
  689|      1|    size_t size;
  690|       |
  691|      1|    if ((file = ossl_safe_getenv("OPENSSL_CONF")) != NULL)
  ------------------
  |  Branch (691:9): [True: 0, False: 1]
  ------------------
  692|      0|        return OPENSSL_strdup(file);
  ------------------
  |  |  119|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  693|       |
  694|      1|    t = X509_get_default_cert_area();
  695|       |    /*
  696|       |     * On windows systems with -DOSSL_WINCTX set, if the needed registry
  697|       |     * keys are not yet set, openssl applets will return, due to an inability
  698|       |     * to locate various directories, like the default cert area.  In that
  699|       |     * event, clone an empty string here, so that commands like openssl version
  700|       |     * continue to operate properly without needing to set OPENSSL_CONF.
  701|       |     * Applets like cms will fail gracefully later when they try to parse an
  702|       |     * empty config file
  703|       |     */
  704|      1|    if (t == NULL)
  ------------------
  |  Branch (704:9): [True: 0, False: 1]
  ------------------
  705|      0|        return OPENSSL_strdup("");
  ------------------
  |  |  119|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  706|       |
  707|      1|#ifndef OPENSSL_SYS_VMS
  708|      1|    sep = "/";
  709|      1|#endif
  710|      1|    size = strlen(t) + strlen(sep) + strlen(OPENSSL_CONF) + 1;
  ------------------
  |  |   81|      1|# define OPENSSL_CONF             "openssl.cnf"
  ------------------
  711|      1|    file = OPENSSL_malloc(size);
  ------------------
  |  |  102|      1|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  712|       |
  713|      1|    if (file == NULL)
  ------------------
  |  Branch (713:9): [True: 0, False: 1]
  ------------------
  714|      0|        return NULL;
  715|      1|    BIO_snprintf(file, size, "%s%s%s", t, sep, OPENSSL_CONF);
  ------------------
  |  |   81|      1|# define OPENSSL_CONF             "openssl.cnf"
  ------------------
  716|       |
  717|      1|    return file;
  718|      1|}
conf_mod.c:do_init_module_list_lock:
  101|      1|{
  102|      1|    module_list_lock = ossl_rcu_lock_new(1, NULL);
  103|      1|    if (module_list_lock == NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 1]
  ------------------
  104|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  105|      0|        return 0;
  106|      0|    }
  107|       |
  108|      1|    return 1;
  109|      1|}
conf_mod.c:conf_modules_finish_int:
  574|      1|{
  575|      1|    CONF_IMODULE *imod;
  576|      1|    STACK_OF(CONF_IMODULE) *old_modules;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  577|      1|    STACK_OF(CONF_IMODULE) *new_modules = NULL;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  578|       |
  579|      1|    if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock))
  ------------------
  |  |  130|      1|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (579:9): [True: 0, False: 1]
  ------------------
  580|      0|        return 0;
  581|       |
  582|       |    /* If module_list_lock is NULL here it means we were already unloaded */
  583|      1|    if (module_list_lock == NULL)
  ------------------
  |  Branch (583:9): [True: 0, False: 1]
  ------------------
  584|      0|        return 0;
  585|       |
  586|      1|    ossl_rcu_write_lock(module_list_lock);
  587|      1|    old_modules = ossl_rcu_deref(&initialized_modules);
  ------------------
  |  |   30|      1|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  588|      1|    ossl_rcu_assign_ptr(&initialized_modules, &new_modules);
  ------------------
  |  |   31|      1|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  589|      1|    ossl_rcu_write_unlock(module_list_lock);
  590|      1|    ossl_synchronize_rcu(module_list_lock);
  591|       |
  592|      1|    while (sk_CONF_IMODULE_num(old_modules) > 0) {
  ------------------
  |  Branch (592:12): [True: 0, False: 1]
  ------------------
  593|      0|        imod = sk_CONF_IMODULE_pop(old_modules);
  594|      0|        module_finish(imod);
  595|      0|    }
  596|      1|    sk_CONF_IMODULE_free(old_modules);
  597|       |
  598|      1|    return 1;
  599|      1|}
conf_mod.c:module_lists_free:
   89|      1|{
   90|      1|    ossl_rcu_lock_free(module_list_lock);
   91|      1|    module_list_lock = NULL;
   92|       |
   93|      1|    sk_CONF_MODULE_free(supported_modules);
   94|      1|    supported_modules = NULL;
   95|       |
   96|      1|    sk_CONF_IMODULE_free(initialized_modules);
   97|      1|    initialized_modules = NULL;
   98|      1|}

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

ossl_lib_ctx_write_lock:
   60|      1|{
   61|      1|    if ((ctx = ossl_lib_ctx_get_concrete(ctx)) == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 1]
  ------------------
   62|      0|        return 0;
   63|      1|    return CRYPTO_THREAD_write_lock(ctx->lock);
   64|      1|}
ossl_lib_ctx_read_lock:
   67|    220|{
   68|    220|    if ((ctx = ossl_lib_ctx_get_concrete(ctx)) == NULL)
  ------------------
  |  Branch (68:9): [True: 0, False: 220]
  ------------------
   69|      0|        return 0;
   70|    220|    return CRYPTO_THREAD_read_lock(ctx->lock);
   71|    220|}
ossl_lib_ctx_unlock:
   74|    221|{
   75|    221|    if ((ctx = ossl_lib_ctx_get_concrete(ctx)) == NULL)
  ------------------
  |  Branch (75:9): [True: 0, False: 221]
  ------------------
   76|      0|        return 0;
   77|    221|    return CRYPTO_THREAD_unlock(ctx->lock);
   78|    221|}
ossl_lib_ctx_default_deinit:
  412|      1|{
  413|      1|    if (!default_context_inited)
  ------------------
  |  Branch (413:9): [True: 0, False: 1]
  ------------------
  414|      0|        return;
  415|      1|    context_deinit(&default_context_int);
  416|      1|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  417|      1|    default_context_inited = 0;
  418|      1|}
OSSL_LIB_CTX_get0_global_default:
  512|      1|{
  513|      1|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|      1|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (513:9): [True: 0, False: 1]
  ------------------
  514|      0|        return NULL;
  515|       |
  516|      1|    return &default_context_int;
  517|      1|}
ossl_release_default_drbg_ctx:
  533|      1|{
  534|       |    /* early release of the DRBG in global default libctx */
  535|      1|    if (default_context_int.drbg != NULL) {
  ------------------
  |  Branch (535:9): [True: 1, False: 0]
  ------------------
  536|      1|        ossl_rand_ctx_free(default_context_int.drbg);
  537|      1|        default_context_int.drbg = NULL;
  538|      1|    }
  539|      1|}
ossl_lib_ctx_get_concrete:
  543|  5.76k|{
  544|  5.76k|#ifndef FIPS_MODULE
  545|  5.76k|    if (ctx == NULL)
  ------------------
  |  Branch (545:9): [True: 1.59k, False: 4.17k]
  ------------------
  546|  1.59k|        return get_default_context();
  547|  4.17k|#endif
  548|  4.17k|    return ctx;
  549|  5.76k|}
ossl_lib_ctx_is_default:
  552|     89|{
  553|     89|#ifndef FIPS_MODULE
  554|     89|    if (ctx == NULL || ctx == get_default_context())
  ------------------
  |  Branch (554:9): [True: 29, False: 60]
  |  Branch (554:24): [True: 60, False: 0]
  ------------------
  555|     89|        return 1;
  556|      0|#endif
  557|      0|    return 0;
  558|     89|}
ossl_lib_ctx_is_global_default:
  561|     43|{
  562|     43|#ifndef FIPS_MODULE
  563|     43|    if (ossl_lib_ctx_get_concrete(ctx) == &default_context_int)
  ------------------
  |  Branch (563:9): [True: 43, False: 0]
  ------------------
  564|     43|        return 1;
  565|      0|#endif
  566|      0|    return 0;
  567|     43|}
ossl_lib_ctx_get_data:
  570|  4.74k|{
  571|  4.74k|    ctx = ossl_lib_ctx_get_concrete(ctx);
  572|  4.74k|    if (ctx == NULL)
  ------------------
  |  Branch (572:9): [True: 0, False: 4.74k]
  ------------------
  573|      0|        return NULL;
  574|       |
  575|  4.74k|    switch (index) {
  576|     10|    case OSSL_LIB_CTX_PROPERTY_STRING_INDEX:
  ------------------
  |  |  101|     10|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  |  Branch (576:5): [True: 10, False: 4.73k]
  ------------------
  577|     10|        return ctx->property_string_data;
  578|  1.84k|    case OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX:
  ------------------
  |  |   98|  1.84k|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
  |  Branch (578:5): [True: 1.84k, False: 2.89k]
  ------------------
  579|  1.84k|        return ctx->evp_method_store;
  580|     40|    case OSSL_LIB_CTX_PROVIDER_STORE_INDEX:
  ------------------
  |  |   99|     40|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  |  Branch (580:5): [True: 40, False: 4.70k]
  ------------------
  581|     40|        return ctx->provider_store;
  582|  2.26k|    case OSSL_LIB_CTX_NAMEMAP_INDEX:
  ------------------
  |  |  102|  2.26k|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  |  Branch (582:5): [True: 2.26k, False: 2.47k]
  ------------------
  583|  2.26k|        return ctx->namemap;
  584|    221|    case OSSL_LIB_CTX_PROPERTY_DEFN_INDEX:
  ------------------
  |  |  100|    221|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
  |  Branch (584:5): [True: 221, False: 4.52k]
  ------------------
  585|    221|        return ctx->property_defns;
  586|     14|    case OSSL_LIB_CTX_GLOBAL_PROPERTIES:
  ------------------
  |  |  114|     14|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  |  Branch (586:5): [True: 14, False: 4.73k]
  ------------------
  587|     14|        return ctx->global_properties;
  588|    344|    case OSSL_LIB_CTX_DRBG_INDEX:
  ------------------
  |  |  103|    344|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  |  Branch (588:5): [True: 344, False: 4.40k]
  ------------------
  589|    344|        return ctx->drbg;
  590|      0|    case OSSL_LIB_CTX_DRBG_NONCE_INDEX:
  ------------------
  |  |  104|      0|# define OSSL_LIB_CTX_DRBG_NONCE_INDEX               6
  ------------------
  |  Branch (590:5): [True: 0, False: 4.74k]
  ------------------
  591|      0|        return ctx->drbg_nonce;
  592|      0|#ifndef FIPS_MODULE
  593|      0|    case OSSL_LIB_CTX_PROVIDER_CONF_INDEX:
  ------------------
  |  |  116|      0|# define OSSL_LIB_CTX_PROVIDER_CONF_INDEX           16
  ------------------
  |  Branch (593:5): [True: 0, False: 4.74k]
  ------------------
  594|      0|        return ctx->provider_conf;
  595|      0|    case OSSL_LIB_CTX_BIO_CORE_INDEX:
  ------------------
  |  |  117|      0|# define OSSL_LIB_CTX_BIO_CORE_INDEX                17
  ------------------
  |  Branch (595:5): [True: 0, False: 4.74k]
  ------------------
  596|      0|        return ctx->bio_core;
  597|      0|    case OSSL_LIB_CTX_CHILD_PROVIDER_INDEX:
  ------------------
  |  |  118|      0|# define OSSL_LIB_CTX_CHILD_PROVIDER_INDEX          18
  ------------------
  |  Branch (597:5): [True: 0, False: 4.74k]
  ------------------
  598|      0|        return ctx->child_provider;
  599|      0|    case OSSL_LIB_CTX_DECODER_STORE_INDEX:
  ------------------
  |  |  111|      0|# define OSSL_LIB_CTX_DECODER_STORE_INDEX           11
  ------------------
  |  Branch (599:5): [True: 0, False: 4.74k]
  ------------------
  600|      0|        return ctx->decoder_store;
  601|      1|    case OSSL_LIB_CTX_DECODER_CACHE_INDEX:
  ------------------
  |  |  120|      1|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  |  Branch (601:5): [True: 1, False: 4.74k]
  ------------------
  602|      1|        return ctx->decoder_cache;
  603|      0|    case OSSL_LIB_CTX_ENCODER_STORE_INDEX:
  ------------------
  |  |  110|      0|# define OSSL_LIB_CTX_ENCODER_STORE_INDEX           10
  ------------------
  |  Branch (603:5): [True: 0, False: 4.74k]
  ------------------
  604|      0|        return ctx->encoder_store;
  605|      0|    case OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX:
  ------------------
  |  |  115|      0|# define OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX      15
  ------------------
  |  Branch (605:5): [True: 0, False: 4.74k]
  ------------------
  606|      0|        return ctx->store_loader_store;
  607|      0|    case OSSL_LIB_CTX_SELF_TEST_CB_INDEX:
  ------------------
  |  |  112|      0|# define OSSL_LIB_CTX_SELF_TEST_CB_INDEX            12
  ------------------
  |  Branch (607:5): [True: 0, False: 4.74k]
  ------------------
  608|      0|        return ctx->self_test_cb;
  609|      0|    case OSSL_LIB_CTX_INDICATOR_CB_INDEX:
  ------------------
  |  |  122|      0|# define OSSL_LIB_CTX_INDICATOR_CB_INDEX            22
  ------------------
  |  Branch (609:5): [True: 0, False: 4.74k]
  ------------------
  610|      0|        return ctx->indicator_cb;
  611|      0|#endif
  612|      0|#ifndef OPENSSL_NO_THREAD_POOL
  613|      0|    case OSSL_LIB_CTX_THREAD_INDEX:
  ------------------
  |  |  119|      0|# define OSSL_LIB_CTX_THREAD_INDEX                  19
  ------------------
  |  Branch (613:5): [True: 0, False: 4.74k]
  ------------------
  614|      0|        return ctx->threads;
  615|      0|#endif
  616|       |
  617|       |#ifdef FIPS_MODULE
  618|       |    case OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX:
  619|       |        return ctx->thread_event_handler;
  620|       |
  621|       |    case OSSL_LIB_CTX_FIPS_PROV_INDEX:
  622|       |        return ctx->fips_prov;
  623|       |#endif
  624|       |
  625|      0|    case OSSL_LIB_CTX_COMP_METHODS:
  ------------------
  |  |  121|      0|# define OSSL_LIB_CTX_COMP_METHODS                  21
  ------------------
  |  Branch (625:5): [True: 0, False: 4.74k]
  ------------------
  626|      0|        return (void *)&ctx->comp_methods;
  627|       |
  628|      0|    default:
  ------------------
  |  Branch (628:5): [True: 0, False: 4.74k]
  ------------------
  629|      0|        return NULL;
  630|  4.74k|    }
  631|  4.74k|}
ossl_lib_ctx_get_ex_data_global:
  639|    490|{
  640|    490|    ctx = ossl_lib_ctx_get_concrete(ctx);
  641|    490|    if (ctx == NULL)
  ------------------
  |  Branch (641:9): [True: 0, False: 490]
  ------------------
  642|      0|        return NULL;
  643|    490|    return &ctx->global;
  644|    490|}
ossl_lib_ctx_get_descriptor:
  647|     43|{
  648|       |#ifdef FIPS_MODULE
  649|       |    return "FIPS internal library context";
  650|       |#else
  651|     43|    if (ossl_lib_ctx_is_global_default(libctx))
  ------------------
  |  Branch (651:9): [True: 43, False: 0]
  ------------------
  652|     43|        return "Global default library context";
  653|      0|    if (ossl_lib_ctx_is_default(libctx))
  ------------------
  |  Branch (653:9): [True: 0, False: 0]
  ------------------
  654|      0|        return "Thread-local default library context";
  655|      0|    return "Non-default library context";
  656|      0|#endif
  657|      0|}
OSSL_LIB_CTX_get_conf_diagnostics:
  668|      1|{
  669|      1|    libctx = ossl_lib_ctx_get_concrete(libctx);
  670|      1|    if (libctx == NULL)
  ------------------
  |  Branch (670:9): [True: 0, False: 1]
  ------------------
  671|      0|        return 0;
  672|      1|    return libctx->conf_diagnostics;
  673|      1|}
context.c:context_deinit:
  370|      1|{
  371|      1|    if (ctx == NULL)
  ------------------
  |  Branch (371:9): [True: 0, False: 1]
  ------------------
  372|      0|        return 1;
  373|       |
  374|      1|    ossl_ctx_thread_stop(ctx);
  375|       |
  376|      1|    context_deinit_objs(ctx);
  377|       |
  378|      1|    ossl_crypto_cleanup_all_ex_data_int(ctx);
  379|       |
  380|      1|    CRYPTO_THREAD_lock_free(ctx->lock);
  381|      1|    ctx->lock = NULL;
  382|      1|    CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key);
  383|      1|    return 1;
  384|      1|}
context.c:context_deinit_objs:
  235|      1|{
  236|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  237|      1|    if (ctx->evp_method_store != NULL) {
  ------------------
  |  Branch (237:9): [True: 1, False: 0]
  ------------------
  238|      1|        ossl_method_store_free(ctx->evp_method_store);
  239|      1|        ctx->evp_method_store = NULL;
  240|      1|    }
  241|       |
  242|       |    /* P2. */
  243|      1|    if (ctx->drbg != NULL) {
  ------------------
  |  Branch (243:9): [True: 0, False: 1]
  ------------------
  244|      0|        ossl_rand_ctx_free(ctx->drbg);
  245|      0|        ctx->drbg = NULL;
  246|      0|    }
  247|       |
  248|      1|#ifndef FIPS_MODULE
  249|       |    /* P2. */
  250|      1|    if (ctx->provider_conf != NULL) {
  ------------------
  |  Branch (250:9): [True: 1, False: 0]
  ------------------
  251|      1|        ossl_prov_conf_ctx_free(ctx->provider_conf);
  252|      1|        ctx->provider_conf = NULL;
  253|      1|    }
  254|       |
  255|       |    /*
  256|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  257|       |     * provider store
  258|       |     */
  259|      1|    if (ctx->decoder_store != NULL) {
  ------------------
  |  Branch (259:9): [True: 1, False: 0]
  ------------------
  260|      1|        ossl_method_store_free(ctx->decoder_store);
  261|      1|        ctx->decoder_store = NULL;
  262|      1|    }
  263|      1|    if (ctx->decoder_cache != NULL) {
  ------------------
  |  Branch (263:9): [True: 1, False: 0]
  ------------------
  264|      1|        ossl_decoder_cache_free(ctx->decoder_cache);
  265|      1|        ctx->decoder_cache = NULL;
  266|      1|    }
  267|       |
  268|       |
  269|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  270|      1|    if (ctx->encoder_store != NULL) {
  ------------------
  |  Branch (270:9): [True: 1, False: 0]
  ------------------
  271|      1|        ossl_method_store_free(ctx->encoder_store);
  272|      1|        ctx->encoder_store = NULL;
  273|      1|    }
  274|       |
  275|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  276|      1|    if (ctx->store_loader_store != NULL) {
  ------------------
  |  Branch (276:9): [True: 1, False: 0]
  ------------------
  277|      1|        ossl_method_store_free(ctx->store_loader_store);
  278|      1|        ctx->store_loader_store = NULL;
  279|      1|    }
  280|      1|#endif
  281|       |
  282|       |    /* P1. Needs to be freed before the child provider data is freed */
  283|      1|    if (ctx->provider_store != NULL) {
  ------------------
  |  Branch (283:9): [True: 1, False: 0]
  ------------------
  284|      1|        ossl_provider_store_free(ctx->provider_store);
  285|      1|        ctx->provider_store = NULL;
  286|      1|    }
  287|       |
  288|       |    /* Default priority. */
  289|      1|    if (ctx->property_string_data != NULL) {
  ------------------
  |  Branch (289:9): [True: 1, False: 0]
  ------------------
  290|      1|        ossl_property_string_data_free(ctx->property_string_data);
  291|      1|        ctx->property_string_data = NULL;
  292|      1|    }
  293|       |
  294|      1|    if (ctx->namemap != NULL) {
  ------------------
  |  Branch (294:9): [True: 1, False: 0]
  ------------------
  295|      1|        ossl_stored_namemap_free(ctx->namemap);
  296|      1|        ctx->namemap = NULL;
  297|      1|    }
  298|       |
  299|      1|    if (ctx->property_defns != NULL) {
  ------------------
  |  Branch (299:9): [True: 1, False: 0]
  ------------------
  300|      1|        ossl_property_defns_free(ctx->property_defns);
  301|      1|        ctx->property_defns = NULL;
  302|      1|    }
  303|       |
  304|      1|    if (ctx->global_properties != NULL) {
  ------------------
  |  Branch (304:9): [True: 1, False: 0]
  ------------------
  305|      1|        ossl_ctx_global_properties_free(ctx->global_properties);
  306|      1|        ctx->global_properties = NULL;
  307|      1|    }
  308|       |
  309|      1|#ifndef FIPS_MODULE
  310|      1|    if (ctx->bio_core != NULL) {
  ------------------
  |  Branch (310:9): [True: 1, False: 0]
  ------------------
  311|      1|        ossl_bio_core_globals_free(ctx->bio_core);
  312|      1|        ctx->bio_core = NULL;
  313|      1|    }
  314|      1|#endif
  315|       |
  316|      1|    if (ctx->drbg_nonce != NULL) {
  ------------------
  |  Branch (316:9): [True: 1, False: 0]
  ------------------
  317|      1|        ossl_prov_drbg_nonce_ctx_free(ctx->drbg_nonce);
  318|      1|        ctx->drbg_nonce = NULL;
  319|      1|    }
  320|       |
  321|      1|#ifndef FIPS_MODULE
  322|      1|    if (ctx->indicator_cb != NULL) {
  ------------------
  |  Branch (322:9): [True: 1, False: 0]
  ------------------
  323|      1|        ossl_indicator_set_callback_free(ctx->indicator_cb);
  324|      1|        ctx->indicator_cb = NULL;
  325|      1|    }
  326|       |
  327|      1|    if (ctx->self_test_cb != NULL) {
  ------------------
  |  Branch (327:9): [True: 1, False: 0]
  ------------------
  328|      1|        ossl_self_test_set_callback_free(ctx->self_test_cb);
  329|      1|        ctx->self_test_cb = NULL;
  330|      1|    }
  331|      1|#endif
  332|       |
  333|       |#ifdef FIPS_MODULE
  334|       |    if (ctx->thread_event_handler != NULL) {
  335|       |        ossl_thread_event_ctx_free(ctx->thread_event_handler);
  336|       |        ctx->thread_event_handler = NULL;
  337|       |    }
  338|       |
  339|       |    if (ctx->fips_prov != NULL) {
  340|       |        ossl_fips_prov_ossl_ctx_free(ctx->fips_prov);
  341|       |        ctx->fips_prov = NULL;
  342|       |    }
  343|       |#endif
  344|       |
  345|      1|#ifndef OPENSSL_NO_THREAD_POOL
  346|      1|    if (ctx->threads != NULL) {
  ------------------
  |  Branch (346:9): [True: 1, False: 0]
  ------------------
  347|      1|        ossl_threads_ctx_free(ctx->threads);
  348|      1|        ctx->threads = NULL;
  349|      1|    }
  350|      1|#endif
  351|       |
  352|       |    /* Low priority. */
  353|      1|#ifndef FIPS_MODULE
  354|      1|    if (ctx->child_provider != NULL) {
  ------------------
  |  Branch (354:9): [True: 1, False: 0]
  ------------------
  355|      1|        ossl_child_prov_ctx_free(ctx->child_provider);
  356|      1|        ctx->child_provider = NULL;
  357|      1|    }
  358|      1|#endif
  359|       |
  360|      1|#ifndef FIPS_MODULE
  361|      1|    if (ctx->comp_methods != NULL) {
  ------------------
  |  Branch (361:9): [True: 1, False: 0]
  ------------------
  362|      1|        ossl_free_compression_methods_int(ctx->comp_methods);
  363|      1|        ctx->comp_methods = NULL;
  364|      1|    }
  365|      1|#endif
  366|       |
  367|      1|}
context.c:context_init:
   92|      1|{
   93|      1|    int exdata_done = 0;
   94|       |
   95|      1|    if (!CRYPTO_THREAD_init_local(&ctx->rcu_local_key, NULL))
  ------------------
  |  Branch (95:9): [True: 0, False: 1]
  ------------------
   96|      0|        return 0;
   97|       |
   98|      1|    ctx->lock = CRYPTO_THREAD_lock_new();
   99|      1|    if (ctx->lock == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 1]
  ------------------
  100|      0|        goto err;
  101|       |
  102|       |    /* Initialize ex_data. */
  103|      1|    if (!ossl_do_ex_data_init(ctx))
  ------------------
  |  Branch (103:9): [True: 0, False: 1]
  ------------------
  104|      0|        goto err;
  105|      1|    exdata_done = 1;
  106|       |
  107|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  108|      1|    ctx->evp_method_store = ossl_method_store_new(ctx);
  109|      1|    if (ctx->evp_method_store == NULL)
  ------------------
  |  Branch (109:9): [True: 0, False: 1]
  ------------------
  110|      0|        goto err;
  111|      1|    OSSL_TRACE1(QUERY, "context_init: allocating store %p\n", ctx->evp_method_store);
  ------------------
  |  |  291|      1|    OSSL_TRACEV(category, (trc_out, format, arg1))
  |  |  ------------------
  |  |  |  |  283|      1|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  112|       |
  113|      1|#ifndef FIPS_MODULE
  114|       |    /* P2. Must be freed before the provider store is freed */
  115|      1|    ctx->provider_conf = ossl_prov_conf_ctx_new(ctx);
  116|      1|    if (ctx->provider_conf == NULL)
  ------------------
  |  Branch (116:9): [True: 0, False: 1]
  ------------------
  117|      0|        goto err;
  118|      1|#endif
  119|       |
  120|       |    /* P2. */
  121|      1|    ctx->drbg = ossl_rand_ctx_new(ctx);
  122|      1|    if (ctx->drbg == NULL)
  ------------------
  |  Branch (122:9): [True: 0, False: 1]
  ------------------
  123|      0|        goto err;
  124|       |
  125|      1|#ifndef FIPS_MODULE
  126|       |    /*
  127|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  128|       |     * provider store
  129|       |     */
  130|      1|    ctx->decoder_store = ossl_method_store_new(ctx);
  131|      1|    if (ctx->decoder_store == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 1]
  ------------------
  132|      0|        goto err;
  133|      1|    ctx->decoder_cache = ossl_decoder_cache_new(ctx);
  134|      1|    if (ctx->decoder_cache == NULL)
  ------------------
  |  Branch (134:9): [True: 0, False: 1]
  ------------------
  135|      0|        goto err;
  136|       |
  137|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  138|      1|    ctx->encoder_store = ossl_method_store_new(ctx);
  139|      1|    if (ctx->encoder_store == NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 1]
  ------------------
  140|      0|        goto err;
  141|       |
  142|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  143|      1|    ctx->store_loader_store = ossl_method_store_new(ctx);
  144|      1|    if (ctx->store_loader_store == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 1]
  ------------------
  145|      0|        goto err;
  146|      1|#endif
  147|       |
  148|       |    /* P1. Needs to be freed before the child provider data is freed */
  149|      1|    ctx->provider_store = ossl_provider_store_new(ctx);
  150|      1|    if (ctx->provider_store == NULL)
  ------------------
  |  Branch (150:9): [True: 0, False: 1]
  ------------------
  151|      0|        goto err;
  152|       |
  153|       |    /* Default priority. */
  154|      1|    ctx->property_string_data = ossl_property_string_data_new(ctx);
  155|      1|    if (ctx->property_string_data == NULL)
  ------------------
  |  Branch (155:9): [True: 0, False: 1]
  ------------------
  156|      0|        goto err;
  157|       |
  158|      1|    ctx->namemap = ossl_stored_namemap_new(ctx);
  159|      1|    if (ctx->namemap == NULL)
  ------------------
  |  Branch (159:9): [True: 0, False: 1]
  ------------------
  160|      0|        goto err;
  161|       |
  162|      1|    ctx->property_defns = ossl_property_defns_new(ctx);
  163|      1|    if (ctx->property_defns == NULL)
  ------------------
  |  Branch (163:9): [True: 0, False: 1]
  ------------------
  164|      0|        goto err;
  165|       |
  166|      1|    ctx->global_properties = ossl_ctx_global_properties_new(ctx);
  167|      1|    if (ctx->global_properties == NULL)
  ------------------
  |  Branch (167:9): [True: 0, False: 1]
  ------------------
  168|      0|        goto err;
  169|       |
  170|      1|#ifndef FIPS_MODULE
  171|      1|    ctx->bio_core = ossl_bio_core_globals_new(ctx);
  172|      1|    if (ctx->bio_core == NULL)
  ------------------
  |  Branch (172:9): [True: 0, False: 1]
  ------------------
  173|      0|        goto err;
  174|      1|#endif
  175|       |
  176|      1|    ctx->drbg_nonce = ossl_prov_drbg_nonce_ctx_new(ctx);
  177|      1|    if (ctx->drbg_nonce == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 1]
  ------------------
  178|      0|        goto err;
  179|       |
  180|      1|#ifndef FIPS_MODULE
  181|      1|    ctx->self_test_cb = ossl_self_test_set_callback_new(ctx);
  182|      1|    if (ctx->self_test_cb == NULL)
  ------------------
  |  Branch (182:9): [True: 0, False: 1]
  ------------------
  183|      0|        goto err;
  184|      1|    ctx->indicator_cb = ossl_indicator_set_callback_new(ctx);
  185|      1|    if (ctx->indicator_cb == NULL)
  ------------------
  |  Branch (185:9): [True: 0, False: 1]
  ------------------
  186|      0|        goto err;
  187|      1|#endif
  188|       |
  189|       |#ifdef FIPS_MODULE
  190|       |    ctx->thread_event_handler = ossl_thread_event_ctx_new(ctx);
  191|       |    if (ctx->thread_event_handler == NULL)
  192|       |        goto err;
  193|       |
  194|       |    ctx->fips_prov = ossl_fips_prov_ossl_ctx_new(ctx);
  195|       |    if (ctx->fips_prov == NULL)
  196|       |        goto err;
  197|       |#endif
  198|       |
  199|      1|#ifndef OPENSSL_NO_THREAD_POOL
  200|      1|    ctx->threads = ossl_threads_ctx_new(ctx);
  201|      1|    if (ctx->threads == NULL)
  ------------------
  |  Branch (201:9): [True: 0, False: 1]
  ------------------
  202|      0|        goto err;
  203|      1|#endif
  204|       |
  205|       |    /* Low priority. */
  206|      1|#ifndef FIPS_MODULE
  207|      1|    ctx->child_provider = ossl_child_prov_ctx_new(ctx);
  208|      1|    if (ctx->child_provider == NULL)
  ------------------
  |  Branch (208:9): [True: 0, False: 1]
  ------------------
  209|      0|        goto err;
  210|      1|#endif
  211|       |
  212|       |    /* Everything depends on properties, so we also pre-initialise that */
  213|      1|    if (!ossl_property_parse_init(ctx))
  ------------------
  |  Branch (213:9): [True: 0, False: 1]
  ------------------
  214|      0|        goto err;
  215|       |
  216|      1|#ifndef FIPS_MODULE
  217|      1|    ctx->comp_methods = ossl_load_builtin_compressions();
  218|      1|#endif
  219|       |
  220|      1|    return 1;
  221|       |
  222|      0| err:
  223|      0|    context_deinit_objs(ctx);
  224|       |
  225|      0|    if (exdata_done)
  ------------------
  |  Branch (225:9): [True: 0, False: 0]
  ------------------
  226|      0|        ossl_crypto_cleanup_all_ex_data_int(ctx);
  227|       |
  228|      0|    CRYPTO_THREAD_lock_free(ctx->lock);
  229|      0|    CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key);
  230|      0|    memset(ctx, '\0', sizeof(*ctx));
  231|      0|    return 0;
  232|      1|}
context.c:default_context_do_init:
  395|      1|{
  396|      1|    if (!CRYPTO_THREAD_init_local(&default_context_thread_local, NULL))
  ------------------
  |  Branch (396:9): [True: 0, False: 1]
  ------------------
  397|      0|        goto err;
  398|       |
  399|      1|    if (!context_init(&default_context_int))
  ------------------
  |  Branch (399:9): [True: 0, False: 1]
  ------------------
  400|      0|        goto deinit_thread;
  401|       |
  402|      1|    default_context_inited = 1;
  403|      1|    return 1;
  404|       |
  405|      0|deinit_thread:
  406|      0|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  407|      0|err:
  408|      0|    return 0;
  409|      0|}
context.c:get_default_context:
  429|  1.65k|{
  430|  1.65k|    OSSL_LIB_CTX *current_defctx = get_thread_default_context();
  431|       |
  432|  1.65k|    if (current_defctx == NULL && default_context_inited)
  ------------------
  |  Branch (432:9): [True: 1.65k, False: 0]
  |  Branch (432:35): [True: 1.65k, False: 0]
  ------------------
  433|  1.65k|        current_defctx = &default_context_int;
  434|  1.65k|    return current_defctx;
  435|  1.65k|}
context.c:get_thread_default_context:
  421|  1.65k|{
  422|  1.65k|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|  1.65k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1.65k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (422:9): [True: 0, False: 1.65k]
  ------------------
  423|      0|        return NULL;
  424|       |
  425|  1.65k|    return CRYPTO_THREAD_get_local(&default_context_thread_local);
  426|  1.65k|}

ossl_algorithm_do_all:
  149|     57|{
  150|     57|    struct algorithm_data_st cbdata = { 0, };
  151|       |
  152|     57|    cbdata.libctx = libctx;
  153|     57|    cbdata.operation_id = operation_id;
  154|     57|    cbdata.pre = pre;
  155|     57|    cbdata.reserve_store = reserve_store;
  156|     57|    cbdata.fn = fn;
  157|     57|    cbdata.unreserve_store = unreserve_store;
  158|     57|    cbdata.post = post;
  159|     57|    cbdata.data = data;
  160|       |
  161|     57|    if (provider == NULL) {
  ------------------
  |  Branch (161:9): [True: 35, False: 22]
  ------------------
  162|     35|        ossl_provider_doall_activated(libctx, algorithm_do_this, &cbdata);
  163|     35|    } else {
  164|     22|        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|     22|        if (!ossl_assert(ossl_lib_ctx_get_concrete(libctx)
  ------------------
  |  |   52|     22|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     22|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (171:13): [True: 0, False: 22]
  ------------------
  172|     22|                         == ossl_lib_ctx_get_concrete(libctx2)))
  173|      0|            return;
  174|       |
  175|     22|        cbdata.libctx = libctx2;
  176|     22|        algorithm_do_this(provider, &cbdata);
  177|     22|    }
  178|     57|}
ossl_algorithm_get1_first_name:
  181|    220|{
  182|    220|    const char *first_name_end = NULL;
  183|    220|    size_t first_name_len = 0;
  184|    220|    char *ret;
  185|       |
  186|    220|    if (algo->algorithm_names == NULL)
  ------------------
  |  Branch (186:9): [True: 0, False: 220]
  ------------------
  187|      0|        return NULL;
  188|       |
  189|    220|    first_name_end = strchr(algo->algorithm_names, ':');
  190|    220|    if (first_name_end == NULL)
  ------------------
  |  Branch (190:9): [True: 78, False: 142]
  ------------------
  191|     78|        first_name_len = strlen(algo->algorithm_names);
  192|    142|    else
  193|    142|        first_name_len = first_name_end - algo->algorithm_names;
  194|       |
  195|    220|    ret = OPENSSL_strndup(algo->algorithm_names, first_name_len);
  ------------------
  |  |  121|    220|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  196|    220|    return ret;
  197|    220|}
core_algorithm.c:algorithm_do_this:
  103|     57|{
  104|     57|    struct algorithm_data_st *data = cbdata;
  105|     57|    int first_operation = 1;
  106|     57|    int last_operation = OSSL_OP__HIGHEST;
  ------------------
  |  |  326|     57|# define OSSL_OP__HIGHEST                           22
  ------------------
  107|     57|    int cur_operation;
  108|     57|    int ok = 1;
  109|       |
  110|     57|    if (data->operation_id != 0)
  ------------------
  |  Branch (110:9): [True: 57, False: 0]
  ------------------
  111|     57|        first_operation = last_operation = data->operation_id;
  112|       |
  113|     57|    for (cur_operation = first_operation;
  114|    114|         cur_operation <= last_operation;
  ------------------
  |  Branch (114:10): [True: 57, False: 57]
  ------------------
  115|     57|         cur_operation++) {
  116|     57|        int no_store = 0;        /* Assume caching is ok */
  117|     57|        const OSSL_ALGORITHM *map = NULL;
  118|     57|        int ret = 0;
  119|       |
  120|     57|        map = ossl_provider_query_operation(provider, cur_operation,
  121|     57|                                            &no_store);
  122|     57|        ret = algorithm_do_map(provider, map, cur_operation, no_store, data);
  123|     57|        ossl_provider_unquery_operation(provider, cur_operation, map);
  124|       |
  125|     57|        if (ret < 0)
  ------------------
  |  Branch (125:13): [True: 0, False: 57]
  ------------------
  126|       |            /* Hard error, bail out immediately! */
  127|      0|            return 0;
  128|       |
  129|       |        /* If post-condition not fulfilled, set general failure */
  130|     57|        if (!ret)
  ------------------
  |  Branch (130:13): [True: 0, False: 57]
  ------------------
  131|      0|            ok = 0;
  132|     57|    }
  133|       |
  134|     57|    return ok;
  135|     57|}
core_algorithm.c:algorithm_do_map:
   44|     57|{
   45|     57|    struct algorithm_data_st *data = cbdata;
   46|     57|    int ret = 0;
   47|       |
   48|     57|    if (!data->reserve_store(no_store, data->data))
  ------------------
  |  Branch (48:9): [True: 0, False: 57]
  ------------------
   49|       |        /* Error, bail out! */
   50|      0|        return -1;
   51|       |
   52|       |    /* Do we fulfill pre-conditions? */
   53|     57|    if (data->pre == NULL) {
  ------------------
  |  Branch (53:9): [True: 0, False: 57]
  ------------------
   54|       |        /* If there is no pre-condition function, assume "yes" */
   55|      0|        ret = 1;
   56|     57|    } else if (!data->pre(provider, cur_operation, no_store, data->data,
  ------------------
  |  Branch (56:16): [True: 0, False: 57]
  ------------------
   57|     57|                          &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|     57|    if (ret == 0) {
  ------------------
  |  Branch (68:9): [True: 51, False: 6]
  ------------------
   69|     51|        ret = 1;
   70|     51|        goto end;
   71|     51|    }
   72|       |
   73|      6|    if (map != NULL) {
  ------------------
  |  Branch (73:9): [True: 6, False: 0]
  ------------------
   74|      6|        const OSSL_ALGORITHM *thismap;
   75|       |
   76|    226|        for (thismap = map; thismap->algorithm_names != NULL; thismap++)
  ------------------
  |  Branch (76:29): [True: 220, False: 6]
  ------------------
   77|    220|            data->fn(provider, thismap, no_store, data->data);
   78|      6|    }
   79|       |
   80|       |    /* Do we fulfill post-conditions? */
   81|      6|    if (data->post == NULL) {
  ------------------
  |  Branch (81:9): [True: 0, False: 6]
  ------------------
   82|       |        /* If there is no post-condition function, assume "yes" */
   83|      0|        ret = 1;
   84|      6|    } else if (!data->post(provider, cur_operation, no_store, data->data,
  ------------------
  |  Branch (84:16): [True: 0, False: 6]
  ------------------
   85|      6|                           &ret)) {
   86|       |        /* Error, bail out! */
   87|      0|        ret = -1;
   88|      0|    }
   89|       |
   90|     57| end:
   91|     57|    data->unreserve_store(data->data);
   92|       |
   93|     57|    return ret;
   94|      6|}

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

ossl_stored_namemap_new:
   56|      1|{
   57|      1|    OSSL_NAMEMAP *namemap = ossl_namemap_new(libctx);
   58|       |
   59|      1|    if (namemap != NULL)
  ------------------
  |  Branch (59:9): [True: 1, False: 0]
  ------------------
   60|      1|        namemap->stored = 1;
   61|       |
   62|      1|    return namemap;
   63|      1|}
ossl_stored_namemap_free:
   66|      1|{
   67|      1|    OSSL_NAMEMAP *namemap = vnamemap;
   68|       |
   69|      1|    if (namemap != NULL) {
  ------------------
  |  Branch (69:9): [True: 1, False: 0]
  ------------------
   70|       |        /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
   71|      1|        namemap->stored = 0;
   72|      1|        ossl_namemap_free(namemap);
   73|      1|    }
   74|      1|}
ossl_namemap_empty:
   82|  2.26k|{
   83|       |#ifdef TSAN_REQUIRES_LOCKING
   84|       |    /* No TSAN support */
   85|       |    int rv;
   86|       |
   87|       |    if (namemap == NULL)
   88|       |        return 1;
   89|       |
   90|       |    if (!CRYPTO_THREAD_read_lock(namemap->lock))
   91|       |        return -1;
   92|       |    rv = namemap->max_number == 0;
   93|       |    CRYPTO_THREAD_unlock(namemap->lock);
   94|       |    return rv;
   95|       |#else
   96|       |    /* Have TSAN support */
   97|  2.26k|    return namemap == NULL || tsan_load(&namemap->max_number) == 0;
  ------------------
  |  |   61|  2.26k|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  |  Branch (97:12): [True: 0, False: 2.26k]
  |  Branch (97:31): [True: 1, False: 2.26k]
  ------------------
   98|  2.26k|#endif
   99|  2.26k|}
ossl_namemap_doall_names:
  109|    363|{
  110|    363|    int i;
  111|    363|    NAMES *names;
  112|       |
  113|    363|    if (namemap == NULL || number <= 0)
  ------------------
  |  Branch (113:9): [True: 0, False: 363]
  |  Branch (113:28): [True: 0, False: 363]
  ------------------
  114|      0|        return 0;
  115|       |
  116|       |    /*
  117|       |     * We duplicate the NAMES stack under a read lock. Subsequently we call
  118|       |     * the user function, so that we're not holding the read lock when in user
  119|       |     * code. This could lead to deadlocks.
  120|       |     */
  121|    363|    if (!CRYPTO_THREAD_read_lock(namemap->lock))
  ------------------
  |  Branch (121:9): [True: 0, False: 363]
  ------------------
  122|      0|        return 0;
  123|       |
  124|    363|    names = sk_NAMES_value(namemap->numnames, number - 1);
  125|    363|    if (names != NULL)
  ------------------
  |  Branch (125:9): [True: 363, False: 0]
  ------------------
  126|    363|        names = sk_OPENSSL_STRING_dup(names);
  ------------------
  |  |  251|    363|#define sk_OPENSSL_STRING_dup(sk) ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_dup(ossl_check_const_OPENSSL_STRING_sk_type(sk)))
  ------------------
  127|       |
  128|    363|    CRYPTO_THREAD_unlock(namemap->lock);
  129|       |
  130|    363|    if (names == NULL)
  ------------------
  |  Branch (130:9): [True: 0, False: 363]
  ------------------
  131|      0|        return 0;
  132|       |
  133|  1.44k|    for (i = 0; i < sk_OPENSSL_STRING_num(names); i++)
  ------------------
  |  |  229|  1.44k|#define sk_OPENSSL_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_STRING_sk_type(sk))
  ------------------
  |  Branch (133:17): [True: 1.08k, False: 363]
  ------------------
  134|  1.08k|        fn(sk_OPENSSL_STRING_value(names, i), data);
  ------------------
  |  |  230|  1.08k|#define sk_OPENSSL_STRING_value(sk, idx) ((char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_STRING_sk_type(sk), (idx)))
  ------------------
  135|       |
  136|    363|    sk_OPENSSL_STRING_free(names);
  ------------------
  |  |  235|    363|#define sk_OPENSSL_STRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_STRING_sk_type(sk))
  ------------------
  137|    363|    return i > 0;
  138|    363|}
ossl_namemap_name2num:
  141|  3.03k|{
  142|  3.03k|    int number = 0;
  143|  3.03k|    HT_VALUE *val;
  144|  3.03k|    NAMENUM_KEY key;
  145|       |
  146|  3.03k|#ifndef FIPS_MODULE
  147|  3.03k|    if (namemap == NULL)
  ------------------
  |  Branch (147:9): [True: 0, False: 3.03k]
  ------------------
  148|      0|        namemap = ossl_namemap_stored(NULL);
  149|  3.03k|#endif
  150|       |
  151|  3.03k|    if (namemap == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 3.03k]
  ------------------
  152|      0|        return 0;
  153|       |
  154|  3.03k|    HT_INIT_KEY(&key);
  ------------------
  |  |  107|  3.03k|#define HT_INIT_KEY(key) do { \
  |  |  108|  3.03k|memset((key), 0, sizeof(*(key))); \
  |  |  109|  3.03k|(key)->key_header.keysize = (sizeof(*(key)) - sizeof(HT_KEY)); \
  |  |  110|  3.03k|(key)->key_header.keybuf = (((uint8_t *)key) + sizeof(HT_KEY)); \
  |  |  111|  3.03k|} while(0)
  |  |  ------------------
  |  |  |  Branch (111:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  3.03k|    HT_SET_KEY_STRING_CASE(&key, name, name);
  ------------------
  |  |  138|  3.03k|#define HT_SET_KEY_STRING_CASE(key, member, value) do { \
  |  |  139|  3.03k|   ossl_ht_strcase((key)->keyfields.member, value, sizeof((key)->keyfields.member) -1); \
  |  |  140|  3.03k|} while(0)
  |  |  ------------------
  |  |  |  Branch (140:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  156|       |
  157|  3.03k|    val = ossl_ht_get(namemap->namenum_ht, TO_HT_KEY(&key));
  ------------------
  |  |  173|  3.03k|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  158|       |
  159|  3.03k|    if (val != NULL)
  ------------------
  |  Branch (159:9): [True: 2.34k, False: 683]
  ------------------
  160|       |        /* We store a (small) int directly instead of a pointer to it. */
  161|  2.34k|        number = (int)(intptr_t)val->value;
  162|       |
  163|  3.03k|    return number;
  164|  3.03k|}
ossl_namemap_name2num_n:
  168|    226|{
  169|    226|    int number = 0;
  170|    226|    HT_VALUE *val;
  171|    226|    NAMENUM_KEY key;
  172|       |
  173|    226|#ifndef FIPS_MODULE
  174|    226|    if (namemap == NULL)
  ------------------
  |  Branch (174:9): [True: 0, False: 226]
  ------------------
  175|      0|        namemap = ossl_namemap_stored(NULL);
  176|    226|#endif
  177|       |
  178|    226|    if (namemap == NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 226]
  ------------------
  179|      0|        return 0;
  180|       |
  181|    226|    HT_INIT_KEY(&key);
  ------------------
  |  |  107|    226|#define HT_INIT_KEY(key) do { \
  |  |  108|    226|memset((key), 0, sizeof(*(key))); \
  |  |  109|    226|(key)->key_header.keysize = (sizeof(*(key)) - sizeof(HT_KEY)); \
  |  |  110|    226|(key)->key_header.keybuf = (((uint8_t *)key) + sizeof(HT_KEY)); \
  |  |  111|    226|} while(0)
  |  |  ------------------
  |  |  |  Branch (111:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  182|    226|    HT_SET_KEY_STRING_CASE_N(&key, name, name, name_len);
  ------------------
  |  |  155|    226|#define HT_SET_KEY_STRING_CASE_N(key, member, value, len) do { \
  |  |  156|    226|    if (len < sizeof((key)->keyfields.member)) \
  |  |  ------------------
  |  |  |  Branch (156:9): [True: 226, False: 0]
  |  |  ------------------
  |  |  157|    226|        ossl_ht_strcase((key)->keyfields.member, value, len); \
  |  |  158|    226|    else \
  |  |  159|    226|        ossl_ht_strcase((key)->keyfields.member, value, sizeof((key)->keyfields.member) - 1); \
  |  |  160|    226|} while(0)
  |  |  ------------------
  |  |  |  Branch (160:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  183|       |
  184|    226|    val = ossl_ht_get(namemap->namenum_ht, TO_HT_KEY(&key));
  ------------------
  |  |  173|    226|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  185|       |
  186|    226|    if (val != NULL)
  ------------------
  |  Branch (186:9): [True: 223, False: 3]
  ------------------
  187|       |        /* We store a (small) int directly instead of a pointer to it. */
  188|    223|        number = (int)(intptr_t)val->value;
  189|       |
  190|    226|    return number;
  191|    226|}
ossl_namemap_add_name:
  289|    648|{
  290|    648|    int tmp_number;
  291|       |
  292|    648|#ifndef FIPS_MODULE
  293|    648|    if (namemap == NULL)
  ------------------
  |  Branch (293:9): [True: 0, False: 648]
  ------------------
  294|      0|        namemap = ossl_namemap_stored(NULL);
  295|    648|#endif
  296|       |
  297|    648|    if (name == NULL || *name == 0 || namemap == NULL)
  ------------------
  |  Branch (297:9): [True: 0, False: 648]
  |  Branch (297:25): [True: 0, False: 648]
  |  Branch (297:39): [True: 0, False: 648]
  ------------------
  298|      0|        return 0;
  299|       |
  300|    648|    if (!CRYPTO_THREAD_write_lock(namemap->lock))
  ------------------
  |  Branch (300:9): [True: 0, False: 648]
  ------------------
  301|      0|        return 0;
  302|    648|    tmp_number = namemap_add_name(namemap, number, name);
  303|    648|    CRYPTO_THREAD_unlock(namemap->lock);
  304|    648|    return tmp_number;
  305|    648|}
ossl_namemap_add_names:
  309|    220|{
  310|    220|    char *tmp, *p, *q, *endp;
  311|       |
  312|       |    /* Check that we have a namemap */
  313|    220|    if (!ossl_assert(namemap != NULL)) {
  ------------------
  |  |   52|    220|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    220|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (313:9): [True: 0, False: 220]
  ------------------
  314|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  315|      0|        return 0;
  316|      0|    }
  317|       |
  318|    220|    if ((tmp = OPENSSL_strdup(names)) == NULL)
  ------------------
  |  |  119|    220|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (318:9): [True: 0, False: 220]
  ------------------
  319|      0|        return 0;
  320|       |
  321|    220|    if (!CRYPTO_THREAD_write_lock(namemap->lock)) {
  ------------------
  |  Branch (321:9): [True: 0, False: 220]
  ------------------
  322|      0|        OPENSSL_free(tmp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  323|      0|        return 0;
  324|      0|    }
  325|       |    /*
  326|       |     * Check that no name is an empty string, and that all names have at
  327|       |     * most one numeric identity together.
  328|       |     */
  329|    680|    for (p = tmp; *p != '\0'; p = q) {
  ------------------
  |  Branch (329:19): [True: 460, False: 220]
  ------------------
  330|    460|        int this_number;
  331|    460|        size_t l;
  332|       |
  333|    460|        if ((q = strchr(p, separator)) == NULL) {
  ------------------
  |  Branch (333:13): [True: 220, False: 240]
  ------------------
  334|    220|            l = strlen(p);       /* offset to \0 */
  335|    220|            q = p + l;
  336|    240|        } else {
  337|    240|            l = q - p;           /* offset to the next separator */
  338|    240|            *q++ = '\0';
  339|    240|        }
  340|       |
  341|    460|        if (*p == '\0') {
  ------------------
  |  Branch (341:13): [True: 0, False: 460]
  ------------------
  342|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  343|      0|            number = 0;
  344|      0|            goto end;
  345|      0|        }
  346|       |
  347|    460|        this_number = ossl_namemap_name2num(namemap, p);
  348|       |
  349|    460|        if (number == 0) {
  ------------------
  |  Branch (349:13): [True: 303, False: 157]
  ------------------
  350|    303|            number = this_number;
  351|    303|        } else if (this_number != 0 && this_number != number) {
  ------------------
  |  Branch (351:20): [True: 133, False: 24]
  |  Branch (351:40): [True: 0, False: 133]
  ------------------
  352|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  353|      0|                           "\"%s\" has an existing different identity %d (from \"%s\")",
  354|      0|                           p, this_number, names);
  355|      0|            number = 0;
  356|      0|            goto end;
  357|      0|        }
  358|    460|    }
  359|    220|    endp = p;
  360|       |
  361|       |    /* Now that we have checked, register all names */
  362|    680|    for (p = tmp; p < endp; p = q) {
  ------------------
  |  Branch (362:19): [True: 460, False: 220]
  ------------------
  363|    460|        int this_number;
  364|       |
  365|    460|        q = p + strlen(p) + 1;
  366|       |
  367|    460|        this_number = namemap_add_name(namemap, number, p);
  368|    460|        if (number == 0) {
  ------------------
  |  Branch (368:13): [True: 102, False: 358]
  ------------------
  369|    102|            number = this_number;
  370|    358|        } else if (this_number != number) {
  ------------------
  |  Branch (370:20): [True: 0, False: 358]
  ------------------
  371|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  372|      0|                           "Got number %d when expecting %d",
  373|      0|                           this_number, number);
  374|      0|            number = 0;
  375|      0|            goto end;
  376|      0|        }
  377|    460|    }
  378|       |
  379|    220| end:
  380|    220|    CRYPTO_THREAD_unlock(namemap->lock);
  381|    220|    OPENSSL_free(tmp);
  ------------------
  |  |  115|    220|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  382|    220|    return number;
  383|    220|}
ossl_namemap_stored:
  481|  2.26k|{
  482|  2.26k|#ifndef FIPS_MODULE
  483|  2.26k|    int nms;
  484|  2.26k|#endif
  485|  2.26k|    OSSL_NAMEMAP *namemap =
  486|  2.26k|        ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX);
  ------------------
  |  |  102|  2.26k|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  487|       |
  488|  2.26k|    if (namemap == NULL)
  ------------------
  |  Branch (488:9): [True: 0, False: 2.26k]
  ------------------
  489|      0|        return NULL;
  490|       |
  491|  2.26k|#ifndef FIPS_MODULE
  492|  2.26k|    nms = ossl_namemap_empty(namemap);
  493|  2.26k|    if (nms < 0) {
  ------------------
  |  Branch (493:9): [True: 0, False: 2.26k]
  ------------------
  494|       |        /*
  495|       |         * Could not get lock to make the count, so maybe internal objects
  496|       |         * weren't added. This seems safest.
  497|       |         */
  498|      0|        return NULL;
  499|      0|    }
  500|  2.26k|    if (nms == 1) {
  ------------------
  |  Branch (500:9): [True: 1, False: 2.26k]
  ------------------
  501|      1|        int i, end;
  502|       |
  503|       |        /* Before pilfering, we make sure the legacy database is populated */
  504|      1|        OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
  ------------------
  |  |  468|      1|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  505|      1|                            | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
  ------------------
  |  |  469|      1|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  506|       |
  507|      1|        OBJ_NAME_do_all(OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|      1|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  508|      1|                        get_legacy_cipher_names, namemap);
  509|      1|        OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH,
  ------------------
  |  |   25|      1|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  510|      1|                        get_legacy_md_names, namemap);
  511|       |
  512|       |        /* We also pilfer data from the legacy EVP_PKEY_ASN1_METHODs */
  513|     16|        for (i = 0, end = EVP_PKEY_asn1_get_count(); i < end; i++)
  ------------------
  |  Branch (513:54): [True: 15, False: 1]
  ------------------
  514|     15|            get_legacy_pkey_meth_names(EVP_PKEY_asn1_get0(i), namemap);
  515|      1|    }
  516|  2.26k|#endif
  517|       |
  518|  2.26k|    return namemap;
  519|  2.26k|}
ossl_namemap_new:
  522|      1|{
  523|      1|    OSSL_NAMEMAP *namemap;
  524|      1|    HT_CONFIG htconf = { NULL, NULL, NULL, NAMEMAP_HT_BUCKETS, 1, 1 };
  ------------------
  |  |   16|      1|#define NAMEMAP_HT_BUCKETS 2048
  ------------------
  525|       |
  526|      1|    htconf.ctx = libctx;
  527|       |
  528|      1|    if ((namemap = OPENSSL_zalloc(sizeof(*namemap))) == NULL)
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (528:9): [True: 0, False: 1]
  ------------------
  529|      0|        goto err;
  530|       |
  531|      1|    if ((namemap->lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (531:9): [True: 0, False: 1]
  ------------------
  532|      0|        goto err;
  533|       |
  534|      1|    if ((namemap->namenum_ht = ossl_ht_new(&htconf)) == NULL)
  ------------------
  |  Branch (534:9): [True: 0, False: 1]
  ------------------
  535|      0|        goto err;
  536|       |
  537|      1|    if ((namemap->numnames = sk_NAMES_new_null()) == NULL)
  ------------------
  |  Branch (537:9): [True: 0, False: 1]
  ------------------
  538|      0|        goto err;
  539|       |
  540|      1|    return namemap;
  541|       |
  542|      0| err:
  543|      0|    ossl_namemap_free(namemap);
  544|      0|    return NULL;
  545|      1|}
ossl_namemap_free:
  548|      1|{
  549|      1|    if (namemap == NULL || namemap->stored)
  ------------------
  |  Branch (549:9): [True: 0, False: 1]
  |  Branch (549:28): [True: 0, False: 1]
  ------------------
  550|      0|        return;
  551|       |
  552|      1|    sk_NAMES_pop_free(namemap->numnames, names_free);
  553|       |
  554|      1|    ossl_ht_free(namemap->namenum_ht);
  555|       |
  556|      1|    CRYPTO_THREAD_lock_free(namemap->lock);
  557|      1|    OPENSSL_free(namemap);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      1|}
core_namemap.c:namemap_add_name:
  258|  1.10k|{
  259|  1.10k|    int ret;
  260|  1.10k|    HT_VALUE val = { 0 };
  261|  1.10k|    NAMENUM_KEY key;
  262|       |
  263|       |    /* If it already exists, we don't add it */
  264|  1.10k|    if ((ret = ossl_namemap_name2num(namemap, name)) != 0)
  ------------------
  |  Branch (264:9): [True: 640, False: 468]
  ------------------
  265|    640|        return ret;
  266|       |
  267|    468|    if ((number = numname_insert(namemap, number, name)) == 0)
  ------------------
  |  Branch (267:9): [True: 0, False: 468]
  ------------------
  268|      0|        return 0;
  269|       |
  270|       |    /* Using tsan_store alone here is safe since we're under lock */
  271|    468|    tsan_store(&namemap->max_number, number);
  ------------------
  |  |   62|    468|#   define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed)
  ------------------
  272|       |
  273|    468|    HT_INIT_KEY(&key);
  ------------------
  |  |  107|    468|#define HT_INIT_KEY(key) do { \
  |  |  108|    468|memset((key), 0, sizeof(*(key))); \
  |  |  109|    468|(key)->key_header.keysize = (sizeof(*(key)) - sizeof(HT_KEY)); \
  |  |  110|    468|(key)->key_header.keybuf = (((uint8_t *)key) + sizeof(HT_KEY)); \
  |  |  111|    468|} while(0)
  |  |  ------------------
  |  |  |  Branch (111:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  274|    468|    HT_SET_KEY_STRING_CASE(&key, name, name);
  ------------------
  |  |  138|    468|#define HT_SET_KEY_STRING_CASE(key, member, value) do { \
  |  |  139|    468|   ossl_ht_strcase((key)->keyfields.member, value, sizeof((key)->keyfields.member) -1); \
  |  |  140|    468|} while(0)
  |  |  ------------------
  |  |  |  Branch (140:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  275|    468|    val.value = (void *)(intptr_t)number;
  276|    468|    ret = ossl_ht_insert(namemap->namenum_ht, TO_HT_KEY(&key), &val, NULL);
  ------------------
  |  |  173|    468|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  277|    468|    if (!ossl_assert(ret != 0)) /* cannot happen as we are under write lock */
  ------------------
  |  |   52|    468|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    468|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (277:9): [True: 0, False: 468]
  ------------------
  278|      0|        return 0;
  279|    468|    if (ret < 1) {
  ------------------
  |  Branch (279:9): [True: 0, False: 468]
  ------------------
  280|       |        /* unable to insert due to too many collisions */
  281|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_NAMES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  282|      0|        return 0;
  283|      0|    }
  284|    468|    return number;
  285|    468|}
core_namemap.c:numname_insert:
  217|    468|{
  218|    468|    NAMES *names;
  219|    468|    char *tmpname;
  220|       |
  221|    468|    if (number > 0) {
  ------------------
  |  Branch (221:9): [True: 248, False: 220]
  ------------------
  222|    248|        names = sk_NAMES_value(namemap->numnames, number - 1);
  223|    248|        if (!ossl_assert(names != NULL)) {
  ------------------
  |  |   52|    248|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    248|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (223:13): [True: 0, False: 248]
  ------------------
  224|       |            /* cannot happen */
  225|      0|            return 0;
  226|      0|        }
  227|    248|    } else {
  228|       |        /* a completely new entry */
  229|    220|        names = sk_OPENSSL_STRING_new_null();
  ------------------
  |  |  232|    220|#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_new_null())
  ------------------
  230|    220|        if (names == NULL)
  ------------------
  |  Branch (230:13): [True: 0, False: 220]
  ------------------
  231|      0|            return 0;
  232|    220|    }
  233|       |
  234|    468|    if ((tmpname = OPENSSL_strdup(name)) == NULL)
  ------------------
  |  |  119|    468|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    468|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    468|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (234:9): [True: 0, False: 468]
  ------------------
  235|      0|        goto err;
  236|       |
  237|    468|    if (!sk_OPENSSL_STRING_push(names, tmpname))
  ------------------
  |  |  239|    468|#define sk_OPENSSL_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr))
  ------------------
  |  Branch (237:9): [True: 0, False: 468]
  ------------------
  238|      0|        goto err;
  239|    468|    tmpname = NULL;
  240|       |
  241|    468|    if (number <= 0) {
  ------------------
  |  Branch (241:9): [True: 220, False: 248]
  ------------------
  242|    220|        if (!sk_NAMES_push(namemap->numnames, names))
  ------------------
  |  Branch (242:13): [True: 0, False: 220]
  ------------------
  243|      0|            goto err;
  244|    220|        number = sk_NAMES_num(namemap->numnames);
  245|    220|    }
  246|    468|    return number;
  247|       |
  248|      0| err:
  249|      0|    if (number <= 0)
  ------------------
  |  Branch (249:9): [True: 0, False: 0]
  ------------------
  250|      0|        sk_OPENSSL_STRING_pop_free(names, name_string_free);
  ------------------
  |  |  243|      0|#define sk_OPENSSL_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_freefunc_type(freefunc))
  ------------------
  251|      0|    OPENSSL_free(tmpname);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  252|      0|    return 0;
  253|    468|}
core_namemap.c:name_string_free:
   44|    468|{
   45|    468|    OPENSSL_free(name);
  ------------------
  |  |  115|    468|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    468|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    468|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   46|    468|}
core_namemap.c:get_legacy_cipher_names:
  420|    183|{
  421|    183|    const EVP_CIPHER *cipher = (void *)OBJ_NAME_get(on->name, on->type);
  422|       |
  423|    183|    if (cipher != NULL)
  ------------------
  |  Branch (423:9): [True: 183, False: 0]
  ------------------
  424|    183|        get_legacy_evp_names(NID_undef, EVP_CIPHER_get_type(cipher), NULL, arg);
  ------------------
  |  |   18|    183|#define NID_undef                       0
  ------------------
  425|    183|}
core_namemap.c:get_legacy_evp_names:
  396|    258|{
  397|    258|    int num = 0;
  398|    258|    ASN1_OBJECT *obj;
  399|       |
  400|    258|    if (base_nid != NID_undef) {
  ------------------
  |  |   18|    258|#define NID_undef                       0
  ------------------
  |  Branch (400:9): [True: 4, False: 254]
  ------------------
  401|      4|        num = ossl_namemap_add_name(arg, num, OBJ_nid2sn(base_nid));
  402|      4|        num = ossl_namemap_add_name(arg, num, OBJ_nid2ln(base_nid));
  403|      4|    }
  404|       |
  405|    258|    if (nid != NID_undef) {
  ------------------
  |  |   18|    258|#define NID_undef                       0
  ------------------
  |  Branch (405:9): [True: 210, False: 48]
  ------------------
  406|    210|        num = ossl_namemap_add_name(arg, num, OBJ_nid2sn(nid));
  407|    210|        num = ossl_namemap_add_name(arg, num, OBJ_nid2ln(nid));
  408|    210|        if ((obj = OBJ_nid2obj(nid)) != NULL) {
  ------------------
  |  Branch (408:13): [True: 210, False: 0]
  ------------------
  409|    210|            char txtoid[OSSL_MAX_NAME_SIZE];
  410|       |
  411|    210|            if (OBJ_obj2txt(txtoid, sizeof(txtoid), obj, 1) > 0)
  ------------------
  |  Branch (411:17): [True: 209, False: 1]
  ------------------
  412|    209|                num = ossl_namemap_add_name(arg, num, txtoid);
  413|    210|        }
  414|    210|    }
  415|    258|    if (pem_name != NULL)
  ------------------
  |  Branch (415:9): [True: 11, False: 247]
  ------------------
  416|     11|        num = ossl_namemap_add_name(arg, num, pem_name);
  417|    258|}
core_namemap.c:get_legacy_md_names:
  428|     59|{
  429|     59|    const EVP_MD *md = (void *)OBJ_NAME_get(on->name, on->type);
  430|       |
  431|     59|    if (md != NULL)
  ------------------
  |  Branch (431:9): [True: 59, False: 0]
  ------------------
  432|     59|        get_legacy_evp_names(0, EVP_MD_get_type(md), NULL, arg);
  433|     59|}
core_namemap.c:get_legacy_pkey_meth_names:
  437|     15|{
  438|     15|    int nid = 0, base_nid = 0, flags = 0;
  439|     15|    const char *pem_name = NULL;
  440|       |
  441|     15|    EVP_PKEY_asn1_get0_info(&nid, &base_nid, &flags, NULL, &pem_name, ameth);
  442|     15|    if (nid != NID_undef) {
  ------------------
  |  |   18|     15|#define NID_undef                       0
  ------------------
  |  Branch (442:9): [True: 15, False: 0]
  ------------------
  443|     15|        if ((flags & ASN1_PKEY_ALIAS) == 0) {
  ------------------
  |  | 1606|     15|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (443:13): [True: 10, False: 5]
  ------------------
  444|     10|            switch (nid) {
  445|      1|            case EVP_PKEY_DHX:
  ------------------
  |  |   72|      1|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5499|      1|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
  |  Branch (445:13): [True: 1, False: 9]
  ------------------
  446|       |                /* We know that the name "DHX" is used too */
  447|      1|                get_legacy_evp_names(0, nid, "DHX", arg);
  448|       |                /* FALLTHRU */
  449|     10|            default:
  ------------------
  |  Branch (449:13): [True: 9, False: 1]
  ------------------
  450|     10|                get_legacy_evp_names(0, nid, pem_name, arg);
  451|     10|            }
  452|     10|        } else {
  453|       |            /*
  454|       |             * Treat aliases carefully, some of them are undesirable, or
  455|       |             * should not be treated as such for providers.
  456|       |             */
  457|       |
  458|      5|            switch (nid) {
  459|      1|            case EVP_PKEY_SM2:
  ------------------
  |  |   74|      1|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1232|      1|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (459:13): [True: 1, False: 4]
  ------------------
  460|       |                /*
  461|       |                 * SM2 is a separate keytype with providers, not an alias for
  462|       |                 * EC.
  463|       |                 */
  464|      1|                get_legacy_evp_names(0, nid, pem_name, arg);
  465|      1|                break;
  466|      4|            default:
  ------------------
  |  Branch (466:13): [True: 4, False: 1]
  ------------------
  467|       |                /* Use the short name of the base nid as the common reference */
  468|      4|                get_legacy_evp_names(base_nid, nid, pem_name, arg);
  469|      5|            }
  470|      5|        }
  471|     15|    }
  472|     15|}
core_namemap.c:names_free:
   49|    220|{
   50|    220|    sk_OPENSSL_STRING_pop_free(n, name_string_free);
  ------------------
  |  |  243|    220|#define sk_OPENSSL_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_freefunc_type(freefunc))
  ------------------
   51|    220|}

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

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

ossl_err_load_CRMF_strings:
   78|      1|{
   79|      1|# ifndef OPENSSL_NO_ERR
   80|      1|    if (ERR_reason_error_string(CRMF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (80:9): [True: 1, False: 0]
  ------------------
   81|      1|        ERR_load_strings_const(CRMF_str_reasons);
   82|      1|# endif
   83|      1|    return 1;
   84|      1|}

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

ossl_ctype_check:
  253|     44|{
  254|     44|    const int max = sizeof(ctype_char_map) / sizeof(*ctype_char_map);
  255|     44|    const int a = ossl_toascii(c);
  ------------------
  |  |   56|     44|#  define ossl_toascii(c)       (c)
  ------------------
  256|       |
  257|     44|    return a >= 0 && a < max && (ctype_char_map[a] & mask) != 0;
  ------------------
  |  Branch (257:12): [True: 44, False: 0]
  |  Branch (257:22): [True: 44, False: 0]
  |  Branch (257:33): [True: 16, False: 28]
  ------------------
  258|     44|}
ossl_isdigit:
  270|  1.55k|{
  271|  1.55k|    int a = ossl_toascii(c);
  ------------------
  |  |   56|  1.55k|#  define ossl_toascii(c)       (c)
  ------------------
  272|       |
  273|  1.55k|    return ASCII_IS_DIGIT(a);
  ------------------
  |  |  265|  1.55k|#define ASCII_IS_DIGIT(c)   (c >= 0x30 && c <= 0x39)
  |  |  ------------------
  |  |  |  Branch (265:30): [True: 1.55k, False: 0]
  |  |  |  Branch (265:43): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
  274|  1.55k|}
ossl_tolower:
  297|  36.7k|{
  298|  36.7k|    int a = ossl_toascii(c);
  ------------------
  |  |   56|  36.7k|#  define ossl_toascii(c)       (c)
  ------------------
  299|       |
  300|  36.7k|    return ASCII_IS_UPPER(a) ? c ^ case_change : c;
  ------------------
  |  |  266|  36.7k|#define ASCII_IS_UPPER(c)   (c >= 0x41 && c <= 0x5A)
  |  |  ------------------
  |  |  |  Branch (266:30): [True: 26.8k, False: 9.87k]
  |  |  |  Branch (266:43): [True: 13.7k, False: 13.0k]
  |  |  ------------------
  ------------------
  301|  36.7k|}

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

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

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

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", i, dso);
  ------------------
  |  |  301|      0|    REF_PRINT_EX(text, val, (void *)object)
  |  |  ------------------
  |  |  |  |  299|      0|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  283|      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);
  ------------------
  |  |  293|      0|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (293: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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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);
  ------------------
  |  |  204|      0|#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
  ------------------
   75|      0|    OPENSSL_free(dso->filename);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|      0|    OPENSSL_free(dso->loaded_filename);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|      0|    CRYPTO_FREE_REF(&dso->references);
   78|      0|    OPENSSL_free(dso);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|      0|    return 1;
   80|      0|}

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

ossl_decoder_cache_new:
  703|      1|{
  704|      1|    DECODER_CACHE *cache = OPENSSL_malloc(sizeof(*cache));
  ------------------
  |  |  102|      1|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  705|       |
  706|      1|    if (cache == NULL)
  ------------------
  |  Branch (706:9): [True: 0, False: 1]
  ------------------
  707|      0|        return NULL;
  708|       |
  709|      1|    cache->lock = CRYPTO_THREAD_lock_new();
  710|      1|    if (cache->lock == NULL) {
  ------------------
  |  Branch (710:9): [True: 0, False: 1]
  ------------------
  711|      0|        OPENSSL_free(cache);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  712|      0|        return NULL;
  713|      0|    }
  714|      1|    cache->hashtable = lh_DECODER_CACHE_ENTRY_new(decoder_cache_entry_hash,
  715|      1|                                                  decoder_cache_entry_cmp);
  716|      1|    if (cache->hashtable == NULL) {
  ------------------
  |  Branch (716:9): [True: 0, False: 1]
  ------------------
  717|      0|        CRYPTO_THREAD_lock_free(cache->lock);
  718|      0|        OPENSSL_free(cache);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  719|      0|        return NULL;
  720|      0|    }
  721|       |
  722|      1|    return cache;
  723|      1|}
ossl_decoder_cache_free:
  726|      1|{
  727|      1|    DECODER_CACHE *cache = (DECODER_CACHE *)vcache;
  728|       |
  729|      1|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  730|      1|    lh_DECODER_CACHE_ENTRY_free(cache->hashtable);
  731|      1|    CRYPTO_THREAD_lock_free(cache->lock);
  732|      1|    OPENSSL_free(cache);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  733|      1|}
ossl_decoder_cache_flush:
  740|      1|{
  741|      1|    DECODER_CACHE *cache
  742|      1|        = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_CACHE_INDEX);
  ------------------
  |  |  120|      1|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  743|       |
  744|      1|    if (cache == NULL)
  ------------------
  |  Branch (744:9): [True: 1, False: 0]
  ------------------
  745|      1|        return 0;
  746|       |
  747|       |
  748|      0|    if (!CRYPTO_THREAD_write_lock(cache->lock)) {
  ------------------
  |  Branch (748:9): [True: 0, False: 0]
  ------------------
  749|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  750|      0|        return 0;
  751|      0|    }
  752|       |
  753|      0|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  754|      0|    lh_DECODER_CACHE_ENTRY_flush(cache->hashtable);
  755|       |
  756|      0|    CRYPTO_THREAD_unlock(cache->lock);
  757|      0|    return 1;
  758|      0|}

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

ENGINE_finish:
  107|  7.31k|{
  108|  7.31k|    int to_return = 1;
  109|       |
  110|  7.31k|    if (e == NULL)
  ------------------
  |  Branch (110:9): [True: 7.31k, False: 0]
  ------------------
  111|  7.31k|        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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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|      1|{
  177|      1|    if (int_cleanup_check(0)) {
  ------------------
  |  Branch (177:9): [True: 0, False: 1]
  ------------------
  178|      0|        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
  179|      0|                                        engine_cleanup_cb_free);
  180|      0|        cleanup_stack = NULL;
  181|      0|    }
  182|      1|    CRYPTO_THREAD_lock_free(global_engine_lock);
  183|      1|    global_engine_lock = NULL;
  184|      1|}
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|      1|{
  120|      1|    if (cleanup_stack)
  ------------------
  |  Branch (120:9): [True: 0, False: 1]
  ------------------
  121|      0|        return 1;
  122|      1|    if (!create)
  ------------------
  |  Branch (122:9): [True: 1, False: 0]
  ------------------
  123|      1|        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|      1|}

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

ENGINE_get_pkey_asn1_meth_engine:
   78|    875|{
   79|    875|    return ossl_engine_table_select(&pkey_asn1_meth_table, nid,
   80|    875|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  302|    875|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  303|    875|#   define OPENSSL_LINE __LINE__
  ------------------
   81|    875|}
ENGINE_pkey_asn1_find_str:
  191|    744|{
  192|    744|    ENGINE_FIND_STR fstr;
  193|    744|    fstr.e = NULL;
  194|    744|    fstr.ameth = NULL;
  195|    744|    fstr.str = str;
  196|    744|    fstr.len = len;
  197|       |
  198|    744|    if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
  ------------------
  |  |  130|    744|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 744, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (198:9): [True: 0, False: 744]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  201|      0|        return NULL;
  202|      0|    }
  203|       |
  204|    744|    if (!CRYPTO_THREAD_read_lock(global_engine_lock))
  ------------------
  |  Branch (204:9): [True: 0, False: 744]
  ------------------
  205|      0|        return NULL;
  206|    744|    engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
  207|       |    /* If found obtain a structural reference to engine */
  208|    744|    if (fstr.e != NULL) {
  ------------------
  |  Branch (208:9): [True: 0, False: 744]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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,                                       \
  |  |  ------------------
  |  |  |  |  301|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6))
  |  |  |  |  ------------------
  |  |  |  |  |  |  283|      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|    744|    *pe = fstr.e;
  219|    744|    CRYPTO_THREAD_unlock(global_engine_lock);
  220|    744|    return fstr.ameth;
  221|    744|}

ENGINE_get_cipher_engine:
   67|      9|{
   68|      9|    return ossl_engine_table_select(&cipher_table, nid,
   69|      9|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  ------------------
   70|      9|}

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

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

OSSL_ERR_STATE_free:
  202|      1|{
  203|      1|    int i;
  204|       |
  205|      1|    if (state == NULL)
  ------------------
  |  Branch (205:9): [True: 0, False: 1]
  ------------------
  206|      0|        return;
  207|     17|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|     17|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (207:17): [True: 16, False: 1]
  ------------------
  208|     16|        err_clear(state, i, 1);
  209|     16|    }
  210|      1|    CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  ------------------
                  CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  ------------------
  211|      1|}
err_cleanup:
  233|      1|{
  234|      1|    if (set_err_thread_local != 0)
  ------------------
  |  Branch (234:9): [True: 1, False: 0]
  ------------------
  235|      1|        CRYPTO_THREAD_cleanup_local(&err_thread_local);
  236|      1|    CRYPTO_THREAD_lock_free(err_string_lock);
  237|      1|    err_string_lock = NULL;
  238|      1|#ifndef OPENSSL_NO_ERR
  239|      1|    lh_ERR_STRING_DATA_free(int_error_hash);
  ------------------
  |  |  376|      1|#define lh_ERR_STRING_DATA_free(lh) OPENSSL_LH_free(ossl_check_ERR_STRING_DATA_lh_type(lh))
  ------------------
  240|      1|    int_error_hash = NULL;
  241|      1|#endif
  242|      1|}
ossl_err_load_ERR_strings:
  272|     35|{
  273|     35|#ifndef OPENSSL_NO_ERR
  274|     35|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|     35|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 35, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (274:9): [True: 0, False: 35]
  ------------------
  275|      0|        return 0;
  276|       |
  277|     35|    err_load_strings(ERR_str_libraries);
  278|     35|    err_load_strings(ERR_str_reasons);
  279|     35|#endif
  280|     35|    return 1;
  281|     35|}
ERR_load_strings_const:
  297|     34|{
  298|     34|#ifndef OPENSSL_NO_ERR
  299|     34|    if (ossl_err_load_ERR_strings() == 0)
  ------------------
  |  Branch (299:9): [True: 0, False: 34]
  ------------------
  300|      0|        return 0;
  301|     34|    err_load_strings(str);
  302|     34|#endif
  303|       |
  304|     34|    return 1;
  305|     34|}
ERR_peek_last_error:
  410|      2|{
  411|      2|    return get_error_values(EV_PEEK_LAST, NULL, NULL, NULL, NULL, NULL);
  412|      2|}
ERR_reason_error_string:
  613|     34|{
  614|     34|#ifndef OPENSSL_NO_ERR
  615|     34|    ERR_STRING_DATA d, *p = NULL;
  616|     34|    unsigned long l, r;
  617|       |
  618|     34|    if (!RUN_ONCE(&err_string_init, do_err_strings_init)) {
  ------------------
  |  |  130|     34|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 34, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (618:9): [True: 0, False: 34]
  ------------------
  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|     34|    if (ERR_SYSTEM_ERROR(e))
  ------------------
  |  |  239|     34|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     34|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 34]
  |  |  ------------------
  ------------------
  628|      0|        return NULL;
  629|       |
  630|     34|    l = ERR_GET_LIB(e);
  631|     34|    r = ERR_GET_REASON(e);
  632|     34|    d.error = ERR_PACK(l, 0, r);
  ------------------
  |  |  279|     34|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     34|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     34|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     34|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     34|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  633|     34|    p = int_err_get_item(&d);
  634|     34|    if (p == NULL) {
  ------------------
  |  Branch (634:9): [True: 34, False: 0]
  ------------------
  635|     34|        d.error = ERR_PACK(0, 0, r);
  ------------------
  |  |  279|     34|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     34|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     34|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     34|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     34|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  636|     34|        p = int_err_get_item(&d);
  637|     34|    }
  638|     34|    return ((p == NULL) ? NULL : p->string);
  ------------------
  |  Branch (638:13): [True: 34, False: 0]
  ------------------
  639|       |#else
  640|       |    return NULL;
  641|       |#endif
  642|     34|}
ossl_err_get_state_int:
  673|  4.21k|{
  674|  4.21k|    ERR_STATE *state;
  675|  4.21k|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|  4.21k|# define get_last_sys_error()    errno
  ------------------
  676|       |
  677|  4.21k|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|  4.21k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (677:9): [True: 0, False: 4.21k]
  ------------------
  678|      0|        return NULL;
  679|       |
  680|  4.21k|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|  4.21k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 4.21k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (680:9): [True: 0, False: 4.21k]
  ------------------
  681|      0|        return NULL;
  682|       |
  683|  4.21k|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  684|  4.21k|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (684:9): [True: 0, False: 4.21k]
  ------------------
  685|      0|        return NULL;
  686|       |
  687|  4.21k|    if (state == NULL) {
  ------------------
  |  Branch (687:9): [True: 1, False: 4.21k]
  ------------------
  688|      1|        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (688:13): [True: 0, False: 1]
  ------------------
  689|      0|            return NULL;
  690|       |
  691|      1|        state = OSSL_ERR_STATE_new();
  692|      1|        if (state == NULL) {
  ------------------
  |  Branch (692:13): [True: 0, False: 1]
  ------------------
  693|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  694|      0|            return NULL;
  695|      0|        }
  696|       |
  697|      1|        if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state)
  ------------------
  |  Branch (697:13): [True: 0, False: 1]
  ------------------
  698|      1|                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  ------------------
  |  Branch (698:20): [True: 0, False: 1]
  ------------------
  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|      1|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  467|      1|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  706|      1|    }
  707|       |
  708|  4.21k|    set_sys_error(saveerrno);
  ------------------
  |  |   32|  4.21k|# define set_sys_error(e)        errno=(e)
  ------------------
  709|  4.21k|    return state;
  710|  4.21k|}
err_shelve_state:
  725|      1|{
  726|      1|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|      1|# 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|      1|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      1|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (740:9): [True: 0, False: 1]
  ------------------
  741|      0|        return 0;
  742|       |
  743|      1|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|      1|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (743:9): [True: 0, False: 1]
  ------------------
  744|      0|        return 0;
  745|       |
  746|      1|    *state = CRYPTO_THREAD_get_local(&err_thread_local);
  747|      1|    if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (747:9): [True: 0, False: 1]
  ------------------
  748|      0|        return 0;
  749|       |
  750|      1|    set_sys_error(saveerrno);
  ------------------
  |  |   32|      1|# define set_sys_error(e)        errno=(e)
  ------------------
  751|      1|    return 1;
  752|      1|}
err_unshelve_state:
  759|      1|{
  760|      1|    if (state != (void*)-1)
  ------------------
  |  Branch (760:9): [True: 1, False: 0]
  ------------------
  761|      1|        CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)state);
  762|      1|}
ERR_get_next_error_library:
  765|      1|{
  766|      1|    int ret;
  767|       |
  768|      1|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|      1|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (768:9): [True: 0, False: 1]
  ------------------
  769|      0|        return 0;
  770|       |
  771|      1|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (771:9): [True: 0, False: 1]
  ------------------
  772|      0|        return 0;
  773|      1|    ret = int_err_library_number++;
  774|      1|    CRYPTO_THREAD_unlock(err_string_lock);
  775|      1|    return ret;
  776|      1|}
err.c:do_err_strings_init:
  214|      1|{
  215|      1|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      1|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (215:9): [True: 0, False: 1]
  ------------------
  216|      0|        return 0;
  217|      1|    err_string_lock = CRYPTO_THREAD_lock_new();
  218|      1|    if (err_string_lock == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 1]
  ------------------
  219|      0|        return 0;
  220|      1|#ifndef OPENSSL_NO_ERR
  221|      1|    int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
  ------------------
  |  |  375|      1|#define lh_ERR_STRING_DATA_new(hfn, cmp) ((LHASH_OF(ERR_STRING_DATA) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_ERR_STRING_DATA_lh_hashfunc_type(hfn), ossl_check_ERR_STRING_DATA_lh_compfunc_type(cmp)), lh_ERR_STRING_DATA_hash_thunk, lh_ERR_STRING_DATA_comp_thunk, lh_ERR_STRING_DATA_doall_thunk, lh_ERR_STRING_DATA_doall_arg_thunk))
  ------------------
  222|      1|                                            err_string_data_cmp);
  223|      1|    if (int_error_hash == NULL) {
  ------------------
  |  Branch (223:9): [True: 0, False: 1]
  ------------------
  224|      0|        CRYPTO_THREAD_lock_free(err_string_lock);
  225|      0|        err_string_lock = NULL;
  226|      0|        return 0;
  227|      0|    }
  228|      1|#endif
  229|      1|    return 1;
  230|      1|}
err.c:err_string_data_hash:
  172|  4.37k|{
  173|  4.37k|    unsigned long ret, l;
  174|       |
  175|  4.37k|    l = a->error;
  176|  4.37k|    ret = l ^ ERR_GET_LIB(l);
  177|  4.37k|    return (ret ^ ret % 19 * 13);
  178|  4.37k|}
err.c:err_string_data_cmp:
  182|  2.94k|{
  183|  2.94k|    if (a->error == b->error)
  ------------------
  |  Branch (183:9): [True: 2.78k, False: 158]
  ------------------
  184|  2.78k|        return 0;
  185|    158|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (185:12): [True: 84, False: 74]
  ------------------
  186|  2.94k|}
err.c:err_load_strings:
  260|    104|{
  261|    104|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (261:9): [True: 0, False: 104]
  ------------------
  262|      0|        return 0;
  263|  4.41k|    for (; str->error; str++)
  ------------------
  |  Branch (263:12): [True: 4.31k, False: 104]
  ------------------
  264|  4.31k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  ------------------
  |  |  378|  4.41k|#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|    104|                                       (ERR_STRING_DATA *)str);
  266|    104|    CRYPTO_THREAD_unlock(err_string_lock);
  267|    104|    return 1;
  268|    104|}
err.c:get_error_values:
  448|      2|{
  449|      2|    int i = 0;
  450|      2|    ERR_STATE *es;
  451|      2|    unsigned long ret;
  452|       |
  453|      2|    es = ossl_err_get_state_int();
  454|      2|    if (es == NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 2]
  ------------------
  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|      2|    while (es->bottom != es->top) {
  ------------------
  |  Branch (461:12): [True: 2, False: 0]
  ------------------
  462|      2|        if (es->err_flags[es->top] & ERR_FLAG_CLEAR) {
  ------------------
  |  |   53|      2|#  define ERR_FLAG_CLEAR          0x02
  ------------------
  |  Branch (462:13): [True: 0, False: 2]
  ------------------
  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|      2|        i = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|      2|#  define ERR_NUM_ERRORS  16
  ------------------
  468|      2|        if (es->err_flags[i] & ERR_FLAG_CLEAR) {
  ------------------
  |  |   53|      2|#  define ERR_FLAG_CLEAR          0x02
  ------------------
  |  Branch (468:13): [True: 0, False: 2]
  ------------------
  469|      0|            es->bottom = i;
  470|      0|            err_clear(es, es->bottom, 0);
  471|      0|            continue;
  472|      0|        }
  473|      2|        break;
  474|      2|    }
  475|       |
  476|       |    /* If everything has been cleared, the stack is empty. */
  477|      2|    if (es->bottom == es->top)
  ------------------
  |  Branch (477:9): [True: 0, False: 2]
  ------------------
  478|      0|        return 0;
  479|       |
  480|       |    /* Which error, the top of stack (latest one) or the first one? */
  481|      2|    if (g == EV_PEEK_LAST)
  ------------------
  |  Branch (481:9): [True: 2, False: 0]
  ------------------
  482|      2|        i = es->top;
  483|      0|    else
  484|      0|        i = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|      0|#  define ERR_NUM_ERRORS  16
  ------------------
  485|       |
  486|      2|    ret = es->err_buffer[i];
  487|      2|    if (g == EV_POP) {
  ------------------
  |  Branch (487:9): [True: 0, False: 2]
  ------------------
  488|      0|        es->bottom = i;
  489|      0|        es->err_buffer[i] = 0;
  490|      0|    }
  491|       |
  492|      2|    if (file != NULL) {
  ------------------
  |  Branch (492:9): [True: 0, False: 2]
  ------------------
  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|      2|    if (line != NULL)
  ------------------
  |  Branch (497:9): [True: 0, False: 2]
  ------------------
  498|      0|        *line = es->err_line[i];
  499|      2|    if (func != NULL) {
  ------------------
  |  Branch (499:9): [True: 0, False: 2]
  ------------------
  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|      2|    if (flags != NULL)
  ------------------
  |  Branch (504:9): [True: 0, False: 2]
  ------------------
  505|      0|        *flags = es->err_data_flags[i];
  506|      2|    if (data == NULL) {
  ------------------
  |  Branch (506:9): [True: 2, False: 0]
  ------------------
  507|      2|        if (g == EV_POP) {
  ------------------
  |  Branch (507:13): [True: 0, False: 2]
  ------------------
  508|      0|            err_clear_data(es, i, 0);
  509|      0|        }
  510|      2|    } 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|      2|    return ret;
  519|      2|}
err.c:int_err_get_item:
  189|     68|{
  190|     68|    ERR_STRING_DATA *p = NULL;
  191|       |
  192|     68|    if (!CRYPTO_THREAD_read_lock(err_string_lock))
  ------------------
  |  Branch (192:9): [True: 0, False: 68]
  ------------------
  193|      0|        return NULL;
  194|     68|    p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
  ------------------
  |  |  380|     68|#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|     68|    CRYPTO_THREAD_unlock(err_string_lock);
  196|       |
  197|     68|    return p;
  198|     68|}
err.c:err_do_init:
  667|      1|{
  668|      1|    set_err_thread_local = 1;
  669|      1|    return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
  670|      1|}
err.c:err_delete_thread_state:
  645|      1|{
  646|      1|    ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
  647|      1|    if (state == NULL)
  ------------------
  |  Branch (647:9): [True: 0, False: 1]
  ------------------
  648|      0|        return;
  649|       |
  650|      1|    CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  651|      1|    OSSL_ERR_STATE_free(state);
  652|      1|}

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

ERR_new:
   17|    892|{
   18|    892|    ERR_STATE *es;
   19|       |
   20|    892|    es = ossl_err_get_state_int();
   21|    892|    if (es == NULL)
  ------------------
  |  Branch (21:9): [True: 0, False: 892]
  ------------------
   22|      0|        return;
   23|       |
   24|       |    /* Allocate a slot */
   25|    892|    err_get_slot(es);
   26|    892|    err_clear(es, es->top, 0);
   27|    892|}
ERR_set_debug:
   30|    892|{
   31|    892|    ERR_STATE *es;
   32|       |
   33|    892|    es = ossl_err_get_state_int();
   34|    892|    if (es == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 892]
  ------------------
   35|      0|        return;
   36|       |
   37|    892|    err_set_debug(es, es->top, file, line, func);
   38|    892|}
ERR_set_error:
   41|    892|{
   42|    892|    va_list args;
   43|       |
   44|    892|    va_start(args, fmt);
   45|    892|    ERR_vset_error(lib, reason, fmt, args);
   46|    892|    va_end(args);
   47|    892|}
ERR_vset_error:
   50|    892|{
   51|    892|    ERR_STATE *es;
   52|    892|    char *buf = NULL;
   53|    892|    size_t buf_size = 0;
   54|    892|    unsigned long flags = 0;
   55|    892|    size_t i;
   56|       |
   57|    892|    es = ossl_err_get_state_int();
   58|    892|    if (es == NULL)
  ------------------
  |  Branch (58:9): [True: 0, False: 892]
  ------------------
   59|      0|        return;
   60|    892|    i = es->top;
   61|       |
   62|    892|    if (fmt != NULL) {
  ------------------
  |  Branch (62:9): [True: 44, False: 848]
  ------------------
   63|     44|        int printed_len = 0;
   64|     44|        char *rbuf = NULL;
   65|       |
   66|     44|        buf = es->err_data[i];
   67|     44|        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|     44|        es->err_data[i] = NULL;
   77|     44|        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|     44|        if (buf_size < ERR_MAX_DATA_SIZE
  ------------------
  |  |  392|     88|#define ERR_MAX_DATA_SIZE       1024
  ------------------
  |  Branch (83:13): [True: 44, False: 0]
  ------------------
   84|     44|            && (rbuf = OPENSSL_realloc(buf, ERR_MAX_DATA_SIZE)) != NULL) {
  ------------------
  |  |  109|     44|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     44|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     44|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (84:16): [True: 44, False: 0]
  ------------------
   85|     44|            buf = rbuf;
   86|     44|            buf_size = ERR_MAX_DATA_SIZE;
  ------------------
  |  |  392|     44|#define ERR_MAX_DATA_SIZE       1024
  ------------------
   87|     44|        }
   88|       |
   89|     44|        if (buf != NULL) {
  ------------------
  |  Branch (89:13): [True: 44, False: 0]
  ------------------
   90|     44|            printed_len = BIO_vsnprintf(buf, buf_size, fmt, args);
   91|     44|        }
   92|     44|        if (printed_len < 0)
  ------------------
  |  Branch (92:13): [True: 0, False: 44]
  ------------------
   93|      0|            printed_len = 0;
   94|     44|        if (buf != NULL)
  ------------------
  |  Branch (94:13): [True: 44, False: 0]
  ------------------
   95|     44|            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|     44|        if ((rbuf = OPENSSL_realloc(buf, printed_len + 1)) != NULL) {
  ------------------
  |  |  109|     44|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     44|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     44|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (103:13): [True: 44, False: 0]
  ------------------
  104|     44|            buf = rbuf;
  105|     44|            buf_size = printed_len + 1;
  106|     44|            buf[printed_len] = '\0';
  107|     44|        }
  108|       |
  109|     44|        if (buf != NULL)
  ------------------
  |  Branch (109:13): [True: 44, False: 0]
  ------------------
  110|     44|            flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   48|     44|# define ERR_TXT_MALLOCED        0x01
  ------------------
                          flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   49|     44|# define ERR_TXT_STRING          0x02
  ------------------
  111|     44|    }
  112|       |
  113|    892|    err_clear_data(es, es->top, 0);
  114|    892|    err_set_error(es, es->top, lib, reason);
  115|    892|    if (fmt != NULL)
  ------------------
  |  Branch (115:9): [True: 44, False: 848]
  ------------------
  116|     44|        err_set_data(es, es->top, buf, buf_size, flags);
  117|    892|}

err.c:err_clear:
   85|     16|{
   86|     16|    err_clear_data(es, i, (deall));
   87|     16|    es->err_marks[i] = 0;
   88|     16|    es->err_flags[i] = 0;
   89|     16|    es->err_buffer[i] = 0;
   90|     16|    es->err_line[i] = -1;
   91|     16|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|     16|    es->err_file[i] = NULL;
   93|     16|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|     16|    es->err_func[i] = NULL;
   95|     16|}
err.c:err_clear_data:
   22|     16|{
   23|     16|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|     16|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 15, False: 1]
  ------------------
   24|     15|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 15, False: 0]
  ------------------
   25|     15|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  115|     15|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     15|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     15|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|     15|            es->err_data[i] = NULL;
   27|     15|            es->err_data_size[i] = 0;
   28|     15|            es->err_data_flags[i] = 0;
   29|     15|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 0, False: 0]
  ------------------
   30|      0|            es->err_data[i][0] = '\0';
   31|      0|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|      0|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|      0|        }
   33|     15|    } else {
   34|      1|        es->err_data[i] = NULL;
   35|      1|        es->err_data_size[i] = 0;
   36|      1|        es->err_data_flags[i] = 0;
   37|      1|    }
   38|     16|}
err_blocks.c:err_get_slot:
   15|    892|{
   16|    892|    es->top = (es->top + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|    892|#  define ERR_NUM_ERRORS  16
  ------------------
   17|    892|    if (es->top == es->bottom)
  ------------------
  |  Branch (17:9): [True: 171, False: 721]
  ------------------
   18|    171|        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|    171|#  define ERR_NUM_ERRORS  16
  ------------------
   19|    892|}
err_blocks.c:err_clear:
   85|    892|{
   86|    892|    err_clear_data(es, i, (deall));
   87|    892|    es->err_marks[i] = 0;
   88|    892|    es->err_flags[i] = 0;
   89|    892|    es->err_buffer[i] = 0;
   90|    892|    es->err_line[i] = -1;
   91|    892|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|    892|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    892|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    892|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|    892|    es->err_file[i] = NULL;
   93|    892|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|    892|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    892|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    892|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|    892|    es->err_func[i] = NULL;
   95|    892|}
err_blocks.c:err_set_debug:
   52|    892|{
   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|    892|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|    892|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    892|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    892|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   58|    892|    if (file == NULL || file[0] == '\0')
  ------------------
  |  Branch (58:9): [True: 0, False: 892]
  |  Branch (58:25): [True: 0, False: 892]
  ------------------
   59|      0|        es->err_file[i] = NULL;
   60|    892|    else if ((es->err_file[i] = CRYPTO_malloc(strlen(file) + 1,
  ------------------
  |  Branch (60:14): [True: 892, False: 0]
  ------------------
   61|    892|                                              NULL, 0)) != NULL)
   62|       |        /* We cannot use OPENSSL_strdup due to possible recursion */
   63|    892|        strcpy(es->err_file[i], file);
   64|       |
   65|    892|    es->err_line[i] = line;
   66|    892|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|    892|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    892|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    892|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|    892|    if (fn == NULL || fn[0] == '\0')
  ------------------
  |  Branch (67:9): [True: 0, False: 892]
  |  Branch (67:23): [True: 0, False: 892]
  ------------------
   68|      0|        es->err_func[i] = NULL;
   69|    892|    else if ((es->err_func[i] = CRYPTO_malloc(strlen(fn) + 1,
  ------------------
  |  Branch (69:14): [True: 892, False: 0]
  ------------------
   70|    892|                                              NULL, 0)) != NULL)
   71|    892|        strcpy(es->err_func[i], fn);
   72|    892|}
err_blocks.c:err_clear_data:
   22|  1.78k|{
   23|  1.78k|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  1.78k|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 1.20k, False: 575]
  ------------------
   24|  1.20k|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 1.20k]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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|  1.20k|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 1.20k, False: 0]
  ------------------
   30|  1.20k|            es->err_data[i][0] = '\0';
   31|  1.20k|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|  1.20k|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|  1.20k|        }
   33|  1.20k|    } else {
   34|    575|        es->err_data[i] = NULL;
   35|    575|        es->err_data_size[i] = 0;
   36|    575|        es->err_data_flags[i] = 0;
   37|    575|    }
   38|  1.78k|}
err_blocks.c:err_set_error:
   42|    892|{
   43|    892|    es->err_buffer[i] =
   44|    892|        lib == ERR_LIB_SYS
  ------------------
  |  |   72|    892|# define ERR_LIB_SYS             2
  ------------------
  |  Branch (44:9): [True: 1, False: 891]
  ------------------
   45|    892|        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
  ------------------
  |  |  218|      1|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  ------------------
   46|    892|        : ERR_PACK(lib, 0, reason);
  ------------------
  |  |  279|  1.78k|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|    891|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|    891|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|  1.78k|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|    891|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
   47|    892|}
err_blocks.c:err_set_data:
   76|     44|{
   77|     44|    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
  ------------------
  |  |   48|     44|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (77:9): [True: 0, False: 44]
  ------------------
   78|      0|        OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|     44|    es->err_data[i] = data;
   80|     44|    es->err_data_size[i] = datasz;
   81|     44|    es->err_data_flags[i] = flags;
   82|     44|}
err_mark.c:err_clear:
   85|    707|{
   86|    707|    err_clear_data(es, i, (deall));
   87|    707|    es->err_marks[i] = 0;
   88|    707|    es->err_flags[i] = 0;
   89|    707|    es->err_buffer[i] = 0;
   90|    707|    es->err_line[i] = -1;
   91|    707|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|    707|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    707|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    707|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|    707|    es->err_file[i] = NULL;
   93|    707|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|    707|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    707|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    707|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|    707|    es->err_func[i] = NULL;
   95|    707|}
err_mark.c:err_clear_data:
   22|    707|{
   23|    707|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|    707|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 497, False: 210]
  ------------------
   24|    497|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 497]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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|    497|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 497, False: 0]
  ------------------
   30|    497|            es->err_data[i][0] = '\0';
   31|    497|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|    497|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|    497|        }
   33|    497|    } else {
   34|    210|        es->err_data[i] = NULL;
   35|    210|        es->err_data_size[i] = 0;
   36|    210|        es->err_data_flags[i] = 0;
   37|    210|    }
   38|    707|}

ERR_set_mark:
   16|    770|{
   17|    770|    ERR_STATE *es;
   18|       |
   19|    770|    es = ossl_err_get_state_int();
   20|    770|    if (es == NULL)
  ------------------
  |  Branch (20:9): [True: 0, False: 770]
  ------------------
   21|      0|        return 0;
   22|       |
   23|    770|    if (es->bottom == es->top)
  ------------------
  |  Branch (23:9): [True: 15, False: 755]
  ------------------
   24|     15|        return 0;
   25|    755|    es->err_marks[es->top]++;
   26|    755|    return 1;
   27|    770|}
ERR_pop_to_mark:
   43|    686|{
   44|    686|    ERR_STATE *es;
   45|       |
   46|    686|    es = ossl_err_get_state_int();
   47|    686|    if (es == NULL)
  ------------------
  |  Branch (47:9): [True: 0, False: 686]
  ------------------
   48|      0|        return 0;
   49|       |
   50|  1.39k|    while (es->bottom != es->top
  ------------------
  |  Branch (50:12): [True: 1.38k, False: 11]
  ------------------
   51|  1.39k|           && es->err_marks[es->top] == 0) {
  ------------------
  |  Branch (51:15): [True: 707, False: 675]
  ------------------
   52|    707|        err_clear(es, es->top, 0);
   53|    707|        es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1;
  ------------------
  |  |   55|     50|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (53:19): [True: 657, False: 50]
  ------------------
   54|    707|    }
   55|       |
   56|    686|    if (es->bottom == es->top)
  ------------------
  |  Branch (56:9): [True: 11, False: 675]
  ------------------
   57|     11|        return 0;
   58|    675|    es->err_marks[es->top]--;
   59|    675|    return 1;
   60|    686|}
ERR_clear_last_mark:
   82|     84|{
   83|     84|    ERR_STATE *es;
   84|     84|    int top;
   85|       |
   86|     84|    es = ossl_err_get_state_int();
   87|     84|    if (es == NULL)
  ------------------
  |  Branch (87:9): [True: 0, False: 84]
  ------------------
   88|      0|        return 0;
   89|       |
   90|     84|    top = es->top;
   91|     84|    while (es->bottom != top
  ------------------
  |  Branch (91:12): [True: 80, False: 4]
  ------------------
   92|     84|           && es->err_marks[top] == 0) {
  ------------------
  |  Branch (92:15): [True: 0, False: 80]
  ------------------
   93|      0|        top = top > 0 ? top - 1 : ERR_NUM_ERRORS - 1;
  ------------------
  |  |   55|      0|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (93:15): [True: 0, False: 0]
  ------------------
   94|      0|    }
   95|       |
   96|     84|    if (es->bottom == top)
  ------------------
  |  Branch (96:9): [True: 4, False: 80]
  ------------------
   97|      4|        return 0;
   98|     80|    es->err_marks[top]--;
   99|     80|    return 1;
  100|     84|}

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

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

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

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

evp_md_ctx_clear_digest:
   45|    298|{
   46|    298|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (46:9): [True: 258, False: 40]
  ------------------
   47|    258|        if (ctx->digest != NULL && ctx->digest->freectx != NULL)
  ------------------
  |  Branch (47:13): [True: 258, False: 0]
  |  Branch (47:36): [True: 258, False: 0]
  ------------------
   48|    258|            ctx->digest->freectx(ctx->algctx);
   49|    258|        ctx->algctx = NULL;
   50|    258|        EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  222|    258|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
   51|    258|    }
   52|       |
   53|       |    /* Code below to be removed when legacy support is dropped. */
   54|       |
   55|       |    /*
   56|       |     * Don't assume ctx->md_data was cleaned in EVP_Digest_Final, because
   57|       |     * sometimes only copies of the context are ever finalised.
   58|       |     */
   59|    298|    cleanup_old_md_data(ctx, force);
   60|    298|    if (force)
  ------------------
  |  Branch (60:9): [True: 0, False: 298]
  ------------------
   61|      0|        ctx->digest = NULL;
   62|       |
   63|    298|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE)
   64|    298|    ENGINE_finish(ctx->engine);
   65|    298|    ctx->engine = NULL;
   66|    298|#endif
   67|       |
   68|       |    /* Non legacy code, this has to be later than the ctx->digest cleaning */
   69|    298|    if (!keep_fetched) {
  ------------------
  |  Branch (69:9): [True: 298, False: 0]
  ------------------
   70|    298|        EVP_MD_free(ctx->fetched_digest);
   71|    298|        ctx->fetched_digest = NULL;
   72|    298|        ctx->reqdigest = NULL;
   73|    298|    }
   74|    298|}
EVP_MD_CTX_reset:
   99|    298|{
  100|    298|    return evp_md_ctx_reset_ex(ctx, 0);
  101|    298|}
EVP_MD_CTX_new:
  130|    298|{
  131|    298|    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  ------------------
  |  |  104|    298|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    298|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    298|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  132|    298|}
EVP_MD_CTX_free:
  135|    298|{
  136|    298|    if (ctx == NULL)
  ------------------
  |  Branch (136:9): [True: 0, False: 298]
  ------------------
  137|      0|        return;
  138|       |
  139|    298|    EVP_MD_CTX_reset(ctx);
  140|    298|    OPENSSL_free(ctx);
  ------------------
  |  |  115|    298|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    298|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    298|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  141|    298|}
evp_md_ctx_free_algctx:
  144|    894|{
  145|    894|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (145:9): [True: 636, False: 258]
  ------------------
  146|    636|        if (!ossl_assert(ctx->digest != NULL)) {
  ------------------
  |  |   52|    636|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    636|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (146:13): [True: 0, False: 636]
  ------------------
  147|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      0|            return 0;
  149|      0|        }
  150|    636|        if (ctx->digest->freectx != NULL)
  ------------------
  |  Branch (150:13): [True: 636, False: 0]
  ------------------
  151|    636|            ctx->digest->freectx(ctx->algctx);
  152|    636|        ctx->algctx = NULL;
  153|    636|    }
  154|    894|    return 1;
  155|    894|}
EVP_DigestInit_ex:
  381|  3.46k|{
  382|  3.46k|    return evp_md_init_internal(ctx, type, NULL, impl);
  383|  3.46k|}
EVP_DigestUpdate:
  386|  3.99k|{
  387|  3.99k|    if (count == 0)
  ------------------
  |  Branch (387:9): [True: 0, False: 3.99k]
  ------------------
  388|      0|        return 1;
  389|       |
  390|  3.99k|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|  3.99k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (390:9): [True: 0, False: 3.99k]
  ------------------
  391|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  392|      0|        return 0;
  393|      0|    }
  394|       |
  395|  3.99k|    if (ctx->pctx != NULL
  ------------------
  |  Branch (395:9): [True: 0, False: 3.99k]
  ------------------
  396|  3.99k|            && EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  741|  3.99k|    (((ctx)->operation & EVP_PKEY_OP_TYPE_SIG) != 0)
  |  |  ------------------
  |  |  |  | 1764|      0|    (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1748|      0|# define EVP_PKEY_OP_SIGN                (1 << 4)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1758|      0|# define EVP_PKEY_OP_SIGNMSG             (1 << 14)
  |  |  |  |  ------------------
  |  |  |  | 1765|      0|     | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1749|      0|# define EVP_PKEY_OP_VERIFY              (1 << 5)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1759|      0|# define EVP_PKEY_OP_VERIFYMSG           (1 << 15)
  |  |  |  |  ------------------
  |  |  |  | 1766|      0|     | EVP_PKEY_OP_VERIFYRECOVER                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1750|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1 << 6)
  |  |  |  |  ------------------
  |  |  |  | 1767|      0|     | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (741:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  397|  3.99k|            && ctx->pctx->op.sig.algctx != NULL) {
  ------------------
  |  Branch (397:16): [True: 0, False: 0]
  ------------------
  398|      0|#ifndef FIPS_MODULE
  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)
  ------------------
  |  | 1751|      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)
  ------------------
  |  | 1752|      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|#endif
  412|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  413|      0|        return 0;
  414|      0|    }
  415|       |
  416|  3.99k|    if (ctx->digest == NULL
  ------------------
  |  Branch (416:9): [True: 0, False: 3.99k]
  ------------------
  417|  3.99k|            || ctx->digest->prov == NULL
  ------------------
  |  Branch (417:16): [True: 0, False: 3.99k]
  ------------------
  418|  3.99k|            || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0)
  ------------------
  |  |  244|  3.99k|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (418:16): [True: 0, False: 3.99k]
  ------------------
  419|      0|        goto legacy;
  420|       |
  421|  3.99k|    if (ctx->digest->dupdate == NULL) {
  ------------------
  |  Branch (421:9): [True: 0, False: 3.99k]
  ------------------
  422|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  423|      0|        return 0;
  424|      0|    }
  425|  3.99k|    return ctx->digest->dupdate(ctx->algctx, data, count);
  426|       |
  427|       |    /* Code below to be removed when legacy support is dropped. */
  428|      0| legacy:
  429|      0|    return ctx->update != NULL ? ctx->update(ctx, data, count) : 0;
  ------------------
  |  Branch (429:12): [True: 0, False: 0]
  ------------------
  430|  3.99k|}
EVP_DigestFinal_ex:
  443|    424|{
  444|    424|    int ret, sz;
  445|    424|    size_t size = 0;
  446|    424|    size_t mdsize = 0;
  447|       |
  448|    424|    if (ctx->digest == NULL)
  ------------------
  |  Branch (448:9): [True: 0, False: 424]
  ------------------
  449|      0|        return 0;
  450|       |
  451|    424|    sz = EVP_MD_CTX_get_size(ctx);
  ------------------
  |  |  594|    424|# define EVP_MD_CTX_get_size(e)        EVP_MD_CTX_get_size_ex(e)
  ------------------
  452|    424|    if (sz < 0)
  ------------------
  |  Branch (452:9): [True: 0, False: 424]
  ------------------
  453|      0|        return 0;
  454|    424|    mdsize = sz;
  455|    424|    if (ctx->digest->prov == NULL)
  ------------------
  |  Branch (455:9): [True: 0, False: 424]
  ------------------
  456|      0|        goto legacy;
  457|       |
  458|    424|    if (ctx->digest->dfinal == NULL) {
  ------------------
  |  Branch (458:9): [True: 0, False: 424]
  ------------------
  459|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  460|      0|        return 0;
  461|      0|    }
  462|       |
  463|    424|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|    424|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (463:9): [True: 0, False: 424]
  ------------------
  464|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  465|      0|        return 0;
  466|      0|    }
  467|       |
  468|    424|    ret = ctx->digest->dfinal(ctx->algctx, md, &size, mdsize);
  469|       |
  470|    424|    ctx->flags |= EVP_MD_CTX_FLAG_FINALISED;
  ------------------
  |  |   33|    424|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  471|       |
  472|    424|    if (isize != NULL) {
  ------------------
  |  Branch (472:9): [True: 424, False: 0]
  ------------------
  473|    424|        if (size <= UINT_MAX) {
  ------------------
  |  Branch (473:13): [True: 424, False: 0]
  ------------------
  474|    424|            *isize = (unsigned int)size;
  475|    424|        } else {
  476|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  477|      0|            ret = 0;
  478|      0|        }
  479|    424|    }
  480|       |
  481|    424|    return ret;
  482|       |
  483|       |    /* Code below to be removed when legacy support is dropped. */
  484|      0| legacy:
  485|      0|    OPENSSL_assert(mdsize <= EVP_MAX_MD_SIZE);
  ------------------
  |  |  438|      0|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  486|      0|    ret = ctx->digest->final(ctx, md);
  487|      0|    if (isize != NULL)
  ------------------
  |  Branch (487:9): [True: 0, False: 0]
  ------------------
  488|      0|        *isize = mdsize;
  489|      0|    if (ctx->digest->cleanup) {
  ------------------
  |  Branch (489:9): [True: 0, False: 0]
  ------------------
  490|      0|        ctx->digest->cleanup(ctx);
  491|      0|        EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  222|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  492|      0|    }
  493|      0|    OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
  494|      0|    return ret;
  495|    424|}
EVP_DigestFinalXOF:
  499|  1.56k|{
  500|  1.56k|    int ret = 0;
  501|  1.56k|    OSSL_PARAM params[2];
  502|  1.56k|    size_t i = 0;
  503|       |
  504|  1.56k|    if (ctx->digest == NULL) {
  ------------------
  |  Branch (504:9): [True: 0, False: 1.56k]
  ------------------
  505|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  506|      0|        return 0;
  507|      0|    }
  508|       |
  509|  1.56k|    if (ctx->digest->prov == NULL)
  ------------------
  |  Branch (509:9): [True: 0, False: 1.56k]
  ------------------
  510|      0|        goto legacy;
  511|       |
  512|  1.56k|    if (ctx->digest->dfinal == NULL) {
  ------------------
  |  Branch (512:9): [True: 0, False: 1.56k]
  ------------------
  513|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  514|      0|        return 0;
  515|      0|    }
  516|       |
  517|  1.56k|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|  1.56k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (517:9): [True: 0, False: 1.56k]
  ------------------
  518|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  519|      0|        return 0;
  520|      0|    }
  521|       |
  522|       |    /*
  523|       |     * For backward compatibility we pass the XOFLEN via a param here so that
  524|       |     * older providers can use the supplied value. Ideally we should have just
  525|       |     * used the size passed into ctx->digest->dfinal().
  526|       |     */
  527|  1.56k|    params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &size);
  ------------------
  |  |  226|  1.56k|# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
  ------------------
  528|  1.56k|    params[i++] = OSSL_PARAM_construct_end();
  529|       |
  530|  1.56k|    if (EVP_MD_CTX_set_params(ctx, params) >= 0)
  ------------------
  |  Branch (530:9): [True: 1.56k, False: 0]
  ------------------
  531|  1.56k|        ret = ctx->digest->dfinal(ctx->algctx, md, &size, size);
  532|       |
  533|  1.56k|    ctx->flags |= EVP_MD_CTX_FLAG_FINALISED;
  ------------------
  |  |   33|  1.56k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  534|       |
  535|  1.56k|    return ret;
  536|       |
  537|      0|legacy:
  538|      0|    if (EVP_MD_xof(ctx->digest)
  ------------------
  |  Branch (538:9): [True: 0, False: 0]
  ------------------
  539|      0|        && size <= INT_MAX
  ------------------
  |  Branch (539:12): [True: 0, False: 0]
  ------------------
  540|      0|        && ctx->digest->md_ctrl(ctx, EVP_MD_CTRL_XOF_LEN, (int)size, NULL)) {
  ------------------
  |  |  209|      0|#  define EVP_MD_CTRL_XOF_LEN                     0x3
  ------------------
  |  Branch (540:12): [True: 0, False: 0]
  ------------------
  541|      0|        ret = ctx->digest->final(ctx, md);
  542|      0|        if (ctx->digest->cleanup != NULL) {
  ------------------
  |  Branch (542:13): [True: 0, False: 0]
  ------------------
  543|      0|            ctx->digest->cleanup(ctx);
  544|      0|            EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  222|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  545|      0|        }
  546|      0|        OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
  547|      0|    } else {
  548|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  549|      0|    }
  550|       |
  551|      0|    return ret;
  552|  1.56k|}
EVP_DigestSqueeze:
  556|  4.44k|{
  557|  4.44k|    if (ctx->digest == NULL) {
  ------------------
  |  Branch (557:9): [True: 0, False: 4.44k]
  ------------------
  558|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  559|      0|        return 0;
  560|      0|    }
  561|       |
  562|  4.44k|    if (ctx->digest->prov == NULL) {
  ------------------
  |  Branch (562:9): [True: 0, False: 4.44k]
  ------------------
  563|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  564|      0|        return 0;
  565|      0|    }
  566|       |
  567|  4.44k|    if (ctx->digest->dsqueeze == NULL) {
  ------------------
  |  Branch (567:9): [True: 0, False: 4.44k]
  ------------------
  568|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  569|      0|        return 0;
  570|      0|    }
  571|       |
  572|  4.44k|    return ctx->digest->dsqueeze(ctx->algctx, md, &size, size);
  573|  4.44k|}
EVP_MD_CTX_set_params:
  777|  1.56k|{
  778|  1.56k|    EVP_PKEY_CTX *pctx = ctx->pctx;
  779|       |
  780|       |    /* If we have a pctx then we should try that first */
  781|  1.56k|    if (pctx != NULL
  ------------------
  |  Branch (781:9): [True: 0, False: 1.56k]
  ------------------
  782|  1.56k|            && (pctx->operation == EVP_PKEY_OP_VERIFYCTX
  ------------------
  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  ------------------
  |  Branch (782:17): [True: 0, False: 0]
  ------------------
  783|      0|                || pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  ------------------
  |  Branch (783:20): [True: 0, False: 0]
  ------------------
  784|  1.56k|            && pctx->op.sig.algctx != NULL
  ------------------
  |  Branch (784:16): [True: 0, False: 0]
  ------------------
  785|  1.56k|            && pctx->op.sig.signature->set_ctx_md_params != NULL)
  ------------------
  |  Branch (785:16): [True: 0, False: 0]
  ------------------
  786|      0|        return pctx->op.sig.signature->set_ctx_md_params(pctx->op.sig.algctx,
  787|      0|                                                         params);
  788|       |
  789|  1.56k|    if (ctx->digest != NULL && ctx->digest->set_ctx_params != NULL)
  ------------------
  |  Branch (789:9): [True: 1.56k, False: 0]
  |  Branch (789:32): [True: 1.56k, False: 0]
  ------------------
  790|  1.56k|        return ctx->digest->set_ctx_params(ctx->algctx, params);
  791|       |
  792|      0|    return 0;
  793|  1.56k|}
EVP_MD_CTX_gettable_params:
  863|    424|{
  864|    424|    EVP_PKEY_CTX *pctx;
  865|    424|    void *provctx;
  866|       |
  867|    424|    if (ctx == NULL)
  ------------------
  |  Branch (867:9): [True: 0, False: 424]
  ------------------
  868|      0|        return NULL;
  869|       |
  870|       |    /* If we have a pctx then we should try that first */
  871|    424|    pctx = ctx->pctx;
  872|    424|    if (pctx != NULL
  ------------------
  |  Branch (872:9): [True: 0, False: 424]
  ------------------
  873|    424|            && (pctx->operation == EVP_PKEY_OP_VERIFYCTX
  ------------------
  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  ------------------
  |  Branch (873:17): [True: 0, False: 0]
  ------------------
  874|      0|                || pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  ------------------
  |  Branch (874:20): [True: 0, False: 0]
  ------------------
  875|    424|            && pctx->op.sig.algctx != NULL
  ------------------
  |  Branch (875:16): [True: 0, False: 0]
  ------------------
  876|    424|            && pctx->op.sig.signature->gettable_ctx_md_params != NULL)
  ------------------
  |  Branch (876:16): [True: 0, False: 0]
  ------------------
  877|      0|        return pctx->op.sig.signature->gettable_ctx_md_params(
  878|      0|                    pctx->op.sig.algctx);
  879|       |
  880|    424|    if (ctx->digest != NULL && ctx->digest->gettable_ctx_params != NULL) {
  ------------------
  |  Branch (880:9): [True: 424, False: 0]
  |  Branch (880:32): [True: 0, False: 424]
  ------------------
  881|      0|        provctx = ossl_provider_ctx(EVP_MD_get0_provider(ctx->digest));
  882|      0|        return ctx->digest->gettable_ctx_params(ctx->algctx, provctx);
  883|      0|    }
  884|    424|    return NULL;
  885|    424|}
evp_md_new:
  942|     27|{
  943|     27|    EVP_MD *md = OPENSSL_zalloc(sizeof(*md));
  ------------------
  |  |  104|     27|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  944|       |
  945|     27|    if (md != NULL && !CRYPTO_NEW_REF(&md->refcnt, 1)) {
  ------------------
  |  Branch (945:9): [True: 27, False: 0]
  |  Branch (945:23): [True: 0, False: 27]
  ------------------
  946|      0|        OPENSSL_free(md);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  947|      0|        return NULL;
  948|      0|    }
  949|     27|    return md;
  950|     27|}
EVP_MD_fetch:
 1164|    976|{
 1165|    976|    EVP_MD *md =
 1166|    976|        evp_generic_fetch(ctx, OSSL_OP_DIGEST, algorithm, properties,
  ------------------
  |  |  310|    976|# define OSSL_OP_DIGEST                              1
  ------------------
 1167|    976|                          evp_md_from_algorithm, evp_md_up_ref, evp_md_free);
 1168|       |
 1169|    976|    return md;
 1170|    976|}
EVP_MD_up_ref:
 1173|  1.90k|{
 1174|  1.90k|    int ref = 0;
 1175|       |
 1176|  1.90k|    if (md->origin == EVP_ORIG_DYNAMIC)
  ------------------
  |  |  252|  1.90k|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (1176:9): [True: 1.90k, False: 0]
  ------------------
 1177|  1.90k|        CRYPTO_UP_REF(&md->refcnt, &ref);
 1178|  1.90k|    return 1;
 1179|  1.90k|}
EVP_MD_free:
 1182|  2.22k|{
 1183|  2.22k|    int i;
 1184|       |
 1185|  2.22k|    if (md == NULL || md->origin != EVP_ORIG_DYNAMIC)
  ------------------
  |  |  252|  1.92k|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (1185:9): [True: 298, False: 1.92k]
  |  Branch (1185:23): [True: 0, False: 1.92k]
  ------------------
 1186|    298|        return;
 1187|       |
 1188|  1.92k|    CRYPTO_DOWN_REF(&md->refcnt, &i);
 1189|  1.92k|    if (i > 0)
  ------------------
  |  Branch (1189:9): [True: 1.90k, False: 27]
  ------------------
 1190|  1.90k|        return;
 1191|     27|    evp_md_free_int(md);
 1192|     27|}
digest.c:cleanup_old_md_data:
   30|  3.76k|{
   31|  3.76k|    if (ctx->digest != NULL) {
  ------------------
  |  Branch (31:9): [True: 3.46k, False: 298]
  ------------------
   32|  3.46k|        if (ctx->digest->cleanup != NULL
  ------------------
  |  Branch (32:13): [True: 0, False: 3.46k]
  ------------------
   33|  3.46k|                && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED))
  ------------------
  |  |  222|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  |  Branch (33:20): [True: 0, False: 0]
  ------------------
   34|      0|            ctx->digest->cleanup(ctx);
   35|  3.46k|        if (ctx->md_data != NULL && ctx->digest->ctx_size > 0
  ------------------
  |  Branch (35:13): [True: 0, False: 3.46k]
  |  Branch (35:37): [True: 0, False: 0]
  ------------------
   36|  3.46k|                && (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)
  ------------------
  |  |  224|      0|# define EVP_MD_CTX_FLAG_REUSE           0x0004/* Don't free up ctx->md_data
  ------------------
  |  Branch (36:21): [True: 0, False: 0]
  ------------------
   37|      0|                    || force)) {
  ------------------
  |  Branch (37:24): [True: 0, False: 0]
  ------------------
   38|      0|            OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
  ------------------
  |  |  113|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|      0|            ctx->md_data = NULL;
   40|      0|        }
   41|  3.46k|    }
   42|  3.76k|}
digest.c:evp_md_ctx_reset_ex:
   77|    298|{
   78|    298|    if (ctx == NULL)
  ------------------
  |  Branch (78:9): [True: 0, False: 298]
  ------------------
   79|      0|        return 1;
   80|       |
   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|    298|    if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX)) {
  ------------------
  |  |   32|    298|#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX   0x0400
  ------------------
  |  Branch (85:9): [True: 298, False: 0]
  ------------------
   86|    298|        EVP_PKEY_CTX_free(ctx->pctx);
   87|    298|        ctx->pctx = NULL;
   88|    298|    }
   89|       |
   90|    298|    evp_md_ctx_clear_digest(ctx, 0, keep_fetched);
   91|    298|    if (!keep_fetched)
  ------------------
  |  Branch (91:9): [True: 298, False: 0]
  ------------------
   92|    298|        OPENSSL_cleanse(ctx, sizeof(*ctx));
   93|       |
   94|    298|    return 1;
   95|    298|}
digest.c:evp_md_init_internal:
  159|  3.46k|{
  160|  3.46k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  161|  3.46k|    ENGINE *tmpimpl = NULL;
  162|  3.46k|#endif
  163|       |
  164|  3.46k|#if !defined(FIPS_MODULE)
  165|  3.46k|    if (ctx->pctx != NULL
  ------------------
  |  Branch (165:9): [True: 0, False: 3.46k]
  ------------------
  166|  3.46k|            && EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  741|  3.46k|    (((ctx)->operation & EVP_PKEY_OP_TYPE_SIG) != 0)
  |  |  ------------------
  |  |  |  | 1764|      0|    (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1748|      0|# define EVP_PKEY_OP_SIGN                (1 << 4)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1758|      0|# define EVP_PKEY_OP_SIGNMSG             (1 << 14)
  |  |  |  |  ------------------
  |  |  |  | 1765|      0|     | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1749|      0|# define EVP_PKEY_OP_VERIFY              (1 << 5)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1759|      0|# define EVP_PKEY_OP_VERIFYMSG           (1 << 15)
  |  |  |  |  ------------------
  |  |  |  | 1766|      0|     | EVP_PKEY_OP_VERIFYRECOVER                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1750|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1 << 6)
  |  |  |  |  ------------------
  |  |  |  | 1767|      0|     | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (741:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  167|  3.46k|            && ctx->pctx->op.sig.algctx != NULL) {
  ------------------
  |  Branch (167:16): [True: 0, False: 0]
  ------------------
  168|       |        /*
  169|       |         * Prior to OpenSSL 3.0 calling EVP_DigestInit_ex() on an mdctx
  170|       |         * previously initialised with EVP_DigestSignInit() would retain
  171|       |         * information about the key, and re-initialise for another sign
  172|       |         * operation. So in that case we redirect to EVP_DigestSignInit()
  173|       |         */
  174|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  ------------------
  |  Branch (174:13): [True: 0, False: 0]
  ------------------
  175|      0|            return EVP_DigestSignInit(ctx, NULL, type, impl, NULL);
  176|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_VERIFYCTX)
  ------------------
  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  ------------------
  |  Branch (176:13): [True: 0, False: 0]
  ------------------
  177|      0|            return EVP_DigestVerifyInit(ctx, NULL, type, impl, NULL);
  178|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  179|      0|        return 0;
  180|      0|    }
  181|  3.46k|#endif
  182|       |
  183|  3.46k|    EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED
  ------------------
  |  |  222|  3.46k|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  184|  3.46k|                                | EVP_MD_CTX_FLAG_FINALISED);
  ------------------
  |  |   33|  3.46k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  185|       |
  186|  3.46k|    if (type != NULL) {
  ------------------
  |  Branch (186:9): [True: 3.46k, False: 0]
  ------------------
  187|  3.46k|        ctx->reqdigest = type;
  188|  3.46k|    } else {
  189|      0|        if (ctx->digest == NULL) {
  ------------------
  |  Branch (189:13): [True: 0, False: 0]
  ------------------
  190|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  191|      0|            return 0;
  192|      0|        }
  193|      0|        type = ctx->digest;
  194|      0|    }
  195|       |
  196|       |    /* Code below to be removed when legacy support is dropped. */
  197|  3.46k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  198|       |    /*
  199|       |     * Whether it's nice or not, "Inits" can be used on "Final"'d contexts so
  200|       |     * this context may already have an ENGINE! Try to avoid releasing the
  201|       |     * previous handle, re-querying for an ENGINE, and having a
  202|       |     * reinitialisation, when it may all be unnecessary.
  203|       |     */
  204|  3.46k|    if (ctx->engine != NULL
  ------------------
  |  Branch (204:9): [True: 0, False: 3.46k]
  ------------------
  205|  3.46k|            && ctx->digest != NULL
  ------------------
  |  Branch (205:16): [True: 0, False: 0]
  ------------------
  206|  3.46k|            && type->type == ctx->digest->type)
  ------------------
  |  Branch (206:16): [True: 0, False: 0]
  ------------------
  207|      0|        goto skip_to_init;
  208|       |
  209|       |    /*
  210|       |     * Ensure an ENGINE left lying around from last time is cleared (the
  211|       |     * previous check attempted to avoid this if the same ENGINE and
  212|       |     * EVP_MD could be used).
  213|       |     */
  214|  3.46k|    ENGINE_finish(ctx->engine);
  215|  3.46k|    ctx->engine = NULL;
  216|       |
  217|  3.46k|    if (impl == NULL)
  ------------------
  |  Branch (217:9): [True: 3.46k, False: 0]
  ------------------
  218|  3.46k|        tmpimpl = ENGINE_get_digest_engine(type->type);
  219|  3.46k|#endif
  220|       |
  221|       |    /*
  222|       |     * If there are engines involved or EVP_MD_CTX_FLAG_NO_INIT is set then we
  223|       |     * should use legacy handling for now.
  224|       |     */
  225|  3.46k|    if (impl != NULL
  ------------------
  |  Branch (225:9): [True: 0, False: 3.46k]
  ------------------
  226|  3.46k|#if !defined(OPENSSL_NO_ENGINE)
  227|  3.46k|            || ctx->engine != NULL
  ------------------
  |  Branch (227:16): [True: 0, False: 3.46k]
  ------------------
  228|  3.46k|# if !defined(FIPS_MODULE)
  229|  3.46k|            || tmpimpl != NULL
  ------------------
  |  Branch (229:16): [True: 0, False: 3.46k]
  ------------------
  230|  3.46k|# endif
  231|  3.46k|#endif
  232|  3.46k|            || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0
  ------------------
  |  |  244|  3.46k|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (232:16): [True: 0, False: 3.46k]
  ------------------
  233|  3.46k|            || (type != NULL && type->origin == EVP_ORIG_METH)
  ------------------
  |  |  254|  3.46k|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (233:17): [True: 3.46k, False: 0]
  |  Branch (233:33): [True: 0, False: 3.46k]
  ------------------
  234|  3.46k|            || (type == NULL && ctx->digest != NULL
  ------------------
  |  Branch (234:17): [True: 0, False: 3.46k]
  |  Branch (234:33): [True: 0, False: 0]
  ------------------
  235|  3.46k|                             && ctx->digest->origin == EVP_ORIG_METH)) {
  ------------------
  |  |  254|      0|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (235:33): [True: 0, False: 0]
  ------------------
  236|       |        /* If we were using provided hash before, cleanup algctx */
  237|      0|        if (!evp_md_ctx_free_algctx(ctx))
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            return 0;
  239|      0|        if (ctx->digest == ctx->fetched_digest)
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|      0|            ctx->digest = NULL;
  241|      0|        EVP_MD_free(ctx->fetched_digest);
  242|      0|        ctx->fetched_digest = NULL;
  243|      0|        goto legacy;
  244|      0|    }
  245|       |
  246|  3.46k|    cleanup_old_md_data(ctx, 1);
  247|       |
  248|       |    /* Start of non-legacy code below */
  249|  3.46k|    if (ctx->digest == type) {
  ------------------
  |  Branch (249:9): [True: 2.57k, False: 894]
  ------------------
  250|  2.57k|        if (!ossl_assert(type->prov != NULL)) {
  ------------------
  |  |   52|  2.57k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  2.57k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (250:13): [True: 0, False: 2.57k]
  ------------------
  251|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  252|      0|            return 0;
  253|      0|        }
  254|  2.57k|    } else {
  255|    894|        if (!evp_md_ctx_free_algctx(ctx))
  ------------------
  |  Branch (255:13): [True: 0, False: 894]
  ------------------
  256|      0|            return 0;
  257|    894|    }
  258|       |
  259|  3.46k|    if (type->prov == NULL) {
  ------------------
  |  Branch (259:9): [True: 0, False: 3.46k]
  ------------------
  260|       |#ifdef FIPS_MODULE
  261|       |        /* We only do explicit fetches inside the FIPS module */
  262|       |        ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  263|       |        return 0;
  264|       |#else
  265|       |        /* The NULL digest is a special case */
  266|      0|        EVP_MD *provmd = EVP_MD_fetch(NULL,
  267|      0|                                      type->type != NID_undef ? OBJ_nid2sn(type->type)
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (267:39): [True: 0, False: 0]
  ------------------
  268|      0|                                                              : "NULL", "");
  269|       |
  270|      0|        if (provmd == NULL) {
  ------------------
  |  Branch (270:13): [True: 0, False: 0]
  ------------------
  271|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|            return 0;
  273|      0|        }
  274|      0|        type = provmd;
  275|      0|        EVP_MD_free(ctx->fetched_digest);
  276|      0|        ctx->fetched_digest = provmd;
  277|      0|#endif
  278|      0|    }
  279|       |
  280|  3.46k|    if (type->prov != NULL && ctx->fetched_digest != type) {
  ------------------
  |  Branch (280:9): [True: 3.46k, False: 0]
  |  Branch (280:31): [True: 894, False: 2.57k]
  ------------------
  281|    894|        if (!EVP_MD_up_ref((EVP_MD *)type)) {
  ------------------
  |  Branch (281:13): [True: 0, False: 894]
  ------------------
  282|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  283|      0|            return 0;
  284|      0|        }
  285|    894|        EVP_MD_free(ctx->fetched_digest);
  286|    894|        ctx->fetched_digest = (EVP_MD *)type;
  287|    894|    }
  288|  3.46k|    ctx->digest = type;
  289|  3.46k|    if (ctx->algctx == NULL) {
  ------------------
  |  Branch (289:9): [True: 894, False: 2.57k]
  ------------------
  290|    894|        ctx->algctx = ctx->digest->newctx(ossl_provider_ctx(type->prov));
  291|    894|        if (ctx->algctx == NULL) {
  ------------------
  |  Branch (291:13): [True: 0, False: 894]
  ------------------
  292|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  293|      0|            return 0;
  294|      0|        }
  295|    894|    }
  296|       |
  297|  3.46k|    if (ctx->digest->dinit == NULL) {
  ------------------
  |  Branch (297:9): [True: 0, False: 3.46k]
  ------------------
  298|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  299|      0|        return 0;
  300|      0|    }
  301|       |
  302|  3.46k|    return ctx->digest->dinit(ctx->algctx, params);
  303|       |
  304|       |    /* Code below to be removed when legacy support is dropped. */
  305|      0| legacy:
  306|       |
  307|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  308|      0|    if (type) {
  ------------------
  |  Branch (308:9): [True: 0, False: 0]
  ------------------
  309|      0|        if (impl != NULL) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            if (!ENGINE_init(impl)) {
  ------------------
  |  Branch (310:17): [True: 0, False: 0]
  ------------------
  311|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  312|      0|                return 0;
  313|      0|            }
  314|      0|        } else {
  315|       |            /* Ask if an ENGINE is reserved for this job */
  316|      0|            impl = tmpimpl;
  317|      0|        }
  318|      0|        if (impl != NULL) {
  ------------------
  |  Branch (318:13): [True: 0, False: 0]
  ------------------
  319|       |            /* There's an ENGINE for this job ... (apparently) */
  320|      0|            const EVP_MD *d = ENGINE_get_digest(impl, type->type);
  321|       |
  322|      0|            if (d == NULL) {
  ------------------
  |  Branch (322:17): [True: 0, False: 0]
  ------------------
  323|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  324|      0|                ENGINE_finish(impl);
  325|      0|                return 0;
  326|      0|            }
  327|       |            /* We'll use the ENGINE's private digest definition */
  328|      0|            type = d;
  329|       |            /*
  330|       |             * Store the ENGINE functional reference so we know 'type' came
  331|       |             * from an ENGINE and we need to release it when done.
  332|       |             */
  333|      0|            ctx->engine = impl;
  334|      0|        } else
  335|      0|            ctx->engine = NULL;
  336|      0|    }
  337|      0|#endif
  338|      0|    if (ctx->digest != type) {
  ------------------
  |  Branch (338:9): [True: 0, False: 0]
  ------------------
  339|      0|        cleanup_old_md_data(ctx, 1);
  340|       |
  341|      0|        ctx->digest = type;
  342|      0|        if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {
  ------------------
  |  |  244|      0|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (342:13): [True: 0, False: 0]
  |  Branch (342:56): [True: 0, False: 0]
  ------------------
  343|      0|            ctx->update = type->update;
  344|      0|            ctx->md_data = OPENSSL_zalloc(type->ctx_size);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  345|      0|            if (ctx->md_data == NULL)
  ------------------
  |  Branch (345:17): [True: 0, False: 0]
  ------------------
  346|      0|                return 0;
  347|      0|        }
  348|      0|    }
  349|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  350|      0| skip_to_init:
  351|      0|#endif
  352|      0|#ifndef FIPS_MODULE
  353|      0|    if (ctx->pctx != NULL
  ------------------
  |  Branch (353:9): [True: 0, False: 0]
  ------------------
  354|      0|            && (!EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  741|      0|    (((ctx)->operation & EVP_PKEY_OP_TYPE_SIG) != 0)
  |  |  ------------------
  |  |  |  | 1764|      0|    (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1748|      0|# define EVP_PKEY_OP_SIGN                (1 << 4)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1758|      0|# define EVP_PKEY_OP_SIGNMSG             (1 << 14)
  |  |  |  |  ------------------
  |  |  |  | 1765|      0|     | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1749|      0|# define EVP_PKEY_OP_VERIFY              (1 << 5)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1759|      0|# define EVP_PKEY_OP_VERIFYMSG           (1 << 15)
  |  |  |  |  ------------------
  |  |  |  | 1766|      0|     | EVP_PKEY_OP_VERIFYRECOVER                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1750|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1 << 6)
  |  |  |  |  ------------------
  |  |  |  | 1767|      0|     | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (354:17): [True: 0, False: 0]
  ------------------
  355|      0|                 || ctx->pctx->op.sig.signature == NULL)) {
  ------------------
  |  Branch (355:21): [True: 0, False: 0]
  ------------------
  356|      0|        int r;
  357|      0|        r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
  ------------------
  |  | 1764|      0|    (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  ------------------
  |  |  |  | 1748|      0|# define EVP_PKEY_OP_SIGN                (1 << 4)
  |  |  ------------------
  |  |                   (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  ------------------
  |  |  |  | 1758|      0|# define EVP_PKEY_OP_SIGNMSG             (1 << 14)
  |  |  ------------------
  |  | 1765|      0|     | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  ------------------
  |  |  |  | 1749|      0|# define EVP_PKEY_OP_VERIFY              (1 << 5)
  |  |  ------------------
  |  |                    | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  ------------------
  |  |  |  | 1759|      0|# define EVP_PKEY_OP_VERIFYMSG           (1 << 15)
  |  |  ------------------
  |  | 1766|      0|     | EVP_PKEY_OP_VERIFYRECOVER                                        \
  |  |  ------------------
  |  |  |  | 1750|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1 << 6)
  |  |  ------------------
  |  | 1767|      0|     | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  ------------------
  |  |  |  | 1751|      0|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  |  |  ------------------
  |  |                    | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  ------------------
  |  |  |  | 1752|      0|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  |  |  ------------------
  ------------------
  358|      0|                              EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
  ------------------
  |  | 1793|      0|# define EVP_PKEY_CTRL_DIGESTINIT        7
  ------------------
  359|      0|        if (r <= 0 && (r != -2))
  ------------------
  |  Branch (359:13): [True: 0, False: 0]
  |  Branch (359:23): [True: 0, False: 0]
  ------------------
  360|      0|            return 0;
  361|      0|    }
  362|      0|#endif
  363|      0|    if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT)
  ------------------
  |  |  244|      0|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  ------------------
  364|      0|        return 1;
  365|      0|    return ctx->digest->init(ctx);
  366|      0|}
digest.c:evp_md_from_algorithm:
 1018|     27|{
 1019|     27|    const OSSL_DISPATCH *fns = algodef->implementation;
 1020|     27|    EVP_MD *md = NULL;
 1021|     27|    int fncnt = 0;
 1022|       |
 1023|       |    /* EVP_MD_fetch() will set the legacy NID if available */
 1024|     27|    if ((md = evp_md_new()) == NULL) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 27]
  ------------------
 1025|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1026|      0|        return NULL;
 1027|      0|    }
 1028|       |
 1029|     27|#ifndef FIPS_MODULE
 1030|     27|    md->type = NID_undef;
  ------------------
  |  |   18|     27|#define NID_undef                       0
  ------------------
 1031|     27|    if (!evp_names_do_all(prov, name_id, set_legacy_nid, &md->type)
  ------------------
  |  Branch (1031:9): [True: 0, False: 27]
  ------------------
 1032|     27|            || md->type == -1) {
  ------------------
  |  Branch (1032:16): [True: 0, False: 27]
  ------------------
 1033|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1034|      0|        goto err;
 1035|      0|    }
 1036|     27|#endif
 1037|       |
 1038|     27|    md->name_id = name_id;
 1039|     27|    if ((md->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL)
  ------------------
  |  Branch (1039:9): [True: 0, False: 27]
  ------------------
 1040|      0|        goto err;
 1041|       |
 1042|     27|    md->description = algodef->algorithm_description;
 1043|       |
 1044|    302|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (1044:12): [True: 275, False: 27]
  ------------------
 1045|    275|        switch (fns->function_id) {
  ------------------
  |  Branch (1045:17): [True: 0, False: 275]
  ------------------
 1046|     27|        case OSSL_FUNC_DIGEST_NEWCTX:
  ------------------
  |  |  330|     27|# define OSSL_FUNC_DIGEST_NEWCTX                     1
  ------------------
  |  Branch (1046:9): [True: 27, False: 248]
  ------------------
 1047|     27|            if (md->newctx == NULL) {
  ------------------
  |  Branch (1047:17): [True: 27, False: 0]
  ------------------
 1048|     27|                md->newctx = OSSL_FUNC_digest_newctx(fns);
 1049|     27|                fncnt++;
 1050|     27|            }
 1051|     27|            break;
 1052|     27|        case OSSL_FUNC_DIGEST_INIT:
  ------------------
  |  |  331|     27|# define OSSL_FUNC_DIGEST_INIT                       2
  ------------------
  |  Branch (1052:9): [True: 27, False: 248]
  ------------------
 1053|     27|            if (md->dinit == NULL) {
  ------------------
  |  Branch (1053:17): [True: 27, False: 0]
  ------------------
 1054|     27|                md->dinit = OSSL_FUNC_digest_init(fns);
 1055|     27|                fncnt++;
 1056|     27|            }
 1057|     27|            break;
 1058|     27|        case OSSL_FUNC_DIGEST_UPDATE:
  ------------------
  |  |  332|     27|# define OSSL_FUNC_DIGEST_UPDATE                     3
  ------------------
  |  Branch (1058:9): [True: 27, False: 248]
  ------------------
 1059|     27|            if (md->dupdate == NULL) {
  ------------------
  |  Branch (1059:17): [True: 27, False: 0]
  ------------------
 1060|     27|                md->dupdate = OSSL_FUNC_digest_update(fns);
 1061|     27|                fncnt++;
 1062|     27|            }
 1063|     27|            break;
 1064|     27|        case OSSL_FUNC_DIGEST_FINAL:
  ------------------
  |  |  333|     27|# define OSSL_FUNC_DIGEST_FINAL                      4
  ------------------
  |  Branch (1064:9): [True: 27, False: 248]
  ------------------
 1065|     27|            if (md->dfinal == NULL) {
  ------------------
  |  Branch (1065:17): [True: 27, False: 0]
  ------------------
 1066|     27|                md->dfinal = OSSL_FUNC_digest_final(fns);
 1067|     27|                fncnt++;
 1068|     27|            }
 1069|     27|            break;
 1070|      4|        case OSSL_FUNC_DIGEST_SQUEEZE:
  ------------------
  |  |  343|      4|# define OSSL_FUNC_DIGEST_SQUEEZE                   14
  ------------------
  |  Branch (1070:9): [True: 4, False: 271]
  ------------------
 1071|      4|            if (md->dsqueeze == NULL) {
  ------------------
  |  Branch (1071:17): [True: 4, False: 0]
  ------------------
 1072|      4|                md->dsqueeze = OSSL_FUNC_digest_squeeze(fns);
 1073|      4|                fncnt++;
 1074|      4|            }
 1075|      4|            break;
 1076|      0|        case OSSL_FUNC_DIGEST_DIGEST:
  ------------------
  |  |  334|      0|# define OSSL_FUNC_DIGEST_DIGEST                     5
  ------------------
  |  Branch (1076:9): [True: 0, False: 275]
  ------------------
 1077|      0|            if (md->digest == NULL)
  ------------------
  |  Branch (1077:17): [True: 0, False: 0]
  ------------------
 1078|      0|                md->digest = OSSL_FUNC_digest_digest(fns);
 1079|       |            /* We don't increment fnct for this as it is stand alone */
 1080|      0|            break;
 1081|     27|        case OSSL_FUNC_DIGEST_FREECTX:
  ------------------
  |  |  335|     27|# define OSSL_FUNC_DIGEST_FREECTX                    6
  ------------------
  |  Branch (1081:9): [True: 27, False: 248]
  ------------------
 1082|     27|            if (md->freectx == NULL) {
  ------------------
  |  Branch (1082:17): [True: 27, False: 0]
  ------------------
 1083|     27|                md->freectx = OSSL_FUNC_digest_freectx(fns);
 1084|     27|                fncnt++;
 1085|     27|            }
 1086|     27|            break;
 1087|     27|        case OSSL_FUNC_DIGEST_DUPCTX:
  ------------------
  |  |  336|     27|# define OSSL_FUNC_DIGEST_DUPCTX                     7
  ------------------
  |  Branch (1087:9): [True: 27, False: 248]
  ------------------
 1088|     27|            if (md->dupctx == NULL)
  ------------------
  |  Branch (1088:17): [True: 27, False: 0]
  ------------------
 1089|     27|                md->dupctx = OSSL_FUNC_digest_dupctx(fns);
 1090|     27|            break;
 1091|     27|        case OSSL_FUNC_DIGEST_GET_PARAMS:
  ------------------
  |  |  337|     27|# define OSSL_FUNC_DIGEST_GET_PARAMS                 8
  ------------------
  |  Branch (1091:9): [True: 27, False: 248]
  ------------------
 1092|     27|            if (md->get_params == NULL)
  ------------------
  |  Branch (1092:17): [True: 27, False: 0]
  ------------------
 1093|     27|                md->get_params = OSSL_FUNC_digest_get_params(fns);
 1094|     27|            break;
 1095|      8|        case OSSL_FUNC_DIGEST_SET_CTX_PARAMS:
  ------------------
  |  |  338|      8|# define OSSL_FUNC_DIGEST_SET_CTX_PARAMS             9
  ------------------
  |  Branch (1095:9): [True: 8, False: 267]
  ------------------
 1096|      8|            if (md->set_ctx_params == NULL)
  ------------------
  |  Branch (1096:17): [True: 8, False: 0]
  ------------------
 1097|      8|                md->set_ctx_params = OSSL_FUNC_digest_set_ctx_params(fns);
 1098|      8|            break;
 1099|      6|        case OSSL_FUNC_DIGEST_GET_CTX_PARAMS:
  ------------------
  |  |  339|      6|# define OSSL_FUNC_DIGEST_GET_CTX_PARAMS            10
  ------------------
  |  Branch (1099:9): [True: 6, False: 269]
  ------------------
 1100|      6|            if (md->get_ctx_params == NULL)
  ------------------
  |  Branch (1100:17): [True: 6, False: 0]
  ------------------
 1101|      6|                md->get_ctx_params = OSSL_FUNC_digest_get_ctx_params(fns);
 1102|      6|            break;
 1103|     27|        case OSSL_FUNC_DIGEST_GETTABLE_PARAMS:
  ------------------
  |  |  340|     27|# define OSSL_FUNC_DIGEST_GETTABLE_PARAMS           11
  ------------------
  |  Branch (1103:9): [True: 27, False: 248]
  ------------------
 1104|     27|            if (md->gettable_params == NULL)
  ------------------
  |  Branch (1104:17): [True: 27, False: 0]
  ------------------
 1105|     27|                md->gettable_params = OSSL_FUNC_digest_gettable_params(fns);
 1106|     27|            break;
 1107|      8|        case OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  341|      8|# define OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS       12
  ------------------
  |  Branch (1107:9): [True: 8, False: 267]
  ------------------
 1108|      8|            if (md->settable_ctx_params == NULL)
  ------------------
  |  Branch (1108:17): [True: 8, False: 0]
  ------------------
 1109|      8|                md->settable_ctx_params =
 1110|      8|                    OSSL_FUNC_digest_settable_ctx_params(fns);
 1111|      8|            break;
 1112|      6|        case OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  342|      6|# define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS       13
  ------------------
  |  Branch (1112:9): [True: 6, False: 269]
  ------------------
 1113|      6|            if (md->gettable_ctx_params == NULL)
  ------------------
  |  Branch (1113:17): [True: 6, False: 0]
  ------------------
 1114|      6|                md->gettable_ctx_params =
 1115|      6|                    OSSL_FUNC_digest_gettable_ctx_params(fns);
 1116|      6|            break;
 1117|     27|        case OSSL_FUNC_DIGEST_COPYCTX:
  ------------------
  |  |  344|     27|# define OSSL_FUNC_DIGEST_COPYCTX                   15
  ------------------
  |  Branch (1117:9): [True: 27, False: 248]
  ------------------
 1118|     27|            if (md->copyctx == NULL)
  ------------------
  |  Branch (1118:17): [True: 27, False: 0]
  ------------------
 1119|     27|                md->copyctx =
 1120|     27|                    OSSL_FUNC_digest_copyctx(fns);
 1121|     27|            break;
 1122|    275|        }
 1123|    275|    }
 1124|     27|    if ((fncnt != 0 && fncnt != 5 && fncnt != 6)
  ------------------
  |  Branch (1124:10): [True: 27, False: 0]
  |  Branch (1124:24): [True: 4, False: 23]
  |  Branch (1124:38): [True: 0, False: 4]
  ------------------
 1125|     27|        || (fncnt == 0 && md->digest == NULL)) {
  ------------------
  |  Branch (1125:13): [True: 0, False: 27]
  |  Branch (1125:27): [True: 0, False: 0]
  ------------------
 1126|       |        /*
 1127|       |         * In order to be a consistent set of functions we either need the
 1128|       |         * whole set of init/update/final etc functions or none of them.
 1129|       |         * The "digest" function can standalone. We at least need one way to
 1130|       |         * generate digests.
 1131|       |         */
 1132|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1133|      0|        goto err;
 1134|      0|    }
 1135|     27|    if (prov != NULL && !ossl_provider_up_ref(prov))
  ------------------
  |  Branch (1135:9): [True: 27, False: 0]
  |  Branch (1135:25): [True: 0, False: 27]
  ------------------
 1136|      0|        goto err;
 1137|       |
 1138|     27|    md->prov = prov;
 1139|       |
 1140|     27|    if (!evp_md_cache_constants(md)) {
  ------------------
  |  Branch (1140:9): [True: 0, False: 27]
  ------------------
 1141|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1142|      0|        goto err;
 1143|      0|    }
 1144|       |
 1145|     27|    return md;
 1146|       |
 1147|      0|err:
 1148|      0|    EVP_MD_free(md);
 1149|      0|    return NULL;
 1150|     27|}
digest.c:set_legacy_nid:
  959|     71|{
  960|     71|    int nid;
  961|     71|    int *legacy_nid = vlegacy_nid;
  962|       |    /*
  963|       |     * We use lowest level function to get the associated method, because
  964|       |     * higher level functions such as EVP_get_digestbyname() have changed
  965|       |     * to look at providers too.
  966|       |     */
  967|     71|    const void *legacy_method = OBJ_NAME_get(name, OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|     71|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  968|       |
  969|     71|    if (*legacy_nid == -1)       /* We found a clash already */
  ------------------
  |  Branch (969:9): [True: 0, False: 71]
  ------------------
  970|      0|        return;
  971|       |
  972|     71|    if (legacy_method == NULL)
  ------------------
  |  Branch (972:9): [True: 48, False: 23]
  ------------------
  973|     48|        return;
  974|     23|    nid = EVP_MD_nid(legacy_method);
  ------------------
  |  |  559|     23|# define EVP_MD_nid EVP_MD_get_type
  ------------------
  975|     23|    if (*legacy_nid != NID_undef && *legacy_nid != nid) {
  ------------------
  |  |   18|     46|#define NID_undef                       0
  ------------------
  |  Branch (975:9): [True: 4, False: 19]
  |  Branch (975:37): [True: 0, False: 4]
  ------------------
  976|      0|        *legacy_nid = -1;
  977|      0|        return;
  978|      0|    }
  979|     23|    *legacy_nid = nid;
  980|     23|}
digest.c:evp_md_cache_constants:
  984|     27|{
  985|     27|    int ok, xof = 0, algid_absent = 0;
  986|     27|    size_t blksz = 0;
  987|     27|    size_t mdsize = 0;
  988|     27|    OSSL_PARAM params[5];
  989|       |
  990|       |    /*
  991|       |     * Note that these parameters are 'constants' that are only set up
  992|       |     * during the EVP_MD_fetch(). For this reason the XOF functions set the
  993|       |     * md_size to 0, since the output size is unknown.
  994|       |     */
  995|     27|    params[0] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_BLOCK_SIZE, &blksz);
  ------------------
  |  |  220|     27|# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize"
  ------------------
  996|     27|    params[1] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_SIZE, &mdsize);
  ------------------
  |  |  223|     27|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
  997|     27|    params[2] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_XOF, &xof);
  ------------------
  |  |  225|     27|# define OSSL_DIGEST_PARAM_XOF "xof"
  ------------------
  998|     27|    params[3] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_ALGID_ABSENT,
  ------------------
  |  |  219|     27|# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent"
  ------------------
  999|     27|                                         &algid_absent);
 1000|     27|    params[4] = OSSL_PARAM_construct_end();
 1001|     27|    ok = evp_do_md_getparams(md, params) > 0;
 1002|     27|    if (mdsize > INT_MAX || blksz > INT_MAX)
  ------------------
  |  Branch (1002:9): [True: 0, False: 27]
  |  Branch (1002:29): [True: 0, False: 27]
  ------------------
 1003|      0|        ok = 0;
 1004|     27|    if (ok) {
  ------------------
  |  Branch (1004:9): [True: 27, False: 0]
  ------------------
 1005|     27|        md->block_size = (int)blksz;
 1006|     27|        md->md_size = (int)mdsize;
 1007|     27|        if (xof)
  ------------------
  |  Branch (1007:13): [True: 4, False: 23]
  ------------------
 1008|      4|            md->flags |= EVP_MD_FLAG_XOF;
  ------------------
  |  |  184|      4|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
 1009|     27|        if (algid_absent)
  ------------------
  |  Branch (1009:13): [True: 18, False: 9]
  ------------------
 1010|     18|            md->flags |= EVP_MD_FLAG_DIGALGID_ABSENT;
  ------------------
  |  |  196|     18|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
 1011|     27|    }
 1012|     27|    return ok;
 1013|     27|}
digest.c:evp_md_up_ref:
 1153|  1.00k|{
 1154|  1.00k|    return EVP_MD_up_ref(md);
 1155|  1.00k|}
digest.c:evp_md_free:
 1158|     58|{
 1159|     58|    EVP_MD_free(md);
 1160|     58|}

EVP_aes_128_cbc:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ecb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ofb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb128:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb1:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb8:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ctr:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cbc:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ecb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ofb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb128:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb1:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb8:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ctr:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cbc:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ecb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ofb:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb128:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb1:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb8:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ctr:
  442|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_gcm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_gcm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_gcm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_xts:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_xts:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ccm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ccm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ccm:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_wrap:
 3772|      1|{
 3773|      1|    return &aes_128_wrap;
 3774|      1|}
EVP_aes_192_wrap:
 3786|      1|{
 3787|      1|    return &aes_192_wrap;
 3788|      1|}
EVP_aes_256_wrap:
 3800|      1|{
 3801|      1|    return &aes_256_wrap;
 3802|      1|}
EVP_aes_128_wrap_pad:
 3814|      1|{
 3815|      1|    return &aes_128_wrap_pad;
 3816|      1|}
EVP_aes_192_wrap_pad:
 3828|      1|{
 3829|      1|    return &aes_192_wrap_pad;
 3830|      1|}
EVP_aes_256_wrap_pad:
 3842|      1|{
 3843|      1|    return &aes_256_wrap_pad;
 3844|      1|}
EVP_aes_128_ocb:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ocb:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ocb:
  468|      1|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      1|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  195|      1|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (195:27): [True: 1, False: 0]
  |  |  ------------------
  ------------------

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

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

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

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

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

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

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

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

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

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

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

EVP_CIPHER_CTX_reset:
   34|      9|{
   35|      9|    if (ctx == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 9]
  ------------------
   36|      0|        return 1;
   37|       |
   38|      9|    if (ctx->cipher == NULL || ctx->cipher->prov == NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 9]
  |  Branch (38:32): [True: 0, False: 9]
  ------------------
   39|      0|        goto legacy;
   40|       |
   41|      9|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (41:9): [True: 9, False: 0]
  ------------------
   42|      9|        if (ctx->cipher->freectx != NULL)
  ------------------
  |  Branch (42:13): [True: 9, False: 0]
  ------------------
   43|      9|            ctx->cipher->freectx(ctx->algctx);
   44|      9|        ctx->algctx = NULL;
   45|      9|    }
   46|      9|    if (ctx->fetched_cipher != NULL)
  ------------------
  |  Branch (46:9): [True: 9, False: 0]
  ------------------
   47|      9|        EVP_CIPHER_free(ctx->fetched_cipher);
   48|      9|    memset(ctx, 0, sizeof(*ctx));
   49|      9|    ctx->iv_len = -1;
   50|       |
   51|      9|    return 1;
   52|       |
   53|       |    /* Remove legacy code below when legacy support is removed. */
   54|      0| legacy:
   55|       |
   56|      0|    if (ctx->cipher != NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 0]
  ------------------
   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|      0|    OPENSSL_free(ctx->cipher_data);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   64|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
   65|      0|    ENGINE_finish(ctx->engine);
   66|      0|#endif
   67|      0|    memset(ctx, 0, sizeof(*ctx));
   68|      0|    ctx->iv_len = -1;
   69|      0|    return 1;
   70|      0|}
EVP_CIPHER_CTX_new:
   73|      9|{
   74|      9|    EVP_CIPHER_CTX *ctx;
   75|       |
   76|      9|    ctx = OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  ------------------
  |  |  104|      9|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|      9|    if (ctx == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 9]
  ------------------
   78|      0|        return NULL;
   79|       |
   80|      9|    ctx->iv_len = -1;
   81|      9|    return ctx;
   82|      9|}
EVP_CIPHER_CTX_free:
   85|      9|{
   86|      9|    if (ctx == NULL)
  ------------------
  |  Branch (86:9): [True: 0, False: 9]
  ------------------
   87|      0|        return;
   88|      9|    EVP_CIPHER_CTX_reset(ctx);
   89|      9|    OPENSSL_free(ctx);
  ------------------
  |  |  115|      9|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   90|      9|}
EVP_CipherInit_ex:
  652|  1.06k|{
  653|  1.06k|    return evp_cipher_init_internal(ctx, cipher, impl, key, iv, enc, 0, NULL);
  654|  1.06k|}
EVP_CipherUpdate:
  718|    759|{
  719|    759|    if (ctx->encrypt)
  ------------------
  |  Branch (719:9): [True: 759, False: 0]
  ------------------
  720|    759|        return EVP_EncryptUpdate(ctx, out, outl, in, inl);
  721|      0|    else
  722|      0|        return EVP_DecryptUpdate(ctx, out, outl, in, inl);
  723|    759|}
EVP_EncryptUpdate:
  979|    759|{
  980|    759|    int ret;
  981|    759|    size_t soutl, inl_ = (size_t)inl;
  982|    759|    int blocksize;
  983|       |
  984|    759|    if (ossl_likely(outl != NULL)) {
  ------------------
  |  |   22|    759|#  define ossl_likely(x)     __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (22:30): [True: 759, False: 0]
  |  |  ------------------
  ------------------
  985|    759|        *outl = 0;
  986|    759|    } else {
  987|      0|        ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  988|      0|        return 0;
  989|      0|    }
  990|       |
  991|       |    /* Prevent accidental use of decryption context when encrypting */
  992|    759|    if (ossl_unlikely(!ctx->encrypt)) {
  ------------------
  |  |   23|    759|#  define ossl_unlikely(x)   __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (23:30): [True: 0, False: 759]
  |  |  ------------------
  ------------------
  993|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  994|      0|        return 0;
  995|      0|    }
  996|       |
  997|    759|    if (ossl_unlikely(ctx->cipher == NULL)) {
  ------------------
  |  |   23|    759|#  define ossl_unlikely(x)   __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (23:30): [True: 0, False: 759]
  |  |  ------------------
  ------------------
  998|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_NO_CIPHER_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  999|      0|        return 0;
 1000|      0|    }
 1001|       |
 1002|    759|    if (ossl_unlikely(ctx->cipher->prov == NULL))
  ------------------
  |  |   23|    759|#  define ossl_unlikely(x)   __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (23:30): [True: 0, False: 759]
  |  |  ------------------
  ------------------
 1003|      0|        goto legacy;
 1004|       |
 1005|    759|    blocksize = ctx->cipher->block_size;
 1006|       |
 1007|    759|    if (ossl_unlikely(ctx->cipher->cupdate == NULL || blocksize < 1)) {
  ------------------
  |  |   23|  1.51k|#  define ossl_unlikely(x)   __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (23:30): [True: 0, False: 759]
  |  |  |  Branch (23:50): [True: 0, False: 759]
  |  |  |  Branch (23:50): [True: 0, False: 759]
  |  |  ------------------
  ------------------
 1008|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1009|      0|        return 0;
 1010|      0|    }
 1011|       |
 1012|    759|    ret = ctx->cipher->cupdate(ctx->algctx, out, &soutl,
 1013|    759|                               inl_ + (size_t)(blocksize == 1 ? 0 : blocksize),
  ------------------
  |  Branch (1013:48): [True: 341, False: 418]
  ------------------
 1014|    759|                               in, inl_);
 1015|       |
 1016|    759|    if (ossl_likely(ret)) {
  ------------------
  |  |   22|    759|#  define ossl_likely(x)     __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (22:30): [True: 759, False: 0]
  |  |  ------------------
  ------------------
 1017|    759|        if (soutl > INT_MAX) {
  ------------------
  |  Branch (1017:13): [True: 0, False: 759]
  ------------------
 1018|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1019|      0|            return 0;
 1020|      0|        }
 1021|    759|        *outl = soutl;
 1022|    759|    }
 1023|       |
 1024|    759|    return ret;
 1025|       |
 1026|       |    /* Code below to be removed when legacy support is dropped. */
 1027|      0| legacy:
 1028|       |
 1029|      0|    return evp_EncryptDecryptUpdate(ctx, out, outl, in, inl);
 1030|    759|}
EVP_CIPHER_gettable_ctx_params:
 1699|    130|{
 1700|    130|    void *provctx;
 1701|       |
 1702|    130|    if (cipher != NULL && cipher->gettable_ctx_params != NULL) {
  ------------------
  |  Branch (1702:9): [True: 130, False: 0]
  |  Branch (1702:27): [True: 130, False: 0]
  ------------------
 1703|    130|        provctx = ossl_provider_ctx(EVP_CIPHER_get0_provider(cipher));
 1704|    130|        return cipher->gettable_ctx_params(NULL, provctx);
 1705|    130|    }
 1706|      0|    return NULL;
 1707|    130|}
evp_cipher_new:
 1842|    130|{
 1843|    130|    EVP_CIPHER *cipher = OPENSSL_zalloc(sizeof(EVP_CIPHER));
  ------------------
  |  |  104|    130|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    130|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    130|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1844|       |
 1845|    130|    if (cipher != NULL && !CRYPTO_NEW_REF(&cipher->refcnt, 1)) {
  ------------------
  |  Branch (1845:9): [True: 130, False: 0]
  |  Branch (1845:27): [True: 0, False: 130]
  ------------------
 1846|      0|        OPENSSL_free(cipher);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1847|      0|        return NULL;
 1848|      0|    }
 1849|    130|    return cipher;
 1850|    130|}
evp_cipher_fetch_from_prov:
 2085|      6|{
 2086|      6|    return evp_generic_fetch_from_prov(prov, OSSL_OP_CIPHER,
  ------------------
  |  |  311|      6|# define OSSL_OP_CIPHER                              2   /* Symmetric Ciphers */
  ------------------
 2087|      6|                                       algorithm, properties,
 2088|      6|                                       evp_cipher_from_algorithm,
 2089|      6|                                       evp_cipher_up_ref,
 2090|      6|                                       evp_cipher_free);
 2091|      6|}
EVP_CIPHER_up_ref:
 2103|    147|{
 2104|    147|    int ref = 0;
 2105|       |
 2106|    147|    if (cipher->origin == EVP_ORIG_DYNAMIC)
  ------------------
  |  |  252|    147|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (2106:9): [True: 147, False: 0]
  ------------------
 2107|    147|        CRYPTO_UP_REF(&cipher->refcnt, &ref);
 2108|    147|    return 1;
 2109|    147|}
evp_cipher_free_int:
 2112|    130|{
 2113|    130|    OPENSSL_free(cipher->type_name);
  ------------------
  |  |  115|    130|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    130|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    130|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2114|    130|    ossl_provider_free(cipher->prov);
 2115|    130|    CRYPTO_FREE_REF(&cipher->refcnt);
 2116|    130|    OPENSSL_free(cipher);
  ------------------
  |  |  115|    130|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    130|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    130|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2117|    130|}
EVP_CIPHER_free:
 2120|    292|{
 2121|    292|    int i;
 2122|       |
 2123|    292|    if (cipher == NULL || cipher->origin != EVP_ORIG_DYNAMIC)
  ------------------
  |  |  252|    277|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (2123:9): [True: 15, False: 277]
  |  Branch (2123:27): [True: 0, False: 277]
  ------------------
 2124|     15|        return;
 2125|       |
 2126|    277|    CRYPTO_DOWN_REF(&cipher->refcnt, &i);
 2127|    277|    if (i > 0)
  ------------------
  |  Branch (2127:9): [True: 147, False: 130]
  ------------------
 2128|    147|        return;
 2129|    130|    evp_cipher_free_int(cipher);
 2130|    130|}
evp_enc.c:evp_cipher_init_internal:
   98|  1.06k|{
   99|  1.06k|    int n;
  100|  1.06k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  101|  1.06k|    ENGINE *tmpimpl = NULL;
  102|  1.06k|#endif
  103|       |
  104|       |    /*
  105|       |     * enc == 1 means we are encrypting.
  106|       |     * enc == 0 means we are decrypting.
  107|       |     * enc == -1 means, use the previously initialised value for encrypt/decrypt
  108|       |     */
  109|  1.06k|    if (enc == -1) {
  ------------------
  |  Branch (109:9): [True: 1.05k, False: 9]
  ------------------
  110|  1.05k|        enc = ctx->encrypt;
  111|  1.05k|    } else {
  112|      9|        if (enc)
  ------------------
  |  Branch (112:13): [True: 9, False: 0]
  ------------------
  113|      9|            enc = 1;
  114|      9|        ctx->encrypt = enc;
  115|      9|    }
  116|       |
  117|  1.06k|    if (cipher == NULL && ctx->cipher == NULL) {
  ------------------
  |  Branch (117:9): [True: 1.05k, False: 9]
  |  Branch (117:27): [True: 0, False: 1.05k]
  ------------------
  118|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_NO_CIPHER_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  119|      0|        return 0;
  120|      0|    }
  121|       |
  122|       |    /* Code below to be removed when legacy support is dropped. */
  123|  1.06k|    if (is_pipeline)
  ------------------
  |  Branch (123:9): [True: 0, False: 1.06k]
  ------------------
  124|      0|        goto nonlegacy;
  125|       |
  126|  1.06k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  127|       |    /*
  128|       |     * Whether it's nice or not, "Inits" can be used on "Final"'d contexts so
  129|       |     * this context may already have an ENGINE! Try to avoid releasing the
  130|       |     * previous handle, re-querying for an ENGINE, and having a
  131|       |     * reinitialisation, when it may all be unnecessary.
  132|       |     */
  133|  1.06k|    if (ctx->engine && ctx->cipher
  ------------------
  |  Branch (133:9): [True: 0, False: 1.06k]
  |  Branch (133:24): [True: 0, False: 0]
  ------------------
  134|  1.06k|        && (cipher == NULL || cipher->nid == ctx->cipher->nid))
  ------------------
  |  Branch (134:13): [True: 0, False: 0]
  |  Branch (134:31): [True: 0, False: 0]
  ------------------
  135|      0|        goto skip_to_init;
  136|       |
  137|  1.06k|    if (cipher != NULL && impl == NULL) {
  ------------------
  |  Branch (137:9): [True: 9, False: 1.05k]
  |  Branch (137:27): [True: 9, False: 0]
  ------------------
  138|       |         /* Ask if an ENGINE is reserved for this job */
  139|      9|        tmpimpl = ENGINE_get_cipher_engine(cipher->nid);
  140|      9|    }
  141|  1.06k|#endif
  142|       |
  143|       |    /*
  144|       |     * If there are engines involved then we should use legacy handling for now.
  145|       |     */
  146|  1.06k|    if (ctx->engine != NULL
  ------------------
  |  Branch (146:9): [True: 0, False: 1.06k]
  ------------------
  147|  1.06k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  148|  1.06k|            || tmpimpl != NULL
  ------------------
  |  Branch (148:16): [True: 0, False: 1.06k]
  ------------------
  149|  1.06k|#endif
  150|  1.06k|            || impl != NULL
  ------------------
  |  Branch (150:16): [True: 0, False: 1.06k]
  ------------------
  151|  1.06k|            || (cipher != NULL && cipher->origin == EVP_ORIG_METH)
  ------------------
  |  |  254|      9|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (151:17): [True: 9, False: 1.05k]
  |  Branch (151:35): [True: 0, False: 9]
  ------------------
  152|  1.06k|            || (cipher == NULL && ctx->cipher != NULL
  ------------------
  |  Branch (152:17): [True: 1.05k, False: 9]
  |  Branch (152:35): [True: 1.05k, False: 0]
  ------------------
  153|  1.06k|                               && ctx->cipher->origin == EVP_ORIG_METH)) {
  ------------------
  |  |  254|  1.05k|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (153:35): [True: 0, False: 1.05k]
  ------------------
  154|      0|        if (ctx->cipher == ctx->fetched_cipher)
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|            ctx->cipher = NULL;
  156|      0|        EVP_CIPHER_free(ctx->fetched_cipher);
  157|      0|        ctx->fetched_cipher = NULL;
  158|      0|        goto legacy;
  159|      0|    }
  160|       |    /*
  161|       |     * Ensure a context left lying around from last time is cleared
  162|       |     * (legacy code)
  163|       |     */
  164|  1.06k|    if (cipher != NULL && ctx->cipher != NULL) {
  ------------------
  |  Branch (164:9): [True: 9, False: 1.05k]
  |  Branch (164:27): [True: 0, False: 9]
  ------------------
  165|      0|        if (ctx->cipher->cleanup != NULL && !ctx->cipher->cleanup(ctx))
  ------------------
  |  Branch (165:13): [True: 0, False: 0]
  |  Branch (165:45): [True: 0, False: 0]
  ------------------
  166|      0|            return 0;
  167|      0|        OPENSSL_clear_free(ctx->cipher_data, ctx->cipher->ctx_size);
  ------------------
  |  |  113|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  168|      0|        ctx->cipher_data = NULL;
  169|      0|    }
  170|       |
  171|       |    /* Start of non-legacy code below */
  172|  1.06k|nonlegacy:
  173|       |    /* Ensure a context left lying around from last time is cleared */
  174|  1.06k|    if (cipher != NULL && ctx->cipher != NULL) {
  ------------------
  |  Branch (174:9): [True: 9, False: 1.05k]
  |  Branch (174:27): [True: 0, False: 9]
  ------------------
  175|      0|        unsigned long flags = ctx->flags;
  176|       |
  177|      0|        EVP_CIPHER_CTX_reset(ctx);
  178|       |        /* Restore encrypt and flags */
  179|      0|        ctx->encrypt = enc;
  180|      0|        ctx->flags = flags;
  181|      0|    }
  182|       |
  183|  1.06k|    if (cipher == NULL)
  ------------------
  |  Branch (183:9): [True: 1.05k, False: 9]
  ------------------
  184|  1.05k|        cipher = ctx->cipher;
  185|       |
  186|  1.06k|    if (cipher->prov == NULL) {
  ------------------
  |  Branch (186:9): [True: 0, False: 1.06k]
  ------------------
  187|       |#ifdef FIPS_MODULE
  188|       |        /* We only do explicit fetches inside the FIPS module */
  189|       |        ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  190|       |        return 0;
  191|       |#else
  192|      0|        EVP_CIPHER *provciph =
  193|      0|            EVP_CIPHER_fetch(NULL,
  194|      0|                             cipher->nid == NID_undef ? "NULL"
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (194:30): [True: 0, False: 0]
  ------------------
  195|      0|                                                      : OBJ_nid2sn(cipher->nid),
  196|      0|                             "");
  197|       |
  198|      0|        if (provciph == NULL)
  ------------------
  |  Branch (198:13): [True: 0, False: 0]
  ------------------
  199|      0|            return 0;
  200|      0|        cipher = provciph;
  201|      0|        EVP_CIPHER_free(ctx->fetched_cipher);
  202|      0|        ctx->fetched_cipher = provciph;
  203|      0|#endif
  204|      0|    }
  205|       |
  206|  1.06k|    if (!ossl_assert(cipher->prov != NULL)) {
  ------------------
  |  |   52|  1.06k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  1.06k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (206:9): [True: 0, False: 1.06k]
  ------------------
  207|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  208|      0|        return 0;
  209|      0|    }
  210|       |
  211|  1.06k|    if (cipher != ctx->fetched_cipher) {
  ------------------
  |  Branch (211:9): [True: 9, False: 1.05k]
  ------------------
  212|      9|        if (!EVP_CIPHER_up_ref((EVP_CIPHER *)cipher)) {
  ------------------
  |  Branch (212:13): [True: 0, False: 9]
  ------------------
  213|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  214|      0|            return 0;
  215|      0|        }
  216|      9|        EVP_CIPHER_free(ctx->fetched_cipher);
  217|       |        /* Coverity false positive, the reference counting is confusing it */
  218|       |        /* coverity[use_after_free] */
  219|      9|        ctx->fetched_cipher = (EVP_CIPHER *)cipher;
  220|      9|    }
  221|  1.06k|    ctx->cipher = cipher;
  222|       |
  223|  1.06k|    if (is_pipeline && !EVP_CIPHER_can_pipeline(cipher, enc)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 1.06k]
  |  Branch (223:24): [True: 0, False: 0]
  ------------------
  224|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_PIPELINE_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  225|      0|        return 0;
  226|      0|    }
  227|       |
  228|  1.06k|    if (ctx->algctx == NULL) {
  ------------------
  |  Branch (228:9): [True: 9, False: 1.05k]
  ------------------
  229|      9|        ctx->algctx = ctx->cipher->newctx(ossl_provider_ctx(cipher->prov));
  230|      9|        if (ctx->algctx == NULL) {
  ------------------
  |  Branch (230:13): [True: 0, False: 9]
  ------------------
  231|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  232|      0|            return 0;
  233|      0|        }
  234|      9|    }
  235|       |
  236|  1.06k|    if ((ctx->flags & EVP_CIPH_NO_PADDING) != 0) {
  ------------------
  |  |  346|  1.06k|# define         EVP_CIPH_NO_PADDING             0x100
  ------------------
  |  Branch (236:9): [True: 0, False: 1.06k]
  ------------------
  237|       |        /*
  238|       |         * If this ctx was already set up for no padding then we need to tell
  239|       |         * the new cipher about it.
  240|       |         */
  241|      0|        if (!EVP_CIPHER_CTX_set_padding(ctx, 0))
  ------------------
  |  Branch (241:13): [True: 0, False: 0]
  ------------------
  242|      0|            return 0;
  243|      0|    }
  244|       |
  245|  1.06k|#ifndef FIPS_MODULE
  246|       |    /*
  247|       |     * Fix for CVE-2023-5363
  248|       |     * Passing in a size as part of the init call takes effect late
  249|       |     * so, force such to occur before the initialisation.
  250|       |     *
  251|       |     * The FIPS provider's internal library context is used in a manner
  252|       |     * such that this is not an issue.
  253|       |     */
  254|  1.06k|    if (params != NULL) {
  ------------------
  |  Branch (254:9): [True: 0, False: 1.06k]
  ------------------
  255|      0|        OSSL_PARAM param_lens[3] = { OSSL_PARAM_END, OSSL_PARAM_END,
  ------------------
  |  |   25|      0|    { NULL, 0, NULL, 0, 0 }
  ------------------
                      OSSL_PARAM param_lens[3] = { OSSL_PARAM_END, OSSL_PARAM_END,
  ------------------
  |  |   25|      0|    { NULL, 0, NULL, 0, 0 }
  ------------------
  256|      0|                                     OSSL_PARAM_END };
  ------------------
  |  |   25|      0|    { NULL, 0, NULL, 0, 0 }
  ------------------
  257|      0|        OSSL_PARAM *q = param_lens;
  258|      0|        const OSSL_PARAM *p;
  259|       |
  260|      0|        p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
  ------------------
  |  |  194|      0|# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
  ------------------
  261|      0|        if (p != NULL)
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|            memcpy(q++, p, sizeof(*q));
  263|       |
  264|       |        /*
  265|       |         * Note that OSSL_CIPHER_PARAM_AEAD_IVLEN is a synonym for
  266|       |         * OSSL_CIPHER_PARAM_IVLEN so both are covered here.
  267|       |         */
  268|      0|        p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_IVLEN);
  ------------------
  |  |  193|      0|# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
  ------------------
  269|      0|        if (p != NULL)
  ------------------
  |  Branch (269:13): [True: 0, False: 0]
  ------------------
  270|      0|            memcpy(q++, p, sizeof(*q));
  271|       |
  272|      0|        if (q != param_lens) {
  ------------------
  |  Branch (272:13): [True: 0, False: 0]
  ------------------
  273|      0|            if (!EVP_CIPHER_CTX_set_params(ctx, param_lens)) {
  ------------------
  |  Branch (273:17): [True: 0, False: 0]
  ------------------
  274|      0|                ERR_raise(ERR_LIB_EVP, EVP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  275|      0|                return 0;
  276|      0|            }
  277|      0|        }
  278|      0|    }
  279|  1.06k|#endif
  280|       |
  281|  1.06k|    if (is_pipeline)
  ------------------
  |  Branch (281:9): [True: 0, False: 1.06k]
  ------------------
  282|      0|        return 1;
  283|       |
  284|  1.06k|    if (enc) {
  ------------------
  |  Branch (284:9): [True: 1.06k, False: 0]
  ------------------
  285|  1.06k|        if (ctx->cipher->einit == NULL) {
  ------------------
  |  Branch (285:13): [True: 0, False: 1.06k]
  ------------------
  286|       |            /*
  287|       |             * We still should be able to set the IV using the new API
  288|       |             * if the key is not specified and old API is not available
  289|       |             */
  290|      0|            if (key == NULL && ctx->cipher->einit_skey != NULL) {
  ------------------
  |  Branch (290:17): [True: 0, False: 0]
  |  Branch (290:32): [True: 0, False: 0]
  ------------------
  291|      0|                return ctx->cipher->einit_skey(ctx->algctx, NULL,
  292|      0|                                               iv,
  293|      0|                                               iv == NULL ? 0
  ------------------
  |  Branch (293:48): [True: 0, False: 0]
  ------------------
  294|      0|                                                          : EVP_CIPHER_CTX_get_iv_length(ctx),
  295|      0|                                               params);
  296|      0|            }
  297|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  298|      0|            return 0;
  299|      0|        }
  300|       |
  301|  1.06k|        return ctx->cipher->einit(ctx->algctx,
  302|  1.06k|                                  key,
  303|  1.06k|                                  key == NULL ? 0
  ------------------
  |  Branch (303:35): [True: 347, False: 715]
  ------------------
  304|  1.06k|                                              : EVP_CIPHER_CTX_get_key_length(ctx),
  305|  1.06k|                                  iv,
  306|  1.06k|                                  iv == NULL ? 0
  ------------------
  |  Branch (306:35): [True: 721, False: 341]
  ------------------
  307|  1.06k|                                             : EVP_CIPHER_CTX_get_iv_length(ctx),
  308|  1.06k|                                  params);
  309|  1.06k|    }
  310|       |
  311|      0|    if (ctx->cipher->dinit == NULL) {
  ------------------
  |  Branch (311:9): [True: 0, False: 0]
  ------------------
  312|       |        /*
  313|       |         * We still should be able to set the IV using the new API
  314|       |         * if the key is not specified and old API is not available
  315|       |         */
  316|      0|        if (key == NULL && ctx->cipher->dinit_skey != NULL) {
  ------------------
  |  Branch (316:13): [True: 0, False: 0]
  |  Branch (316:28): [True: 0, False: 0]
  ------------------
  317|      0|            return ctx->cipher->dinit_skey(ctx->algctx, NULL,
  318|      0|                                           iv,
  319|      0|                                           iv == NULL ? 0
  ------------------
  |  Branch (319:44): [True: 0, False: 0]
  ------------------
  320|      0|                                                      : EVP_CIPHER_CTX_get_iv_length(ctx),
  321|      0|                                           params);
  322|      0|        }
  323|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  324|      0|        return 0;
  325|      0|    }
  326|       |
  327|      0|    return ctx->cipher->dinit(ctx->algctx,
  328|      0|                              key,
  329|      0|                              key == NULL ? 0
  ------------------
  |  Branch (329:31): [True: 0, False: 0]
  ------------------
  330|      0|                                          : EVP_CIPHER_CTX_get_key_length(ctx),
  331|      0|                              iv,
  332|      0|                              iv == NULL ? 0
  ------------------
  |  Branch (332:31): [True: 0, False: 0]
  ------------------
  333|      0|                                         : EVP_CIPHER_CTX_get_iv_length(ctx),
  334|      0|                                  params);
  335|       |
  336|       |    /* Code below to be removed when legacy support is dropped. */
  337|      0| legacy:
  338|       |
  339|      0|    if (cipher != NULL) {
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|       |        /*
  341|       |         * Ensure a context left lying around from last time is cleared (we
  342|       |         * previously attempted to avoid this if the same ENGINE and
  343|       |         * EVP_CIPHER could be used).
  344|       |         */
  345|      0|        if (ctx->cipher) {
  ------------------
  |  Branch (345:13): [True: 0, False: 0]
  ------------------
  346|      0|            unsigned long flags = ctx->flags;
  347|      0|            EVP_CIPHER_CTX_reset(ctx);
  348|       |            /* Restore encrypt and flags */
  349|      0|            ctx->encrypt = enc;
  350|      0|            ctx->flags = flags;
  351|      0|        }
  352|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  353|      0|        if (impl != NULL) {
  ------------------
  |  Branch (353:13): [True: 0, False: 0]
  ------------------
  354|      0|            if (!ENGINE_init(impl)) {
  ------------------
  |  Branch (354:17): [True: 0, False: 0]
  ------------------
  355|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  356|      0|                return 0;
  357|      0|            }
  358|      0|        } else {
  359|      0|            impl = tmpimpl;
  360|      0|        }
  361|      0|        if (impl != NULL) {
  ------------------
  |  Branch (361:13): [True: 0, False: 0]
  ------------------
  362|       |            /* There's an ENGINE for this job ... (apparently) */
  363|      0|            const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);
  364|       |
  365|      0|            if (c == NULL) {
  ------------------
  |  Branch (365:17): [True: 0, False: 0]
  ------------------
  366|       |                /*
  367|       |                 * One positive side-effect of US's export control history,
  368|       |                 * is that we should at least be able to avoid using US
  369|       |                 * misspellings of "initialisation"?
  370|       |                 */
  371|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  372|      0|                return 0;
  373|      0|            }
  374|       |            /* We'll use the ENGINE's private cipher definition */
  375|      0|            cipher = c;
  376|       |            /*
  377|       |             * Store the ENGINE functional reference so we know 'cipher' came
  378|       |             * from an ENGINE and we need to release it when done.
  379|       |             */
  380|      0|            ctx->engine = impl;
  381|      0|        } else {
  382|      0|            ctx->engine = NULL;
  383|      0|        }
  384|      0|#endif
  385|       |
  386|      0|        ctx->cipher = cipher;
  387|      0|        if (ctx->cipher->ctx_size) {
  ------------------
  |  Branch (387:13): [True: 0, False: 0]
  ------------------
  388|      0|            ctx->cipher_data = OPENSSL_zalloc(ctx->cipher->ctx_size);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  389|      0|            if (ctx->cipher_data == NULL) {
  ------------------
  |  Branch (389:17): [True: 0, False: 0]
  ------------------
  390|      0|                ctx->cipher = NULL;
  391|      0|                return 0;
  392|      0|            }
  393|      0|        } else {
  394|      0|            ctx->cipher_data = NULL;
  395|      0|        }
  396|      0|        ctx->key_len = cipher->key_len;
  397|       |        /* Preserve wrap enable flag, zero everything else */
  398|      0|        ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
  ------------------
  |  |  386|      0|# define         EVP_CIPHER_CTX_FLAG_WRAP_ALLOW  0x1
  ------------------
  399|      0|        if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) {
  ------------------
  |  |  342|      0|# define         EVP_CIPH_CTRL_INIT              0x40
  ------------------
  |  Branch (399:13): [True: 0, False: 0]
  ------------------
  400|      0|            if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL) <= 0) {
  ------------------
  |  |  390|      0|# define         EVP_CTRL_INIT                   0x0
  ------------------
  |  Branch (400:17): [True: 0, False: 0]
  ------------------
  401|      0|                ctx->cipher = NULL;
  402|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  403|      0|                return 0;
  404|      0|            }
  405|      0|        }
  406|      0|    }
  407|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  408|      0| skip_to_init:
  409|      0|#endif
  410|      0|    if (ctx->cipher == NULL)
  ------------------
  |  Branch (410:9): [True: 0, False: 0]
  ------------------
  411|      0|        return 0;
  412|       |
  413|       |    /* we assume block size is a power of 2 in *cryptUpdate */
  414|      0|    OPENSSL_assert(ctx->cipher->block_size == 1
  ------------------
  |  |  438|      0|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:13): [True: 0, False: 0]
  |  |  |  Branch (438:13): [True: 0, False: 0]
  |  |  |  Branch (438:13): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  415|      0|                   || ctx->cipher->block_size == 8
  416|      0|                   || ctx->cipher->block_size == 16);
  417|       |
  418|      0|    if (!(ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW)
  ------------------
  |  |  386|      0|# define         EVP_CIPHER_CTX_FLAG_WRAP_ALLOW  0x1
  ------------------
  |  Branch (418:9): [True: 0, False: 0]
  ------------------
  419|      0|        && EVP_CIPHER_CTX_get_mode(ctx) == EVP_CIPH_WRAP_MODE) {
  ------------------
  |  |  679|      0|# define EVP_CIPHER_CTX_get_mode(c)  EVP_CIPHER_get_mode(EVP_CIPHER_CTX_get0_cipher(c))
  ------------------
                      && EVP_CIPHER_CTX_get_mode(ctx) == EVP_CIPH_WRAP_MODE) {
  ------------------
  |  |  330|      0|# define         EVP_CIPH_WRAP_MODE              0x10002
  ------------------
  |  Branch (419:12): [True: 0, False: 0]
  ------------------
  420|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_WRAP_MODE_NOT_ALLOWED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  421|      0|        return 0;
  422|      0|    }
  423|       |
  424|      0|    if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx))
  ------------------
  |  Branch (424:9): [True: 0, False: 0]
  ------------------
  425|      0|                & EVP_CIPH_CUSTOM_IV) == 0) {
  ------------------
  |  |  338|      0|# define         EVP_CIPH_CUSTOM_IV              0x10
  ------------------
  426|      0|        switch (EVP_CIPHER_CTX_get_mode(ctx)) {
  ------------------
  |  |  679|      0|# define EVP_CIPHER_CTX_get_mode(c)  EVP_CIPHER_get_mode(EVP_CIPHER_CTX_get0_cipher(c))
  ------------------
  427|       |
  428|      0|        case EVP_CIPH_STREAM_CIPHER:
  ------------------
  |  |  321|      0|# define         EVP_CIPH_STREAM_CIPHER          0x0
  ------------------
  |  Branch (428:9): [True: 0, False: 0]
  ------------------
  429|      0|        case EVP_CIPH_ECB_MODE:
  ------------------
  |  |  322|      0|# define         EVP_CIPH_ECB_MODE               0x1
  ------------------
  |  Branch (429:9): [True: 0, False: 0]
  ------------------
  430|      0|            break;
  431|       |
  432|      0|        case EVP_CIPH_CFB_MODE:
  ------------------
  |  |  324|      0|# define         EVP_CIPH_CFB_MODE               0x3
  ------------------
  |  Branch (432:9): [True: 0, False: 0]
  ------------------
  433|      0|        case EVP_CIPH_OFB_MODE:
  ------------------
  |  |  325|      0|# define         EVP_CIPH_OFB_MODE               0x4
  ------------------
  |  Branch (433:9): [True: 0, False: 0]
  ------------------
  434|       |
  435|      0|            ctx->num = 0;
  436|       |            /* fall-through */
  437|       |
  438|      0|        case EVP_CIPH_CBC_MODE:
  ------------------
  |  |  323|      0|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  |  Branch (438:9): [True: 0, False: 0]
  ------------------
  439|      0|            n = EVP_CIPHER_CTX_get_iv_length(ctx);
  440|      0|            if (n < 0 || n > (int)sizeof(ctx->iv)) {
  ------------------
  |  Branch (440:17): [True: 0, False: 0]
  |  Branch (440:26): [True: 0, False: 0]
  ------------------
  441|      0|                ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_IV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  442|      0|                return 0;
  443|      0|            }
  444|      0|            if (iv != NULL)
  ------------------
  |  Branch (444:17): [True: 0, False: 0]
  ------------------
  445|      0|                memcpy(ctx->oiv, iv, n);
  446|      0|            memcpy(ctx->iv, ctx->oiv, n);
  447|      0|            break;
  448|       |
  449|      0|        case EVP_CIPH_CTR_MODE:
  ------------------
  |  |  326|      0|# define         EVP_CIPH_CTR_MODE               0x5
  ------------------
  |  Branch (449:9): [True: 0, False: 0]
  ------------------
  450|      0|            ctx->num = 0;
  451|       |            /* Don't reuse IV for CTR mode */
  452|      0|            if (iv != NULL) {
  ------------------
  |  Branch (452:17): [True: 0, False: 0]
  ------------------
  453|      0|                n = EVP_CIPHER_CTX_get_iv_length(ctx);
  454|      0|                if (n <= 0 || n > (int)sizeof(ctx->iv)) {
  ------------------
  |  Branch (454:21): [True: 0, False: 0]
  |  Branch (454:31): [True: 0, False: 0]
  ------------------
  455|      0|                    ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_IV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  456|      0|                    return 0;
  457|      0|                }
  458|      0|                memcpy(ctx->iv, iv, n);
  459|      0|            }
  460|      0|            break;
  461|       |
  462|      0|        default:
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  ------------------
  463|      0|            return 0;
  464|      0|        }
  465|      0|    }
  466|       |
  467|      0|    if (key != NULL || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
  ------------------
  |  |  340|      0|# define         EVP_CIPH_ALWAYS_CALL_INIT       0x20
  ------------------
  |  Branch (467:9): [True: 0, False: 0]
  |  Branch (467:24): [True: 0, False: 0]
  ------------------
  468|      0|        if (!ctx->cipher->init(ctx, key, iv, enc))
  ------------------
  |  Branch (468:13): [True: 0, False: 0]
  ------------------
  469|      0|            return 0;
  470|      0|    }
  471|      0|    ctx->buf_len = 0;
  472|      0|    ctx->final_used = 0;
  473|      0|    ctx->block_mask = ctx->cipher->block_size - 1;
  474|      0|    return 1;
  475|      0|}
evp_enc.c:evp_cipher_from_algorithm:
 1886|    130|{
 1887|    130|    const OSSL_DISPATCH *fns = algodef->implementation;
 1888|    130|    EVP_CIPHER *cipher = NULL;
 1889|    130|    int fnciphcnt = 0, encinit = 0, decinit = 0, fnpipecnt = 0, fnctxcnt = 0;
 1890|       |
 1891|    130|    if ((cipher = evp_cipher_new()) == NULL) {
  ------------------
  |  Branch (1891:9): [True: 0, False: 130]
  ------------------
 1892|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1893|      0|        return NULL;
 1894|      0|    }
 1895|       |
 1896|    130|#ifndef FIPS_MODULE
 1897|    130|    cipher->nid = NID_undef;
  ------------------
  |  |   18|    130|#define NID_undef                       0
  ------------------
 1898|    130|    if (!evp_names_do_all(prov, name_id, set_legacy_nid, &cipher->nid)
  ------------------
  |  Branch (1898:9): [True: 0, False: 130]
  ------------------
 1899|    130|            || cipher->nid == -1) {
  ------------------
  |  Branch (1899:16): [True: 0, False: 130]
  ------------------
 1900|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1901|      0|        goto err;
 1902|      0|    }
 1903|    130|#endif
 1904|       |
 1905|    130|    cipher->name_id = name_id;
 1906|    130|    if ((cipher->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL)
  ------------------
  |  Branch (1906:9): [True: 0, False: 130]
  ------------------
 1907|      0|        goto err;
 1908|       |
 1909|    130|    cipher->description = algodef->algorithm_description;
 1910|       |
 1911|  2.07k|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (1911:12): [True: 1.94k, False: 130]
  ------------------
 1912|  1.94k|        switch (fns->function_id) {
  ------------------
  |  Branch (1912:17): [True: 0, False: 1.94k]
  ------------------
 1913|    130|        case OSSL_FUNC_CIPHER_NEWCTX:
  ------------------
  |  |  378|    130|# define OSSL_FUNC_CIPHER_NEWCTX                     1
  ------------------
  |  Branch (1913:9): [True: 130, False: 1.81k]
  ------------------
 1914|    130|            if (cipher->newctx != NULL)
  ------------------
  |  Branch (1914:17): [True: 0, False: 130]
  ------------------
 1915|      0|                break;
 1916|    130|            cipher->newctx = OSSL_FUNC_cipher_newctx(fns);
 1917|    130|            fnctxcnt++;
 1918|    130|            break;
 1919|    130|        case OSSL_FUNC_CIPHER_ENCRYPT_INIT:
  ------------------
  |  |  379|    130|# define OSSL_FUNC_CIPHER_ENCRYPT_INIT               2
  ------------------
  |  Branch (1919:9): [True: 130, False: 1.81k]
  ------------------
 1920|    130|            if (cipher->einit != NULL)
  ------------------
  |  Branch (1920:17): [True: 0, False: 130]
  ------------------
 1921|      0|                break;
 1922|    130|            cipher->einit = OSSL_FUNC_cipher_encrypt_init(fns);
 1923|    130|            encinit = 1;
 1924|    130|            break;
 1925|    130|        case OSSL_FUNC_CIPHER_DECRYPT_INIT:
  ------------------
  |  |  380|    130|# define OSSL_FUNC_CIPHER_DECRYPT_INIT               3
  ------------------
  |  Branch (1925:9): [True: 130, False: 1.81k]
  ------------------
 1926|    130|            if (cipher->dinit != NULL)
  ------------------
  |  Branch (1926:17): [True: 0, False: 130]
  ------------------
 1927|      0|                break;
 1928|    130|            cipher->dinit = OSSL_FUNC_cipher_decrypt_init(fns);
 1929|    130|            decinit = 1;
 1930|    130|            break;
 1931|     68|        case OSSL_FUNC_CIPHER_ENCRYPT_SKEY_INIT:
  ------------------
  |  |  396|     68|# define OSSL_FUNC_CIPHER_ENCRYPT_SKEY_INIT         19
  ------------------
  |  Branch (1931:9): [True: 68, False: 1.87k]
  ------------------
 1932|     68|            if (cipher->einit_skey != NULL)
  ------------------
  |  Branch (1932:17): [True: 0, False: 68]
  ------------------
 1933|      0|                break;
 1934|     68|            cipher->einit_skey = OSSL_FUNC_cipher_encrypt_skey_init(fns);
 1935|     68|            encinit = 1;
 1936|     68|            break;
 1937|     68|        case OSSL_FUNC_CIPHER_DECRYPT_SKEY_INIT:
  ------------------
  |  |  397|     68|# define OSSL_FUNC_CIPHER_DECRYPT_SKEY_INIT         20
  ------------------
  |  Branch (1937:9): [True: 68, False: 1.87k]
  ------------------
 1938|     68|            if (cipher->dinit_skey != NULL)
  ------------------
  |  Branch (1938:17): [True: 0, False: 68]
  ------------------
 1939|      0|                break;
 1940|     68|            cipher->dinit_skey = OSSL_FUNC_cipher_decrypt_skey_init(fns);
 1941|     68|            decinit = 1;
 1942|     68|            break;
 1943|    130|        case OSSL_FUNC_CIPHER_UPDATE:
  ------------------
  |  |  381|    130|# define OSSL_FUNC_CIPHER_UPDATE                     4
  ------------------
  |  Branch (1943:9): [True: 130, False: 1.81k]
  ------------------
 1944|    130|            if (cipher->cupdate != NULL)
  ------------------
  |  Branch (1944:17): [True: 0, False: 130]
  ------------------
 1945|      0|                break;
 1946|    130|            cipher->cupdate = OSSL_FUNC_cipher_update(fns);
 1947|    130|            fnciphcnt++;
 1948|    130|            break;
 1949|    130|        case OSSL_FUNC_CIPHER_FINAL:
  ------------------
  |  |  382|    130|# define OSSL_FUNC_CIPHER_FINAL                      5
  ------------------
  |  Branch (1949:9): [True: 130, False: 1.81k]
  ------------------
 1950|    130|            if (cipher->cfinal != NULL)
  ------------------
  |  Branch (1950:17): [True: 0, False: 130]
  ------------------
 1951|      0|                break;
 1952|    130|            cipher->cfinal = OSSL_FUNC_cipher_final(fns);
 1953|    130|            fnciphcnt++;
 1954|    130|            break;
 1955|    118|        case OSSL_FUNC_CIPHER_CIPHER:
  ------------------
  |  |  383|    118|# define OSSL_FUNC_CIPHER_CIPHER                     6
  ------------------
  |  Branch (1955:9): [True: 118, False: 1.82k]
  ------------------
 1956|    118|            if (cipher->ccipher != NULL)
  ------------------
  |  Branch (1956:17): [True: 0, False: 118]
  ------------------
 1957|      0|                break;
 1958|    118|            cipher->ccipher = OSSL_FUNC_cipher_cipher(fns);
 1959|    118|            break;
 1960|      0|        case OSSL_FUNC_CIPHER_PIPELINE_ENCRYPT_INIT:
  ------------------
  |  |  392|      0|# define OSSL_FUNC_CIPHER_PIPELINE_ENCRYPT_INIT     15
  ------------------
  |  Branch (1960:9): [True: 0, False: 1.94k]
  ------------------
 1961|      0|            if (cipher->p_einit != NULL)
  ------------------
  |  Branch (1961:17): [True: 0, False: 0]
  ------------------
 1962|      0|                break;
 1963|      0|            cipher->p_einit = OSSL_FUNC_cipher_pipeline_encrypt_init(fns);
 1964|      0|            fnpipecnt++;
 1965|      0|            break;
 1966|      0|        case OSSL_FUNC_CIPHER_PIPELINE_DECRYPT_INIT:
  ------------------
  |  |  393|      0|# define OSSL_FUNC_CIPHER_PIPELINE_DECRYPT_INIT     16
  ------------------
  |  Branch (1966:9): [True: 0, False: 1.94k]
  ------------------
 1967|      0|            if (cipher->p_dinit != NULL)
  ------------------
  |  Branch (1967:17): [True: 0, False: 0]
  ------------------
 1968|      0|                break;
 1969|      0|            cipher->p_dinit = OSSL_FUNC_cipher_pipeline_decrypt_init(fns);
 1970|      0|            fnpipecnt++;
 1971|      0|            break;
 1972|      0|        case OSSL_FUNC_CIPHER_PIPELINE_UPDATE:
  ------------------
  |  |  394|      0|# define OSSL_FUNC_CIPHER_PIPELINE_UPDATE           17
  ------------------
  |  Branch (1972:9): [True: 0, False: 1.94k]
  ------------------
 1973|      0|            if (cipher->p_cupdate != NULL)
  ------------------
  |  Branch (1973:17): [True: 0, False: 0]
  ------------------
 1974|      0|                break;
 1975|      0|            cipher->p_cupdate = OSSL_FUNC_cipher_pipeline_update(fns);
 1976|      0|            fnpipecnt++;
 1977|      0|            break;
 1978|      0|        case OSSL_FUNC_CIPHER_PIPELINE_FINAL:
  ------------------
  |  |  395|      0|# define OSSL_FUNC_CIPHER_PIPELINE_FINAL            18
  ------------------
  |  Branch (1978:9): [True: 0, False: 1.94k]
  ------------------
 1979|      0|            if (cipher->p_cfinal != NULL)
  ------------------
  |  Branch (1979:17): [True: 0, False: 0]
  ------------------
 1980|      0|                break;
 1981|      0|            cipher->p_cfinal = OSSL_FUNC_cipher_pipeline_final(fns);
 1982|      0|            fnpipecnt++;
 1983|      0|            break;
 1984|    130|        case OSSL_FUNC_CIPHER_FREECTX:
  ------------------
  |  |  384|    130|# define OSSL_FUNC_CIPHER_FREECTX                    7
  ------------------
  |  Branch (1984:9): [True: 130, False: 1.81k]
  ------------------
 1985|    130|            if (cipher->freectx != NULL)
  ------------------
  |  Branch (1985:17): [True: 0, False: 130]
  ------------------
 1986|      0|                break;
 1987|    130|            cipher->freectx = OSSL_FUNC_cipher_freectx(fns);
 1988|    130|            fnctxcnt++;
 1989|    130|            break;
 1990|    129|        case OSSL_FUNC_CIPHER_DUPCTX:
  ------------------
  |  |  385|    129|# define OSSL_FUNC_CIPHER_DUPCTX                     8
  ------------------
  |  Branch (1990:9): [True: 129, False: 1.81k]
  ------------------
 1991|    129|            if (cipher->dupctx != NULL)
  ------------------
  |  Branch (1991:17): [True: 0, False: 129]
  ------------------
 1992|      0|                break;
 1993|    129|            cipher->dupctx = OSSL_FUNC_cipher_dupctx(fns);
 1994|    129|            break;
 1995|    130|        case OSSL_FUNC_CIPHER_GET_PARAMS:
  ------------------
  |  |  386|    130|# define OSSL_FUNC_CIPHER_GET_PARAMS                 9
  ------------------
  |  Branch (1995:9): [True: 130, False: 1.81k]
  ------------------
 1996|    130|            if (cipher->get_params != NULL)
  ------------------
  |  Branch (1996:17): [True: 0, False: 130]
  ------------------
 1997|      0|                break;
 1998|    130|            cipher->get_params = OSSL_FUNC_cipher_get_params(fns);
 1999|    130|            break;
 2000|    130|        case OSSL_FUNC_CIPHER_GET_CTX_PARAMS:
  ------------------
  |  |  387|    130|# define OSSL_FUNC_CIPHER_GET_CTX_PARAMS            10
  ------------------
  |  Branch (2000:9): [True: 130, False: 1.81k]
  ------------------
 2001|    130|            if (cipher->get_ctx_params != NULL)
  ------------------
  |  Branch (2001:17): [True: 0, False: 130]
  ------------------
 2002|      0|                break;
 2003|    130|            cipher->get_ctx_params = OSSL_FUNC_cipher_get_ctx_params(fns);
 2004|    130|            break;
 2005|    130|        case OSSL_FUNC_CIPHER_SET_CTX_PARAMS:
  ------------------
  |  |  388|    130|# define OSSL_FUNC_CIPHER_SET_CTX_PARAMS            11
  ------------------
  |  Branch (2005:9): [True: 130, False: 1.81k]
  ------------------
 2006|    130|            if (cipher->set_ctx_params != NULL)
  ------------------
  |  Branch (2006:17): [True: 0, False: 130]
  ------------------
 2007|      0|                break;
 2008|    130|            cipher->set_ctx_params = OSSL_FUNC_cipher_set_ctx_params(fns);
 2009|    130|            break;
 2010|    130|        case OSSL_FUNC_CIPHER_GETTABLE_PARAMS:
  ------------------
  |  |  389|    130|# define OSSL_FUNC_CIPHER_GETTABLE_PARAMS           12
  ------------------
  |  Branch (2010:9): [True: 130, False: 1.81k]
  ------------------
 2011|    130|            if (cipher->gettable_params != NULL)
  ------------------
  |  Branch (2011:17): [True: 0, False: 130]
  ------------------
 2012|      0|                break;
 2013|    130|            cipher->gettable_params = OSSL_FUNC_cipher_gettable_params(fns);
 2014|    130|            break;
 2015|    130|        case OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  390|    130|# define OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS       13
  ------------------
  |  Branch (2015:9): [True: 130, False: 1.81k]
  ------------------
 2016|    130|            if (cipher->gettable_ctx_params != NULL)
  ------------------
  |  Branch (2016:17): [True: 0, False: 130]
  ------------------
 2017|      0|                break;
 2018|    130|            cipher->gettable_ctx_params =
 2019|    130|                OSSL_FUNC_cipher_gettable_ctx_params(fns);
 2020|    130|            break;
 2021|    130|        case OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  391|    130|# define OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS       14
  ------------------
  |  Branch (2021:9): [True: 130, False: 1.81k]
  ------------------
 2022|    130|            if (cipher->settable_ctx_params != NULL)
  ------------------
  |  Branch (2022:17): [True: 0, False: 130]
  ------------------
 2023|      0|                break;
 2024|    130|            cipher->settable_ctx_params =
 2025|    130|                OSSL_FUNC_cipher_settable_ctx_params(fns);
 2026|    130|            break;
 2027|  1.94k|        }
 2028|  1.94k|    }
 2029|    130|    fnciphcnt += encinit + decinit;
 2030|    130|    if ((fnciphcnt != 0 && fnciphcnt != 3 && fnciphcnt != 4)
  ------------------
  |  Branch (2030:10): [True: 130, False: 0]
  |  Branch (2030:28): [True: 130, False: 0]
  |  Branch (2030:46): [True: 0, False: 130]
  ------------------
 2031|    130|            || (fnciphcnt == 0 && cipher->ccipher == NULL && fnpipecnt == 0)
  ------------------
  |  Branch (2031:17): [True: 0, False: 130]
  |  Branch (2031:35): [True: 0, False: 0]
  |  Branch (2031:62): [True: 0, False: 0]
  ------------------
 2032|    130|            || (fnpipecnt != 0 && (fnpipecnt < 3 || cipher->p_cupdate == NULL
  ------------------
  |  Branch (2032:17): [True: 0, False: 130]
  |  Branch (2032:36): [True: 0, False: 0]
  |  Branch (2032:53): [True: 0, False: 0]
  ------------------
 2033|      0|                                   || cipher->p_cfinal == NULL))
  ------------------
  |  Branch (2033:39): [True: 0, False: 0]
  ------------------
 2034|    130|            || fnctxcnt != 2) {
  ------------------
  |  Branch (2034:16): [True: 0, False: 130]
  ------------------
 2035|       |        /*
 2036|       |         * In order to be a consistent set of functions we must have at least
 2037|       |         * a complete set of "encrypt" functions, or a complete set of "decrypt"
 2038|       |         * functions, or a single "cipher" function. In all cases we need both
 2039|       |         * the "newctx" and "freectx" functions.
 2040|       |         */
 2041|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2042|      0|        goto err;
 2043|      0|    }
 2044|    130|    if (prov != NULL && !ossl_provider_up_ref(prov))
  ------------------
  |  Branch (2044:9): [True: 130, False: 0]
  |  Branch (2044:25): [True: 0, False: 130]
  ------------------
 2045|      0|        goto err;
 2046|       |
 2047|    130|    cipher->prov = prov;
 2048|       |
 2049|    130|    if (!evp_cipher_cache_constants(cipher)) {
  ------------------
  |  Branch (2049:9): [True: 0, False: 130]
  ------------------
 2050|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2051|      0|        goto err;
 2052|      0|    }
 2053|       |
 2054|    130|    return cipher;
 2055|       |
 2056|      0|err:
 2057|      0|    EVP_CIPHER_free(cipher);
 2058|      0|    return NULL;
 2059|    130|}
evp_enc.c:set_legacy_nid:
 1860|    243|{
 1861|    243|    int nid;
 1862|    243|    int *legacy_nid = vlegacy_nid;
 1863|       |    /*
 1864|       |     * We use lowest level function to get the associated method, because
 1865|       |     * higher level functions such as EVP_get_cipherbyname() have changed
 1866|       |     * to look at providers too.
 1867|       |     */
 1868|    243|    const void *legacy_method = OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|    243|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
 1869|       |
 1870|    243|    if (*legacy_nid == -1)       /* We found a clash already */
  ------------------
  |  Branch (1870:9): [True: 0, False: 243]
  ------------------
 1871|      0|        return;
 1872|    243|    if (legacy_method == NULL)
  ------------------
  |  Branch (1872:9): [True: 109, False: 134]
  ------------------
 1873|    109|        return;
 1874|    134|    nid = EVP_CIPHER_get_nid(legacy_method);
 1875|    134|    if (*legacy_nid != NID_undef && *legacy_nid != nid) {
  ------------------
  |  |   18|    268|#define NID_undef                       0
  ------------------
  |  Branch (1875:9): [True: 26, False: 108]
  |  Branch (1875:37): [True: 0, False: 26]
  ------------------
 1876|      0|        *legacy_nid = -1;
 1877|      0|        return;
 1878|      0|    }
 1879|    134|    *legacy_nid = nid;
 1880|    134|}
evp_enc.c:evp_cipher_up_ref:
 2062|    138|{
 2063|    138|    return EVP_CIPHER_up_ref(cipher);
 2064|    138|}
evp_enc.c:evp_cipher_free:
 2067|    262|{
 2068|    262|    EVP_CIPHER_free(cipher);
 2069|    262|}

ossl_err_load_EVP_strings:
  227|      1|{
  228|      1|#ifndef OPENSSL_NO_ERR
  229|      1|    if (ERR_reason_error_string(EVP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (229:9): [True: 1, False: 0]
  ------------------
  230|      1|        ERR_load_strings_const(EVP_str_reasons);
  231|      1|#endif
  232|      1|    return 1;
  233|      1|}

evp_generic_fetch:
  397|  1.33k|{
  398|  1.33k|    struct evp_method_data_st methdata;
  399|  1.33k|    void *method;
  400|       |
  401|  1.33k|    methdata.libctx = libctx;
  402|  1.33k|    methdata.tmp_store = NULL;
  403|  1.33k|    method = inner_evp_generic_fetch(&methdata, NULL, operation_id,
  404|  1.33k|                                     name, properties,
  405|  1.33k|                                     new_method, up_ref_method, free_method);
  406|  1.33k|    dealloc_tmp_evp_method_store(methdata.tmp_store);
  407|  1.33k|    return method;
  408|  1.33k|}
evp_generic_fetch_from_prov:
  423|    118|{
  424|    118|    struct evp_method_data_st methdata;
  425|    118|    void *method;
  426|       |
  427|    118|    methdata.libctx = ossl_provider_libctx(prov);
  428|    118|    methdata.tmp_store = NULL;
  429|    118|    method = inner_evp_generic_fetch(&methdata, prov, operation_id,
  430|    118|                                     name, properties,
  431|    118|                                     new_method, up_ref_method, free_method);
  432|    118|    dealloc_tmp_evp_method_store(methdata.tmp_store);
  433|    118|    return method;
  434|    118|}
evp_is_a:
  658|      3|{
  659|       |    /*
  660|       |     * For a |prov| that is NULL, the library context will be NULL
  661|       |     */
  662|      3|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  663|      3|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  664|       |
  665|      3|    if (prov == NULL)
  ------------------
  |  Branch (665:9): [True: 0, False: 3]
  ------------------
  666|      0|        number = ossl_namemap_name2num(namemap, legacy_name);
  667|      3|    return ossl_namemap_name2num(namemap, name) == number;
  668|      3|}
evp_names_do_all:
  673|    363|{
  674|    363|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  675|    363|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  676|       |
  677|    363|    return ossl_namemap_doall_names(namemap, number, fn, data);
  678|    363|}
evp_fetch.c:inner_evp_generic_fetch:
  259|  1.45k|{
  260|  1.45k|    OSSL_METHOD_STORE *store = get_evp_method_store(methdata->libctx);
  261|  1.45k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  262|       |#ifdef FIPS_MODULE
  263|       |    /*
  264|       |     * The FIPS provider has its own internal library context where only it
  265|       |     * is loaded.  Consequently, property queries aren't relevant because
  266|       |     * there is only one fetchable algorithm and it is assumed that the
  267|       |     * FIPS-ness is handled by the using algorithm.
  268|       |     */
  269|       |    const char *const propq = "";
  270|       |#else
  271|  1.45k|    const char *const propq = properties != NULL ? properties : "";
  ------------------
  |  Branch (271:31): [True: 0, False: 1.45k]
  ------------------
  272|  1.45k|#endif  /* FIPS_MODULE */
  273|  1.45k|    uint32_t meth_id = 0;
  274|  1.45k|    void *method = NULL;
  275|  1.45k|    int unsupported, name_id;
  276|       |
  277|  1.45k|    if (store == NULL || namemap == NULL) {
  ------------------
  |  Branch (277:9): [True: 0, False: 1.45k]
  |  Branch (277:26): [True: 0, False: 1.45k]
  ------------------
  278|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  279|      0|        return NULL;
  280|      0|    }
  281|       |
  282|       |    /*
  283|       |     * If there's ever an operation_id == 0 passed, we have an internal
  284|       |     * programming error.
  285|       |     */
  286|  1.45k|    if (!ossl_assert(operation_id > 0)) {
  ------------------
  |  |   52|  1.45k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  1.45k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (286:9): [True: 0, False: 1.45k]
  ------------------
  287|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  288|      0|        return NULL;
  289|      0|    }
  290|       |
  291|       |    /* If we haven't received a name id yet, try to get one for the name */
  292|  1.45k|    name_id = name != NULL ? ossl_namemap_name2num(namemap, name) : 0;
  ------------------
  |  Branch (292:15): [True: 1.45k, False: 0]
  ------------------
  293|       |
  294|       |    /*
  295|       |     * If we have a name id, calculate a method id with evp_method_id().
  296|       |     *
  297|       |     * evp_method_id returns 0 if we have too many operations (more than
  298|       |     * about 2^8) or too many names (more than about 2^24).  In that case,
  299|       |     * we can't create any new method.
  300|       |     * For all intents and purposes, this is an internal error.
  301|       |     */
  302|  1.45k|    if (name_id != 0 && (meth_id = evp_method_id(name_id, operation_id)) == 0) {
  ------------------
  |  Branch (302:9): [True: 1.45k, False: 6]
  |  Branch (302:25): [True: 0, False: 1.45k]
  ------------------
  303|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  304|      0|        return NULL;
  305|      0|    }
  306|       |
  307|       |    /*
  308|       |     * If we haven't found the name yet, chances are that the algorithm to
  309|       |     * be fetched is unsupported.
  310|       |     */
  311|  1.45k|    unsupported = name_id == 0;
  312|       |
  313|  1.45k|    if (meth_id == 0
  ------------------
  |  Branch (313:9): [True: 6, False: 1.45k]
  ------------------
  314|  1.45k|        || !ossl_method_store_cache_get(store, prov, meth_id, propq, &method)) {
  ------------------
  |  Branch (314:12): [True: 51, False: 1.40k]
  ------------------
  315|     57|        OSSL_METHOD_CONSTRUCT_METHOD mcm = {
  316|     57|            get_tmp_evp_method_store,
  317|     57|            reserve_evp_method_store,
  318|     57|            unreserve_evp_method_store,
  319|     57|            get_evp_method_from_store,
  320|     57|            put_evp_method_in_store,
  321|     57|            construct_evp_method,
  322|     57|            destruct_evp_method
  323|     57|        };
  324|       |
  325|     57|        methdata->operation_id = operation_id;
  326|     57|        methdata->name_id = name_id;
  327|     57|        methdata->names = name;
  328|     57|        methdata->propquery = propq;
  329|     57|        methdata->method_from_algorithm = new_method;
  330|     57|        methdata->refcnt_up_method = up_ref_method;
  331|     57|        methdata->destruct_method = free_method;
  332|     57|        methdata->flag_construct_error_occurred = 0;
  333|     57|        if ((method = ossl_method_construct(methdata->libctx, operation_id,
  ------------------
  |  Branch (333:13): [True: 14, False: 43]
  ------------------
  334|     57|                                            &prov, 0 /* !force_cache */,
  335|     57|                                            &mcm, methdata)) != NULL) {
  336|       |            /*
  337|       |             * If construction did create a method for us, we know that
  338|       |             * there is a correct name_id and meth_id, since those have
  339|       |             * already been calculated in get_evp_method_from_store() and
  340|       |             * put_evp_method_in_store() above.
  341|       |             * Note that there is a corner case here, in which, if a user
  342|       |             * passes a name of the form name1:name2:..., then the construction
  343|       |             * will create a method against all names, but the lookup will fail
  344|       |             * as ossl_namemap_name2num treats the name string as a single name
  345|       |             * rather than introducing new features where in the EVP_<obj>_fetch
  346|       |             * parses the string and queries for each, return an error.
  347|       |             */
  348|     14|            if (name_id == 0)
  ------------------
  |  Branch (348:17): [True: 3, False: 11]
  ------------------
  349|      3|                name_id = ossl_namemap_name2num(namemap, name);
  350|     14|            if (name_id == 0) {
  ------------------
  |  Branch (350:17): [True: 0, False: 14]
  ------------------
  351|      0|                ERR_raise_data(ERR_LIB_EVP, ERR_R_FETCH_FAILED,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                              ERR_raise_data(ERR_LIB_EVP, ERR_R_FETCH_FAILED,
  ------------------
  |  |   76|      0|# define ERR_LIB_EVP             6
  ------------------
                              ERR_raise_data(ERR_LIB_EVP, 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  352|      0|                               "Algorithm %s cannot be found", name);
  353|      0|                free_method(method);
  354|      0|                method = NULL;
  355|     14|            } else {
  356|     14|                meth_id = evp_method_id(name_id, operation_id);
  357|     14|                if (meth_id != 0)
  ------------------
  |  Branch (357:21): [True: 14, False: 0]
  ------------------
  358|     14|                    ossl_method_store_cache_set(store, prov, meth_id, propq,
  359|     14|                                                method, up_ref_method, free_method);
  360|     14|            }
  361|     14|        }
  362|       |
  363|       |        /*
  364|       |         * If we never were in the constructor, the algorithm to be fetched
  365|       |         * is unsupported.
  366|       |         */
  367|     57|        unsupported = !methdata->flag_construct_error_occurred;
  368|     57|    }
  369|       |
  370|  1.45k|    if ((name_id != 0 || name != NULL) && method == NULL) {
  ------------------
  |  Branch (370:10): [True: 1.45k, False: 3]
  |  Branch (370:26): [True: 3, False: 0]
  |  Branch (370:43): [True: 43, False: 1.41k]
  ------------------
  371|     43|        int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  363|     43|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|     43|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|     43|# 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 (371:20): [True: 43, False: 0]
  ------------------
  372|       |
  373|     43|        if (name == NULL)
  ------------------
  |  Branch (373:13): [True: 0, False: 43]
  ------------------
  374|      0|            name = ossl_namemap_num2name(namemap, name_id, 0);
  375|     43|        ERR_raise_data(ERR_LIB_EVP, code,
  ------------------
  |  |  403|     43|    (ERR_new(),                                                 \
  |  |  404|     43|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|     43|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|     43|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|     43|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|     43|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, code,
  ------------------
  |  |   76|     43|# define ERR_LIB_EVP             6
  ------------------
  376|     43|                       "%s, Algorithm (%s : %d), Properties (%s)",
  377|     43|                       ossl_lib_ctx_get_descriptor(methdata->libctx),
  378|     43|                       name == NULL ? "<null>" : name, name_id,
  ------------------
  |  Branch (378:24): [True: 0, False: 43]
  ------------------
  379|     43|                       properties == NULL ? "<null>" : properties);
  ------------------
  |  Branch (379:24): [True: 43, False: 0]
  ------------------
  380|  1.41k|    } else {
  381|  1.41k|        OSSL_TRACE4(QUERY, "%s, Algorithm (%s : %d), Properties (%s)\n",
  ------------------
  |  |  297|  1.41k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4))
  |  |  ------------------
  |  |  |  |  283|  1.41k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  382|  1.41k|                    ossl_lib_ctx_get_descriptor(methdata->libctx),
  383|  1.41k|                    name == NULL ? "<null>" : name, name_id,
  384|  1.41k|                    properties == NULL ? "<null>" : properties);
  385|  1.41k|    }
  386|       |
  387|  1.45k|    return method;
  388|  1.45k|}
evp_fetch.c:evp_method_id:
  117|  1.73k|{
  118|  1.73k|    if (!ossl_assert(name_id > 0 && name_id <= METHOD_ID_NAME_MAX)
  ------------------
  |  |   52|  3.47k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 1.73k, False: 0]
  |  |  |  Branch (52:43): [True: 1.73k, False: 0]
  |  |  ------------------
  |  |   53|  3.47k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (118:9): [True: 0, False: 1.73k]
  ------------------
  119|  1.73k|        || !ossl_assert(operation_id > 0
  ------------------
  |  |   52|  3.47k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 1.73k, False: 0]
  |  |  |  Branch (52:43): [True: 1.73k, False: 0]
  |  |  ------------------
  |  |   53|  1.73k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (119:12): [True: 0, False: 1.73k]
  ------------------
  120|  1.73k|                        && operation_id <= METHOD_ID_OPERATION_MAX))
  121|      0|        return 0;
  122|  1.73k|    return (((name_id << METHOD_ID_NAME_OFFSET) & METHOD_ID_NAME_MASK)
  ------------------
  |  |  114|  1.73k|#define METHOD_ID_NAME_OFFSET           8
  ------------------
                  return (((name_id << METHOD_ID_NAME_OFFSET) & METHOD_ID_NAME_MASK)
  ------------------
  |  |  113|  1.73k|#define METHOD_ID_NAME_MASK             0x7FFFFF00
  ------------------
  123|  1.73k|            | (operation_id & METHOD_ID_OPERATION_MASK));
  ------------------
  |  |  111|  1.73k|#define METHOD_ID_OPERATION_MASK        0x000000FF
  ------------------
  124|  1.73k|}
evp_fetch.c:reserve_evp_method_store:
   73|     57|{
   74|     57|    struct evp_method_data_st *methdata = data;
   75|       |
   76|     57|    if (store == NULL
  ------------------
  |  Branch (76:9): [True: 57, False: 0]
  ------------------
   77|     57|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (77:12): [True: 0, False: 57]
  ------------------
   78|      0|        return 0;
   79|       |
   80|     57|    return ossl_method_lock_store(store);
   81|     57|}
evp_fetch.c:unreserve_evp_method_store:
   84|     57|{
   85|     57|    struct evp_method_data_st *methdata = data;
   86|       |
   87|     57|    if (store == NULL
  ------------------
  |  Branch (87:9): [True: 57, False: 0]
  ------------------
   88|     57|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (88:12): [True: 0, False: 57]
  ------------------
   89|      0|        return 0;
   90|       |
   91|     57|    return ossl_method_unlock_store(store);
   92|     57|}
evp_fetch.c:get_evp_method_from_store:
  128|     57|{
  129|     57|    struct evp_method_data_st *methdata = data;
  130|     57|    void *method = NULL;
  131|     57|    int name_id;
  132|     57|    uint32_t meth_id;
  133|       |
  134|       |    /*
  135|       |     * get_evp_method_from_store() is only called to try and get the method
  136|       |     * that evp_generic_fetch() is asking for, and the operation id as well
  137|       |     * as the name or name id are passed via methdata.
  138|       |     */
  139|     57|    if ((name_id = methdata->name_id) == 0 && methdata->names != NULL) {
  ------------------
  |  Branch (139:9): [True: 6, False: 51]
  |  Branch (139:47): [True: 6, False: 0]
  ------------------
  140|      6|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  141|      6|        const char *names = methdata->names;
  142|      6|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   24|      6|#define NAME_SEPARATOR ':'
  ------------------
  143|      6|        size_t l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (143:21): [True: 6, False: 0]
  ------------------
  144|       |
  145|      6|        if (namemap == 0)
  ------------------
  |  Branch (145:13): [True: 0, False: 6]
  ------------------
  146|      0|            return NULL;
  147|      6|        name_id = ossl_namemap_name2num_n(namemap, names, l);
  148|      6|    }
  149|       |
  150|     57|    if (name_id == 0
  ------------------
  |  Branch (150:9): [True: 3, False: 54]
  ------------------
  151|     57|        || (meth_id = evp_method_id(name_id, methdata->operation_id)) == 0)
  ------------------
  |  Branch (151:12): [True: 0, False: 54]
  ------------------
  152|      3|        return NULL;
  153|       |
  154|     54|    if (store == NULL
  ------------------
  |  Branch (154:9): [True: 54, False: 0]
  ------------------
  155|     54|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (155:12): [True: 0, False: 54]
  ------------------
  156|      0|        return NULL;
  157|       |
  158|     54|    if (!ossl_method_store_fetch(store, meth_id, methdata->propquery, prov,
  ------------------
  |  Branch (158:9): [True: 40, False: 14]
  ------------------
  159|     54|                                 &method))
  160|     40|        return NULL;
  161|     14|    return method;
  162|     54|}
evp_fetch.c:put_evp_method_in_store:
  168|    220|{
  169|    220|    struct evp_method_data_st *methdata = data;
  170|    220|    OSSL_NAMEMAP *namemap;
  171|    220|    int name_id;
  172|    220|    uint32_t meth_id;
  173|    220|    size_t l = 0;
  174|       |
  175|       |    /*
  176|       |     * put_evp_method_in_store() is only called with an EVP method that was
  177|       |     * successfully created by construct_method() below, which means that
  178|       |     * all the names should already be stored in the namemap with the same
  179|       |     * numeric identity, so just use the first to get that identity.
  180|       |     */
  181|    220|    if (names != NULL) {
  ------------------
  |  Branch (181:9): [True: 220, False: 0]
  ------------------
  182|    220|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   24|    220|#define NAME_SEPARATOR ':'
  ------------------
  183|       |
  184|    220|        l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (184:14): [True: 78, False: 142]
  ------------------
  185|    220|    }
  186|       |
  187|    220|    if ((namemap = ossl_namemap_stored(methdata->libctx)) == NULL
  ------------------
  |  Branch (187:9): [True: 0, False: 220]
  ------------------
  188|    220|        || (name_id = ossl_namemap_name2num_n(namemap, names, l)) == 0
  ------------------
  |  Branch (188:12): [True: 0, False: 220]
  ------------------
  189|    220|        || (meth_id = evp_method_id(name_id, methdata->operation_id)) == 0)
  ------------------
  |  Branch (189:12): [True: 0, False: 220]
  ------------------
  190|      0|        return 0;
  191|       |
  192|    220|    OSSL_TRACE1(QUERY, "put_evp_method_in_store: original store: %p\n", store);
  ------------------
  |  |  291|    220|    OSSL_TRACEV(category, (trc_out, format, arg1))
  |  |  ------------------
  |  |  |  |  283|    220|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  193|    220|    if (store == NULL
  ------------------
  |  Branch (193:9): [True: 220, False: 0]
  ------------------
  194|    220|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (194:12): [True: 0, False: 220]
  ------------------
  195|      0|        return 0;
  196|       |
  197|    220|    OSSL_TRACE5(QUERY,
  ------------------
  |  |  299|    220|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5))
  |  |  ------------------
  |  |  |  |  283|    220|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  198|    220|                "put_evp_method_in_store: "
  199|    220|                "store: %p, names: %s, operation_id %d, method_id: %d, properties: %s\n",
  200|    220|                store, names, methdata->operation_id, meth_id, propdef ? propdef : "<null>");
  201|    220|    return ossl_method_store_add(store, prov, meth_id, propdef, method,
  202|    220|                                 methdata->refcnt_up_method,
  203|    220|                                 methdata->destruct_method);
  204|    220|}
evp_fetch.c:construct_evp_method:
  212|    220|{
  213|       |    /*
  214|       |     * This function is only called if get_evp_method_from_store() returned
  215|       |     * NULL, so it's safe to say that of all the spots to create a new
  216|       |     * namemap entry, this is it.  Should the name already exist there, we
  217|       |     * know that ossl_namemap_add_name() will return its corresponding
  218|       |     * number.
  219|       |     */
  220|    220|    struct evp_method_data_st *methdata = data;
  221|    220|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  222|    220|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  223|    220|    const char *names = algodef->algorithm_names;
  224|    220|    int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
  ------------------
  |  |   24|    220|#define NAME_SEPARATOR ':'
  ------------------
  225|    220|    void *method;
  226|       |
  227|    220|    if (name_id == 0)
  ------------------
  |  Branch (227:9): [True: 0, False: 220]
  ------------------
  228|      0|        return NULL;
  229|       |
  230|    220|    method = methdata->method_from_algorithm(name_id, algodef, prov);
  231|       |
  232|       |    /*
  233|       |     * Flag to indicate that there was actual construction errors.  This
  234|       |     * helps inner_evp_generic_fetch() determine what error it should
  235|       |     * record on inaccessible algorithms.
  236|       |     */
  237|    220|    if (method == NULL)
  ------------------
  |  Branch (237:9): [True: 0, False: 220]
  ------------------
  238|      0|        methdata->flag_construct_error_occurred = 1;
  239|       |
  240|    220|    return method;
  241|    220|}
evp_fetch.c:destruct_evp_method:
  244|    220|{
  245|    220|    struct evp_method_data_st *methdata = data;
  246|       |
  247|    220|    methdata->destruct_method(method);
  248|    220|}
evp_fetch.c:dealloc_tmp_evp_method_store:
   61|  1.45k|{
   62|  1.45k|    OSSL_TRACE1(QUERY, "Deallocating the tmp_store %p\n", store);
  ------------------
  |  |  291|  1.45k|    OSSL_TRACEV(category, (trc_out, format, arg1))
  |  |  ------------------
  |  |  |  |  283|  1.45k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   63|  1.45k|    if (store != NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 1.45k]
  ------------------
   64|      0|        ossl_method_store_free(store);
   65|  1.45k|}
evp_fetch.c:get_evp_method_store:
   68|  1.84k|{
   69|  1.84k|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX);
  ------------------
  |  |   98|  1.84k|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
   70|  1.84k|}

EVP_CIPHER_get_type:
  256|    183|{
  257|    183|    int nid;
  258|    183|    nid = EVP_CIPHER_get_nid(cipher);
  259|       |
  260|    183|    switch (nid) {
  261|       |
  262|      3|    case NID_rc2_cbc:
  ------------------
  |  | 1280|      3|#define NID_rc2_cbc             37
  ------------------
  |  Branch (262:5): [True: 3, False: 180]
  ------------------
  263|      5|    case NID_rc2_64_cbc:
  ------------------
  |  | 1301|      5|#define NID_rc2_64_cbc          166
  ------------------
  |  Branch (263:5): [True: 2, False: 181]
  ------------------
  264|      7|    case NID_rc2_40_cbc:
  ------------------
  |  | 1297|      7|#define NID_rc2_40_cbc          98
  ------------------
  |  Branch (264:5): [True: 2, False: 181]
  ------------------
  265|       |
  266|      7|        return NID_rc2_cbc;
  ------------------
  |  | 1280|      7|#define NID_rc2_cbc             37
  ------------------
  267|       |
  268|      1|    case NID_rc4:
  ------------------
  |  | 1305|      1|#define NID_rc4         5
  ------------------
  |  Branch (268:5): [True: 1, False: 182]
  ------------------
  269|      2|    case NID_rc4_40:
  ------------------
  |  | 1310|      2|#define NID_rc4_40              97
  ------------------
  |  Branch (269:5): [True: 1, False: 182]
  ------------------
  270|       |
  271|      2|        return NID_rc4;
  ------------------
  |  | 1305|      2|#define NID_rc4         5
  ------------------
  272|       |
  273|      1|    case NID_aes_128_cfb128:
  ------------------
  |  | 3089|      1|#define NID_aes_128_cfb128              421
  ------------------
  |  Branch (273:5): [True: 1, False: 182]
  ------------------
  274|      2|    case NID_aes_128_cfb8:
  ------------------
  |  | 3210|      2|#define NID_aes_128_cfb8                653
  ------------------
  |  Branch (274:5): [True: 1, False: 182]
  ------------------
  275|      3|    case NID_aes_128_cfb1:
  ------------------
  |  | 3198|      3|#define NID_aes_128_cfb1                650
  ------------------
  |  Branch (275:5): [True: 1, False: 182]
  ------------------
  276|       |
  277|      3|        return NID_aes_128_cfb128;
  ------------------
  |  | 3089|      3|#define NID_aes_128_cfb128              421
  ------------------
  278|       |
  279|      1|    case NID_aes_192_cfb128:
  ------------------
  |  | 3127|      1|#define NID_aes_192_cfb128              425
  ------------------
  |  Branch (279:5): [True: 1, False: 182]
  ------------------
  280|      2|    case NID_aes_192_cfb8:
  ------------------
  |  | 3214|      2|#define NID_aes_192_cfb8                654
  ------------------
  |  Branch (280:5): [True: 1, False: 182]
  ------------------
  281|      3|    case NID_aes_192_cfb1:
  ------------------
  |  | 3202|      3|#define NID_aes_192_cfb1                651
  ------------------
  |  Branch (281:5): [True: 1, False: 182]
  ------------------
  282|       |
  283|      3|        return NID_aes_192_cfb128;
  ------------------
  |  | 3127|      3|#define NID_aes_192_cfb128              425
  ------------------
  284|       |
  285|      1|    case NID_aes_256_cfb128:
  ------------------
  |  | 3165|      1|#define NID_aes_256_cfb128              429
  ------------------
  |  Branch (285:5): [True: 1, False: 182]
  ------------------
  286|      2|    case NID_aes_256_cfb8:
  ------------------
  |  | 3218|      2|#define NID_aes_256_cfb8                655
  ------------------
  |  Branch (286:5): [True: 1, False: 182]
  ------------------
  287|      3|    case NID_aes_256_cfb1:
  ------------------
  |  | 3206|      3|#define NID_aes_256_cfb1                652
  ------------------
  |  Branch (287:5): [True: 1, False: 182]
  ------------------
  288|       |
  289|      3|        return NID_aes_256_cfb128;
  ------------------
  |  | 3165|      3|#define NID_aes_256_cfb128              429
  ------------------
  290|       |
  291|      1|    case NID_des_cfb64:
  ------------------
  |  | 2259|      1|#define NID_des_cfb64           30
  ------------------
  |  Branch (291:5): [True: 1, False: 182]
  ------------------
  292|      2|    case NID_des_cfb8:
  ------------------
  |  | 3250|      2|#define NID_des_cfb8            657
  ------------------
  |  Branch (292:5): [True: 1, False: 182]
  ------------------
  293|      3|    case NID_des_cfb1:
  ------------------
  |  | 3246|      3|#define NID_des_cfb1            656
  ------------------
  |  Branch (293:5): [True: 1, False: 182]
  ------------------
  294|       |
  295|      3|        return NID_des_cfb64;
  ------------------
  |  | 2259|      3|#define NID_des_cfb64           30
  ------------------
  296|       |
  297|      1|    case NID_des_ede3_cfb64:
  ------------------
  |  | 2300|      1|#define NID_des_ede3_cfb64              61
  ------------------
  |  Branch (297:5): [True: 1, False: 182]
  ------------------
  298|      2|    case NID_des_ede3_cfb8:
  ------------------
  |  | 3258|      2|#define NID_des_ede3_cfb8               659
  ------------------
  |  Branch (298:5): [True: 1, False: 182]
  ------------------
  299|      3|    case NID_des_ede3_cfb1:
  ------------------
  |  | 3254|      3|#define NID_des_ede3_cfb1               658
  ------------------
  |  Branch (299:5): [True: 1, False: 182]
  ------------------
  300|       |
  301|      3|        return NID_des_cfb64;
  ------------------
  |  | 2259|      3|#define NID_des_cfb64           30
  ------------------
  302|       |
  303|    159|    default:
  ------------------
  |  Branch (303:5): [True: 159, False: 24]
  ------------------
  304|       |#ifdef FIPS_MODULE
  305|       |        return NID_undef;
  306|       |#else
  307|    159|        {
  308|       |            /* Check it has an OID and it is valid */
  309|    159|            ASN1_OBJECT *otmp = OBJ_nid2obj(nid);
  310|       |
  311|    159|            if (OBJ_get0_data(otmp) == NULL)
  ------------------
  |  Branch (311:17): [True: 48, False: 111]
  ------------------
  312|     48|                nid = NID_undef;
  ------------------
  |  |   18|     48|#define NID_undef                       0
  ------------------
  313|    159|            ASN1_OBJECT_free(otmp);
  314|    159|            return nid;
  315|      2|        }
  316|    183|#endif
  317|    183|    }
  318|    183|}
evp_cipher_cache_constants:
  321|    130|{
  322|    130|    int ok, aead = 0, custom_iv = 0, cts = 0, multiblock = 0, randkey = 0;
  323|    130|    int encrypt_then_mac = 0;
  324|    130|    size_t ivlen = 0;
  325|    130|    size_t blksz = 0;
  326|    130|    size_t keylen = 0;
  327|    130|    unsigned int mode = 0;
  328|    130|    OSSL_PARAM params[11];
  329|       |
  330|    130|    params[0] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_BLOCK_SIZE, &blksz);
  ------------------
  |  |  183|    130|# define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize"
  ------------------
  331|    130|    params[1] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_IVLEN, &ivlen);
  ------------------
  |  |  193|    130|# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
  ------------------
  332|    130|    params[2] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_KEYLEN, &keylen);
  ------------------
  |  |  194|    130|# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
  ------------------
  333|    130|    params[3] = OSSL_PARAM_construct_uint(OSSL_CIPHER_PARAM_MODE, &mode);
  ------------------
  |  |  195|    130|# define OSSL_CIPHER_PARAM_MODE "mode"
  ------------------
  334|    130|    params[4] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_AEAD, &aead);
  ------------------
  |  |  169|    130|# define OSSL_CIPHER_PARAM_AEAD "aead"
  ------------------
  335|    130|    params[5] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_CUSTOM_IV,
  ------------------
  |  |  186|    130|# define OSSL_CIPHER_PARAM_CUSTOM_IV "custom-iv"
  ------------------
  336|    130|                                         &custom_iv);
  337|    130|    params[6] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_CTS, &cts);
  ------------------
  |  |  184|    130|# define OSSL_CIPHER_PARAM_CTS "cts"
  ------------------
  338|    130|    params[7] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK,
  ------------------
  |  |  203|    130|# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK "tls-multi"
  ------------------
  339|    130|                                         &multiblock);
  340|    130|    params[8] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_HAS_RAND_KEY,
  ------------------
  |  |  191|    130|# define OSSL_CIPHER_PARAM_HAS_RAND_KEY "has-randkey"
  ------------------
  341|    130|                                         &randkey);
  342|    130|    params[9] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC,
  ------------------
  |  |  188|    130|# define OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC "encrypt-then-mac"
  ------------------
  343|    130|                                         &encrypt_then_mac);
  344|    130|    params[10] = OSSL_PARAM_construct_end();
  345|    130|    ok = evp_do_ciph_getparams(cipher, params) > 0;
  346|    130|    if (ok) {
  ------------------
  |  Branch (346:9): [True: 130, False: 0]
  ------------------
  347|    130|        cipher->block_size = blksz;
  348|    130|        cipher->iv_len = ivlen;
  349|    130|        cipher->key_len = keylen;
  350|    130|        cipher->flags = mode;
  351|    130|        if (aead)
  ------------------
  |  Branch (351:13): [True: 28, False: 102]
  ------------------
  352|     28|            cipher->flags |= EVP_CIPH_FLAG_AEAD_CIPHER;
  ------------------
  |  |  368|     28|# define         EVP_CIPH_FLAG_AEAD_CIPHER       0x200000
  ------------------
  353|    130|        if (custom_iv)
  ------------------
  |  Branch (353:13): [True: 41, False: 89]
  ------------------
  354|     41|            cipher->flags |= EVP_CIPH_CUSTOM_IV;
  ------------------
  |  |  338|     41|# define         EVP_CIPH_CUSTOM_IV              0x10
  ------------------
  355|    130|        if (cts)
  ------------------
  |  Branch (355:13): [True: 6, False: 124]
  ------------------
  356|      6|            cipher->flags |= EVP_CIPH_FLAG_CTS;
  ------------------
  |  |  366|      6|# define         EVP_CIPH_FLAG_CTS               0x4000
  ------------------
  357|    130|        if (multiblock)
  ------------------
  |  Branch (357:13): [True: 4, False: 126]
  ------------------
  358|      4|            cipher->flags |= EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK;
  ------------------
  |  |  369|      4|# define         EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000
  ------------------
  359|    130|        if (cipher->ccipher != NULL)
  ------------------
  |  Branch (359:13): [True: 118, False: 12]
  ------------------
  360|    118|            cipher->flags |= EVP_CIPH_FLAG_CUSTOM_CIPHER;
  ------------------
  |  |  367|    118|# define         EVP_CIPH_FLAG_CUSTOM_CIPHER     0x100000
  ------------------
  361|    130|        if (randkey)
  ------------------
  |  Branch (361:13): [True: 11, False: 119]
  ------------------
  362|     11|            cipher->flags |= EVP_CIPH_RAND_KEY;
  ------------------
  |  |  348|     11|# define         EVP_CIPH_RAND_KEY               0x200
  ------------------
  363|    130|        if (encrypt_then_mac)
  ------------------
  |  Branch (363:13): [True: 0, False: 130]
  ------------------
  364|      0|            cipher->flags |= EVP_CIPH_FLAG_ENC_THEN_MAC;
  ------------------
  |  |  379|      0|# define         EVP_CIPH_FLAG_ENC_THEN_MAC      0x10000000
  ------------------
  365|    130|        if (OSSL_PARAM_locate_const(EVP_CIPHER_gettable_ctx_params(cipher),
  ------------------
  |  Branch (365:13): [True: 0, False: 130]
  ------------------
  366|    130|                                    OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS))
  ------------------
  |  |  181|    130|# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS
  |  |  ------------------
  |  |  |  |  120|    130|# define OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS "algorithm-id-params"
  |  |  ------------------
  ------------------
  367|      0|            cipher->flags |= EVP_CIPH_FLAG_CUSTOM_ASN1;
  ------------------
  |  |  373|      0|# define         EVP_CIPH_FLAG_CUSTOM_ASN1       0x1000000
  ------------------
  368|    130|    }
  369|    130|    return ok;
  370|    130|}
EVP_CIPHER_get_iv_length:
  491|      3|{
  492|      3|    return (cipher == NULL) ? 0 : cipher->iv_len;
  ------------------
  |  Branch (492:12): [True: 0, False: 3]
  ------------------
  493|      3|}
EVP_CIPHER_CTX_get_iv_length:
  496|    341|{
  497|    341|    if (ctx->cipher == NULL)
  ------------------
  |  Branch (497:9): [True: 0, False: 341]
  ------------------
  498|      0|        return 0;
  499|       |
  500|    341|    if (ctx->iv_len < 0) {
  ------------------
  |  Branch (500:9): [True: 3, False: 338]
  ------------------
  501|      3|        int rv, len = EVP_CIPHER_get_iv_length(ctx->cipher);
  502|      3|        size_t v = len;
  503|      3|        OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      3|    { NULL, 0, NULL, 0, 0 }
  ------------------
                      OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      3|    { NULL, 0, NULL, 0, 0 }
  ------------------
  504|       |
  505|      3|        if (ctx->cipher->get_ctx_params != NULL) {
  ------------------
  |  Branch (505:13): [True: 3, False: 0]
  ------------------
  506|      3|            params[0] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_IVLEN,
  ------------------
  |  |  193|      3|# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
  ------------------
  507|      3|                                                    &v);
  508|      3|            rv = evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params);
  509|      3|            if (rv > 0) {
  ------------------
  |  Branch (509:17): [True: 3, False: 0]
  ------------------
  510|      3|                if (OSSL_PARAM_modified(params)
  ------------------
  |  Branch (510:21): [True: 3, False: 0]
  ------------------
  511|      3|                        && !OSSL_PARAM_get_int(params, &len))
  ------------------
  |  Branch (511:28): [True: 0, False: 3]
  ------------------
  512|      0|                    return -1;
  513|      3|            } else if (rv != EVP_CTRL_RET_UNSUPPORTED) {
  ------------------
  |  |   13|      0|#define EVP_CTRL_RET_UNSUPPORTED -1
  ------------------
  |  Branch (513:24): [True: 0, False: 0]
  ------------------
  514|      0|                return -1;
  515|      0|            }
  516|      3|        }
  517|       |        /* Code below to be removed when legacy support is dropped. */
  518|      0|        else if ((EVP_CIPHER_get_flags(ctx->cipher)
  ------------------
  |  Branch (518:18): [True: 0, False: 0]
  ------------------
  519|      0|                  & EVP_CIPH_CUSTOM_IV_LENGTH) != 0) {
  ------------------
  |  |  352|      0|# define         EVP_CIPH_CUSTOM_IV_LENGTH       0x800
  ------------------
  520|      0|            rv = EVP_CIPHER_CTX_ctrl((EVP_CIPHER_CTX *)ctx, EVP_CTRL_GET_IVLEN,
  ------------------
  |  |  453|      0|# define         EVP_CTRL_GET_IVLEN                      0x25
  ------------------
  521|      0|                                     0, &len);
  522|      0|            if (rv <= 0)
  ------------------
  |  Branch (522:17): [True: 0, False: 0]
  ------------------
  523|      0|                return -1;
  524|      0|        }
  525|       |        /*-
  526|       |         * Casting away the const is annoying but required here.  We need to
  527|       |         * cache the result for performance reasons.
  528|       |         */
  529|      3|        ((EVP_CIPHER_CTX *)ctx)->iv_len = len;
  530|      3|    }
  531|    341|    return ctx->iv_len;
  532|    341|}
EVP_CIPHER_get_key_length:
  642|      3|{
  643|      3|    return cipher->key_len;
  644|      3|}
EVP_CIPHER_CTX_get_key_length:
  647|    715|{
  648|    715|    if (ctx->cipher == NULL)
  ------------------
  |  Branch (648:9): [True: 0, False: 715]
  ------------------
  649|      0|        return 0;
  650|       |
  651|    715|    if (ctx->key_len <= 0 && ctx->cipher->prov != NULL) {
  ------------------
  |  Branch (651:9): [True: 9, False: 706]
  |  Branch (651:30): [True: 9, False: 0]
  ------------------
  652|      9|        int ok;
  653|      9|        OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      9|    { NULL, 0, NULL, 0, 0 }
  ------------------
                      OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      9|    { NULL, 0, NULL, 0, 0 }
  ------------------
  654|      9|        size_t len;
  655|       |
  656|      9|        params[0] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_KEYLEN, &len);
  ------------------
  |  |  194|      9|# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
  ------------------
  657|      9|        ok = evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params);
  658|      9|        if (ok <= 0)
  ------------------
  |  Branch (658:13): [True: 0, False: 9]
  ------------------
  659|      0|            return EVP_CTRL_RET_UNSUPPORTED;
  ------------------
  |  |   13|      0|#define EVP_CTRL_RET_UNSUPPORTED -1
  ------------------
  660|       |
  661|       |        /*-
  662|       |         * The if branch should never be taken since EVP_MAX_KEY_LENGTH is
  663|       |         * less than INT_MAX but best to be safe.
  664|       |         *
  665|       |         * Casting away the const is annoying but required here.  We need to
  666|       |         * cache the result for performance reasons.
  667|       |         */
  668|      9|        if (!OSSL_PARAM_get_int(params, &((EVP_CIPHER_CTX *)ctx)->key_len))
  ------------------
  |  Branch (668:13): [True: 0, False: 9]
  ------------------
  669|      0|            return -1;
  670|      9|        ((EVP_CIPHER_CTX *)ctx)->key_len = (int)len;
  671|      9|    }
  672|    715|    return ctx->key_len;
  673|    715|}
EVP_CIPHER_get_nid:
  676|    317|{
  677|    317|    return (cipher == NULL) ? NID_undef : cipher->nid;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (677:12): [True: 0, False: 317]
  ------------------
  678|    317|}
EVP_CIPHER_get0_provider:
  732|    130|{
  733|    130|    return cipher->prov;
  734|    130|}
EVP_MD_get_type:
  795|     82|{
  796|     82|    return md->type;
  797|     82|}
EVP_MD_get_size:
  814|    424|{
  815|    424|    if (md == NULL) {
  ------------------
  |  Branch (815:9): [True: 0, False: 424]
  ------------------
  816|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  817|      0|        return -1;
  818|      0|    }
  819|    424|    return md->md_size;
  820|    424|}
EVP_MD_xof:
  823|  1.78k|{
  824|  1.78k|    return md != NULL && ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0);
  ------------------
  |  |  184|  1.78k|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
  |  Branch (824:12): [True: 1.78k, False: 0]
  |  Branch (824:26): [True: 1.52k, False: 258]
  ------------------
  825|  1.78k|}
EVP_MD_get_flags:
  828|  1.78k|{
  829|  1.78k|    return md->flags;
  830|  1.78k|}
evp_md_free_int:
  866|     27|{
  867|     27|    OPENSSL_free(md->type_name);
  ------------------
  |  |  115|     27|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  868|     27|    ossl_provider_free(md->prov);
  869|     27|    CRYPTO_FREE_REF(&md->refcnt);
  870|     27|    OPENSSL_free(md);
  ------------------
  |  |  115|     27|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  871|     27|}
EVP_MD_CTX_get0_md:
 1023|  2.20k|{
 1024|  2.20k|    if (ctx == NULL)
  ------------------
  |  Branch (1024:9): [True: 0, False: 2.20k]
  ------------------
 1025|      0|        return NULL;
 1026|  2.20k|    return ctx->reqdigest;
 1027|  2.20k|}
EVP_MD_CTX_get_size_ex:
 1042|    424|{
 1043|    424|    EVP_MD_CTX *c = (EVP_MD_CTX *)ctx;
 1044|    424|    const OSSL_PARAM *gettables;
 1045|       |
 1046|    424|    gettables = EVP_MD_CTX_gettable_params(c);
 1047|    424|    if (gettables != NULL
  ------------------
  |  Branch (1047:9): [True: 0, False: 424]
  ------------------
 1048|    424|            && OSSL_PARAM_locate_const(gettables,
  ------------------
  |  Branch (1048:16): [True: 0, False: 0]
  ------------------
 1049|      0|                                       OSSL_DIGEST_PARAM_SIZE) != NULL) {
  ------------------
  |  |  223|      0|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
 1050|      0|        OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      0|    { NULL, 0, NULL, 0, 0 }
  ------------------
                      OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      0|    { NULL, 0, NULL, 0, 0 }
  ------------------
 1051|      0|        size_t sz = 0;
 1052|       |
 1053|       |        /*
 1054|       |         * For XOF's EVP_MD_get_size() returns 0
 1055|       |         * So try to get the xoflen instead. This will return -1 if the
 1056|       |         * xof length has not been set.
 1057|       |         */
 1058|      0|        params[0] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_SIZE, &sz);
  ------------------
  |  |  223|      0|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
 1059|      0|        if (EVP_MD_CTX_get_params(c, params) != 1
  ------------------
  |  Branch (1059:13): [True: 0, False: 0]
  ------------------
 1060|      0|                || sz == SIZE_MAX
  ------------------
  |  Branch (1060:20): [True: 0, False: 0]
  ------------------
 1061|      0|                || sz == 0)
  ------------------
  |  Branch (1061:20): [True: 0, False: 0]
  ------------------
 1062|      0|            return -1;
 1063|      0|        return sz;
 1064|      0|    }
 1065|       |    /* Normal digests have a constant fixed size output */
 1066|    424|    return EVP_MD_get_size(EVP_MD_CTX_get0_md(ctx));
 1067|    424|}
EVP_MD_CTX_set_flags:
 1114|    258|{
 1115|    258|    ctx->flags |= flags;
 1116|    258|}
EVP_MD_CTX_clear_flags:
 1119|  3.46k|{
 1120|  3.46k|    ctx->flags &= ~flags;
 1121|  3.46k|}
EVP_MD_CTX_test_flags:
 1124|    298|{
 1125|    298|    return (ctx->flags & flags);
 1126|    298|}

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

EVP_RAND_enable_locking:
   95|      1|{
   96|      1|    if (rand->meth->enable_locking != NULL)
  ------------------
  |  Branch (96:9): [True: 1, False: 0]
  ------------------
   97|      1|        return rand->meth->enable_locking(rand->algctx);
   98|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   99|      0|    return 0;
  100|      1|}
EVP_RAND_fetch:
  287|      4|{
  288|      4|    return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties,
  ------------------
  |  |  314|      4|# define OSSL_OP_RAND                                5
  ------------------
  289|      4|                             evp_rand_from_algorithm, evp_rand_up_ref,
  290|      4|                             evp_rand_free);
  291|      4|}
EVP_RAND_up_ref:
  294|      4|{
  295|      4|    return evp_rand_up_ref(rand);
  296|      4|}
EVP_RAND_free:
  299|      8|{
  300|      8|    evp_rand_free(rand);
  301|      8|}
EVP_RAND_get0_provider:
  324|      6|{
  325|      6|    return rand->prov;
  326|      6|}
EVP_RAND_CTX_up_ref:
  336|      3|{
  337|      3|    int ref = 0;
  338|       |
  339|      3|    return CRYPTO_UP_REF(&ctx->refcnt, &ref);
  340|      3|}
EVP_RAND_CTX_new:
  343|      4|{
  344|      4|    EVP_RAND_CTX *ctx;
  345|      4|    void *parent_ctx = NULL;
  346|      4|    const OSSL_DISPATCH *parent_dispatch = NULL;
  347|       |
  348|      4|    if (rand == NULL) {
  ------------------
  |  Branch (348:9): [True: 0, False: 4]
  ------------------
  349|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  350|      0|        return NULL;
  351|      0|    }
  352|       |
  353|      4|    ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |  104|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  354|      4|    if (ctx == NULL)
  ------------------
  |  Branch (354:9): [True: 0, False: 4]
  ------------------
  355|      0|        return NULL;
  356|      4|    if (!CRYPTO_NEW_REF(&ctx->refcnt, 1)) {
  ------------------
  |  Branch (356:9): [True: 0, False: 4]
  ------------------
  357|      0|        OPENSSL_free(ctx);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  358|      0|        return NULL;
  359|      0|    }
  360|      4|    if (parent != NULL) {
  ------------------
  |  Branch (360:9): [True: 3, False: 1]
  ------------------
  361|      3|        if (!EVP_RAND_CTX_up_ref(parent)) {
  ------------------
  |  Branch (361:13): [True: 0, False: 3]
  ------------------
  362|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  363|      0|            CRYPTO_FREE_REF(&ctx->refcnt);
  364|      0|            OPENSSL_free(ctx);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  365|      0|            return NULL;
  366|      0|        }
  367|      3|        parent_ctx = parent->algctx;
  368|      3|        parent_dispatch = parent->meth->dispatch;
  369|      3|    }
  370|      4|    if ((ctx->algctx = rand->newctx(ossl_provider_ctx(rand->prov), parent_ctx,
  ------------------
  |  Branch (370:9): [True: 0, False: 4]
  ------------------
  371|      4|                                    parent_dispatch)) == NULL
  372|      4|            || !EVP_RAND_up_ref(rand)) {
  ------------------
  |  Branch (372:16): [True: 0, False: 4]
  ------------------
  373|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  374|      0|        rand->freectx(ctx->algctx);
  375|      0|        CRYPTO_FREE_REF(&ctx->refcnt);
  376|      0|        OPENSSL_free(ctx);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  377|      0|        EVP_RAND_CTX_free(parent);
  378|      0|        return NULL;
  379|      0|    }
  380|      4|    ctx->meth = rand;
  381|      4|    ctx->parent = parent;
  382|      4|    return ctx;
  383|      4|}
EVP_RAND_CTX_free:
  386|      8|{
  387|      8|    int ref = 0;
  388|      8|    EVP_RAND_CTX *parent;
  389|       |
  390|      8|    if (ctx == NULL)
  ------------------
  |  Branch (390:9): [True: 1, False: 7]
  ------------------
  391|      1|        return;
  392|       |
  393|      7|    CRYPTO_DOWN_REF(&ctx->refcnt, &ref);
  394|      7|    if (ref > 0)
  ------------------
  |  Branch (394:9): [True: 3, False: 4]
  ------------------
  395|      3|        return;
  396|      4|    parent = ctx->parent;
  397|      4|    ctx->meth->freectx(ctx->algctx);
  398|      4|    ctx->algctx = NULL;
  399|      4|    EVP_RAND_free(ctx->meth);
  400|      4|    CRYPTO_FREE_REF(&ctx->refcnt);
  401|      4|    OPENSSL_free(ctx);
  ------------------
  |  |  115|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  402|      4|    EVP_RAND_CTX_free(parent);
  403|      4|}
EVP_RAND_CTX_settable_params:
  484|      3|{
  485|      3|    void *provctx;
  486|       |
  487|      3|    if (ctx->meth->settable_ctx_params == NULL)
  ------------------
  |  Branch (487:9): [True: 0, False: 3]
  ------------------
  488|      0|        return NULL;
  489|      3|    provctx = ossl_provider_ctx(EVP_RAND_get0_provider(ctx->meth));
  490|      3|    return ctx->meth->settable_ctx_params(ctx->algctx, provctx);
  491|      3|}
EVP_RAND_instantiate:
  525|      4|{
  526|      4|    int res;
  527|       |
  528|      4|    if (!evp_rand_lock(ctx))
  ------------------
  |  Branch (528:9): [True: 0, False: 4]
  ------------------
  529|      0|        return 0;
  530|      4|    res = evp_rand_instantiate_locked(ctx, strength, prediction_resistance,
  531|      4|                                      pstr, pstr_len, params);
  532|      4|    evp_rand_unlock(ctx);
  533|      4|    return res;
  534|      4|}
EVP_RAND_generate:
  587|    339|{
  588|    339|    int res;
  589|       |
  590|    339|    if (!evp_rand_lock(ctx))
  ------------------
  |  Branch (590:9): [True: 0, False: 339]
  ------------------
  591|      0|        return 0;
  592|    339|    res = evp_rand_generate_locked(ctx, out, outlen, strength,
  593|    339|                                   prediction_resistance, addin, addin_len);
  594|    339|    evp_rand_unlock(ctx);
  595|    339|    return res;
  596|    339|}
evp_rand.c:evp_rand_from_algorithm:
  120|      5|{
  121|      5|    const OSSL_DISPATCH *fns = algodef->implementation;
  122|      5|    EVP_RAND *rand = NULL;
  123|      5|    int fnrandcnt = 0, fnctxcnt = 0, fnlockcnt = 0, fnenablelockcnt = 0;
  124|       |#ifdef FIPS_MODULE
  125|       |    int fnzeroizecnt = 0;
  126|       |#endif
  127|       |
  128|      5|    if ((rand = evp_rand_new()) == NULL) {
  ------------------
  |  Branch (128:9): [True: 0, False: 5]
  ------------------
  129|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  130|      0|        return NULL;
  131|      0|    }
  132|      5|    rand->name_id = name_id;
  133|      5|    if ((rand->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (133:9): [True: 0, False: 5]
  ------------------
  134|      0|        evp_rand_free(rand);
  135|      0|        return NULL;
  136|      0|    }
  137|      5|    rand->description = algodef->algorithm_description;
  138|      5|    rand->dispatch = fns;
  139|     83|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (139:12): [True: 78, False: 5]
  ------------------
  140|     78|        switch (fns->function_id) {
  ------------------
  |  Branch (140:17): [True: 0, False: 78]
  ------------------
  141|      5|        case OSSL_FUNC_RAND_NEWCTX:
  ------------------
  |  |  535|      5|# define OSSL_FUNC_RAND_NEWCTX                        1
  ------------------
  |  Branch (141:9): [True: 5, False: 73]
  ------------------
  142|      5|            if (rand->newctx != NULL)
  ------------------
  |  Branch (142:17): [True: 0, False: 5]
  ------------------
  143|      0|                break;
  144|      5|            rand->newctx = OSSL_FUNC_rand_newctx(fns);
  145|      5|            fnctxcnt++;
  146|      5|            break;
  147|      5|        case OSSL_FUNC_RAND_FREECTX:
  ------------------
  |  |  536|      5|# define OSSL_FUNC_RAND_FREECTX                       2
  ------------------
  |  Branch (147:9): [True: 5, False: 73]
  ------------------
  148|      5|            if (rand->freectx != NULL)
  ------------------
  |  Branch (148:17): [True: 0, False: 5]
  ------------------
  149|      0|                break;
  150|      5|            rand->freectx = OSSL_FUNC_rand_freectx(fns);
  151|      5|            fnctxcnt++;
  152|      5|            break;
  153|      5|        case OSSL_FUNC_RAND_INSTANTIATE:
  ------------------
  |  |  537|      5|# define OSSL_FUNC_RAND_INSTANTIATE                   3
  ------------------
  |  Branch (153:9): [True: 5, False: 73]
  ------------------
  154|      5|            if (rand->instantiate != NULL)
  ------------------
  |  Branch (154:17): [True: 0, False: 5]
  ------------------
  155|      0|                break;
  156|      5|            rand->instantiate = OSSL_FUNC_rand_instantiate(fns);
  157|      5|            fnrandcnt++;
  158|      5|            break;
  159|      5|        case OSSL_FUNC_RAND_UNINSTANTIATE:
  ------------------
  |  |  538|      5|# define OSSL_FUNC_RAND_UNINSTANTIATE                 4
  ------------------
  |  Branch (159:9): [True: 5, False: 73]
  ------------------
  160|      5|             if (rand->uninstantiate != NULL)
  ------------------
  |  Branch (160:18): [True: 0, False: 5]
  ------------------
  161|      0|                break;
  162|      5|            rand->uninstantiate = OSSL_FUNC_rand_uninstantiate(fns);
  163|      5|            fnrandcnt++;
  164|      5|            break;
  165|      5|        case OSSL_FUNC_RAND_GENERATE:
  ------------------
  |  |  539|      5|# define OSSL_FUNC_RAND_GENERATE                      5
  ------------------
  |  Branch (165:9): [True: 5, False: 73]
  ------------------
  166|      5|            if (rand->generate != NULL)
  ------------------
  |  Branch (166:17): [True: 0, False: 5]
  ------------------
  167|      0|                break;
  168|      5|            rand->generate = OSSL_FUNC_rand_generate(fns);
  169|      5|            fnrandcnt++;
  170|      5|            break;
  171|      5|        case OSSL_FUNC_RAND_RESEED:
  ------------------
  |  |  540|      5|# define OSSL_FUNC_RAND_RESEED                        6
  ------------------
  |  Branch (171:9): [True: 5, False: 73]
  ------------------
  172|      5|            if (rand->reseed != NULL)
  ------------------
  |  Branch (172:17): [True: 0, False: 5]
  ------------------
  173|      0|                break;
  174|      5|            rand->reseed = OSSL_FUNC_rand_reseed(fns);
  175|      5|            break;
  176|      1|        case OSSL_FUNC_RAND_NONCE:
  ------------------
  |  |  541|      1|# define OSSL_FUNC_RAND_NONCE                         7
  ------------------
  |  Branch (176:9): [True: 1, False: 77]
  ------------------
  177|      1|            if (rand->nonce != NULL)
  ------------------
  |  Branch (177:17): [True: 0, False: 1]
  ------------------
  178|      0|                break;
  179|      1|            rand->nonce = OSSL_FUNC_rand_nonce(fns);
  180|      1|            break;
  181|      5|        case OSSL_FUNC_RAND_ENABLE_LOCKING:
  ------------------
  |  |  542|      5|# define OSSL_FUNC_RAND_ENABLE_LOCKING                8
  ------------------
  |  Branch (181:9): [True: 5, False: 73]
  ------------------
  182|      5|            if (rand->enable_locking != NULL)
  ------------------
  |  Branch (182:17): [True: 0, False: 5]
  ------------------
  183|      0|                break;
  184|      5|            rand->enable_locking = OSSL_FUNC_rand_enable_locking(fns);
  185|      5|            fnenablelockcnt++;
  186|      5|            break;
  187|      5|        case OSSL_FUNC_RAND_LOCK:
  ------------------
  |  |  543|      5|# define OSSL_FUNC_RAND_LOCK                          9
  ------------------
  |  Branch (187:9): [True: 5, False: 73]
  ------------------
  188|      5|            if (rand->lock != NULL)
  ------------------
  |  Branch (188:17): [True: 0, False: 5]
  ------------------
  189|      0|                break;
  190|      5|            rand->lock = OSSL_FUNC_rand_lock(fns);
  191|      5|            fnlockcnt++;
  192|      5|            break;
  193|      5|        case OSSL_FUNC_RAND_UNLOCK:
  ------------------
  |  |  544|      5|# define OSSL_FUNC_RAND_UNLOCK                       10
  ------------------
  |  Branch (193:9): [True: 5, False: 73]
  ------------------
  194|      5|            if (rand->unlock != NULL)
  ------------------
  |  Branch (194:17): [True: 0, False: 5]
  ------------------
  195|      0|                break;
  196|      5|            rand->unlock = OSSL_FUNC_rand_unlock(fns);
  197|      5|            fnlockcnt++;
  198|      5|            break;
  199|      0|        case OSSL_FUNC_RAND_GETTABLE_PARAMS:
  ------------------
  |  |  545|      0|# define OSSL_FUNC_RAND_GETTABLE_PARAMS              11
  ------------------
  |  Branch (199:9): [True: 0, False: 78]
  ------------------
  200|      0|            if (rand->gettable_params != NULL)
  ------------------
  |  Branch (200:17): [True: 0, False: 0]
  ------------------
  201|      0|                break;
  202|      0|            rand->gettable_params =
  203|      0|                OSSL_FUNC_rand_gettable_params(fns);
  204|      0|            break;
  205|      5|        case OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  546|      5|# define OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS          12
  ------------------
  |  Branch (205:9): [True: 5, False: 73]
  ------------------
  206|      5|            if (rand->gettable_ctx_params != NULL)
  ------------------
  |  Branch (206:17): [True: 0, False: 5]
  ------------------
  207|      0|                break;
  208|      5|            rand->gettable_ctx_params =
  209|      5|                OSSL_FUNC_rand_gettable_ctx_params(fns);
  210|      5|            break;
  211|      4|        case OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  547|      4|# define OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS          13
  ------------------
  |  Branch (211:9): [True: 4, False: 74]
  ------------------
  212|      4|            if (rand->settable_ctx_params != NULL)
  ------------------
  |  Branch (212:17): [True: 0, False: 4]
  ------------------
  213|      0|                break;
  214|      4|            rand->settable_ctx_params =
  215|      4|                OSSL_FUNC_rand_settable_ctx_params(fns);
  216|      4|            break;
  217|      0|        case OSSL_FUNC_RAND_GET_PARAMS:
  ------------------
  |  |  548|      0|# define OSSL_FUNC_RAND_GET_PARAMS                   14
  ------------------
  |  Branch (217:9): [True: 0, False: 78]
  ------------------
  218|      0|            if (rand->get_params != NULL)
  ------------------
  |  Branch (218:17): [True: 0, False: 0]
  ------------------
  219|      0|                break;
  220|      0|            rand->get_params = OSSL_FUNC_rand_get_params(fns);
  221|      0|            break;
  222|      5|        case OSSL_FUNC_RAND_GET_CTX_PARAMS:
  ------------------
  |  |  549|      5|# define OSSL_FUNC_RAND_GET_CTX_PARAMS               15
  ------------------
  |  Branch (222:9): [True: 5, False: 73]
  ------------------
  223|      5|            if (rand->get_ctx_params != NULL)
  ------------------
  |  Branch (223:17): [True: 0, False: 5]
  ------------------
  224|      0|                break;
  225|      5|            rand->get_ctx_params = OSSL_FUNC_rand_get_ctx_params(fns);
  226|      5|            fnctxcnt++;
  227|      5|            break;
  228|      4|        case OSSL_FUNC_RAND_SET_CTX_PARAMS:
  ------------------
  |  |  550|      4|# define OSSL_FUNC_RAND_SET_CTX_PARAMS               16
  ------------------
  |  Branch (228:9): [True: 4, False: 74]
  ------------------
  229|      4|            if (rand->set_ctx_params != NULL)
  ------------------
  |  Branch (229:17): [True: 0, False: 4]
  ------------------
  230|      0|                break;
  231|      4|            rand->set_ctx_params = OSSL_FUNC_rand_set_ctx_params(fns);
  232|      4|            break;
  233|      5|        case OSSL_FUNC_RAND_VERIFY_ZEROIZATION:
  ------------------
  |  |  551|      5|# define OSSL_FUNC_RAND_VERIFY_ZEROIZATION           17
  ------------------
  |  Branch (233:9): [True: 5, False: 73]
  ------------------
  234|      5|            if (rand->verify_zeroization != NULL)
  ------------------
  |  Branch (234:17): [True: 0, False: 5]
  ------------------
  235|      0|                break;
  236|      5|            rand->verify_zeroization = OSSL_FUNC_rand_verify_zeroization(fns);
  237|       |#ifdef FIPS_MODULE
  238|       |            fnzeroizecnt++;
  239|       |#endif
  240|      5|            break;
  241|      5|        case OSSL_FUNC_RAND_GET_SEED:
  ------------------
  |  |  552|      5|# define OSSL_FUNC_RAND_GET_SEED                     18
  ------------------
  |  Branch (241:9): [True: 5, False: 73]
  ------------------
  242|      5|            if (rand->get_seed != NULL)
  ------------------
  |  Branch (242:17): [True: 0, False: 5]
  ------------------
  243|      0|                break;
  244|      5|            rand->get_seed = OSSL_FUNC_rand_get_seed(fns);
  245|      5|            break;
  246|      4|        case OSSL_FUNC_RAND_CLEAR_SEED:
  ------------------
  |  |  553|      4|# define OSSL_FUNC_RAND_CLEAR_SEED                   19
  ------------------
  |  Branch (246:9): [True: 4, False: 74]
  ------------------
  247|      4|            if (rand->clear_seed != NULL)
  ------------------
  |  Branch (247:17): [True: 0, False: 4]
  ------------------
  248|      0|                break;
  249|      4|            rand->clear_seed = OSSL_FUNC_rand_clear_seed(fns);
  250|      4|            break;
  251|     78|        }
  252|     78|    }
  253|       |    /*
  254|       |     * In order to be a consistent set of functions we must have at least
  255|       |     * a complete set of "rand" functions and a complete set of context
  256|       |     * management functions.  In FIPS mode, we also require the zeroization
  257|       |     * verification function.
  258|       |     *
  259|       |     * In addition, if locking can be enabled, we need a complete set of
  260|       |     * locking functions.
  261|       |     */
  262|      5|    if (fnrandcnt != 3
  ------------------
  |  Branch (262:9): [True: 0, False: 5]
  ------------------
  263|      5|            || fnctxcnt != 3
  ------------------
  |  Branch (263:16): [True: 0, False: 5]
  ------------------
  264|      5|            || (fnenablelockcnt != 0 && fnenablelockcnt != 1)
  ------------------
  |  Branch (264:17): [True: 5, False: 0]
  |  Branch (264:41): [True: 0, False: 5]
  ------------------
  265|      5|            || (fnlockcnt != 0 && fnlockcnt != 2)
  ------------------
  |  Branch (265:17): [True: 5, False: 0]
  |  Branch (265:35): [True: 0, False: 5]
  ------------------
  266|       |#ifdef FIPS_MODULE
  267|       |            || fnzeroizecnt != 1
  268|       |#endif
  269|      5|       ) {
  270|      0|        evp_rand_free(rand);
  271|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        return NULL;
  273|      0|    }
  274|       |
  275|      5|    if (prov != NULL && !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (275:9): [True: 5, False: 0]
  |  Branch (275:25): [True: 0, False: 5]
  ------------------
  276|      0|        evp_rand_free(rand);
  277|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  278|      0|        return NULL;
  279|      0|    }
  280|      5|    rand->prov = prov;
  281|       |
  282|      5|    return rand;
  283|      5|}
evp_rand.c:evp_rand_new:
   80|      5|{
   81|      5|    EVP_RAND *rand = OPENSSL_zalloc(sizeof(*rand));
  ------------------
  |  |  104|      5|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   82|       |
   83|      5|    if (rand == NULL)
  ------------------
  |  Branch (83:9): [True: 0, False: 5]
  ------------------
   84|      0|        return NULL;
   85|       |
   86|      5|    if (!CRYPTO_NEW_REF(&rand->refcnt, 1)) {
  ------------------
  |  Branch (86:9): [True: 0, False: 5]
  ------------------
   87|      0|        OPENSSL_free(rand);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   88|      0|        return NULL;
   89|      0|    }
   90|      5|    return rand;
   91|      5|}
evp_rand.c:evp_rand_up_ref:
   54|     15|{
   55|     15|    EVP_RAND *rand = (EVP_RAND *)vrand;
   56|     15|    int ref = 0;
   57|       |
   58|     15|    if (rand != NULL)
  ------------------
  |  Branch (58:9): [True: 15, False: 0]
  ------------------
   59|     15|        return CRYPTO_UP_REF(&rand->refcnt, &ref);
   60|      0|    return 1;
   61|     15|}
evp_rand.c:evp_rand_free:
   64|     20|{
   65|     20|    EVP_RAND *rand = (EVP_RAND *)vrand;
   66|     20|    int ref = 0;
   67|       |
   68|     20|    if (rand == NULL)
  ------------------
  |  Branch (68:9): [True: 0, False: 20]
  ------------------
   69|      0|        return;
   70|     20|    CRYPTO_DOWN_REF(&rand->refcnt, &ref);
   71|     20|    if (ref > 0)
  ------------------
  |  Branch (71:9): [True: 15, False: 5]
  ------------------
   72|     15|        return;
   73|      5|    OPENSSL_free(rand->type_name);
  ------------------
  |  |  115|      5|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   74|      5|    ossl_provider_free(rand->prov);
   75|      5|    CRYPTO_FREE_REF(&rand->refcnt);
   76|      5|    OPENSSL_free(rand);
  ------------------
  |  |  115|      5|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|      5|}
evp_rand.c:evp_rand_lock:
  104|    343|{
  105|    343|    if (rand->meth->lock != NULL)
  ------------------
  |  Branch (105:9): [True: 343, False: 0]
  ------------------
  106|    343|        return rand->meth->lock(rand->algctx);
  107|      0|    return 1;
  108|    343|}
evp_rand.c:evp_rand_get_ctx_params_locked:
  412|    339|{
  413|    339|    return ctx->meth->get_ctx_params(ctx->algctx, params);
  414|    339|}
evp_rand.c:evp_rand_unlock:
  112|    343|{
  113|    343|    if (rand->meth->unlock != NULL)
  ------------------
  |  Branch (113:9): [True: 343, False: 0]
  ------------------
  114|    343|        rand->meth->unlock(rand->algctx);
  115|    343|}
evp_rand.c:evp_rand_instantiate_locked:
  516|      4|{
  517|      4|    return ctx->meth->instantiate(ctx->algctx, strength, prediction_resistance,
  518|      4|                                  pstr, pstr_len, params);
  519|      4|}
evp_rand.c:evp_rand_generate_locked:
  557|    339|{
  558|    339|    size_t chunk, max_request = 0;
  559|    339|    OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    339|    { NULL, 0, NULL, 0, 0 }
  ------------------
                  OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    339|    { NULL, 0, NULL, 0, 0 }
  ------------------
  560|       |
  561|    339|    params[0] = OSSL_PARAM_construct_size_t(OSSL_RAND_PARAM_MAX_REQUEST,
  ------------------
  |  |  532|    339|# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
  ------------------
  562|    339|                                            &max_request);
  563|    339|    if (!evp_rand_get_ctx_params_locked(ctx, params)
  ------------------
  |  Branch (563:9): [True: 0, False: 339]
  ------------------
  564|    339|            || max_request == 0) {
  ------------------
  |  Branch (564:16): [True: 0, False: 339]
  ------------------
  565|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  566|      0|        return 0;
  567|      0|    }
  568|    676|    for (; outlen > 0; outlen -= chunk, out += chunk) {
  ------------------
  |  Branch (568:12): [True: 337, False: 339]
  ------------------
  569|    337|        chunk = outlen > max_request ? max_request : outlen;
  ------------------
  |  Branch (569:17): [True: 0, False: 337]
  ------------------
  570|    337|        if (!ctx->meth->generate(ctx->algctx, out, chunk, strength,
  ------------------
  |  Branch (570:13): [True: 0, False: 337]
  ------------------
  571|    337|                                 prediction_resistance, addin, addin_len)) {
  572|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  573|      0|            return 0;
  574|      0|        }
  575|       |        /*
  576|       |         * Prediction resistance is only relevant the first time around,
  577|       |         * subsequently, the DRBG has already been properly reseeded.
  578|       |         */
  579|    337|        prediction_resistance = 0;
  580|    337|    }
  581|    339|    return 1;
  582|    339|}

evp_do_ciph_getparams:
   38|    130|int name (const type *obj, OSSL_PARAM params[])                                \
   39|    130|{                                                                              \
   40|    260|    PARAM_CHECK(obj, func, err)                                                \
  ------------------
  |  |   28|    130|    if (obj == NULL)                                                           \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 0, False: 130]
  |  |  ------------------
  |  |   29|    130|        return 0;                                                              \
  |  |   30|    130|    if (obj->prov == NULL)                                                     \
  |  |  ------------------
  |  |  |  Branch (30:9): [True: 0, False: 130]
  |  |  ------------------
  |  |   31|    130|        return EVP_CTRL_RET_UNSUPPORTED;                                       \
  |  |  ------------------
  |  |  |  |   13|      0|#define EVP_CTRL_RET_UNSUPPORTED -1
  |  |  ------------------
  |  |   32|    130|    if (obj->func == NULL) {                                                   \
  |  |  ------------------
  |  |  |  Branch (32:9): [True: 0, False: 130]
  |  |  ------------------
  |  |   33|      0|        errfunc();                                                             \
  |  |   34|      0|        return 0;                                                              \
  |  |   35|      0|    }
  ------------------
   41|    260|    return obj->func(params);                                                  \
   42|    260|}
evp_do_ciph_ctx_getparams:
   45|     12|int name (const type *obj, void *algctx, OSSL_PARAM params[])                  \
   46|     12|{                                                                              \
   47|     24|    PARAM_CHECK(obj, func, err)                                                \
  ------------------
  |  |   28|     12|    if (obj == NULL)                                                           \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 0, False: 12]
  |  |  ------------------
  |  |   29|     12|        return 0;                                                              \
  |  |   30|     12|    if (obj->prov == NULL)                                                     \
  |  |  ------------------
  |  |  |  Branch (30:9): [True: 0, False: 12]
  |  |  ------------------
  |  |   31|     12|        return EVP_CTRL_RET_UNSUPPORTED;                                       \
  |  |  ------------------
  |  |  |  |   13|      0|#define EVP_CTRL_RET_UNSUPPORTED -1
  |  |  ------------------
  |  |   32|     12|    if (obj->func == NULL) {                                                   \
  |  |  ------------------
  |  |  |  Branch (32:9): [True: 0, False: 12]
  |  |  ------------------
  |  |   33|      0|        errfunc();                                                             \
  |  |   34|      0|        return 0;                                                              \
  |  |   35|      0|    }
  ------------------
   48|     24|    return obj->func(algctx, params);                                          \
   49|     24|}
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_KEYEXCH_free:
  154|     74|{
  155|     74|    int i;
  156|       |
  157|     74|    if (exchange == NULL)
  ------------------
  |  Branch (157:9): [True: 60, False: 14]
  ------------------
  158|     60|        return;
  159|     14|    CRYPTO_DOWN_REF(&exchange->refcnt, &i);
  160|     14|    if (i > 0)
  ------------------
  |  Branch (160:9): [True: 7, False: 7]
  ------------------
  161|      7|        return;
  162|      7|    OPENSSL_free(exchange->type_name);
  ------------------
  |  |  115|      7|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      7|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      7|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|      7|    ossl_provider_free(exchange->prov);
  164|      7|    CRYPTO_FREE_REF(&exchange->refcnt);
  165|      7|    OPENSSL_free(exchange);
  ------------------
  |  |  115|      7|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      7|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      7|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  166|      7|}
EVP_KEYEXCH_up_ref:
  169|      7|{
  170|      7|    int ref = 0;
  171|       |
  172|      7|    CRYPTO_UP_REF(&exchange->refcnt, &ref);
  173|      7|    return 1;
  174|      7|}
EVP_KEYEXCH_fetch:
  183|     20|{
  184|     20|    return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties,
  ------------------
  |  |  316|     20|# define OSSL_OP_KEYEXCH                            11
  ------------------
  185|     20|                             evp_keyexch_from_algorithm,
  186|     20|                             evp_keyexch_up_ref,
  187|     20|                             evp_keyexch_free);
  188|     20|}
evp_keyexch_fetch_from_prov:
  193|     20|{
  194|     20|    return evp_generic_fetch_from_prov(prov, OSSL_OP_KEYEXCH,
  ------------------
  |  |  316|     20|# define OSSL_OP_KEYEXCH                            11
  ------------------
  195|     20|                                       algorithm, properties,
  196|     20|                                       evp_keyexch_from_algorithm,
  197|     20|                                       evp_keyexch_up_ref,
  198|     20|                                       evp_keyexch_free);
  199|     20|}
EVP_PKEY_derive_init:
  202|     20|{
  203|     20|    return EVP_PKEY_derive_init_ex(ctx, NULL);
  204|     20|}
EVP_PKEY_derive_init_ex:
  207|     20|{
  208|     20|    int ret;
  209|     20|    void *provkey = NULL;
  210|     20|    EVP_KEYEXCH *exchange = NULL;
  211|     20|    EVP_KEYMGMT *tmp_keymgmt = NULL;
  212|     20|    const OSSL_PROVIDER *tmp_prov = NULL;
  213|     20|    const char *supported_exch = NULL;
  214|     20|    int iter;
  215|       |
  216|     20|    if (ctx == NULL) {
  ------------------
  |  Branch (216:9): [True: 0, False: 20]
  ------------------
  217|      0|        ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  218|      0|        return -2;
  219|      0|    }
  220|       |
  221|     20|    evp_pkey_ctx_free_old_ops(ctx);
  222|     20|    ctx->operation = EVP_PKEY_OP_DERIVE;
  ------------------
  |  | 1755|     20|# define EVP_PKEY_OP_DERIVE              (1 << 11)
  ------------------
  223|       |
  224|     20|    ERR_set_mark();
  225|       |
  226|     20|    if (evp_pkey_ctx_is_legacy(ctx))
  ------------------
  |  |   36|     20|    ((ctx)->keymgmt == NULL)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 20]
  |  |  ------------------
  ------------------
  227|      0|        goto legacy;
  228|       |
  229|       |    /*
  230|       |     * Some algorithms (e.g. legacy KDFs) don't have a pkey - so we create
  231|       |     * a blank one.
  232|       |     */
  233|     20|    if (ctx->pkey == NULL) {
  ------------------
  |  Branch (233:9): [True: 0, False: 20]
  ------------------
  234|      0|        EVP_PKEY *pkey = EVP_PKEY_new();
  235|       |
  236|      0|        if (pkey == NULL
  ------------------
  |  Branch (236:13): [True: 0, False: 0]
  ------------------
  237|      0|            || !EVP_PKEY_set_type_by_keymgmt(pkey, ctx->keymgmt)
  ------------------
  |  Branch (237:16): [True: 0, False: 0]
  ------------------
  238|      0|            || (pkey->keydata = evp_keymgmt_newdata(ctx->keymgmt)) == NULL) {
  ------------------
  |  Branch (238:16): [True: 0, False: 0]
  ------------------
  239|      0|            ERR_clear_last_mark();
  240|      0|            EVP_PKEY_free(pkey);
  241|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  242|      0|            goto err;
  243|      0|        }
  244|      0|        ctx->pkey = pkey;
  245|      0|    }
  246|       |
  247|       |    /*
  248|       |     * Try to derive the supported exch from |ctx->keymgmt|.
  249|       |     */
  250|     20|    if (!ossl_assert(ctx->pkey->keymgmt == NULL
  ------------------
  |  |   52|     40|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 0, False: 20]
  |  |  |  Branch (52:43): [True: 20, False: 0]
  |  |  ------------------
  |  |   53|     20|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (250:9): [True: 0, False: 20]
  ------------------
  251|     20|                     || ctx->pkey->keymgmt == ctx->keymgmt)) {
  252|      0|        ERR_clear_last_mark();
  253|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|      0|        goto err;
  255|      0|    }
  256|     20|    supported_exch = evp_keymgmt_util_query_operation_name(ctx->keymgmt,
  257|     20|                                                           OSSL_OP_KEYEXCH);
  ------------------
  |  |  316|     20|# define OSSL_OP_KEYEXCH                            11
  ------------------
  258|     20|    if (supported_exch == NULL) {
  ------------------
  |  Branch (258:9): [True: 0, False: 20]
  ------------------
  259|      0|        ERR_clear_last_mark();
  260|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  261|      0|        goto err;
  262|      0|    }
  263|       |
  264|       |
  265|       |    /*
  266|       |     * We perform two iterations:
  267|       |     *
  268|       |     * 1.  Do the normal exchange fetch, using the fetching data given by
  269|       |     *     the EVP_PKEY_CTX.
  270|       |     * 2.  Do the provider specific exchange fetch, from the same provider
  271|       |     *     as |ctx->keymgmt|
  272|       |     *
  273|       |     * We then try to fetch the keymgmt from the same provider as the
  274|       |     * exchange, and try to export |ctx->pkey| to that keymgmt (when
  275|       |     * this keymgmt happens to be the same as |ctx->keymgmt|, the export
  276|       |     * is a no-op, but we call it anyway to not complicate the code even
  277|       |     * more).
  278|       |     * If the export call succeeds (returns a non-NULL provider key pointer),
  279|       |     * we're done and can perform the operation itself.  If not, we perform
  280|       |     * the second iteration, or jump to legacy.
  281|       |     */
  282|     40|    for (iter = 1, provkey = NULL; iter < 3 && provkey == NULL; iter++) {
  ------------------
  |  Branch (282:36): [True: 40, False: 0]
  |  Branch (282:48): [True: 40, False: 0]
  ------------------
  283|     40|        EVP_KEYMGMT *tmp_keymgmt_tofree = NULL;
  284|       |
  285|       |        /*
  286|       |         * If we're on the second iteration, free the results from the first.
  287|       |         * They are NULL on the first iteration, so no need to check what
  288|       |         * iteration we're on.
  289|       |         */
  290|     40|        EVP_KEYEXCH_free(exchange);
  291|     40|        EVP_KEYMGMT_free(tmp_keymgmt);
  292|       |
  293|     40|        switch (iter) {
  ------------------
  |  Branch (293:17): [True: 0, False: 40]
  ------------------
  294|     20|        case 1:
  ------------------
  |  Branch (294:9): [True: 20, False: 20]
  ------------------
  295|     20|            exchange =
  296|     20|                EVP_KEYEXCH_fetch(ctx->libctx, supported_exch, ctx->propquery);
  297|     20|            if (exchange != NULL)
  ------------------
  |  Branch (297:17): [True: 0, False: 20]
  ------------------
  298|      0|                tmp_prov = EVP_KEYEXCH_get0_provider(exchange);
  299|     20|            break;
  300|     20|        case 2:
  ------------------
  |  Branch (300:9): [True: 20, False: 20]
  ------------------
  301|     20|            tmp_prov = EVP_KEYMGMT_get0_provider(ctx->keymgmt);
  302|     20|            exchange =
  303|     20|                evp_keyexch_fetch_from_prov((OSSL_PROVIDER *)tmp_prov,
  304|     20|                                              supported_exch, ctx->propquery);
  305|     20|            if (exchange == NULL)
  ------------------
  |  Branch (305:17): [True: 20, False: 0]
  ------------------
  306|     20|                goto legacy;
  307|      0|            break;
  308|     40|        }
  309|     20|        if (exchange == NULL)
  ------------------
  |  Branch (309:13): [True: 20, False: 0]
  ------------------
  310|     20|            continue;
  311|       |
  312|       |        /*
  313|       |         * Ensure that the key is provided, either natively, or as a cached
  314|       |         * export.  We start by fetching the keymgmt with the same name as
  315|       |         * |ctx->keymgmt|, but from the provider of the exchange method, using
  316|       |         * the same property query as when fetching the exchange method.
  317|       |         * With the keymgmt we found (if we did), we try to export |ctx->pkey|
  318|       |         * to it (evp_pkey_export_to_provider() is smart enough to only actually
  319|       |         * export it if |tmp_keymgmt| is different from |ctx->pkey|'s keymgmt)
  320|       |         */
  321|      0|        tmp_keymgmt_tofree = tmp_keymgmt =
  322|      0|            evp_keymgmt_fetch_from_prov((OSSL_PROVIDER *)tmp_prov,
  323|      0|                                        EVP_KEYMGMT_get0_name(ctx->keymgmt),
  324|      0|                                        ctx->propquery);
  325|      0|        if (tmp_keymgmt != NULL)
  ------------------
  |  Branch (325:13): [True: 0, False: 0]
  ------------------
  326|      0|            provkey = evp_pkey_export_to_provider(ctx->pkey, ctx->libctx,
  327|      0|                                                  &tmp_keymgmt, ctx->propquery);
  328|      0|        if (tmp_keymgmt == NULL)
  ------------------
  |  Branch (328:13): [True: 0, False: 0]
  ------------------
  329|      0|            EVP_KEYMGMT_free(tmp_keymgmt_tofree);
  330|      0|    }
  331|       |
  332|      0|    if (provkey == NULL) {
  ------------------
  |  Branch (332:9): [True: 0, False: 0]
  ------------------
  333|      0|        EVP_KEYEXCH_free(exchange);
  334|      0|        goto legacy;
  335|      0|    }
  336|       |
  337|      0|    ERR_pop_to_mark();
  338|       |
  339|       |    /* No more legacy from here down to legacy: */
  340|       |
  341|       |    /* A Coverity false positive with up_ref/down_ref and free */
  342|       |    /* coverity[use_after_free] */
  343|      0|    ctx->op.kex.exchange = exchange;
  344|       |    /* A Coverity false positive with up_ref/down_ref and free */
  345|       |    /* coverity[deref_arg] */
  346|      0|    ctx->op.kex.algctx = exchange->newctx(ossl_provider_ctx(exchange->prov));
  347|      0|    if (ctx->op.kex.algctx == NULL) {
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|       |        /* The provider key can stay in the cache */
  349|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  350|      0|        goto err;
  351|      0|    }
  352|      0|    ret = exchange->init(ctx->op.kex.algctx, provkey, params);
  353|       |
  354|      0|    EVP_KEYMGMT_free(tmp_keymgmt);
  355|      0|    return ret ? 1 : 0;
  ------------------
  |  Branch (355:12): [True: 0, False: 0]
  ------------------
  356|      0| err:
  357|      0|    evp_pkey_ctx_free_old_ops(ctx);
  358|      0|    ctx->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|      0|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
  359|      0|    EVP_KEYMGMT_free(tmp_keymgmt);
  360|      0|    return 0;
  361|       |
  362|     20| legacy:
  363|       |    /*
  364|       |     * If we don't have the full support we need with provided methods,
  365|       |     * let's go see if legacy does.
  366|       |     */
  367|     20|    ERR_pop_to_mark();
  368|       |
  369|       |#ifdef FIPS_MODULE
  370|       |    return 0;
  371|       |#else
  372|     20|    if (ctx->pmeth == NULL || ctx->pmeth->derive == NULL) {
  ------------------
  |  Branch (372:9): [True: 20, False: 0]
  |  Branch (372:31): [True: 0, False: 0]
  ------------------
  373|     20|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     20|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     20|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     20|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     20|     ERR_set_error)
  |  |  ------------------
  ------------------
  374|     20|        return -2;
  375|     20|    }
  376|       |
  377|      0|    if (ctx->pmeth->derive_init == NULL)
  ------------------
  |  Branch (377:9): [True: 0, False: 0]
  ------------------
  378|      0|        return 1;
  379|      0|    ret = ctx->pmeth->derive_init(ctx);
  380|      0|    if (ret <= 0)
  ------------------
  |  Branch (380:9): [True: 0, False: 0]
  ------------------
  381|      0|        ctx->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|      0|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
  382|      0|    EVP_KEYMGMT_free(tmp_keymgmt);
  383|      0|    return ret;
  384|      0|#endif
  385|      0|}
EVP_PKEY_derive_set_peer_ex:
  389|     20|{
  390|     20|    int ret = 0, check;
  391|     20|    void *provkey = NULL;
  392|     20|    EVP_PKEY_CTX *check_ctx = NULL;
  393|     20|    EVP_KEYMGMT *tmp_keymgmt = NULL, *tmp_keymgmt_tofree = NULL;
  394|       |
  395|     20|    if (ctx == NULL) {
  ------------------
  |  Branch (395:9): [True: 0, False: 20]
  ------------------
  396|      0|        ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  397|      0|        return -1;
  398|      0|    }
  399|       |
  400|     20|    if (!EVP_PKEY_CTX_IS_DERIVE_OP(ctx) || ctx->op.kex.algctx == NULL)
  ------------------
  |  |  744|     40|    (((ctx)->operation & EVP_PKEY_OP_TYPE_DERIVE) != 0)
  |  |  ------------------
  |  |  |  | 1773|     20|    (EVP_PKEY_OP_DERIVE)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1755|     20|# define EVP_PKEY_OP_DERIVE              (1 << 11)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (400:9): [True: 0, False: 20]
  |  Branch (400:44): [True: 20, False: 0]
  ------------------
  401|     20|        goto legacy;
  402|       |
  403|      0|    if (ctx->op.kex.exchange->set_peer == NULL) {
  ------------------
  |  Branch (403:9): [True: 0, False: 0]
  ------------------
  404|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  405|      0|        return -2;
  406|      0|    }
  407|       |
  408|      0|    if (validate_peer) {
  ------------------
  |  Branch (408:9): [True: 0, False: 0]
  ------------------
  409|      0|        check_ctx = EVP_PKEY_CTX_new_from_pkey(ctx->libctx, peer, ctx->propquery);
  410|      0|        if (check_ctx == NULL)
  ------------------
  |  Branch (410:13): [True: 0, False: 0]
  ------------------
  411|      0|            return -1;
  412|      0|        check = EVP_PKEY_public_check(check_ctx);
  413|      0|        EVP_PKEY_CTX_free(check_ctx);
  414|      0|        if (check <= 0)
  ------------------
  |  Branch (414:13): [True: 0, False: 0]
  ------------------
  415|      0|            return -1;
  416|      0|    }
  417|       |
  418|       |    /*
  419|       |     * Ensure that the |peer| is provided, either natively, or as a cached
  420|       |     * export.  We start by fetching the keymgmt with the same name as
  421|       |     * |ctx->keymgmt|, but from the provider of the exchange method, using
  422|       |     * the same property query as when fetching the exchange method.
  423|       |     * With the keymgmt we found (if we did), we try to export |peer|
  424|       |     * to it (evp_pkey_export_to_provider() is smart enough to only actually
  425|       |     * export it if |tmp_keymgmt| is different from |peer|'s keymgmt)
  426|       |     */
  427|      0|    tmp_keymgmt_tofree = tmp_keymgmt =
  428|      0|        evp_keymgmt_fetch_from_prov((OSSL_PROVIDER *)
  429|      0|                                    EVP_KEYEXCH_get0_provider(ctx->op.kex.exchange),
  430|      0|                                    EVP_KEYMGMT_get0_name(ctx->keymgmt),
  431|      0|                                    ctx->propquery);
  432|      0|    if (tmp_keymgmt != NULL)
  ------------------
  |  Branch (432:9): [True: 0, False: 0]
  ------------------
  433|       |        /* A Coverity issue with up_ref/down_ref and free */
  434|       |        /* coverity[pass_freed_arg] */
  435|      0|        provkey = evp_pkey_export_to_provider(peer, ctx->libctx,
  436|      0|                                              &tmp_keymgmt, ctx->propquery);
  437|      0|    EVP_KEYMGMT_free(tmp_keymgmt_tofree);
  438|       |
  439|       |    /*
  440|       |     * If making the key provided wasn't possible, legacy may be able to pick
  441|       |     * it up
  442|       |     */
  443|      0|    if (provkey == NULL)
  ------------------
  |  Branch (443:9): [True: 0, False: 0]
  ------------------
  444|      0|        goto legacy;
  445|      0|    ret = ctx->op.kex.exchange->set_peer(ctx->op.kex.algctx, provkey);
  446|      0|    if (ret <= 0)
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  ------------------
  447|      0|        return ret;
  448|      0|    goto common;
  449|       |
  450|     20| legacy:
  451|       |#ifdef FIPS_MODULE
  452|       |    return ret;
  453|       |#else
  454|     20|    if (ctx->pmeth == NULL
  ------------------
  |  Branch (454:9): [True: 20, False: 0]
  ------------------
  455|     20|        || !(ctx->pmeth->derive != NULL
  ------------------
  |  Branch (455:14): [True: 0, False: 0]
  ------------------
  456|      0|             || ctx->pmeth->encrypt != NULL
  ------------------
  |  Branch (456:17): [True: 0, False: 0]
  ------------------
  457|      0|             || ctx->pmeth->decrypt != NULL)
  ------------------
  |  Branch (457:17): [True: 0, False: 0]
  ------------------
  458|     20|        || ctx->pmeth->ctrl == NULL) {
  ------------------
  |  Branch (458:12): [True: 0, False: 0]
  ------------------
  459|     20|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     20|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     20|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     20|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     20|     ERR_set_error)
  |  |  ------------------
  ------------------
  460|     20|        return -2;
  461|     20|    }
  462|      0|    if (ctx->operation != EVP_PKEY_OP_DERIVE
  ------------------
  |  | 1755|      0|# define EVP_PKEY_OP_DERIVE              (1 << 11)
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  ------------------
  463|      0|        && ctx->operation != EVP_PKEY_OP_ENCRYPT
  ------------------
  |  | 1753|      0|# define EVP_PKEY_OP_ENCRYPT             (1 << 9)
  ------------------
  |  Branch (463:12): [True: 0, False: 0]
  ------------------
  464|      0|        && ctx->operation != EVP_PKEY_OP_DECRYPT) {
  ------------------
  |  | 1754|      0|# define EVP_PKEY_OP_DECRYPT             (1 << 10)
  ------------------
  |  Branch (464:12): [True: 0, False: 0]
  ------------------
  465|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  466|      0|        return -1;
  467|      0|    }
  468|       |
  469|      0|    ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 0, peer);
  ------------------
  |  | 1791|      0|# define EVP_PKEY_CTRL_PEER_KEY          2
  ------------------
  470|       |
  471|      0|    if (ret <= 0)
  ------------------
  |  Branch (471:9): [True: 0, False: 0]
  ------------------
  472|      0|        return ret;
  473|       |
  474|      0|    if (ret == 2)
  ------------------
  |  Branch (474:9): [True: 0, False: 0]
  ------------------
  475|      0|        return 1;
  476|       |
  477|      0|    if (ctx->pkey == NULL) {
  ------------------
  |  Branch (477:9): [True: 0, False: 0]
  ------------------
  478|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  479|      0|        return -1;
  480|      0|    }
  481|       |
  482|      0|    if (ctx->pkey->type != peer->type) {
  ------------------
  |  Branch (482:9): [True: 0, False: 0]
  ------------------
  483|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  484|      0|        return -1;
  485|      0|    }
  486|       |
  487|       |    /*
  488|       |     * For clarity.  The error is if parameters in peer are
  489|       |     * present (!missing) but don't match.  EVP_PKEY_parameters_eq may return
  490|       |     * 1 (match), 0 (don't match) and -2 (comparison is not defined).  -1
  491|       |     * (different key types) is impossible here because it is checked earlier.
  492|       |     * -2 is OK for us here, as well as 1, so we can check for 0 only.
  493|       |     */
  494|      0|    if (!EVP_PKEY_missing_parameters(peer) &&
  ------------------
  |  Branch (494:9): [True: 0, False: 0]
  ------------------
  495|      0|        !EVP_PKEY_parameters_eq(ctx->pkey, peer)) {
  ------------------
  |  Branch (495:9): [True: 0, False: 0]
  ------------------
  496|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_DIFFERENT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  497|      0|        return -1;
  498|      0|    }
  499|       |
  500|      0|    ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer);
  ------------------
  |  | 1791|      0|# define EVP_PKEY_CTRL_PEER_KEY          2
  ------------------
  501|      0|    if (ret <= 0)
  ------------------
  |  Branch (501:9): [True: 0, False: 0]
  ------------------
  502|      0|        return ret;
  503|      0|#endif
  504|       |
  505|      0| common:
  506|      0|    if (!EVP_PKEY_up_ref(peer))
  ------------------
  |  Branch (506:9): [True: 0, False: 0]
  ------------------
  507|      0|        return -1;
  508|       |
  509|      0|    EVP_PKEY_free(ctx->peerkey);
  510|      0|    ctx->peerkey = peer;
  511|       |
  512|      0|    return 1;
  513|      0|}
EVP_PKEY_derive_set_peer:
  516|     20|{
  517|     20|    return EVP_PKEY_derive_set_peer_ex(ctx, peer, 1);
  518|     20|}
EVP_PKEY_derive:
  521|     20|{
  522|     20|    int ret;
  523|       |
  524|     20|    if (ctx == NULL || pkeylen == NULL) {
  ------------------
  |  Branch (524:9): [True: 0, False: 20]
  |  Branch (524:24): [True: 0, False: 20]
  ------------------
  525|      0|        ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  526|      0|        return -1;
  527|      0|    }
  528|       |
  529|     20|    if (!EVP_PKEY_CTX_IS_DERIVE_OP(ctx)) {
  ------------------
  |  |  744|     20|    (((ctx)->operation & EVP_PKEY_OP_TYPE_DERIVE) != 0)
  |  |  ------------------
  |  |  |  | 1773|     20|    (EVP_PKEY_OP_DERIVE)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1755|     20|# define EVP_PKEY_OP_DERIVE              (1 << 11)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (529:9): [True: 0, False: 20]
  ------------------
  530|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  531|      0|        return -1;
  532|      0|    }
  533|       |
  534|     20|    if (ctx->op.kex.algctx == NULL)
  ------------------
  |  Branch (534:9): [True: 20, False: 0]
  ------------------
  535|     20|        goto legacy;
  536|       |
  537|      0|    ret = ctx->op.kex.exchange->derive(ctx->op.kex.algctx, key, pkeylen,
  538|      0|                                       key != NULL ? *pkeylen : 0);
  ------------------
  |  Branch (538:40): [True: 0, False: 0]
  ------------------
  539|       |
  540|      0|    return ret;
  541|     20| legacy:
  542|     20|    if (ctx->pmeth == NULL || ctx->pmeth->derive == NULL) {
  ------------------
  |  Branch (542:9): [True: 20, False: 0]
  |  Branch (542:31): [True: 0, False: 0]
  ------------------
  543|     20|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     20|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     20|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     20|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     20|     ERR_set_error)
  |  |  ------------------
  ------------------
  544|     20|        return -2;
  545|     20|    }
  546|       |
  547|      0|    M_check_autoarg(ctx, key, pkeylen, EVP_F_EVP_PKEY_DERIVE)
  ------------------
  |  |  389|      0|    if (ctx->pmeth->flags & EVP_PKEY_FLAG_AUTOARGLEN) {           \
  |  |  ------------------
  |  |  |  | 1813|      0|# define EVP_PKEY_FLAG_AUTOARGLEN        2
  |  |  ------------------
  |  |  |  Branch (389:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  390|      0|        size_t pksize = (size_t)EVP_PKEY_get_size(ctx->pkey);         \
  |  |  391|      0|                                                                  \
  |  |  392|      0|        if (pksize == 0) {                                        \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  393|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY); /*ckerr_ignore*/ \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|      0|            return 0;                                             \
  |  |  395|      0|        }                                                         \
  |  |  396|      0|        if (arg == NULL) {                                        \
  |  |  ------------------
  |  |  |  Branch (396:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  397|      0|            *arglen = pksize;                                     \
  |  |  398|      0|            return 1;                                             \
  |  |  399|      0|        }                                                         \
  |  |  400|      0|        if (*arglen < pksize) {                                   \
  |  |  ------------------
  |  |  |  Branch (400:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  401|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_BUFFER_TOO_SMALL); /*ckerr_ignore*/ \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  402|      0|            return 0;                                             \
  |  |  403|      0|        }                                                         \
  |  |  404|      0|    }
  ------------------
  548|      0|        return ctx->pmeth->derive(ctx, key, pkeylen);
  549|      0|}
exchange.c:evp_keyexch_from_algorithm:
   52|      7|{
   53|      7|    const OSSL_DISPATCH *fns = algodef->implementation;
   54|      7|    EVP_KEYEXCH *exchange = NULL;
   55|      7|    int fncnt = 0, sparamfncnt = 0, gparamfncnt = 0;
   56|       |
   57|      7|    if ((exchange = evp_keyexch_new(prov)) == NULL) {
  ------------------
  |  Branch (57:9): [True: 0, False: 7]
  ------------------
   58|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   59|      0|        goto err;
   60|      0|    }
   61|       |
   62|      7|    exchange->name_id = name_id;
   63|      7|    if ((exchange->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 7]
  ------------------
   64|      0|        goto err;
   65|      7|    exchange->description = algodef->algorithm_description;
   66|       |
   67|     70|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (67:12): [True: 63, False: 7]
  ------------------
   68|     63|        switch (fns->function_id) {
  ------------------
  |  Branch (68:17): [True: 0, False: 63]
  ------------------
   69|      7|        case OSSL_FUNC_KEYEXCH_NEWCTX:
  ------------------
  |  |  762|      7|# define OSSL_FUNC_KEYEXCH_NEWCTX                      1
  ------------------
  |  Branch (69:9): [True: 7, False: 56]
  ------------------
   70|      7|            if (exchange->newctx != NULL)
  ------------------
  |  Branch (70:17): [True: 0, False: 7]
  ------------------
   71|      0|                break;
   72|      7|            exchange->newctx = OSSL_FUNC_keyexch_newctx(fns);
   73|      7|            fncnt++;
   74|      7|            break;
   75|      7|        case OSSL_FUNC_KEYEXCH_INIT:
  ------------------
  |  |  763|      7|# define OSSL_FUNC_KEYEXCH_INIT                        2
  ------------------
  |  Branch (75:9): [True: 7, False: 56]
  ------------------
   76|      7|            if (exchange->init != NULL)
  ------------------
  |  Branch (76:17): [True: 0, False: 7]
  ------------------
   77|      0|                break;
   78|      7|            exchange->init = OSSL_FUNC_keyexch_init(fns);
   79|      7|            fncnt++;
   80|      7|            break;
   81|      4|        case OSSL_FUNC_KEYEXCH_SET_PEER:
  ------------------
  |  |  765|      4|# define OSSL_FUNC_KEYEXCH_SET_PEER                    4
  ------------------
  |  Branch (81:9): [True: 4, False: 59]
  ------------------
   82|      4|            if (exchange->set_peer != NULL)
  ------------------
  |  Branch (82:17): [True: 0, False: 4]
  ------------------
   83|      0|                break;
   84|      4|            exchange->set_peer = OSSL_FUNC_keyexch_set_peer(fns);
   85|      4|            break;
   86|      7|        case OSSL_FUNC_KEYEXCH_DERIVE:
  ------------------
  |  |  764|      7|# define OSSL_FUNC_KEYEXCH_DERIVE                      3
  ------------------
  |  Branch (86:9): [True: 7, False: 56]
  ------------------
   87|      7|            if (exchange->derive != NULL)
  ------------------
  |  Branch (87:17): [True: 0, False: 7]
  ------------------
   88|      0|                break;
   89|      7|            exchange->derive = OSSL_FUNC_keyexch_derive(fns);
   90|      7|            fncnt++;
   91|      7|            break;
   92|      7|        case OSSL_FUNC_KEYEXCH_FREECTX:
  ------------------
  |  |  766|      7|# define OSSL_FUNC_KEYEXCH_FREECTX                     5
  ------------------
  |  Branch (92:9): [True: 7, False: 56]
  ------------------
   93|      7|            if (exchange->freectx != NULL)
  ------------------
  |  Branch (93:17): [True: 0, False: 7]
  ------------------
   94|      0|                break;
   95|      7|            exchange->freectx = OSSL_FUNC_keyexch_freectx(fns);
   96|      7|            fncnt++;
   97|      7|            break;
   98|      7|        case OSSL_FUNC_KEYEXCH_DUPCTX:
  ------------------
  |  |  767|      7|# define OSSL_FUNC_KEYEXCH_DUPCTX                      6
  ------------------
  |  Branch (98:9): [True: 7, False: 56]
  ------------------
   99|      7|            if (exchange->dupctx != NULL)
  ------------------
  |  Branch (99:17): [True: 0, False: 7]
  ------------------
  100|      0|                break;
  101|      7|            exchange->dupctx = OSSL_FUNC_keyexch_dupctx(fns);
  102|      7|            break;
  103|      7|        case OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS:
  ------------------
  |  |  770|      7|# define OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS              9
  ------------------
  |  Branch (103:9): [True: 7, False: 56]
  ------------------
  104|      7|            if (exchange->get_ctx_params != NULL)
  ------------------
  |  Branch (104:17): [True: 0, False: 7]
  ------------------
  105|      0|                break;
  106|      7|            exchange->get_ctx_params = OSSL_FUNC_keyexch_get_ctx_params(fns);
  107|      7|            gparamfncnt++;
  108|      7|            break;
  109|      7|        case OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  771|      7|# define OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS        10
  ------------------
  |  Branch (109:9): [True: 7, False: 56]
  ------------------
  110|      7|            if (exchange->gettable_ctx_params != NULL)
  ------------------
  |  Branch (110:17): [True: 0, False: 7]
  ------------------
  111|      0|                break;
  112|      7|            exchange->gettable_ctx_params
  113|      7|                = OSSL_FUNC_keyexch_gettable_ctx_params(fns);
  114|      7|            gparamfncnt++;
  115|      7|            break;
  116|      5|        case OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS:
  ------------------
  |  |  768|      5|# define OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS              7
  ------------------
  |  Branch (116:9): [True: 5, False: 58]
  ------------------
  117|      5|            if (exchange->set_ctx_params != NULL)
  ------------------
  |  Branch (117:17): [True: 0, False: 5]
  ------------------
  118|      0|                break;
  119|      5|            exchange->set_ctx_params = OSSL_FUNC_keyexch_set_ctx_params(fns);
  120|      5|            sparamfncnt++;
  121|      5|            break;
  122|      5|        case OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  769|      5|# define OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS         8
  ------------------
  |  Branch (122:9): [True: 5, False: 58]
  ------------------
  123|      5|            if (exchange->settable_ctx_params != NULL)
  ------------------
  |  Branch (123:17): [True: 0, False: 5]
  ------------------
  124|      0|                break;
  125|      5|            exchange->settable_ctx_params
  126|      5|                = OSSL_FUNC_keyexch_settable_ctx_params(fns);
  127|      5|            sparamfncnt++;
  128|      5|            break;
  129|     63|        }
  130|     63|    }
  131|      7|    if (fncnt != 4
  ------------------
  |  Branch (131:9): [True: 0, False: 7]
  ------------------
  132|      7|            || (gparamfncnt != 0 && gparamfncnt != 2)
  ------------------
  |  Branch (132:17): [True: 7, False: 0]
  |  Branch (132:37): [True: 0, False: 7]
  ------------------
  133|      7|            || (sparamfncnt != 0 && sparamfncnt != 2)) {
  ------------------
  |  Branch (133:17): [True: 5, False: 2]
  |  Branch (133:37): [True: 0, False: 5]
  ------------------
  134|       |        /*
  135|       |         * In order to be a consistent set of functions we must have at least
  136|       |         * a complete set of "exchange" functions: init, derive, newctx,
  137|       |         * and freectx. The set_ctx_params and settable_ctx_params functions are
  138|       |         * optional, but if one of them is present then the other one must also
  139|       |         * be present. Same goes for get_ctx_params and gettable_ctx_params.
  140|       |         * The dupctx and set_peer functions are optional.
  141|       |         */
  142|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  143|      0|        goto err;
  144|      0|    }
  145|       |
  146|      7|    return exchange;
  147|       |
  148|      0| err:
  149|      0|    EVP_KEYEXCH_free(exchange);
  150|      0|    return NULL;
  151|      7|}
exchange.c:evp_keyexch_new:
   32|      7|{
   33|      7|    EVP_KEYEXCH *exchange = OPENSSL_zalloc(sizeof(EVP_KEYEXCH));
  ------------------
  |  |  104|      7|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      7|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      7|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   34|       |
   35|      7|    if (exchange == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 7]
  ------------------
   36|      0|        return NULL;
   37|       |
   38|      7|    if (!CRYPTO_NEW_REF(&exchange->refcnt, 1)
  ------------------
  |  Branch (38:9): [True: 0, False: 7]
  ------------------
   39|      7|        || !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (39:12): [True: 0, False: 7]
  ------------------
   40|      0|        CRYPTO_FREE_REF(&exchange->refcnt);
   41|      0|        OPENSSL_free(exchange);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   42|      0|        return NULL;
   43|      0|    }
   44|      7|    exchange->prov = prov;
   45|       |
   46|      7|    return exchange;
   47|      7|}
exchange.c:evp_keyexch_up_ref:
   27|      7|{
   28|      7|    return EVP_KEYEXCH_up_ref(data);
   29|      7|}
exchange.c:evp_keyexch_free:
   22|     14|{
   23|     14|    EVP_KEYEXCH_free(data);
   24|     14|}

EVP_PKEY_encapsulate_init:
  221|     46|{
  222|     46|    return evp_kem_init(ctx, EVP_PKEY_OP_ENCAPSULATE, params, NULL);
  ------------------
  |  | 1756|     46|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  ------------------
  223|     46|}
EVP_PKEY_encapsulate:
  228|     46|{
  229|     46|    if (ctx == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 46]
  ------------------
  230|      0|        return 0;
  231|       |
  232|     46|    if (ctx->operation != EVP_PKEY_OP_ENCAPSULATE) {
  ------------------
  |  | 1756|     46|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  ------------------
  |  Branch (232:9): [True: 0, False: 46]
  ------------------
  233|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  234|      0|        return -1;
  235|      0|    }
  236|       |
  237|     46|    if (ctx->op.encap.algctx == NULL) {
  ------------------
  |  Branch (237:9): [True: 0, False: 46]
  ------------------
  238|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  239|      0|        return -2;
  240|      0|    }
  241|       |
  242|     46|    if (out != NULL && secret == NULL)
  ------------------
  |  Branch (242:9): [True: 46, False: 0]
  |  Branch (242:24): [True: 0, False: 46]
  ------------------
  243|      0|        return 0;
  244|       |
  245|     46|    return ctx->op.encap.kem->encapsulate(ctx->op.encap.algctx,
  246|     46|                                          out, outlen, secret, secretlen);
  247|     46|}
EVP_PKEY_decapsulate_init:
  250|     46|{
  251|     46|    return evp_kem_init(ctx, EVP_PKEY_OP_DECAPSULATE, params, NULL);
  ------------------
  |  | 1757|     46|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  ------------------
  252|     46|}
EVP_PKEY_decapsulate:
  265|     46|{
  266|     46|    if (ctx == NULL
  ------------------
  |  Branch (266:9): [True: 0, False: 46]
  ------------------
  267|     46|        || (in == NULL || inlen == 0)
  ------------------
  |  Branch (267:13): [True: 0, False: 46]
  |  Branch (267:27): [True: 0, False: 46]
  ------------------
  268|     46|        || (secret == NULL && secretlen == NULL))
  ------------------
  |  Branch (268:13): [True: 0, False: 46]
  |  Branch (268:31): [True: 0, False: 0]
  ------------------
  269|      0|        return 0;
  270|       |
  271|     46|    if (ctx->operation != EVP_PKEY_OP_DECAPSULATE) {
  ------------------
  |  | 1757|     46|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  ------------------
  |  Branch (271:9): [True: 0, False: 46]
  ------------------
  272|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  273|      0|        return -1;
  274|      0|    }
  275|       |
  276|     46|    if (ctx->op.encap.algctx == NULL) {
  ------------------
  |  Branch (276:9): [True: 0, False: 46]
  ------------------
  277|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  278|      0|        return -2;
  279|      0|    }
  280|     46|    return ctx->op.encap.kem->decapsulate(ctx->op.encap.algctx,
  281|     46|                                          secret, secretlen, in, inlen);
  282|     46|}
EVP_KEM_free:
  433|    209|{
  434|    209|    int i;
  435|       |
  436|    209|    if (kem == NULL)
  ------------------
  |  Branch (436:9): [True: 92, False: 117]
  ------------------
  437|     92|        return;
  438|       |
  439|    117|    CRYPTO_DOWN_REF(&kem->refcnt, &i);
  440|    117|    if (i > 0)
  ------------------
  |  Branch (440:9): [True: 106, False: 11]
  ------------------
  441|    106|        return;
  442|     11|    OPENSSL_free(kem->type_name);
  ------------------
  |  |  115|     11|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     11|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     11|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  443|     11|    ossl_provider_free(kem->prov);
  444|     11|    CRYPTO_FREE_REF(&kem->refcnt);
  445|     11|    OPENSSL_free(kem);
  ------------------
  |  |  115|     11|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     11|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     11|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  446|     11|}
EVP_KEM_up_ref:
  449|    106|{
  450|    106|    int ref = 0;
  451|       |
  452|    106|    CRYPTO_UP_REF(&kem->refcnt, &ref);
  453|    106|    return 1;
  454|    106|}
EVP_KEM_get0_provider:
  457|     92|{
  458|     92|    return kem->prov;
  459|     92|}
EVP_KEM_fetch:
  463|     92|{
  464|     92|    return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties,
  ------------------
  |  |  319|     92|# define OSSL_OP_KEM                                14
  ------------------
  465|     92|                             evp_kem_from_algorithm,
  466|     92|                             evp_kem_up_ref,
  467|     92|                             evp_kem_free);
  468|     92|}
kem.c:evp_kem_init:
   32|     92|{
   33|     92|    int ret = 0;
   34|     92|    EVP_KEM *kem = NULL;
   35|     92|    EVP_KEYMGMT *tmp_keymgmt = NULL;
   36|     92|    const OSSL_PROVIDER *tmp_prov = NULL;
   37|     92|    void *provkey = NULL, *provauthkey = NULL;
   38|     92|    const char *supported_kem = NULL;
   39|     92|    int iter;
   40|       |
   41|     92|    if (ctx == NULL || ctx->keytype == NULL) {
  ------------------
  |  Branch (41:9): [True: 0, False: 92]
  |  Branch (41:24): [True: 0, False: 92]
  ------------------
   42|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   43|      0|        return 0;
   44|      0|    }
   45|       |
   46|     92|    evp_pkey_ctx_free_old_ops(ctx);
   47|     92|    ctx->operation = operation;
   48|       |
   49|     92|    if (ctx->pkey == NULL) {
  ------------------
  |  Branch (49:9): [True: 0, False: 92]
  ------------------
   50|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   51|      0|        goto err;
   52|      0|    }
   53|     92|    if (authkey != NULL && authkey->type != ctx->pkey->type) {
  ------------------
  |  Branch (53:9): [True: 0, False: 92]
  |  Branch (53:28): [True: 0, False: 0]
  ------------------
   54|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   55|      0|        return 0;
   56|      0|    }
   57|       |    /*
   58|       |     * Try to derive the supported kem from |ctx->keymgmt|.
   59|       |     */
   60|     92|    if (!ossl_assert(ctx->pkey->keymgmt == NULL
  ------------------
  |  |   52|    184|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 0, False: 92]
  |  |  |  Branch (52:43): [True: 92, False: 0]
  |  |  ------------------
  |  |   53|     92|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (60:9): [True: 0, False: 92]
  ------------------
   61|     92|                     || ctx->pkey->keymgmt == ctx->keymgmt)) {
   62|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   63|      0|        goto err;
   64|      0|    }
   65|     92|    supported_kem = evp_keymgmt_util_query_operation_name(ctx->keymgmt,
   66|     92|                                                          OSSL_OP_KEM);
  ------------------
  |  |  319|     92|# define OSSL_OP_KEM                                14
  ------------------
   67|     92|    if (supported_kem == NULL) {
  ------------------
  |  Branch (67:9): [True: 0, False: 92]
  ------------------
   68|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   69|      0|        goto err;
   70|      0|    }
   71|       |
   72|       |    /*
   73|       |     * Because we cleared out old ops, we shouldn't need to worry about
   74|       |     * checking if kem is already there.
   75|       |     * We perform two iterations:
   76|       |     *
   77|       |     * 1.  Do the normal kem fetch, using the fetching data given by
   78|       |     *     the EVP_PKEY_CTX.
   79|       |     * 2.  Do the provider specific kem fetch, from the same provider
   80|       |     *     as |ctx->keymgmt|
   81|       |     *
   82|       |     * We then try to fetch the keymgmt from the same provider as the
   83|       |     * kem, and try to export |ctx->pkey| to that keymgmt (when this
   84|       |     * keymgmt happens to be the same as |ctx->keymgmt|, the export is
   85|       |     * a no-op, but we call it anyway to not complicate the code even
   86|       |     * more).
   87|       |     * If the export call succeeds (returns a non-NULL provider key pointer),
   88|       |     * we're done and can perform the operation itself.  If not, we perform
   89|       |     * the second iteration, or jump to legacy.
   90|       |     */
   91|    184|    for (iter = 1, provkey = NULL; iter < 3 && provkey == NULL; iter++) {
  ------------------
  |  Branch (91:36): [True: 184, False: 0]
  |  Branch (91:48): [True: 92, False: 92]
  ------------------
   92|     92|        EVP_KEYMGMT *tmp_keymgmt_tofree = NULL;
   93|       |
   94|       |        /*
   95|       |         * If we're on the second iteration, free the results from the first.
   96|       |         * They are NULL on the first iteration, so no need to check what
   97|       |         * iteration we're on.
   98|       |         */
   99|     92|        EVP_KEM_free(kem);
  100|     92|        EVP_KEYMGMT_free(tmp_keymgmt);
  101|       |
  102|     92|        switch (iter) {
  ------------------
  |  Branch (102:17): [True: 0, False: 92]
  ------------------
  103|     92|        case 1:
  ------------------
  |  Branch (103:9): [True: 92, False: 0]
  ------------------
  104|     92|            kem = EVP_KEM_fetch(ctx->libctx, supported_kem, ctx->propquery);
  105|     92|            if (kem != NULL)
  ------------------
  |  Branch (105:17): [True: 92, False: 0]
  ------------------
  106|     92|                tmp_prov = EVP_KEM_get0_provider(kem);
  107|     92|            break;
  108|      0|        case 2:
  ------------------
  |  Branch (108:9): [True: 0, False: 92]
  ------------------
  109|      0|            tmp_prov = EVP_KEYMGMT_get0_provider(ctx->keymgmt);
  110|      0|            kem = evp_kem_fetch_from_prov((OSSL_PROVIDER *)tmp_prov,
  111|      0|                                          supported_kem, ctx->propquery);
  112|       |
  113|      0|            if (kem == NULL) {
  ------------------
  |  Branch (113:17): [True: 0, False: 0]
  ------------------
  114|      0|                ERR_raise(ERR_LIB_EVP,
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  115|      0|                          EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  116|      0|                ret = -2;
  117|      0|                goto err;
  118|      0|            }
  119|     92|        }
  120|     92|        if (kem == NULL)
  ------------------
  |  Branch (120:13): [True: 0, False: 92]
  ------------------
  121|      0|            continue;
  122|       |
  123|       |        /*
  124|       |         * Ensure that the key is provided, either natively, or as a cached
  125|       |         * export.  We start by fetching the keymgmt with the same name as
  126|       |         * |ctx->pkey|, but from the provider of the kem method, using the
  127|       |         * same property query as when fetching the kem method.
  128|       |         * With the keymgmt we found (if we did), we try to export |ctx->pkey|
  129|       |         * to it (evp_pkey_export_to_provider() is smart enough to only actually
  130|       |         * export it if |tmp_keymgmt| is different from |ctx->pkey|'s keymgmt)
  131|       |         */
  132|     92|        tmp_keymgmt_tofree = tmp_keymgmt =
  133|     92|            evp_keymgmt_fetch_from_prov((OSSL_PROVIDER *)tmp_prov,
  134|     92|                                        EVP_KEYMGMT_get0_name(ctx->keymgmt),
  135|     92|                                        ctx->propquery);
  136|     92|        if (tmp_keymgmt != NULL) {
  ------------------
  |  Branch (136:13): [True: 92, False: 0]
  ------------------
  137|     92|            provkey = evp_pkey_export_to_provider(ctx->pkey, ctx->libctx,
  138|     92|                                                  &tmp_keymgmt, ctx->propquery);
  139|     92|            if (provkey != NULL && authkey != NULL) {
  ------------------
  |  Branch (139:17): [True: 92, False: 0]
  |  Branch (139:36): [True: 0, False: 92]
  ------------------
  140|      0|                provauthkey = evp_pkey_export_to_provider(authkey, ctx->libctx,
  141|      0|                                                          &tmp_keymgmt,
  142|      0|                                                          ctx->propquery);
  143|      0|                if (provauthkey == NULL) {
  ------------------
  |  Branch (143:21): [True: 0, False: 0]
  ------------------
  144|      0|                    EVP_KEM_free(kem);
  145|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  146|      0|                    goto err;
  147|      0|                }
  148|      0|            }
  149|     92|        }
  150|     92|        if (tmp_keymgmt == NULL)
  ------------------
  |  Branch (150:13): [True: 0, False: 92]
  ------------------
  151|      0|            EVP_KEYMGMT_free(tmp_keymgmt_tofree);
  152|     92|    }
  153|       |
  154|     92|    if (provkey == NULL) {
  ------------------
  |  Branch (154:9): [True: 0, False: 92]
  ------------------
  155|      0|        EVP_KEM_free(kem);
  156|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  157|      0|        goto err;
  158|      0|    }
  159|       |
  160|     92|    ctx->op.encap.kem = kem;
  161|     92|    ctx->op.encap.algctx = kem->newctx(ossl_provider_ctx(kem->prov));
  162|     92|    if (ctx->op.encap.algctx == NULL) {
  ------------------
  |  Branch (162:9): [True: 0, False: 92]
  ------------------
  163|       |        /* The provider key can stay in the cache */
  164|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  165|      0|        goto err;
  166|      0|    }
  167|       |
  168|     92|    switch (operation) {
  169|     46|    case EVP_PKEY_OP_ENCAPSULATE:
  ------------------
  |  | 1756|     46|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  ------------------
  |  Branch (169:5): [True: 46, False: 46]
  ------------------
  170|     46|        if (provauthkey != NULL && kem->auth_encapsulate_init != NULL) {
  ------------------
  |  Branch (170:13): [True: 0, False: 46]
  |  Branch (170:36): [True: 0, False: 0]
  ------------------
  171|      0|            ret = kem->auth_encapsulate_init(ctx->op.encap.algctx, provkey,
  172|      0|                                             provauthkey, params);
  173|     46|        } else if (provauthkey == NULL && kem->encapsulate_init != NULL) {
  ------------------
  |  Branch (173:20): [True: 46, False: 0]
  |  Branch (173:43): [True: 46, False: 0]
  ------------------
  174|     46|            ret = kem->encapsulate_init(ctx->op.encap.algctx, provkey, params);
  175|     46|        } else {
  176|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  177|      0|            ret = -2;
  178|      0|            goto err;
  179|      0|        }
  180|     46|        break;
  181|     46|    case EVP_PKEY_OP_DECAPSULATE:
  ------------------
  |  | 1757|     46|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  ------------------
  |  Branch (181:5): [True: 46, False: 46]
  ------------------
  182|     46|        if (provauthkey != NULL && kem->auth_decapsulate_init != NULL) {
  ------------------
  |  Branch (182:13): [True: 0, False: 46]
  |  Branch (182:36): [True: 0, False: 0]
  ------------------
  183|      0|            ret = kem->auth_decapsulate_init(ctx->op.encap.algctx, provkey,
  184|      0|                                             provauthkey, params);
  185|     46|        } else if (provauthkey == NULL && kem->encapsulate_init != NULL) {
  ------------------
  |  Branch (185:20): [True: 46, False: 0]
  |  Branch (185:43): [True: 46, False: 0]
  ------------------
  186|     46|            ret = kem->decapsulate_init(ctx->op.encap.algctx, provkey, params);
  187|     46|        } else {
  188|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  189|      0|            ret = -2;
  190|      0|            goto err;
  191|      0|        }
  192|     46|        break;
  193|     46|    default:
  ------------------
  |  Branch (193:5): [True: 0, False: 92]
  ------------------
  194|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  195|      0|        goto err;
  196|     92|    }
  197|       |
  198|     92|    EVP_KEYMGMT_free(tmp_keymgmt);
  199|     92|    tmp_keymgmt = NULL;
  200|       |
  201|     92|    if (ret > 0)
  ------------------
  |  Branch (201:9): [True: 92, False: 0]
  ------------------
  202|     92|        return 1;
  203|      0| err:
  204|      0|    if (ret <= 0) {
  ------------------
  |  Branch (204:9): [True: 0, False: 0]
  ------------------
  205|      0|        evp_pkey_ctx_free_old_ops(ctx);
  206|      0|        ctx->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|      0|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
  207|      0|    }
  208|      0|    EVP_KEYMGMT_free(tmp_keymgmt);
  209|      0|    return ret;
  210|     92|}
kem.c:evp_kem_from_algorithm:
  304|     11|{
  305|     11|    const OSSL_DISPATCH *fns = algodef->implementation;
  306|     11|    EVP_KEM *kem = NULL;
  307|     11|    int ctxfncnt = 0, encfncnt = 0, decfncnt = 0;
  308|     11|    int gparamfncnt = 0, sparamfncnt = 0;
  309|       |
  310|     11|    if ((kem = evp_kem_new(prov)) == NULL) {
  ------------------
  |  Branch (310:9): [True: 0, False: 11]
  ------------------
  311|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  312|      0|        goto err;
  313|      0|    }
  314|       |
  315|     11|    kem->name_id = name_id;
  316|     11|    if ((kem->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL)
  ------------------
  |  Branch (316:9): [True: 0, False: 11]
  ------------------
  317|      0|        goto err;
  318|     11|    kem->description = algodef->algorithm_description;
  319|       |
  320|    108|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (320:12): [True: 97, False: 11]
  ------------------
  321|     97|        switch (fns->function_id) {
  ------------------
  |  Branch (321:17): [True: 0, False: 97]
  ------------------
  322|     11|        case OSSL_FUNC_KEM_NEWCTX:
  ------------------
  |  |  989|     11|# define OSSL_FUNC_KEM_NEWCTX                  1
  ------------------
  |  Branch (322:9): [True: 11, False: 86]
  ------------------
  323|     11|            if (kem->newctx != NULL)
  ------------------
  |  Branch (323:17): [True: 0, False: 11]
  ------------------
  324|      0|                break;
  325|     11|            kem->newctx = OSSL_FUNC_kem_newctx(fns);
  326|     11|            ctxfncnt++;
  327|     11|            break;
  328|     11|        case OSSL_FUNC_KEM_ENCAPSULATE_INIT:
  ------------------
  |  |  990|     11|# define OSSL_FUNC_KEM_ENCAPSULATE_INIT        2
  ------------------
  |  Branch (328:9): [True: 11, False: 86]
  ------------------
  329|     11|            if (kem->encapsulate_init != NULL)
  ------------------
  |  Branch (329:17): [True: 0, False: 11]
  ------------------
  330|      0|                break;
  331|     11|            kem->encapsulate_init = OSSL_FUNC_kem_encapsulate_init(fns);
  332|     11|            encfncnt++;
  333|     11|            break;
  334|      3|        case OSSL_FUNC_KEM_AUTH_ENCAPSULATE_INIT:
  ------------------
  |  | 1000|      3|# define OSSL_FUNC_KEM_AUTH_ENCAPSULATE_INIT  12
  ------------------
  |  Branch (334:9): [True: 3, False: 94]
  ------------------
  335|      3|            if (kem->auth_encapsulate_init != NULL)
  ------------------
  |  Branch (335:17): [True: 0, False: 3]
  ------------------
  336|      0|                break;
  337|      3|            kem->auth_encapsulate_init = OSSL_FUNC_kem_auth_encapsulate_init(fns);
  338|      3|            encfncnt++;
  339|      3|            break;
  340|     11|        case OSSL_FUNC_KEM_ENCAPSULATE:
  ------------------
  |  |  991|     11|# define OSSL_FUNC_KEM_ENCAPSULATE             3
  ------------------
  |  Branch (340:9): [True: 11, False: 86]
  ------------------
  341|     11|            if (kem->encapsulate != NULL)
  ------------------
  |  Branch (341:17): [True: 0, False: 11]
  ------------------
  342|      0|                break;
  343|     11|            kem->encapsulate = OSSL_FUNC_kem_encapsulate(fns);
  344|     11|            encfncnt++;
  345|     11|            break;
  346|     11|        case OSSL_FUNC_KEM_DECAPSULATE_INIT:
  ------------------
  |  |  992|     11|# define OSSL_FUNC_KEM_DECAPSULATE_INIT        4
  ------------------
  |  Branch (346:9): [True: 11, False: 86]
  ------------------
  347|     11|            if (kem->decapsulate_init != NULL)
  ------------------
  |  Branch (347:17): [True: 0, False: 11]
  ------------------
  348|      0|                break;
  349|     11|            kem->decapsulate_init = OSSL_FUNC_kem_decapsulate_init(fns);
  350|     11|            decfncnt++;
  351|     11|            break;
  352|      3|        case OSSL_FUNC_KEM_AUTH_DECAPSULATE_INIT:
  ------------------
  |  | 1001|      3|# define OSSL_FUNC_KEM_AUTH_DECAPSULATE_INIT  13
  ------------------
  |  Branch (352:9): [True: 3, False: 94]
  ------------------
  353|      3|            if (kem->auth_decapsulate_init != NULL)
  ------------------
  |  Branch (353:17): [True: 0, False: 3]
  ------------------
  354|      0|                break;
  355|      3|            kem->auth_decapsulate_init = OSSL_FUNC_kem_auth_decapsulate_init(fns);
  356|      3|            decfncnt++;
  357|      3|            break;
  358|     11|        case OSSL_FUNC_KEM_DECAPSULATE:
  ------------------
  |  |  993|     11|# define OSSL_FUNC_KEM_DECAPSULATE             5
  ------------------
  |  Branch (358:9): [True: 11, False: 86]
  ------------------
  359|     11|            if (kem->decapsulate != NULL)
  ------------------
  |  Branch (359:17): [True: 0, False: 11]
  ------------------
  360|      0|                break;
  361|     11|            kem->decapsulate = OSSL_FUNC_kem_decapsulate(fns);
  362|     11|            decfncnt++;
  363|     11|            break;
  364|     11|        case OSSL_FUNC_KEM_FREECTX:
  ------------------
  |  |  994|     11|# define OSSL_FUNC_KEM_FREECTX                 6
  ------------------
  |  Branch (364:9): [True: 11, False: 86]
  ------------------
  365|     11|            if (kem->freectx != NULL)
  ------------------
  |  Branch (365:17): [True: 0, False: 11]
  ------------------
  366|      0|                break;
  367|     11|            kem->freectx = OSSL_FUNC_kem_freectx(fns);
  368|     11|            ctxfncnt++;
  369|     11|            break;
  370|      1|        case OSSL_FUNC_KEM_DUPCTX:
  ------------------
  |  |  995|      1|# define OSSL_FUNC_KEM_DUPCTX                  7
  ------------------
  |  Branch (370:9): [True: 1, False: 96]
  ------------------
  371|      1|            if (kem->dupctx != NULL)
  ------------------
  |  Branch (371:17): [True: 0, False: 1]
  ------------------
  372|      0|                break;
  373|      1|            kem->dupctx = OSSL_FUNC_kem_dupctx(fns);
  374|      1|            break;
  375|      1|        case OSSL_FUNC_KEM_GET_CTX_PARAMS:
  ------------------
  |  |  996|      1|# define OSSL_FUNC_KEM_GET_CTX_PARAMS          8
  ------------------
  |  Branch (375:9): [True: 1, False: 96]
  ------------------
  376|      1|            if (kem->get_ctx_params != NULL)
  ------------------
  |  Branch (376:17): [True: 0, False: 1]
  ------------------
  377|      0|                break;
  378|      1|            kem->get_ctx_params
  379|      1|                = OSSL_FUNC_kem_get_ctx_params(fns);
  380|      1|            gparamfncnt++;
  381|      1|            break;
  382|      1|        case OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  997|      1|# define OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS     9
  ------------------
  |  Branch (382:9): [True: 1, False: 96]
  ------------------
  383|      1|            if (kem->gettable_ctx_params != NULL)
  ------------------
  |  Branch (383:17): [True: 0, False: 1]
  ------------------
  384|      0|                break;
  385|      1|            kem->gettable_ctx_params
  386|      1|                = OSSL_FUNC_kem_gettable_ctx_params(fns);
  387|      1|            gparamfncnt++;
  388|      1|            break;
  389|     11|        case OSSL_FUNC_KEM_SET_CTX_PARAMS:
  ------------------
  |  |  998|     11|# define OSSL_FUNC_KEM_SET_CTX_PARAMS         10
  ------------------
  |  Branch (389:9): [True: 11, False: 86]
  ------------------
  390|     11|            if (kem->set_ctx_params != NULL)
  ------------------
  |  Branch (390:17): [True: 0, False: 11]
  ------------------
  391|      0|                break;
  392|     11|            kem->set_ctx_params
  393|     11|                = OSSL_FUNC_kem_set_ctx_params(fns);
  394|     11|            sparamfncnt++;
  395|     11|            break;
  396|     11|        case OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  999|     11|# define OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS    11
  ------------------
  |  Branch (396:9): [True: 11, False: 86]
  ------------------
  397|     11|            if (kem->settable_ctx_params != NULL)
  ------------------
  |  Branch (397:17): [True: 0, False: 11]
  ------------------
  398|      0|                break;
  399|     11|            kem->settable_ctx_params
  400|     11|                = OSSL_FUNC_kem_settable_ctx_params(fns);
  401|     11|            sparamfncnt++;
  402|     11|            break;
  403|     97|        }
  404|     97|    }
  405|     11|    if (ctxfncnt != 2
  ------------------
  |  Branch (405:9): [True: 0, False: 11]
  ------------------
  406|     11|        || (encfncnt != 0 && encfncnt != 2 && encfncnt != 3)
  ------------------
  |  Branch (406:13): [True: 11, False: 0]
  |  Branch (406:30): [True: 3, False: 8]
  |  Branch (406:47): [True: 0, False: 3]
  ------------------
  407|     11|        || (decfncnt != 0 && decfncnt != 2 && decfncnt != 3)
  ------------------
  |  Branch (407:13): [True: 11, False: 0]
  |  Branch (407:30): [True: 3, False: 8]
  |  Branch (407:47): [True: 0, False: 3]
  ------------------
  408|     11|        || (encfncnt != decfncnt)
  ------------------
  |  Branch (408:12): [True: 0, False: 11]
  ------------------
  409|     11|        || (gparamfncnt != 0 && gparamfncnt != 2)
  ------------------
  |  Branch (409:13): [True: 1, False: 10]
  |  Branch (409:33): [True: 0, False: 1]
  ------------------
  410|     11|        || (sparamfncnt != 0 && sparamfncnt != 2)) {
  ------------------
  |  Branch (410:13): [True: 11, False: 0]
  |  Branch (410:33): [True: 0, False: 11]
  ------------------
  411|       |        /*
  412|       |         * In order to be a consistent set of functions we must have at least
  413|       |         * a set of context functions (newctx and freectx) as well as a pair
  414|       |         * (or triplet) of "kem" functions:
  415|       |         * (encapsulate_init, (and/or auth_encapsulate_init), encapsulate) or
  416|       |         * (decapsulate_init, (and/or auth_decapsulate_init), decapsulate).
  417|       |         * set_ctx_params and settable_ctx_params are optional, but if one of
  418|       |         * them is present then the other one must also be present. The same
  419|       |         * applies to get_ctx_params and gettable_ctx_params.
  420|       |         * The dupctx function is optional.
  421|       |         */
  422|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  423|      0|        goto err;
  424|      0|    }
  425|       |
  426|     11|    return kem;
  427|      0| err:
  428|      0|    EVP_KEM_free(kem);
  429|      0|    return NULL;
  430|     11|}
kem.c:evp_kem_new:
  285|     11|{
  286|     11|    EVP_KEM *kem = OPENSSL_zalloc(sizeof(EVP_KEM));
  ------------------
  |  |  104|     11|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     11|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     11|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  287|       |
  288|     11|    if (kem == NULL)
  ------------------
  |  Branch (288:9): [True: 0, False: 11]
  ------------------
  289|      0|        return NULL;
  290|       |
  291|     11|    if (!CRYPTO_NEW_REF(&kem->refcnt, 1)
  ------------------
  |  Branch (291:9): [True: 0, False: 11]
  ------------------
  292|     11|        || !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (292:12): [True: 0, False: 11]
  ------------------
  293|      0|        CRYPTO_FREE_REF(&kem->refcnt);
  294|      0|        OPENSSL_free(kem);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  295|      0|        return NULL;
  296|      0|    }
  297|     11|    kem->prov = prov;
  298|       |
  299|     11|    return kem;
  300|     11|}
kem.c:evp_kem_up_ref:
   26|    106|{
   27|    106|    return EVP_KEM_up_ref(data);
   28|    106|}
kem.c:evp_kem_free:
   21|     25|{
   22|     25|    EVP_KEM_free(data);
   23|     25|}

evp_keymgmt_util_assign_pkey:
   62|    166|{
   63|    166|    if (pkey == NULL || keymgmt == NULL || keydata == NULL
  ------------------
  |  Branch (63:9): [True: 0, False: 166]
  |  Branch (63:25): [True: 0, False: 166]
  |  Branch (63:44): [True: 0, False: 166]
  ------------------
   64|    166|        || !EVP_PKEY_set_type_by_keymgmt(pkey, keymgmt)) {
  ------------------
  |  Branch (64:12): [True: 0, False: 166]
  ------------------
   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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   66|      0|        return 0;
   67|      0|    }
   68|    166|    pkey->keydata = keydata;
   69|    166|    evp_keymgmt_util_cache_keyinfo(pkey);
   70|    166|    return 1;
   71|    166|}
evp_keymgmt_util_export:
   89|      3|{
   90|      3|    if (pk == NULL || export_cb == NULL)
  ------------------
  |  Branch (90:9): [True: 0, False: 3]
  |  Branch (90:23): [True: 0, False: 3]
  ------------------
   91|      0|        return 0;
   92|      3|    return evp_keymgmt_export(pk->keymgmt, pk->keydata, selection,
   93|      3|                              export_cb, export_cbarg);
   94|      3|}
evp_keymgmt_util_export_to_provider:
   98|     92|{
   99|     92|    struct evp_keymgmt_util_try_import_data_st import_data;
  100|     92|    OP_CACHE_ELEM *op;
  101|       |
  102|       |    /* Export to where? */
  103|     92|    if (keymgmt == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 92]
  ------------------
  104|      0|        return NULL;
  105|       |
  106|       |    /* If we have an unassigned key, give up */
  107|     92|    if (pk->keydata == NULL)
  ------------------
  |  Branch (107:9): [True: 0, False: 92]
  ------------------
  108|      0|        return NULL;
  109|       |
  110|       |    /*
  111|       |     * If |keymgmt| matches the "origin" |keymgmt|, there is no more to do.
  112|       |     * The "origin" is determined by the |keymgmt| pointers being identical
  113|       |     * or when the provider and the name ID match.  The latter case handles the
  114|       |     * situation where the fetch cache is flushed and a "new" key manager is
  115|       |     * created.
  116|       |     */
  117|     92|    if (pk->keymgmt == keymgmt
  ------------------
  |  Branch (117:9): [True: 92, False: 0]
  ------------------
  118|     92|        || (pk->keymgmt->name_id == keymgmt->name_id
  ------------------
  |  Branch (118:13): [True: 0, False: 0]
  ------------------
  119|      0|            && pk->keymgmt->prov == keymgmt->prov))
  ------------------
  |  Branch (119:16): [True: 0, False: 0]
  ------------------
  120|     92|        return pk->keydata;
  121|       |
  122|      0|    if (!CRYPTO_THREAD_read_lock(pk->lock))
  ------------------
  |  Branch (122:9): [True: 0, False: 0]
  ------------------
  123|      0|        return NULL;
  124|       |    /*
  125|       |     * If the provider native "origin" hasn't changed since last time, we
  126|       |     * try to find our keymgmt in the operation cache.  If it has changed
  127|       |     * and our keymgmt isn't found, we will clear the cache further down.
  128|       |     */
  129|      0|    if (pk->dirty_cnt == pk->dirty_cnt_copy) {
  ------------------
  |  Branch (129:9): [True: 0, False: 0]
  ------------------
  130|       |        /* If this key is already exported to |keymgmt|, no more to do */
  131|      0|        op = evp_keymgmt_util_find_operation_cache(pk, keymgmt, selection);
  132|      0|        if (op != NULL && op->keymgmt != NULL) {
  ------------------
  |  Branch (132:13): [True: 0, False: 0]
  |  Branch (132:27): [True: 0, False: 0]
  ------------------
  133|      0|            void *ret = op->keydata;
  134|       |
  135|      0|            CRYPTO_THREAD_unlock(pk->lock);
  136|      0|            return ret;
  137|      0|        }
  138|      0|    }
  139|      0|    CRYPTO_THREAD_unlock(pk->lock);
  140|       |
  141|       |    /* If the "origin" |keymgmt| doesn't support exporting, give up */
  142|      0|    if (pk->keymgmt->export == NULL)
  ------------------
  |  Branch (142:9): [True: 0, False: 0]
  ------------------
  143|      0|        return NULL;
  144|       |
  145|       |    /*
  146|       |     * Make sure that the type of the keymgmt to export to matches the type
  147|       |     * of the "origin"
  148|       |     */
  149|      0|    if (!ossl_assert(match_type(pk->keymgmt, keymgmt)))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (149:9): [True: 0, False: 0]
  ------------------
  150|      0|        return NULL;
  151|       |
  152|       |    /*
  153|       |     * We look at the already cached provider keys, and import from the
  154|       |     * first that supports it (i.e. use its export function), and export
  155|       |     * the imported data to the new provider.
  156|       |     */
  157|       |
  158|       |    /* Setup for the export callback */
  159|      0|    import_data.keydata = NULL;  /* evp_keymgmt_util_try_import will create it */
  160|      0|    import_data.keymgmt = keymgmt;
  161|      0|    import_data.selection = selection;
  162|       |
  163|       |    /*
  164|       |     * The export function calls the callback (evp_keymgmt_util_try_import),
  165|       |     * which does the import for us.  If successful, we're done.
  166|       |     */
  167|      0|    if (!evp_keymgmt_util_export(pk, selection,
  ------------------
  |  Branch (167:9): [True: 0, False: 0]
  ------------------
  168|      0|                                 &evp_keymgmt_util_try_import, &import_data))
  169|       |        /* If there was an error, bail out */
  170|      0|        return NULL;
  171|       |
  172|      0|    if (!CRYPTO_THREAD_write_lock(pk->lock)) {
  ------------------
  |  Branch (172:9): [True: 0, False: 0]
  ------------------
  173|      0|        evp_keymgmt_freedata(keymgmt, import_data.keydata);
  174|      0|        return NULL;
  175|      0|    }
  176|       |    /* Check to make sure some other thread didn't get there first */
  177|      0|    op = evp_keymgmt_util_find_operation_cache(pk, keymgmt, selection);
  178|      0|    if (op != NULL && op->keydata != NULL) {
  ------------------
  |  Branch (178:9): [True: 0, False: 0]
  |  Branch (178:23): [True: 0, False: 0]
  ------------------
  179|      0|        void *ret = op->keydata;
  180|       |
  181|      0|        CRYPTO_THREAD_unlock(pk->lock);
  182|       |
  183|       |        /*
  184|       |         * Another thread seemms to have already exported this so we abandon
  185|       |         * all the work we just did.
  186|       |         */
  187|      0|        evp_keymgmt_freedata(keymgmt, import_data.keydata);
  188|       |
  189|      0|        return ret;
  190|      0|    }
  191|       |
  192|       |    /*
  193|       |     * If the dirty counter changed since last time, then clear the
  194|       |     * operation cache.  In that case, we know that |i| is zero.
  195|       |     */
  196|      0|    if (pk->dirty_cnt != pk->dirty_cnt_copy)
  ------------------
  |  Branch (196:9): [True: 0, False: 0]
  ------------------
  197|      0|        evp_keymgmt_util_clear_operation_cache(pk);
  198|       |
  199|       |    /* Add the new export to the operation cache */
  200|      0|    if (!evp_keymgmt_util_cache_keydata(pk, keymgmt, import_data.keydata,
  ------------------
  |  Branch (200:9): [True: 0, False: 0]
  ------------------
  201|      0|                                        selection)) {
  202|      0|        CRYPTO_THREAD_unlock(pk->lock);
  203|      0|        evp_keymgmt_freedata(keymgmt, import_data.keydata);
  204|      0|        return NULL;
  205|      0|    }
  206|       |
  207|       |    /* Synchronize the dirty count */
  208|      0|    pk->dirty_cnt_copy = pk->dirty_cnt;
  209|       |
  210|      0|    CRYPTO_THREAD_unlock(pk->lock);
  211|       |
  212|      0|    return import_data.keydata;
  213|      0|}
evp_keymgmt_util_clear_operation_cache:
  223|    244|{
  224|    244|    if (pk != NULL) {
  ------------------
  |  Branch (224:9): [True: 244, False: 0]
  ------------------
  225|    244|        sk_OP_CACHE_ELEM_pop_free(pk->operation_cache, op_cache_free);
  226|    244|        pk->operation_cache = NULL;
  227|    244|    }
  228|       |
  229|    244|    return 1;
  230|    244|}
evp_keymgmt_util_cache_keyinfo:
  290|    166|{
  291|       |    /*
  292|       |     * Cache information about the provider "origin" key.
  293|       |     *
  294|       |     * This services functions like EVP_PKEY_get_size, EVP_PKEY_get_bits, etc
  295|       |     */
  296|    166|    if (pk->keydata != NULL) {
  ------------------
  |  Branch (296:9): [True: 166, False: 0]
  ------------------
  297|    166|        int bits = 0;
  298|    166|        int security_bits = 0;
  299|    166|        int security_category = -1;
  300|    166|        int size = 0;
  301|    166|        OSSL_PARAM params[5];
  302|       |
  303|    166|        params[0] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_BITS, &bits);
  ------------------
  |  |  360|    166|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  304|    166|        params[1] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_SECURITY_BITS,
  ------------------
  |  |  487|    166|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  305|    166|                                             &security_bits);
  306|    166|        params[2] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_SECURITY_CATEGORY,
  ------------------
  |  |  488|    166|# define OSSL_PKEY_PARAM_SECURITY_CATEGORY OSSL_ALG_PARAM_SECURITY_CATEGORY
  |  |  ------------------
  |  |  |  |  127|    166|# define OSSL_ALG_PARAM_SECURITY_CATEGORY "security-category"
  |  |  ------------------
  ------------------
  307|    166|                                             &security_category);
  308|    166|        params[3] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_MAX_SIZE, &size);
  ------------------
  |  |  416|    166|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  309|    166|        params[4] = OSSL_PARAM_construct_end();
  310|    166|        if (evp_keymgmt_get_params(pk->keymgmt, pk->keydata, params)) {
  ------------------
  |  Branch (310:13): [True: 166, False: 0]
  ------------------
  311|    166|            pk->cache.size = size;
  312|    166|            pk->cache.bits = bits;
  313|    166|            pk->cache.security_bits = security_bits;
  314|    166|            pk->cache.security_category = security_category;
  315|    166|        }
  316|    166|    }
  317|    166|}
evp_keymgmt_util_fromdata:
  321|     78|{
  322|     78|    void *keydata = NULL;
  323|       |
  324|     78|    if ((keydata = evp_keymgmt_newdata(keymgmt)) == NULL
  ------------------
  |  Branch (324:9): [True: 0, False: 78]
  ------------------
  325|     78|        || !evp_keymgmt_import(keymgmt, keydata, selection, params)
  ------------------
  |  Branch (325:12): [True: 78, False: 0]
  ------------------
  326|     78|        || !evp_keymgmt_util_assign_pkey(target, keymgmt, keydata)) {
  ------------------
  |  Branch (326:12): [True: 0, False: 0]
  ------------------
  327|     78|        evp_keymgmt_freedata(keymgmt, keydata);
  328|     78|        keydata = NULL;
  329|     78|    }
  330|     78|    return keydata;
  331|     78|}
evp_keymgmt_util_has:
  334|     38|{
  335|       |    /* Check if key is even assigned */
  336|     38|    if (pk->keymgmt == NULL)
  ------------------
  |  Branch (336:9): [True: 0, False: 38]
  ------------------
  337|      0|        return 0;
  338|       |
  339|     38|    return evp_keymgmt_has(pk->keymgmt, pk->keydata, selection);
  340|     38|}
evp_keymgmt_util_match:
  356|     19|{
  357|     19|    EVP_KEYMGMT *keymgmt1 = NULL, *keymgmt2 = NULL;
  358|     19|    void *keydata1 = NULL, *keydata2 = NULL;
  359|       |
  360|     19|    if (pk1 == NULL || pk2 == NULL) {
  ------------------
  |  Branch (360:9): [True: 0, False: 19]
  |  Branch (360:24): [True: 0, False: 19]
  ------------------
  361|      0|        if (pk1 == NULL && pk2 == NULL)
  ------------------
  |  Branch (361:13): [True: 0, False: 0]
  |  Branch (361:28): [True: 0, False: 0]
  ------------------
  362|      0|            return 1;
  363|      0|        return 0;
  364|      0|    }
  365|       |
  366|     19|    keymgmt1 = pk1->keymgmt;
  367|     19|    keydata1 = pk1->keydata;
  368|     19|    keymgmt2 = pk2->keymgmt;
  369|     19|    keydata2 = pk2->keydata;
  370|       |
  371|     19|    if (keymgmt1 != keymgmt2) {
  ------------------
  |  Branch (371:9): [True: 3, False: 16]
  ------------------
  372|       |        /*
  373|       |         * The condition for a successful cross export is that the
  374|       |         * keydata to be exported is NULL (typed, but otherwise empty
  375|       |         * EVP_PKEY), or that it was possible to export it with
  376|       |         * evp_keymgmt_util_export_to_provider().
  377|       |         *
  378|       |         * We use |ok| to determine if it's ok to cross export one way,
  379|       |         * but also to determine if we should attempt a cross export
  380|       |         * the other way.  There's no point doing it both ways.
  381|       |         */
  382|      3|        int ok = 0;
  383|       |
  384|       |        /* Complex case, where the keymgmt differ */
  385|      3|        if (keymgmt1 != NULL
  ------------------
  |  Branch (385:13): [True: 3, False: 0]
  ------------------
  386|      3|            && keymgmt2 != NULL
  ------------------
  |  Branch (386:16): [True: 3, False: 0]
  ------------------
  387|      3|            && !match_type(keymgmt1, keymgmt2)) {
  ------------------
  |  Branch (387:16): [True: 3, False: 0]
  ------------------
  388|      3|            ERR_raise(ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      3|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      3|     ERR_set_error)
  |  |  ------------------
  ------------------
  389|      3|            return -1;           /* Not the same type */
  390|      3|        }
  391|       |
  392|       |        /*
  393|       |         * The key types are determined to match, so we try cross export,
  394|       |         * but only to keymgmt's that supply a matching function.
  395|       |         */
  396|      0|        if (keymgmt2 != NULL
  ------------------
  |  Branch (396:13): [True: 0, False: 0]
  ------------------
  397|      0|            && keymgmt2->match != NULL) {
  ------------------
  |  Branch (397:16): [True: 0, False: 0]
  ------------------
  398|      0|            void *tmp_keydata = NULL;
  399|       |
  400|      0|            ok = 1;
  401|      0|            if (keydata1 != NULL) {
  ------------------
  |  Branch (401:17): [True: 0, False: 0]
  ------------------
  402|      0|                tmp_keydata =
  403|      0|                    evp_keymgmt_util_export_to_provider(pk1, keymgmt2,
  404|      0|                                                        selection);
  405|      0|                ok = (tmp_keydata != NULL);
  406|      0|            }
  407|      0|            if (ok) {
  ------------------
  |  Branch (407:17): [True: 0, False: 0]
  ------------------
  408|      0|                keymgmt1 = keymgmt2;
  409|      0|                keydata1 = tmp_keydata;
  410|      0|            }
  411|      0|        }
  412|       |        /*
  413|       |         * If we've successfully cross exported one way, there's no point
  414|       |         * doing it the other way, hence the |!ok| check.
  415|       |         */
  416|      0|        if (!ok
  ------------------
  |  Branch (416:13): [True: 0, False: 0]
  ------------------
  417|      0|            && keymgmt1 != NULL
  ------------------
  |  Branch (417:16): [True: 0, False: 0]
  ------------------
  418|      0|            && keymgmt1->match != NULL) {
  ------------------
  |  Branch (418:16): [True: 0, False: 0]
  ------------------
  419|      0|            void *tmp_keydata = NULL;
  420|       |
  421|      0|            ok = 1;
  422|      0|            if (keydata2 != NULL) {
  ------------------
  |  Branch (422:17): [True: 0, False: 0]
  ------------------
  423|      0|                tmp_keydata =
  424|      0|                    evp_keymgmt_util_export_to_provider(pk2, keymgmt1,
  425|      0|                                                        selection);
  426|      0|                ok = (tmp_keydata != NULL);
  427|      0|            }
  428|      0|            if (ok) {
  ------------------
  |  Branch (428:17): [True: 0, False: 0]
  ------------------
  429|      0|                keymgmt2 = keymgmt1;
  430|      0|                keydata2 = tmp_keydata;
  431|      0|            }
  432|      0|        }
  433|      0|    }
  434|       |
  435|       |    /* If we still don't have matching keymgmt implementations, we give up */
  436|     16|    if (keymgmt1 != keymgmt2)
  ------------------
  |  Branch (436:9): [True: 0, False: 16]
  ------------------
  437|      0|        return -2;
  438|       |
  439|       |    /* If both keydata are NULL, then they're the same key */
  440|     16|    if (keydata1 == NULL && keydata2 == NULL)
  ------------------
  |  Branch (440:9): [True: 0, False: 16]
  |  Branch (440:29): [True: 0, False: 0]
  ------------------
  441|      0|        return 1;
  442|       |    /* If only one of the keydata is NULL, then they're different keys */
  443|     16|    if (keydata1 == NULL || keydata2 == NULL)
  ------------------
  |  Branch (443:9): [True: 0, False: 16]
  |  Branch (443:29): [True: 0, False: 16]
  ------------------
  444|      0|        return 0;
  445|       |    /* If both keydata are non-NULL, we let the backend decide */
  446|     16|    return evp_keymgmt_match(keymgmt1, keydata1, keydata2, selection);
  447|     16|}
evp_keymgmt_util_gen:
  519|    166|{
  520|    166|    void *keydata = NULL;
  521|       |
  522|    166|    if ((keydata = evp_keymgmt_gen(keymgmt, genctx, cb, cbarg)) == NULL
  ------------------
  |  Branch (522:9): [True: 0, False: 166]
  ------------------
  523|    166|        || !evp_keymgmt_util_assign_pkey(target, keymgmt, keydata)) {
  ------------------
  |  Branch (523:12): [True: 0, False: 166]
  ------------------
  524|      0|        evp_keymgmt_freedata(keymgmt, keydata);
  525|      0|        keydata = NULL;
  526|      0|    }
  527|       |
  528|    166|    return keydata;
  529|    166|}
evp_keymgmt_util_query_operation_name:
  584|    112|{
  585|    112|    const char *name = NULL;
  586|       |
  587|    112|    if (keymgmt != NULL) {
  ------------------
  |  Branch (587:9): [True: 112, False: 0]
  ------------------
  588|    112|        if (keymgmt->query_operation_name != NULL)
  ------------------
  |  Branch (588:13): [True: 0, False: 112]
  ------------------
  589|      0|            name = keymgmt->query_operation_name(op_id);
  590|    112|        if (name == NULL)
  ------------------
  |  Branch (590:13): [True: 112, False: 0]
  ------------------
  591|    112|            name = EVP_KEYMGMT_get0_name(keymgmt);
  592|    112|    }
  593|    112|    return name;
  594|    112|}
keymgmt_lib.c:match_type:
   23|      3|{
   24|      3|    const char *name2 = EVP_KEYMGMT_get0_name(keymgmt2);
   25|       |
   26|      3|    return EVP_KEYMGMT_is_a(keymgmt1, name2);
   27|      3|}

evp_keymgmt_fetch_from_prov:
  277|     92|{
  278|     92|    return evp_generic_fetch_from_prov(prov, OSSL_OP_KEYMGMT,
  ------------------
  |  |  315|     92|# define OSSL_OP_KEYMGMT                            10
  ------------------
  279|     92|                                       name, properties,
  280|     92|                                       keymgmt_from_algorithm,
  281|     92|                                       evp_keymgmt_up_ref,
  282|     92|                                       evp_keymgmt_free);
  283|     92|}
EVP_KEYMGMT_fetch:
  287|    247|{
  288|    247|    return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties,
  ------------------
  |  |  315|    247|# define OSSL_OP_KEYMGMT                            10
  ------------------
  289|    247|                             keymgmt_from_algorithm,
  290|    247|                             evp_keymgmt_up_ref,
  291|    247|                             evp_keymgmt_free);
  292|    247|}
EVP_KEYMGMT_up_ref:
  295|    660|{
  296|    660|    int ref = 0;
  297|       |
  298|    660|    CRYPTO_UP_REF(&keymgmt->refcnt, &ref);
  299|    660|    return 1;
  300|    660|}
EVP_KEYMGMT_free:
  303|    924|{
  304|    924|    int ref = 0;
  305|       |
  306|    924|    if (keymgmt == NULL)
  ------------------
  |  Branch (306:9): [True: 224, False: 700]
  ------------------
  307|    224|        return;
  308|       |
  309|    700|    CRYPTO_DOWN_REF(&keymgmt->refcnt, &ref);
  310|    700|    if (ref > 0)
  ------------------
  |  Branch (310:9): [True: 660, False: 40]
  ------------------
  311|    660|        return;
  312|     40|    OPENSSL_free(keymgmt->type_name);
  ------------------
  |  |  115|     40|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  313|     40|    ossl_provider_free(keymgmt->prov);
  314|     40|    CRYPTO_FREE_REF(&keymgmt->refcnt);
  315|     40|    OPENSSL_free(keymgmt);
  ------------------
  |  |  115|     40|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  316|     40|}
EVP_KEYMGMT_get0_provider:
  319|    264|{
  320|    264|    return keymgmt->prov;
  321|    264|}
evp_keymgmt_get_legacy_alg:
  329|    359|{
  330|    359|    return keymgmt->legacy_alg;
  331|    359|}
EVP_KEYMGMT_get0_name:
  339|    322|{
  340|    322|    return keymgmt->type_name;
  341|    322|}
EVP_KEYMGMT_is_a:
  344|      3|{
  345|      3|    return keymgmt != NULL
  ------------------
  |  Branch (345:12): [True: 3, False: 0]
  ------------------
  346|      3|           && evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name);
  ------------------
  |  Branch (346:15): [True: 0, False: 3]
  ------------------
  347|      3|}
EVP_KEYMGMT_names_do_all:
  363|    206|{
  364|    206|    if (keymgmt->prov != NULL)
  ------------------
  |  Branch (364:9): [True: 206, False: 0]
  ------------------
  365|    206|        return evp_names_do_all(keymgmt->prov, keymgmt->name_id, fn, data);
  366|       |
  367|      0|    return 1;
  368|    206|}
evp_keymgmt_newdata:
  374|     78|{
  375|     78|    void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt));
  376|       |
  377|       |    /*
  378|       |     * 'new' is currently mandatory on its own, but when new
  379|       |     * constructors appear, it won't be quite as mandatory,
  380|       |     * so we have a check for future cases.
  381|       |     */
  382|     78|    if (keymgmt->new == NULL)
  ------------------
  |  Branch (382:9): [True: 0, False: 78]
  ------------------
  383|      0|        return NULL;
  384|     78|    return keymgmt->new(provctx);
  385|     78|}
evp_keymgmt_freedata:
  388|    244|{
  389|       |    /* This is mandatory, no need to check for its presence */
  390|    244|    keymgmt->free(keydata);
  391|    244|}
evp_keymgmt_gen_init:
  395|    166|{
  396|    166|    void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt));
  397|       |
  398|    166|    if (keymgmt->gen_init == NULL)
  ------------------
  |  Branch (398:9): [True: 0, False: 166]
  ------------------
  399|      0|        return NULL;
  400|    166|    return keymgmt->gen_init(provctx, selection, params);
  401|    166|}
evp_keymgmt_gen:
  453|    166|{
  454|    166|    void *ret;
  455|    166|    const char *desc = keymgmt->description != NULL ? keymgmt->description : "";
  ------------------
  |  Branch (455:24): [True: 166, False: 0]
  ------------------
  456|       |
  457|    166|    if (keymgmt->gen == NULL) {
  ------------------
  |  Branch (457:9): [True: 0, False: 166]
  ------------------
  458|      0|        ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED,
  ------------------
  |  |   76|      0|# define ERR_LIB_EVP             6
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED,
  ------------------
  |  |  110|      0|# define EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED             236
  ------------------
  459|      0|                       "%s key generation:%s", keymgmt->type_name, desc);
  460|      0|        return NULL;
  461|      0|    }
  462|       |
  463|    166|    ret = keymgmt->gen(genctx, cb, cbarg);
  464|    166|    if (ret == NULL)
  ------------------
  |  Branch (464:9): [True: 0, False: 166]
  ------------------
  465|      0|        ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_FAILURE,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_FAILURE,
  ------------------
  |  |   76|      0|# define ERR_LIB_EVP             6
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_PROVIDER_KEYMGMT_FAILURE,
  ------------------
  |  |  109|      0|# define EVP_R_PROVIDER_KEYMGMT_FAILURE                   233
  ------------------
  466|      0|                       "%s key generation:%s", keymgmt->type_name, desc);
  467|    166|    return ret;
  468|    166|}
evp_keymgmt_gen_cleanup:
  471|    166|{
  472|    166|    if (keymgmt->gen_cleanup != NULL)
  ------------------
  |  Branch (472:9): [True: 166, False: 0]
  ------------------
  473|    166|        keymgmt->gen_cleanup(genctx);
  474|    166|}
evp_keymgmt_get_params:
  491|    166|{
  492|    166|    if (keymgmt->get_params == NULL)
  ------------------
  |  Branch (492:9): [True: 0, False: 166]
  ------------------
  493|      0|        return 1;
  494|    166|    return keymgmt->get_params(keydata, params);
  495|    166|}
evp_keymgmt_has:
  524|     38|{
  525|       |    /* This is mandatory, no need to check for its presence */
  526|     38|    return keymgmt->has(keydata, selection);
  527|     38|}
evp_keymgmt_match:
  541|     16|{
  542|       |    /* We assume no match if the implementation doesn't have a function */
  543|     16|    if (keymgmt->match == NULL)
  ------------------
  |  Branch (543:9): [True: 0, False: 16]
  ------------------
  544|      0|        return 0;
  545|     16|    return keymgmt->match(keydata1, keydata2, selection);
  546|     16|}
evp_keymgmt_import:
  550|     78|{
  551|     78|    if (keymgmt->import == NULL)
  ------------------
  |  Branch (551:9): [True: 0, False: 78]
  ------------------
  552|      0|        return 0;
  553|     78|    return keymgmt->import(keydata, selection, params);
  554|     78|}
evp_keymgmt_export:
  570|      3|{
  571|      3|    if (keymgmt->export == NULL)
  ------------------
  |  Branch (571:9): [True: 0, False: 3]
  ------------------
  572|      0|        return 0;
  573|      3|    return keymgmt->export(keydata, selection, param_cb, cbarg);
  574|      3|}
keymgmt_meth.c:keymgmt_from_algorithm:
   66|     40|{
   67|     40|    const OSSL_DISPATCH *fns = algodef->implementation;
   68|     40|    EVP_KEYMGMT *keymgmt = NULL;
   69|     40|    int setparamfncnt = 0, getparamfncnt = 0;
   70|     40|    int setgenparamfncnt = 0;
   71|     40|    int importfncnt = 0, exportfncnt = 0;
   72|     40|    int importtypesfncnt = 0, exporttypesfncnt = 0;
   73|     40|    int getgenparamfncnt = 0;
   74|       |
   75|     40|    if ((keymgmt = keymgmt_new()) == NULL)
  ------------------
  |  Branch (75:9): [True: 0, False: 40]
  ------------------
   76|      0|        return NULL;
   77|       |
   78|     40|    keymgmt->name_id = name_id;
   79|     40|    if ((keymgmt->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (79:9): [True: 0, False: 40]
  ------------------
   80|      0|        EVP_KEYMGMT_free(keymgmt);
   81|      0|        return NULL;
   82|      0|    }
   83|     40|    keymgmt->description = algodef->algorithm_description;
   84|       |
   85|    746|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (85:12): [True: 706, False: 40]
  ------------------
   86|    706|        switch (fns->function_id) {
  ------------------
  |  Branch (86:17): [True: 0, False: 706]
  ------------------
   87|     40|        case OSSL_FUNC_KEYMGMT_NEW:
  ------------------
  |  |  658|     40|# define OSSL_FUNC_KEYMGMT_NEW                         1
  ------------------
  |  Branch (87:9): [True: 40, False: 666]
  ------------------
   88|     40|            if (keymgmt->new == NULL)
  ------------------
  |  Branch (88:17): [True: 40, False: 0]
  ------------------
   89|     40|                keymgmt->new = OSSL_FUNC_keymgmt_new(fns);
   90|     40|            break;
   91|     37|        case OSSL_FUNC_KEYMGMT_GEN_INIT:
  ------------------
  |  |  662|     37|# define OSSL_FUNC_KEYMGMT_GEN_INIT                    2
  ------------------
  |  Branch (91:9): [True: 37, False: 669]
  ------------------
   92|     37|            if (keymgmt->gen_init == NULL)
  ------------------
  |  Branch (92:17): [True: 37, False: 0]
  ------------------
   93|     37|                keymgmt->gen_init = OSSL_FUNC_keymgmt_gen_init(fns);
   94|     37|            break;
   95|      5|        case OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE:
  ------------------
  |  |  663|      5|# define OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE            3
  ------------------
  |  Branch (95:9): [True: 5, False: 701]
  ------------------
   96|      5|            if (keymgmt->gen_set_template == NULL)
  ------------------
  |  Branch (96:17): [True: 5, False: 0]
  ------------------
   97|      5|                keymgmt->gen_set_template =
   98|      5|                    OSSL_FUNC_keymgmt_gen_set_template(fns);
   99|      5|            break;
  100|     37|        case OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS:
  ------------------
  |  |  664|     37|# define OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS              4
  ------------------
  |  Branch (100:9): [True: 37, False: 669]
  ------------------
  101|     37|            if (keymgmt->gen_set_params == NULL) {
  ------------------
  |  Branch (101:17): [True: 37, False: 0]
  ------------------
  102|     37|                setgenparamfncnt++;
  103|     37|                keymgmt->gen_set_params =
  104|     37|                    OSSL_FUNC_keymgmt_gen_set_params(fns);
  105|     37|            }
  106|     37|            break;
  107|     37|        case OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS:
  ------------------
  |  |  665|     37|# define OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS         5
  ------------------
  |  Branch (107:9): [True: 37, False: 669]
  ------------------
  108|     37|            if (keymgmt->gen_settable_params == NULL) {
  ------------------
  |  Branch (108:17): [True: 37, False: 0]
  ------------------
  109|     37|                setgenparamfncnt++;
  110|     37|                keymgmt->gen_settable_params =
  111|     37|                    OSSL_FUNC_keymgmt_gen_settable_params(fns);
  112|     37|            }
  113|     37|            break;
  114|      2|        case OSSL_FUNC_KEYMGMT_GEN_GET_PARAMS:
  ------------------
  |  |  668|      2|# define OSSL_FUNC_KEYMGMT_GEN_GET_PARAMS              15
  ------------------
  |  Branch (114:9): [True: 2, False: 704]
  ------------------
  115|      2|            if (keymgmt->gen_get_params == NULL) {
  ------------------
  |  Branch (115:17): [True: 2, False: 0]
  ------------------
  116|      2|                getgenparamfncnt++;
  117|      2|                keymgmt->gen_get_params =
  118|      2|                    OSSL_FUNC_keymgmt_gen_get_params(fns);
  119|      2|            }
  120|      2|            break;
  121|      2|        case OSSL_FUNC_KEYMGMT_GEN_GETTABLE_PARAMS:
  ------------------
  |  |  669|      2|# define OSSL_FUNC_KEYMGMT_GEN_GETTABLE_PARAMS         16
  ------------------
  |  Branch (121:9): [True: 2, False: 704]
  ------------------
  122|      2|            if (keymgmt->gen_gettable_params == NULL) {
  ------------------
  |  Branch (122:17): [True: 2, False: 0]
  ------------------
  123|      2|                getgenparamfncnt++;
  124|      2|                keymgmt->gen_gettable_params =
  125|      2|                    OSSL_FUNC_keymgmt_gen_gettable_params(fns);
  126|      2|            }
  127|      2|            break;
  128|     37|        case OSSL_FUNC_KEYMGMT_GEN:
  ------------------
  |  |  666|     37|# define OSSL_FUNC_KEYMGMT_GEN                         6
  ------------------
  |  Branch (128:9): [True: 37, False: 669]
  ------------------
  129|     37|            if (keymgmt->gen == NULL)
  ------------------
  |  Branch (129:17): [True: 37, False: 0]
  ------------------
  130|     37|                keymgmt->gen = OSSL_FUNC_keymgmt_gen(fns);
  131|     37|            break;
  132|     37|        case OSSL_FUNC_KEYMGMT_GEN_CLEANUP:
  ------------------
  |  |  667|     37|# define OSSL_FUNC_KEYMGMT_GEN_CLEANUP                 7
  ------------------
  |  Branch (132:9): [True: 37, False: 669]
  ------------------
  133|     37|            if (keymgmt->gen_cleanup == NULL)
  ------------------
  |  Branch (133:17): [True: 37, False: 0]
  ------------------
  134|     37|                keymgmt->gen_cleanup = OSSL_FUNC_keymgmt_gen_cleanup(fns);
  135|     37|            break;
  136|     40|        case OSSL_FUNC_KEYMGMT_FREE:
  ------------------
  |  |  694|     40|# define OSSL_FUNC_KEYMGMT_FREE                       10
  ------------------
  |  Branch (136:9): [True: 40, False: 666]
  ------------------
  137|     40|            if (keymgmt->free == NULL)
  ------------------
  |  Branch (137:17): [True: 40, False: 0]
  ------------------
  138|     40|                keymgmt->free = OSSL_FUNC_keymgmt_free(fns);
  139|     40|            break;
  140|     29|        case OSSL_FUNC_KEYMGMT_LOAD:
  ------------------
  |  |  689|     29|# define OSSL_FUNC_KEYMGMT_LOAD                        8
  ------------------
  |  Branch (140:9): [True: 29, False: 677]
  ------------------
  141|     29|            if (keymgmt->load == NULL)
  ------------------
  |  Branch (141:17): [True: 29, False: 0]
  ------------------
  142|     29|                keymgmt->load = OSSL_FUNC_keymgmt_load(fns);
  143|     29|            break;
  144|     37|        case OSSL_FUNC_KEYMGMT_GET_PARAMS:
  ------------------
  |  |  698|     37|#define OSSL_FUNC_KEYMGMT_GET_PARAMS                  11
  ------------------
  |  Branch (144:9): [True: 37, False: 669]
  ------------------
  145|     37|            if (keymgmt->get_params == NULL) {
  ------------------
  |  Branch (145:17): [True: 37, False: 0]
  ------------------
  146|     37|                getparamfncnt++;
  147|     37|                keymgmt->get_params = OSSL_FUNC_keymgmt_get_params(fns);
  148|     37|            }
  149|     37|            break;
  150|     37|        case OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS:
  ------------------
  |  |  699|     37|#define OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS             12
  ------------------
  |  Branch (150:9): [True: 37, False: 669]
  ------------------
  151|     37|            if (keymgmt->gettable_params == NULL) {
  ------------------
  |  Branch (151:17): [True: 37, False: 0]
  ------------------
  152|     37|                getparamfncnt++;
  153|     37|                keymgmt->gettable_params =
  154|     37|                    OSSL_FUNC_keymgmt_gettable_params(fns);
  155|     37|            }
  156|     37|            break;
  157|     19|         case OSSL_FUNC_KEYMGMT_SET_PARAMS:
  ------------------
  |  |  705|     19|#define OSSL_FUNC_KEYMGMT_SET_PARAMS                  13
  ------------------
  |  Branch (157:10): [True: 19, False: 687]
  ------------------
  158|     19|            if (keymgmt->set_params == NULL) {
  ------------------
  |  Branch (158:17): [True: 19, False: 0]
  ------------------
  159|     19|                setparamfncnt++;
  160|     19|                keymgmt->set_params = OSSL_FUNC_keymgmt_set_params(fns);
  161|     19|            }
  162|     19|            break;
  163|     19|        case OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS:
  ------------------
  |  |  706|     19|#define OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS             14
  ------------------
  |  Branch (163:9): [True: 19, False: 687]
  ------------------
  164|     19|            if (keymgmt->settable_params == NULL) {
  ------------------
  |  Branch (164:17): [True: 19, False: 0]
  ------------------
  165|     19|                setparamfncnt++;
  166|     19|                keymgmt->settable_params =
  167|     19|                    OSSL_FUNC_keymgmt_settable_params(fns);
  168|     19|            }
  169|     19|            break;
  170|      4|        case OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME:
  ------------------
  |  |  713|      4|# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME       20
  ------------------
  |  Branch (170:9): [True: 4, False: 702]
  ------------------
  171|      4|            if (keymgmt->query_operation_name == NULL)
  ------------------
  |  Branch (171:17): [True: 4, False: 0]
  ------------------
  172|      4|                keymgmt->query_operation_name =
  173|      4|                    OSSL_FUNC_keymgmt_query_operation_name(fns);
  174|      4|            break;
  175|     40|        case OSSL_FUNC_KEYMGMT_HAS:
  ------------------
  |  |  718|     40|# define OSSL_FUNC_KEYMGMT_HAS                        21
  ------------------
  |  Branch (175:9): [True: 40, False: 666]
  ------------------
  176|     40|            if (keymgmt->has == NULL)
  ------------------
  |  Branch (176:17): [True: 40, False: 0]
  ------------------
  177|     40|                keymgmt->has = OSSL_FUNC_keymgmt_has(fns);
  178|     40|            break;
  179|     33|        case OSSL_FUNC_KEYMGMT_DUP:
  ------------------
  |  |  748|     33|# define OSSL_FUNC_KEYMGMT_DUP                        44
  ------------------
  |  Branch (179:9): [True: 33, False: 673]
  ------------------
  180|     33|            if (keymgmt->dup == NULL)
  ------------------
  |  Branch (180:17): [True: 33, False: 0]
  ------------------
  181|     33|                keymgmt->dup = OSSL_FUNC_keymgmt_dup(fns);
  182|     33|            break;
  183|     29|        case OSSL_FUNC_KEYMGMT_VALIDATE:
  ------------------
  |  |  722|     29|# define OSSL_FUNC_KEYMGMT_VALIDATE                   22
  ------------------
  |  Branch (183:9): [True: 29, False: 677]
  ------------------
  184|     29|            if (keymgmt->validate == NULL)
  ------------------
  |  Branch (184:17): [True: 29, False: 0]
  ------------------
  185|     29|                keymgmt->validate = OSSL_FUNC_keymgmt_validate(fns);
  186|     29|            break;
  187|     37|        case OSSL_FUNC_KEYMGMT_MATCH:
  ------------------
  |  |  727|     37|# define OSSL_FUNC_KEYMGMT_MATCH                      23
  ------------------
  |  Branch (187:9): [True: 37, False: 669]
  ------------------
  188|     37|            if (keymgmt->match == NULL)
  ------------------
  |  Branch (188:17): [True: 37, False: 0]
  ------------------
  189|     37|                keymgmt->match = OSSL_FUNC_keymgmt_match(fns);
  190|     37|            break;
  191|     37|        case OSSL_FUNC_KEYMGMT_IMPORT:
  ------------------
  |  |  733|     37|# define OSSL_FUNC_KEYMGMT_IMPORT                     40
  ------------------
  |  Branch (191:9): [True: 37, False: 669]
  ------------------
  192|     37|            if (keymgmt->import == NULL) {
  ------------------
  |  Branch (192:17): [True: 37, False: 0]
  ------------------
  193|     37|                importfncnt++;
  194|     37|                keymgmt->import = OSSL_FUNC_keymgmt_import(fns);
  195|     37|            }
  196|     37|            break;
  197|     37|        case OSSL_FUNC_KEYMGMT_IMPORT_TYPES:
  ------------------
  |  |  734|     37|# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES               41
  ------------------
  |  Branch (197:9): [True: 37, False: 669]
  ------------------
  198|     37|            if (keymgmt->import_types == NULL) {
  ------------------
  |  Branch (198:17): [True: 37, False: 0]
  ------------------
  199|     37|                if (importtypesfncnt == 0)
  ------------------
  |  Branch (199:21): [True: 37, False: 0]
  ------------------
  200|     37|                    importfncnt++;
  201|     37|                importtypesfncnt++;
  202|     37|                keymgmt->import_types = OSSL_FUNC_keymgmt_import_types(fns);
  203|     37|            }
  204|     37|            break;
  205|      0|        case OSSL_FUNC_KEYMGMT_IMPORT_TYPES_EX:
  ------------------
  |  |  753|      0|# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES_EX            45
  ------------------
  |  Branch (205:9): [True: 0, False: 706]
  ------------------
  206|      0|            if (keymgmt->import_types_ex == NULL) {
  ------------------
  |  Branch (206:17): [True: 0, False: 0]
  ------------------
  207|      0|                if (importtypesfncnt == 0)
  ------------------
  |  Branch (207:21): [True: 0, False: 0]
  ------------------
  208|      0|                    importfncnt++;
  209|      0|                importtypesfncnt++;
  210|      0|                keymgmt->import_types_ex = OSSL_FUNC_keymgmt_import_types_ex(fns);
  211|      0|            }
  212|      0|            break;
  213|     37|        case OSSL_FUNC_KEYMGMT_EXPORT:
  ------------------
  |  |  735|     37|# define OSSL_FUNC_KEYMGMT_EXPORT                     42
  ------------------
  |  Branch (213:9): [True: 37, False: 669]
  ------------------
  214|     37|            if (keymgmt->export == NULL) {
  ------------------
  |  Branch (214:17): [True: 37, False: 0]
  ------------------
  215|     37|                exportfncnt++;
  216|     37|                keymgmt->export = OSSL_FUNC_keymgmt_export(fns);
  217|     37|            }
  218|     37|            break;
  219|     37|        case OSSL_FUNC_KEYMGMT_EXPORT_TYPES:
  ------------------
  |  |  736|     37|# define OSSL_FUNC_KEYMGMT_EXPORT_TYPES               43
  ------------------
  |  Branch (219:9): [True: 37, False: 669]
  ------------------
  220|     37|            if (keymgmt->export_types == NULL) {
  ------------------
  |  Branch (220:17): [True: 37, False: 0]
  ------------------
  221|     37|                if (exporttypesfncnt == 0)
  ------------------
  |  Branch (221:21): [True: 37, False: 0]
  ------------------
  222|     37|                    exportfncnt++;
  223|     37|                exporttypesfncnt++;
  224|     37|                keymgmt->export_types = OSSL_FUNC_keymgmt_export_types(fns);
  225|     37|            }
  226|     37|            break;
  227|      0|        case OSSL_FUNC_KEYMGMT_EXPORT_TYPES_EX:
  ------------------
  |  |  754|      0|# define OSSL_FUNC_KEYMGMT_EXPORT_TYPES_EX            46
  ------------------
  |  Branch (227:9): [True: 0, False: 706]
  ------------------
  228|      0|            if (keymgmt->export_types_ex == NULL) {
  ------------------
  |  Branch (228:17): [True: 0, False: 0]
  ------------------
  229|      0|                if (exporttypesfncnt == 0)
  ------------------
  |  Branch (229:21): [True: 0, False: 0]
  ------------------
  230|      0|                    exportfncnt++;
  231|      0|                exporttypesfncnt++;
  232|      0|                keymgmt->export_types_ex = OSSL_FUNC_keymgmt_export_types_ex(fns);
  233|      0|            }
  234|      0|            break;
  235|    706|        }
  236|    706|    }
  237|       |    /*
  238|       |     * Try to check that the method is sensible.
  239|       |     * At least one constructor and the destructor are MANDATORY
  240|       |     * The functions 'has' is MANDATORY
  241|       |     * It makes no sense being able to free stuff if you can't create it.
  242|       |     * It makes no sense providing OSSL_PARAM descriptors for import and
  243|       |     * export if you can't import or export.
  244|       |     */
  245|     40|    if (keymgmt->free == NULL
  ------------------
  |  Branch (245:9): [True: 0, False: 40]
  ------------------
  246|     40|        || (keymgmt->new == NULL
  ------------------
  |  Branch (246:13): [True: 0, False: 40]
  ------------------
  247|     40|            && keymgmt->gen == NULL
  ------------------
  |  Branch (247:16): [True: 0, False: 0]
  ------------------
  248|     40|            && keymgmt->load == NULL)
  ------------------
  |  Branch (248:16): [True: 0, False: 0]
  ------------------
  249|     40|        || keymgmt->has == NULL
  ------------------
  |  Branch (249:12): [True: 0, False: 40]
  ------------------
  250|     40|        || (getparamfncnt != 0 && getparamfncnt != 2)
  ------------------
  |  Branch (250:13): [True: 37, False: 3]
  |  Branch (250:35): [True: 0, False: 37]
  ------------------
  251|     40|        || (setparamfncnt != 0 && setparamfncnt != 2)
  ------------------
  |  Branch (251:13): [True: 19, False: 21]
  |  Branch (251:35): [True: 0, False: 19]
  ------------------
  252|     40|        || (setgenparamfncnt != 0 && setgenparamfncnt != 2)
  ------------------
  |  Branch (252:13): [True: 37, False: 3]
  |  Branch (252:38): [True: 0, False: 37]
  ------------------
  253|     40|        || (getgenparamfncnt != 0 && getgenparamfncnt != 2)
  ------------------
  |  Branch (253:13): [True: 2, False: 38]
  |  Branch (253:38): [True: 0, False: 2]
  ------------------
  254|     40|        || (importfncnt != 0 && importfncnt != 2)
  ------------------
  |  Branch (254:13): [True: 37, False: 3]
  |  Branch (254:33): [True: 0, False: 37]
  ------------------
  255|     40|        || (exportfncnt != 0 && exportfncnt != 2)
  ------------------
  |  Branch (255:13): [True: 37, False: 3]
  |  Branch (255:33): [True: 0, False: 37]
  ------------------
  256|     40|        || (keymgmt->gen != NULL
  ------------------
  |  Branch (256:13): [True: 37, False: 3]
  ------------------
  257|     40|            && (keymgmt->gen_init == NULL
  ------------------
  |  Branch (257:17): [True: 0, False: 37]
  ------------------
  258|     37|                || keymgmt->gen_cleanup == NULL))) {
  ------------------
  |  Branch (258:20): [True: 0, False: 37]
  ------------------
  259|      0|        EVP_KEYMGMT_free(keymgmt);
  260|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  261|      0|        return NULL;
  262|      0|    }
  263|     40|    keymgmt->prov = prov;
  264|     40|    if (prov != NULL)
  ------------------
  |  Branch (264:9): [True: 40, False: 0]
  ------------------
  265|     40|        ossl_provider_up_ref(prov);
  266|       |
  267|     40|#ifndef FIPS_MODULE
  268|     40|    keymgmt->legacy_alg = get_legacy_alg_type_from_keymgmt(keymgmt);
  269|     40|#endif
  270|       |
  271|     40|    return keymgmt;
  272|     40|}
keymgmt_meth.c:keymgmt_new:
   31|     40|{
   32|     40|    EVP_KEYMGMT *keymgmt = NULL;
   33|       |
   34|     40|    if ((keymgmt = OPENSSL_zalloc(sizeof(*keymgmt))) == NULL)
  ------------------
  |  |  104|     40|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (34:9): [True: 0, False: 40]
  ------------------
   35|      0|        return NULL;
   36|     40|    if (!CRYPTO_NEW_REF(&keymgmt->refcnt, 1)) {
  ------------------
  |  Branch (36:9): [True: 0, False: 40]
  ------------------
   37|      0|        EVP_KEYMGMT_free(keymgmt);
   38|      0|        return NULL;
   39|      0|    }
   40|     40|    return keymgmt;
   41|     40|}
keymgmt_meth.c:get_legacy_alg_type_from_keymgmt:
   54|     40|{
   55|     40|    int type = NID_undef;
  ------------------
  |  |   18|     40|#define NID_undef                       0
  ------------------
   56|       |
   57|     40|    EVP_KEYMGMT_names_do_all(keymgmt, help_get_legacy_alg_type_from_keymgmt,
   58|     40|                             &type);
   59|     40|    return type;
   60|     40|}
keymgmt_meth.c:help_get_legacy_alg_type_from_keymgmt:
   46|    107|{
   47|    107|    int *type = arg;
   48|       |
   49|    107|    if (*type == NID_undef)
  ------------------
  |  |   18|    107|#define NID_undef                       0
  ------------------
  |  Branch (49:9): [True: 84, False: 23]
  ------------------
   50|     84|        *type = evp_pkey_name2type(keytype);
   51|    107|}
keymgmt_meth.c:evp_keymgmt_up_ref:
   26|    379|{
   27|    379|    return EVP_KEYMGMT_up_ref(data);
   28|    379|}
keymgmt_meth.c:evp_keymgmt_free:
   21|     83|{
   22|     83|    EVP_KEYMGMT_free(data);
   23|     83|}

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

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

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

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

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

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

EVP_sha1:
  103|      1|{
  104|      1|    return &sha1_md;
  105|      1|}
EVP_sha224:
  118|      1|{
  119|      1|    return &sha224_md;
  120|      1|}
EVP_sha256:
  133|      1|{
  134|      1|    return &sha256_md;
  135|      1|}
EVP_sha512_224:
  148|      1|{
  149|      1|    return &sha512_224_md;
  150|      1|}
EVP_sha512_256:
  163|      1|{
  164|      1|    return &sha512_256_md;
  165|      1|}
EVP_sha384:
  178|      1|{
  179|      1|    return &sha384_md;
  180|      1|}
EVP_sha512:
  193|      1|{
  194|      1|    return &sha512_md;
  195|      1|}
EVP_sha3_224:
  198|      1|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  199|      1|{                                                                              \
  200|      1|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  201|      1|        NID_sha3_##bitlen,                                                     \
  202|      1|        NID_RSA_SHA3_##bitlen,                                                 \
  203|      1|        bitlen / 8,                                                            \
  204|      1|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  205|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  206|      1|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  207|      1|                                 sha3_int_final, NULL,                         \
  208|      1|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  209|      1|    };                                                                         \
  210|      1|    return &sha3_##bitlen##_md;                                                \
  211|      1|}
EVP_sha3_256:
  198|      1|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  199|      1|{                                                                              \
  200|      1|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  201|      1|        NID_sha3_##bitlen,                                                     \
  202|      1|        NID_RSA_SHA3_##bitlen,                                                 \
  203|      1|        bitlen / 8,                                                            \
  204|      1|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  205|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  206|      1|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  207|      1|                                 sha3_int_final, NULL,                         \
  208|      1|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  209|      1|    };                                                                         \
  210|      1|    return &sha3_##bitlen##_md;                                                \
  211|      1|}
EVP_sha3_384:
  198|      1|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  199|      1|{                                                                              \
  200|      1|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  201|      1|        NID_sha3_##bitlen,                                                     \
  202|      1|        NID_RSA_SHA3_##bitlen,                                                 \
  203|      1|        bitlen / 8,                                                            \
  204|      1|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  205|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  206|      1|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  207|      1|                                 sha3_int_final, NULL,                         \
  208|      1|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  209|      1|    };                                                                         \
  210|      1|    return &sha3_##bitlen##_md;                                                \
  211|      1|}
EVP_sha3_512:
  198|      1|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  199|      1|{                                                                              \
  200|      1|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  201|      1|        NID_sha3_##bitlen,                                                     \
  202|      1|        NID_RSA_SHA3_##bitlen,                                                 \
  203|      1|        bitlen / 8,                                                            \
  204|      1|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  205|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  206|      1|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  207|      1|                                 sha3_int_final, NULL,                         \
  208|      1|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  209|      1|    };                                                                         \
  210|      1|    return &sha3_##bitlen##_md;                                                \
  211|      1|}
EVP_shake128:
  213|      1|const EVP_MD *EVP_shake##bitlen(void)                                          \
  214|      1|{                                                                              \
  215|      1|    static const EVP_MD shake##bitlen##_md = {                                 \
  216|      1|        NID_shake##bitlen,                                                     \
  217|      1|        0,                                                                     \
  218|      1|        bitlen / 8,                                                            \
  219|      1|        EVP_MD_FLAG_XOF | EVP_MD_FLAG_DIGALGID_ABSENT,                         \
  ------------------
  |  |  184|      1|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
                      EVP_MD_FLAG_XOF | EVP_MD_FLAG_DIGALGID_ABSENT,                         \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  220|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  221|      1|        LEGACY_EVP_MD_METH_TABLE(shake_init, sha3_int_update, sha3_int_final,  \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  222|      1|                        shake_ctrl, (KECCAK1600_WIDTH - bitlen * 2) / 8),      \
  223|      1|    };                                                                         \
  224|      1|    return &shake##bitlen##_md;                                                \
  225|      1|}
EVP_shake256:
  213|      1|const EVP_MD *EVP_shake##bitlen(void)                                          \
  214|      1|{                                                                              \
  215|      1|    static const EVP_MD shake##bitlen##_md = {                                 \
  216|      1|        NID_shake##bitlen,                                                     \
  217|      1|        0,                                                                     \
  218|      1|        bitlen / 8,                                                            \
  219|      1|        EVP_MD_FLAG_XOF | EVP_MD_FLAG_DIGALGID_ABSENT,                         \
  ------------------
  |  |  184|      1|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
                      EVP_MD_FLAG_XOF | EVP_MD_FLAG_DIGALGID_ABSENT,                         \
  ------------------
  |  |  196|      1|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  220|      1|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  253|      1|#define EVP_ORIG_GLOBAL     1
  ------------------
  221|      1|        LEGACY_EVP_MD_METH_TABLE(shake_init, sha3_int_update, sha3_int_final,  \
  ------------------
  |  |   40|      1|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  222|      1|                        shake_ctrl, (KECCAK1600_WIDTH - bitlen * 2) / 8),      \
  223|      1|    };                                                                         \
  224|      1|    return &shake##bitlen##_md;                                                \
  225|      1|}

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

EVP_add_cipher:
   20|    144|{
   21|    144|    int r;
   22|       |
   23|    144|    if (c == NULL)
  ------------------
  |  Branch (23:9): [True: 0, False: 144]
  ------------------
   24|      0|        return 0;
   25|       |
   26|    144|    r = OBJ_NAME_add(OBJ_nid2sn(c->nid), OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|    144|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
   27|    144|                     (const char *)c);
   28|    144|    if (r == 0)
  ------------------
  |  Branch (28:9): [True: 0, False: 144]
  ------------------
   29|      0|        return 0;
   30|    144|    r = OBJ_NAME_add(OBJ_nid2ln(c->nid), OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|    144|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
   31|    144|                     (const char *)c);
   32|    144|    return r;
   33|    144|}
EVP_add_digest:
   36|     22|{
   37|     22|    int r;
   38|     22|    const char *name;
   39|       |
   40|     22|    name = OBJ_nid2sn(md->type);
   41|     22|    r = OBJ_NAME_add(name, OBJ_NAME_TYPE_MD_METH, (const char *)md);
  ------------------
  |  |   25|     22|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
   42|     22|    if (r == 0)
  ------------------
  |  Branch (42:9): [True: 0, False: 22]
  ------------------
   43|      0|        return 0;
   44|     22|    r = OBJ_NAME_add(OBJ_nid2ln(md->type), OBJ_NAME_TYPE_MD_METH,
  ------------------
  |  |   25|     22|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
   45|     22|                     (const char *)md);
   46|     22|    if (r == 0)
  ------------------
  |  Branch (46:9): [True: 0, False: 22]
  ------------------
   47|      0|        return 0;
   48|       |
   49|     22|    if (md->pkey_type && md->type != md->pkey_type) {
  ------------------
  |  Branch (49:9): [True: 17, False: 5]
  |  Branch (49:26): [True: 16, False: 1]
  ------------------
   50|     16|        r = OBJ_NAME_add(OBJ_nid2sn(md->pkey_type),
   51|     16|                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   25|     16|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
                                       OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   33|     16|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
   52|     16|        if (r == 0)
  ------------------
  |  Branch (52:13): [True: 0, False: 16]
  ------------------
   53|      0|            return 0;
   54|     16|        r = OBJ_NAME_add(OBJ_nid2ln(md->pkey_type),
   55|     16|                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   25|     16|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
                                       OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   33|     16|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
   56|     16|    }
   57|     22|    return r;
   58|     22|}
evp_cleanup_int:
  180|      1|{
  181|      1|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_KDF_METH);
  ------------------
  |  |   30|      1|# define OBJ_NAME_TYPE_KDF_METH          0x06
  ------------------
  182|      1|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|      1|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  183|      1|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|      1|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  184|       |    /*
  185|       |     * The above calls will only clean out the contents of the name hash
  186|       |     * table, but not the hash table itself.  The following line does that
  187|       |     * part.  -- Richard Levitte
  188|       |     */
  189|      1|    OBJ_NAME_cleanup(-1);
  190|       |
  191|      1|    EVP_PBE_cleanup();
  192|      1|    OBJ_sigid_free();
  193|       |
  194|      1|    evp_app_cleanup_int();
  195|      1|}

EVP_PKEY_eq:
  369|     38|{
  370|       |    /*
  371|       |     * This will just call evp_keymgmt_util_match when legacy support
  372|       |     * is gone.
  373|       |     */
  374|       |
  375|       |    /* Trivial shortcuts */
  376|     38|    if (a == b)
  ------------------
  |  Branch (376:9): [True: 19, False: 19]
  ------------------
  377|     19|        return 1;
  378|     19|    if (a == NULL || b == NULL)
  ------------------
  |  Branch (378:9): [True: 0, False: 19]
  |  Branch (378:22): [True: 0, False: 19]
  ------------------
  379|      0|        return 0;
  380|       |
  381|     19|#ifndef FIPS_MODULE
  382|     19|    if (a->keymgmt != NULL || b->keymgmt != NULL)
  ------------------
  |  Branch (382:9): [True: 19, False: 0]
  |  Branch (382:31): [True: 0, False: 0]
  ------------------
  383|     19|#endif  /* !FIPS_MODULE */
  384|     19|    {
  385|     19|        int selection = SELECT_PARAMETERS;
  ------------------
  |  |   58|     19|# define SELECT_PARAMETERS OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS
  |  |  ------------------
  |  |  |  |  642|     19|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  ------------------
  386|       |
  387|     19|        if (evp_keymgmt_util_has((EVP_PKEY *)a, OSSL_KEYMGMT_SELECT_PUBLIC_KEY)
  ------------------
  |  |  641|     19|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (387:13): [True: 19, False: 0]
  ------------------
  388|     19|            && evp_keymgmt_util_has((EVP_PKEY *)b, OSSL_KEYMGMT_SELECT_PUBLIC_KEY))
  ------------------
  |  |  641|     19|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (388:16): [True: 19, False: 0]
  ------------------
  389|     19|            selection |= OSSL_KEYMGMT_SELECT_PUBLIC_KEY;
  ------------------
  |  |  641|     19|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  390|      0|        else
  391|      0|            selection |= OSSL_KEYMGMT_SELECT_KEYPAIR;
  ------------------
  |  |  650|      0|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|      0|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  392|     19|        return evp_pkey_cmp_any(a, b, selection);
  393|     19|    }
  394|       |
  395|      0|#ifndef FIPS_MODULE
  396|       |    /* All legacy keys */
  397|      0|    if (a->type != b->type)
  ------------------
  |  Branch (397:9): [True: 0, False: 0]
  ------------------
  398|      0|        return -1;
  399|       |
  400|      0|    if (a->ameth != NULL) {
  ------------------
  |  Branch (400:9): [True: 0, False: 0]
  ------------------
  401|      0|        int ret;
  402|       |        /* Compare parameters if the algorithm has them */
  403|      0|        if (a->ameth->param_cmp != NULL) {
  ------------------
  |  Branch (403:13): [True: 0, False: 0]
  ------------------
  404|      0|            ret = a->ameth->param_cmp(a, b);
  405|      0|            if (ret <= 0)
  ------------------
  |  Branch (405:17): [True: 0, False: 0]
  ------------------
  406|      0|                return ret;
  407|      0|        }
  408|       |
  409|      0|        if (a->ameth->pub_cmp != NULL)
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|      0|            return a->ameth->pub_cmp(a, b);
  411|      0|    }
  412|       |
  413|      0|    return -2;
  414|      0|#endif  /* !FIPS_MODULE */
  415|      0|}
EVP_PKEY_new_raw_private_key_ex:
  537|     35|{
  538|     35|    return new_raw_key_int(libctx, keytype, propq, EVP_PKEY_NONE, NULL, priv,
  ------------------
  |  |   62|     35|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|     35|#define NID_undef                       0
  |  |  ------------------
  ------------------
  539|     35|                           len, 1);
  540|     35|}
EVP_PKEY_new_raw_public_key_ex:
  552|     46|{
  553|     46|    return new_raw_key_int(libctx, keytype, propq, EVP_PKEY_NONE, NULL, pub,
  ------------------
  |  |   62|     46|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|     46|#define NID_undef                       0
  |  |  ------------------
  ------------------
  554|     46|                           len, 0);
  555|     46|}
EVP_PKEY_type:
 1026|    875|{
 1027|    875|    int ret;
 1028|    875|    const EVP_PKEY_ASN1_METHOD *ameth;
 1029|    875|    ENGINE *e;
 1030|    875|    ameth = EVP_PKEY_asn1_find(&e, type);
 1031|    875|    if (ameth)
  ------------------
  |  Branch (1031:9): [True: 5, False: 870]
  ------------------
 1032|      5|        ret = ameth->pkey_id;
 1033|    870|    else
 1034|    870|        ret = NID_undef;
  ------------------
  |  |   18|    870|#define NID_undef                       0
  ------------------
 1035|    875|# ifndef OPENSSL_NO_ENGINE
 1036|    875|    ENGINE_finish(e);
 1037|    875|# endif
 1038|    875|    return ret;
 1039|    875|}
evp_pkey_name2type:
 1079|    446|{
 1080|    446|    int type;
 1081|    446|    size_t i;
 1082|       |
 1083|  5.76k|    for (i = 0; i < OSSL_NELEM(standard_name2type); i++) {
  ------------------
  |  |   14|  5.76k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (1083:17): [True: 5.32k, False: 440]
  ------------------
 1084|  5.32k|        if (OPENSSL_strcasecmp(name, standard_name2type[i].ptr) == 0)
  ------------------
  |  Branch (1084:13): [True: 6, False: 5.31k]
  ------------------
 1085|      6|            return (int)standard_name2type[i].id;
 1086|  5.32k|    }
 1087|       |
 1088|    440|    if ((type = EVP_PKEY_type(OBJ_sn2nid(name))) != NID_undef)
  ------------------
  |  |   18|    440|#define NID_undef                       0
  ------------------
  |  Branch (1088:9): [True: 5, False: 435]
  ------------------
 1089|      5|        return type;
 1090|    435|    return EVP_PKEY_type(OBJ_ln2nid(name));
 1091|    440|}
EVP_PKEY_new:
 1509|    244|{
 1510|    244|    EVP_PKEY *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |  104|    244|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1511|       |
 1512|    244|    if (ret == NULL)
  ------------------
  |  Branch (1512:9): [True: 0, False: 244]
  ------------------
 1513|      0|        return NULL;
 1514|       |
 1515|    244|    ret->type = EVP_PKEY_NONE;
  ------------------
  |  |   62|    244|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    244|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1516|    244|    ret->save_type = EVP_PKEY_NONE;
  ------------------
  |  |   62|    244|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    244|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1517|       |
 1518|    244|    if (!CRYPTO_NEW_REF(&ret->references, 1))
  ------------------
  |  Branch (1518:9): [True: 0, False: 244]
  ------------------
 1519|      0|        goto err;
 1520|       |
 1521|    244|    ret->lock = CRYPTO_THREAD_lock_new();
 1522|    244|    if (ret->lock == NULL) {
  ------------------
  |  Branch (1522:9): [True: 0, False: 244]
  ------------------
 1523|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1524|      0|        goto err;
 1525|      0|    }
 1526|       |
 1527|    244|#ifndef FIPS_MODULE
 1528|    244|    ret->save_parameters = 1;
 1529|    244|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EVP_PKEY, ret, &ret->ex_data)) {
  ------------------
  |  |  247|    244|# define CRYPTO_EX_INDEX_EVP_PKEY        17
  ------------------
  |  Branch (1529:9): [True: 0, False: 244]
  ------------------
 1530|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1531|      0|        goto err;
 1532|      0|    }
 1533|    244|#endif
 1534|    244|    return ret;
 1535|       |
 1536|      0| err:
 1537|      0|    CRYPTO_FREE_REF(&ret->references);
 1538|      0|    CRYPTO_THREAD_lock_free(ret->lock);
 1539|      0|    OPENSSL_free(ret);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1540|      0|    return NULL;
 1541|    244|}
EVP_PKEY_set_type_by_keymgmt:
 1695|    166|{
 1696|    166|#ifndef FIPS_MODULE
 1697|    166|# define EVP_PKEY_TYPE_STR str[0]
 1698|    166|# define EVP_PKEY_TYPE_STRLEN (str[0] == NULL ? -1 : (int)strlen(str[0]))
 1699|       |    /*
 1700|       |     * Find at most two strings that have an associated EVP_PKEY_ASN1_METHOD
 1701|       |     * Ideally, only one should be found.  If two (or more) are found, the
 1702|       |     * match is ambiguous.  This should never happen, but...
 1703|       |     */
 1704|    166|    const char *str[2] = { NULL, NULL };
 1705|       |
 1706|    166|    if (!EVP_KEYMGMT_names_do_all(keymgmt, find_ameth, &str)
  ------------------
  |  Branch (1706:9): [True: 0, False: 166]
  ------------------
 1707|    166|            || str[1] != NULL) {
  ------------------
  |  Branch (1707:16): [True: 0, False: 166]
  ------------------
 1708|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1709|      0|        return 0;
 1710|      0|    }
 1711|       |#else
 1712|       |# define EVP_PKEY_TYPE_STR NULL
 1713|       |# define EVP_PKEY_TYPE_STRLEN -1
 1714|       |#endif
 1715|    166|    return pkey_set_type(pkey, NULL, EVP_PKEY_NONE,
  ------------------
  |  |   62|    166|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    166|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1716|    166|                         EVP_PKEY_TYPE_STR, EVP_PKEY_TYPE_STRLEN,
  ------------------
  |  | 1697|    166|# define EVP_PKEY_TYPE_STR str[0]
  ------------------
                                       EVP_PKEY_TYPE_STR, EVP_PKEY_TYPE_STRLEN,
  ------------------
  |  | 1698|    166|# define EVP_PKEY_TYPE_STRLEN (str[0] == NULL ? -1 : (int)strlen(str[0]))
  |  |  ------------------
  |  |  |  Branch (1698:32): [True: 166, False: 0]
  |  |  ------------------
  ------------------
 1717|    166|                         keymgmt);
 1718|       |
 1719|    166|#undef EVP_PKEY_TYPE_STR
 1720|    166|#undef EVP_PKEY_TYPE_STRLEN
 1721|    166|}
EVP_PKEY_up_ref:
 1724|    115|{
 1725|    115|    int i;
 1726|       |
 1727|    115|    if (CRYPTO_UP_REF(&pkey->references, &i) <= 0)
  ------------------
  |  Branch (1727:9): [True: 0, False: 115]
  ------------------
 1728|      0|        return 0;
 1729|       |
 1730|    115|    REF_PRINT_COUNT("EVP_PKEY", i, pkey);
  ------------------
  |  |  301|    115|    REF_PRINT_EX(text, val, (void *)object)
  |  |  ------------------
  |  |  |  |  299|    115|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|    115|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  283|    115|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1731|    115|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  293|    115|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (293:12): [True: 0, False: 115]
  |  |  ------------------
  ------------------
 1732|    115|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (1732:13): [True: 115, False: 0]
  ------------------
 1733|    115|}
evp_pkey_free_legacy:
 1798|    410|{
 1799|    410|    const EVP_PKEY_ASN1_METHOD *ameth = x->ameth;
 1800|    410|    ENGINE *tmpe = NULL;
 1801|       |
 1802|    410|    if (ameth == NULL && x->legacy_cache_pkey.ptr != NULL)
  ------------------
  |  Branch (1802:9): [True: 410, False: 0]
  |  Branch (1802:26): [True: 0, False: 410]
  ------------------
 1803|      0|        ameth = EVP_PKEY_asn1_find(&tmpe, x->type);
 1804|       |
 1805|    410|    if (ameth != NULL) {
  ------------------
  |  Branch (1805:9): [True: 0, False: 410]
  ------------------
 1806|      0|        if (x->legacy_cache_pkey.ptr != NULL) {
  ------------------
  |  Branch (1806:13): [True: 0, False: 0]
  ------------------
 1807|       |            /*
 1808|       |             * We should never have both a legacy origin key, and a key in the
 1809|       |             * legacy cache.
 1810|       |             */
 1811|      0|            assert(x->pkey.ptr == NULL);
 1812|       |            /*
 1813|       |             * For the purposes of freeing we make the legacy cache look like
 1814|       |             * a legacy origin key.
 1815|       |             */
 1816|      0|            x->pkey = x->legacy_cache_pkey;
 1817|      0|            x->legacy_cache_pkey.ptr = NULL;
 1818|      0|        }
 1819|      0|        if (ameth->pkey_free != NULL)
  ------------------
  |  Branch (1819:13): [True: 0, False: 0]
  ------------------
 1820|      0|            ameth->pkey_free(x);
 1821|      0|        x->pkey.ptr = NULL;
 1822|      0|    }
 1823|    410|# ifndef OPENSSL_NO_ENGINE
 1824|    410|    ENGINE_finish(tmpe);
 1825|    410|    ENGINE_finish(x->engine);
 1826|    410|    x->engine = NULL;
 1827|    410|    ENGINE_finish(x->pmeth_engine);
 1828|    410|    x->pmeth_engine = NULL;
 1829|    410|# endif
 1830|    410|}
EVP_PKEY_free:
 1851|  1.53k|{
 1852|  1.53k|    int i;
 1853|       |
 1854|  1.53k|    if (x == NULL)
  ------------------
  |  Branch (1854:9): [True: 1.17k, False: 359]
  ------------------
 1855|  1.17k|        return;
 1856|       |
 1857|    359|    CRYPTO_DOWN_REF(&x->references, &i);
 1858|    359|    REF_PRINT_COUNT("EVP_PKEY", i, x);
  ------------------
  |  |  301|    359|    REF_PRINT_EX(text, val, (void *)object)
  |  |  ------------------
  |  |  |  |  299|    359|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|    359|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  283|    359|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1859|    359|    if (i > 0)
  ------------------
  |  Branch (1859:9): [True: 115, False: 244]
  ------------------
 1860|    115|        return;
 1861|    244|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  293|    244|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (293:12): [True: 0, False: 244]
  |  |  ------------------
  ------------------
 1862|    244|    evp_pkey_free_it(x);
 1863|    244|#ifndef FIPS_MODULE
 1864|    244|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_EVP_PKEY, x, &x->ex_data);
  ------------------
  |  |  247|    244|# define CRYPTO_EX_INDEX_EVP_PKEY        17
  ------------------
 1865|    244|#endif
 1866|    244|    CRYPTO_THREAD_lock_free(x->lock);
 1867|    244|    CRYPTO_FREE_REF(&x->references);
 1868|    244|#ifndef FIPS_MODULE
 1869|    244|    sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
  ------------------
  |  |  278|    244|#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))
  ------------------
 1870|    244|#endif
 1871|    244|    OPENSSL_free(x);
  ------------------
  |  |  115|    244|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1872|    244|}
evp_pkey_export_to_provider:
 1909|     92|{
 1910|     92|    EVP_KEYMGMT *allocated_keymgmt = NULL;
 1911|     92|    EVP_KEYMGMT *tmp_keymgmt = NULL;
 1912|     92|    int selection = OSSL_KEYMGMT_SELECT_ALL;
  ------------------
  |  |  652|     92|    ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  650|     92|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  640|     92|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  641|     92|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  647|     92|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  642|     92|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  ------------------
  |  |  |  |  648|     92|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  643|     92|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1913|     92|    void *keydata = NULL;
 1914|     92|    int check;
 1915|       |
 1916|     92|    if (pk == NULL)
  ------------------
  |  Branch (1916:9): [True: 0, False: 92]
  ------------------
 1917|      0|        return NULL;
 1918|       |
 1919|       |    /* No key data => nothing to export */
 1920|     92|    check = 1;
 1921|     92|#ifndef FIPS_MODULE
 1922|     92|    check = check && pk->pkey.ptr == NULL;
  ------------------
  |  Branch (1922:13): [True: 92, False: 0]
  |  Branch (1922:22): [True: 92, False: 0]
  ------------------
 1923|     92|#endif
 1924|     92|    check = check && pk->keydata == NULL;
  ------------------
  |  Branch (1924:13): [True: 92, False: 0]
  |  Branch (1924:22): [True: 0, False: 92]
  ------------------
 1925|     92|    if (check)
  ------------------
  |  Branch (1925:9): [True: 0, False: 92]
  ------------------
 1926|      0|        return NULL;
 1927|       |
 1928|     92|#ifndef FIPS_MODULE
 1929|     92|    if (pk->pkey.ptr != NULL) {
  ------------------
  |  Branch (1929:9): [True: 0, False: 92]
  ------------------
 1930|       |        /*
 1931|       |         * If the legacy key doesn't have an dirty counter or export function,
 1932|       |         * give up
 1933|       |         */
 1934|      0|        if (pk->ameth->dirty_cnt == NULL || pk->ameth->export_to == NULL)
  ------------------
  |  Branch (1934:13): [True: 0, False: 0]
  |  Branch (1934:45): [True: 0, False: 0]
  ------------------
 1935|      0|            return NULL;
 1936|      0|    }
 1937|     92|#endif
 1938|       |
 1939|     92|    if (keymgmt != NULL) {
  ------------------
  |  Branch (1939:9): [True: 92, False: 0]
  ------------------
 1940|     92|        tmp_keymgmt = *keymgmt;
 1941|     92|        *keymgmt = NULL;
 1942|     92|    }
 1943|       |
 1944|       |    /*
 1945|       |     * If no keymgmt was given or found, get a default keymgmt.  We do so by
 1946|       |     * letting EVP_PKEY_CTX_new_from_pkey() do it for us, then we steal it.
 1947|       |     */
 1948|     92|    if (tmp_keymgmt == NULL) {
  ------------------
  |  Branch (1948:9): [True: 0, False: 92]
  ------------------
 1949|      0|        EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_pkey(libctx, pk, propquery);
 1950|       |
 1951|      0|        if (ctx == NULL)
  ------------------
  |  Branch (1951:13): [True: 0, False: 0]
  ------------------
 1952|      0|            goto end;
 1953|      0|        allocated_keymgmt = tmp_keymgmt = ctx->keymgmt;
 1954|      0|        ctx->keymgmt = NULL;
 1955|      0|        EVP_PKEY_CTX_free(ctx);
 1956|      0|    }
 1957|       |
 1958|       |    /* If there's still no keymgmt to be had, give up */
 1959|     92|    if (tmp_keymgmt == NULL)
  ------------------
  |  Branch (1959:9): [True: 0, False: 92]
  ------------------
 1960|      0|        goto end;
 1961|       |
 1962|     92|#ifndef FIPS_MODULE
 1963|     92|    if (pk->pkey.ptr != NULL) {
  ------------------
  |  Branch (1963:9): [True: 0, False: 92]
  ------------------
 1964|      0|        OP_CACHE_ELEM *op;
 1965|       |
 1966|       |        /*
 1967|       |         * If the legacy "origin" hasn't changed since last time, we try
 1968|       |         * to find our keymgmt in the operation cache.  If it has changed,
 1969|       |         * |i| remains zero, and we will clear the cache further down.
 1970|       |         */
 1971|      0|        if (pk->ameth->dirty_cnt(pk) == pk->dirty_cnt_copy) {
  ------------------
  |  Branch (1971:13): [True: 0, False: 0]
  ------------------
 1972|      0|            if (!CRYPTO_THREAD_read_lock(pk->lock))
  ------------------
  |  Branch (1972:17): [True: 0, False: 0]
  ------------------
 1973|      0|                goto end;
 1974|      0|            op = evp_keymgmt_util_find_operation_cache(pk, tmp_keymgmt,
 1975|      0|                                                       selection);
 1976|       |
 1977|       |            /*
 1978|       |             * If |tmp_keymgmt| is present in the operation cache, it means
 1979|       |             * that export doesn't need to be redone.  In that case, we take
 1980|       |             * token copies of the cached pointers, to have token success
 1981|       |             * values to return. It is possible (e.g. in a no-cached-fetch
 1982|       |             * build), for op->keymgmt to be a different pointer to tmp_keymgmt
 1983|       |             * even though the name/provider must be the same. In other words
 1984|       |             * the keymgmt instance may be different but still equivalent, i.e.
 1985|       |             * same algorithm/provider instance - but we make the simplifying
 1986|       |             * assumption that the keydata can be used with either keymgmt
 1987|       |             * instance. Not doing so introduces significant complexity and
 1988|       |             * probably requires refactoring - since we would have to ripple
 1989|       |             * the change in keymgmt instance up the call chain.
 1990|       |             */
 1991|      0|            if (op != NULL && op->keymgmt != NULL) {
  ------------------
  |  Branch (1991:17): [True: 0, False: 0]
  |  Branch (1991:31): [True: 0, False: 0]
  ------------------
 1992|      0|                keydata = op->keydata;
 1993|      0|                CRYPTO_THREAD_unlock(pk->lock);
 1994|      0|                goto end;
 1995|      0|            }
 1996|      0|            CRYPTO_THREAD_unlock(pk->lock);
 1997|      0|        }
 1998|       |
 1999|       |        /* Make sure that the keymgmt key type matches the legacy NID */
 2000|      0|        if (!EVP_KEYMGMT_is_a(tmp_keymgmt, OBJ_nid2sn(pk->type)))
  ------------------
  |  Branch (2000:13): [True: 0, False: 0]
  ------------------
 2001|      0|            goto end;
 2002|       |
 2003|      0|        if ((keydata = evp_keymgmt_newdata(tmp_keymgmt)) == NULL)
  ------------------
  |  Branch (2003:13): [True: 0, False: 0]
  ------------------
 2004|      0|            goto end;
 2005|       |
 2006|      0|        if (!pk->ameth->export_to(pk, keydata, tmp_keymgmt->import,
  ------------------
  |  Branch (2006:13): [True: 0, False: 0]
  ------------------
 2007|      0|                                  libctx, propquery)) {
 2008|      0|            evp_keymgmt_freedata(tmp_keymgmt, keydata);
 2009|      0|            keydata = NULL;
 2010|      0|            goto end;
 2011|      0|        }
 2012|       |
 2013|       |        /*
 2014|       |         * If the dirty counter changed since last time, then clear the
 2015|       |         * operation cache.  In that case, we know that |i| is zero.  Just
 2016|       |         * in case this is a re-export, we increment then decrement the
 2017|       |         * keymgmt reference counter.
 2018|       |         */
 2019|      0|        if (!EVP_KEYMGMT_up_ref(tmp_keymgmt)) { /* refcnt++ */
  ------------------
  |  Branch (2019:13): [True: 0, False: 0]
  ------------------
 2020|      0|            evp_keymgmt_freedata(tmp_keymgmt, keydata);
 2021|      0|            keydata = NULL;
 2022|      0|            goto end;
 2023|      0|        }
 2024|       |
 2025|      0|        if (!CRYPTO_THREAD_write_lock(pk->lock))
  ------------------
  |  Branch (2025:13): [True: 0, False: 0]
  ------------------
 2026|      0|            goto end;
 2027|      0|        if (pk->ameth->dirty_cnt(pk) != pk->dirty_cnt_copy
  ------------------
  |  Branch (2027:13): [True: 0, False: 0]
  ------------------
 2028|      0|                && !evp_keymgmt_util_clear_operation_cache(pk)) {
  ------------------
  |  Branch (2028:20): [True: 0, False: 0]
  ------------------
 2029|      0|            CRYPTO_THREAD_unlock(pk->lock);
 2030|      0|            evp_keymgmt_freedata(tmp_keymgmt, keydata);
 2031|      0|            keydata = NULL;
 2032|      0|            EVP_KEYMGMT_free(tmp_keymgmt);
 2033|      0|            goto end;
 2034|      0|        }
 2035|      0|        EVP_KEYMGMT_free(tmp_keymgmt); /* refcnt-- */
 2036|       |
 2037|       |        /* Check to make sure some other thread didn't get there first */
 2038|      0|        op = evp_keymgmt_util_find_operation_cache(pk, tmp_keymgmt, selection);
 2039|      0|        if (op != NULL && op->keymgmt != NULL) {
  ------------------
  |  Branch (2039:13): [True: 0, False: 0]
  |  Branch (2039:27): [True: 0, False: 0]
  ------------------
 2040|      0|            void *tmp_keydata = op->keydata;
 2041|       |
 2042|      0|            CRYPTO_THREAD_unlock(pk->lock);
 2043|      0|            evp_keymgmt_freedata(tmp_keymgmt, keydata);
 2044|      0|            keydata = tmp_keydata;
 2045|      0|            goto end;
 2046|      0|        }
 2047|       |
 2048|       |        /* Add the new export to the operation cache */
 2049|      0|        if (!evp_keymgmt_util_cache_keydata(pk, tmp_keymgmt, keydata,
  ------------------
  |  Branch (2049:13): [True: 0, False: 0]
  ------------------
 2050|      0|                                            selection)) {
 2051|      0|            CRYPTO_THREAD_unlock(pk->lock);
 2052|      0|            evp_keymgmt_freedata(tmp_keymgmt, keydata);
 2053|      0|            keydata = NULL;
 2054|      0|            goto end;
 2055|      0|        }
 2056|       |
 2057|       |        /* Synchronize the dirty count */
 2058|      0|        pk->dirty_cnt_copy = pk->ameth->dirty_cnt(pk);
 2059|       |
 2060|      0|        CRYPTO_THREAD_unlock(pk->lock);
 2061|      0|        goto end;
 2062|      0|    }
 2063|     92|#endif  /* FIPS_MODULE */
 2064|       |
 2065|     92|    keydata = evp_keymgmt_util_export_to_provider(pk, tmp_keymgmt, selection);
 2066|       |
 2067|     92| end:
 2068|       |    /*
 2069|       |     * If nothing was exported, |tmp_keymgmt| might point at a freed
 2070|       |     * EVP_KEYMGMT, so we clear it to be safe.  It shouldn't be useful for
 2071|       |     * the caller either way in that case.
 2072|       |     */
 2073|     92|    if (keydata == NULL)
  ------------------
  |  Branch (2073:9): [True: 0, False: 92]
  ------------------
 2074|      0|        tmp_keymgmt = NULL;
 2075|       |
 2076|     92|    if (keymgmt != NULL && tmp_keymgmt != NULL) {
  ------------------
  |  Branch (2076:9): [True: 92, False: 0]
  |  Branch (2076:28): [True: 92, False: 0]
  ------------------
 2077|     92|        *keymgmt = tmp_keymgmt;
 2078|     92|        allocated_keymgmt = NULL;
 2079|     92|    }
 2080|       |
 2081|     92|    EVP_KEYMGMT_free(allocated_keymgmt);
 2082|     92|    return keydata;
 2083|     92|}
p_lib.c:evp_pkey_cmp_any:
  263|     19|{
  264|       |#ifdef FIPS_MODULE
  265|       |    return evp_keymgmt_util_match((EVP_PKEY *)a, (EVP_PKEY *)b, selection);
  266|       |#else
  267|     19|    EVP_KEYMGMT *keymgmt1 = NULL, *keymgmt2 = NULL;
  268|     19|    void *keydata1 = NULL, *keydata2 = NULL, *tmp_keydata = NULL;
  269|       |
  270|       |    /* If none of them are provided, this function shouldn't have been called */
  271|     19|    if (!ossl_assert(evp_pkey_is_provided(a) || evp_pkey_is_provided(b)))
  ------------------
  |  |   52|     19|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 19, False: 0]
  |  |  |  Branch (52:43): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|     19|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (271:9): [True: 0, False: 19]
  ------------------
  272|      0|        return -2;
  273|       |
  274|       |    /* For purely provided keys, we just call the keymgmt utility */
  275|     19|    if (evp_pkey_is_provided(a) && evp_pkey_is_provided(b))
  ------------------
  |  |  649|     38|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (649:5): [True: 19, False: 0]
  |  |  ------------------
  ------------------
                  if (evp_pkey_is_provided(a) && evp_pkey_is_provided(b))
  ------------------
  |  |  649|     19|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (649:5): [True: 19, False: 0]
  |  |  ------------------
  ------------------
  276|     19|        return evp_keymgmt_util_match((EVP_PKEY *)a, (EVP_PKEY *)b, selection);
  277|       |
  278|       |    /*
  279|       |     * At this point, one of them is provided, the other not.  This allows
  280|       |     * us to compare types using legacy NIDs.
  281|       |     */
  282|      0|    if (evp_pkey_is_legacy(a)
  ------------------
  |  |  647|      0|    ((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
  |  |  ------------------
  |  |  |  |   62|      0|# define EVP_PKEY_NONE   NID_undef
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define NID_undef                       0
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (647:6): [True: 0, False: 0]
  |  |  |  Branch (647:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  283|      0|        && !EVP_KEYMGMT_is_a(b->keymgmt, OBJ_nid2sn(a->type)))
  ------------------
  |  Branch (283:12): [True: 0, False: 0]
  ------------------
  284|      0|        return -1;               /* not the same key type */
  285|      0|    if (evp_pkey_is_legacy(b)
  ------------------
  |  |  647|      0|    ((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
  |  |  ------------------
  |  |  |  |   62|      0|# define EVP_PKEY_NONE   NID_undef
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define NID_undef                       0
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (647:6): [True: 0, False: 0]
  |  |  |  Branch (647:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  286|      0|        && !EVP_KEYMGMT_is_a(a->keymgmt, OBJ_nid2sn(b->type)))
  ------------------
  |  Branch (286:12): [True: 0, False: 0]
  ------------------
  287|      0|        return -1;               /* not the same key type */
  288|       |
  289|       |    /*
  290|       |     * We've determined that they both are the same keytype, so the next
  291|       |     * step is to do a bit of cross export to ensure we have keydata for
  292|       |     * both keys in the same keymgmt.
  293|       |     */
  294|      0|    keymgmt1 = a->keymgmt;
  295|      0|    keydata1 = a->keydata;
  296|      0|    keymgmt2 = b->keymgmt;
  297|      0|    keydata2 = b->keydata;
  298|       |
  299|      0|    if (keymgmt2 != NULL && keymgmt2->match != NULL) {
  ------------------
  |  Branch (299:9): [True: 0, False: 0]
  |  Branch (299:29): [True: 0, False: 0]
  ------------------
  300|      0|        tmp_keydata =
  301|      0|            evp_pkey_export_to_provider((EVP_PKEY *)a, NULL, &keymgmt2, NULL);
  302|      0|        if (tmp_keydata != NULL) {
  ------------------
  |  Branch (302:13): [True: 0, False: 0]
  ------------------
  303|      0|            keymgmt1 = keymgmt2;
  304|      0|            keydata1 = tmp_keydata;
  305|      0|        }
  306|      0|    }
  307|      0|    if (tmp_keydata == NULL && keymgmt1 != NULL && keymgmt1->match != NULL) {
  ------------------
  |  Branch (307:9): [True: 0, False: 0]
  |  Branch (307:32): [True: 0, False: 0]
  |  Branch (307:52): [True: 0, False: 0]
  ------------------
  308|      0|        tmp_keydata =
  309|      0|            evp_pkey_export_to_provider((EVP_PKEY *)b, NULL, &keymgmt1, NULL);
  310|      0|        if (tmp_keydata != NULL) {
  ------------------
  |  Branch (310:13): [True: 0, False: 0]
  ------------------
  311|      0|            keymgmt2 = keymgmt1;
  312|      0|            keydata2 = tmp_keydata;
  313|      0|        }
  314|      0|    }
  315|       |
  316|       |    /* If we still don't have matching keymgmt implementations, we give up */
  317|      0|    if (keymgmt1 != keymgmt2)
  ------------------
  |  Branch (317:9): [True: 0, False: 0]
  ------------------
  318|      0|        return -2;
  319|       |
  320|       |    /* If the keymgmt implementations are NULL, the export failed */
  321|      0|    if (keymgmt1 == NULL)
  ------------------
  |  Branch (321:9): [True: 0, False: 0]
  ------------------
  322|      0|        return -2;
  323|       |
  324|      0|    return evp_keymgmt_match(keymgmt1, keydata1, keydata2, selection);
  325|      0|#endif  /* FIPS_MODULE */
  326|      0|}
p_lib.c:new_raw_key_int:
  426|     81|{
  427|     81|    EVP_PKEY *pkey = NULL;
  428|     81|    EVP_PKEY_CTX *ctx = NULL;
  429|     81|    const EVP_PKEY_ASN1_METHOD *ameth = NULL;
  430|     81|    int result = 0;
  431|       |
  432|     81|# ifndef OPENSSL_NO_ENGINE
  433|       |    /* Check if there is an Engine for this type */
  434|     81|    if (e == NULL) {
  ------------------
  |  Branch (434:9): [True: 81, False: 0]
  ------------------
  435|     81|        ENGINE *tmpe = NULL;
  436|       |
  437|     81|        if (strtype != NULL)
  ------------------
  |  Branch (437:13): [True: 80, False: 1]
  ------------------
  438|     80|            ameth = EVP_PKEY_asn1_find_str(&tmpe, strtype, -1);
  439|      1|        else if (nidtype != EVP_PKEY_NONE)
  ------------------
  |  |   62|      1|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|      1|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (439:18): [True: 0, False: 1]
  ------------------
  440|      0|            ameth = EVP_PKEY_asn1_find(&tmpe, nidtype);
  441|       |
  442|       |        /* If tmpe is NULL then no engine is claiming to support this type */
  443|     81|        if (tmpe == NULL)
  ------------------
  |  Branch (443:13): [True: 81, False: 0]
  ------------------
  444|     81|            ameth = NULL;
  445|       |
  446|     81|        ENGINE_finish(tmpe);
  447|     81|    }
  448|     81|# endif
  449|       |
  450|     81|    if (e == NULL && ameth == NULL) {
  ------------------
  |  Branch (450:9): [True: 81, False: 0]
  |  Branch (450:22): [True: 81, False: 0]
  ------------------
  451|       |        /*
  452|       |         * No engine is claiming to support this type, so lets see if we have
  453|       |         * a provider.
  454|       |         */
  455|     81|        ctx = EVP_PKEY_CTX_new_from_name(libctx,
  456|     81|                                         strtype != NULL ? strtype
  ------------------
  |  Branch (456:42): [True: 80, False: 1]
  ------------------
  457|     81|                                                         : OBJ_nid2sn(nidtype),
  458|     81|                                         propq);
  459|     81|        if (ctx == NULL)
  ------------------
  |  Branch (459:13): [True: 3, False: 78]
  ------------------
  460|      3|            goto err;
  461|       |        /* May fail if no provider available */
  462|     78|        ERR_set_mark();
  463|     78|        if (EVP_PKEY_fromdata_init(ctx) == 1) {
  ------------------
  |  Branch (463:13): [True: 78, False: 0]
  ------------------
  464|     78|            OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|     78|    { NULL, 0, NULL, 0, 0 }
  ------------------
                          OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|     78|    { NULL, 0, NULL, 0, 0 }
  ------------------
  465|       |
  466|     78|            ERR_clear_last_mark();
  467|     78|            params[0] = OSSL_PARAM_construct_octet_string(
  468|     78|                            key_is_priv ? OSSL_PKEY_PARAM_PRIV_KEY
  ------------------
  |  |  431|     35|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  |  Branch (468:29): [True: 35, False: 43]
  ------------------
  469|     78|                                        : OSSL_PKEY_PARAM_PUB_KEY,
  ------------------
  |  |  433|    121|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  470|     78|                            (void *)key, len);
  471|       |
  472|     78|            if (EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) != 1) {
  ------------------
  |  |  113|     78|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  111|     78|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     78|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  647|     78|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  642|     78|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  648|     78|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  643|     78|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  641|     78|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  640|     78|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
  |  Branch (472:17): [True: 78, False: 0]
  ------------------
  473|     78|                ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     78|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     78|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     78|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     78|     ERR_set_error)
  |  |  ------------------
  ------------------
  474|     78|                goto err;
  475|     78|            }
  476|       |
  477|      0|            EVP_PKEY_CTX_free(ctx);
  478|       |
  479|      0|            return pkey;
  480|     78|        }
  481|      0|        ERR_pop_to_mark();
  482|       |        /* else not supported so fallback to legacy */
  483|      0|    }
  484|       |
  485|       |    /* Legacy code path */
  486|       |
  487|      0|    pkey = EVP_PKEY_new();
  488|      0|    if (pkey == NULL) {
  ------------------
  |  Branch (488:9): [True: 0, False: 0]
  ------------------
  489|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  490|      0|        goto err;
  491|      0|    }
  492|       |
  493|      0|    if (!pkey_set_type(pkey, e, nidtype, strtype, -1, NULL)) {
  ------------------
  |  Branch (493:9): [True: 0, False: 0]
  ------------------
  494|       |        /* ERR_raise(ERR_LIB_EVP, ...) already called */
  495|      0|        goto err;
  496|      0|    }
  497|       |
  498|      0|    if (!ossl_assert(pkey->ameth != NULL))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (498:9): [True: 0, False: 0]
  ------------------
  499|      0|        goto err;
  500|       |
  501|      0|    if (key_is_priv) {
  ------------------
  |  Branch (501:9): [True: 0, False: 0]
  ------------------
  502|      0|        if (pkey->ameth->set_priv_key == NULL) {
  ------------------
  |  Branch (502:13): [True: 0, False: 0]
  ------------------
  503|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  504|      0|            goto err;
  505|      0|        }
  506|       |
  507|      0|        if (!pkey->ameth->set_priv_key(pkey, key, len)) {
  ------------------
  |  Branch (507:13): [True: 0, False: 0]
  ------------------
  508|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  509|      0|            goto err;
  510|      0|        }
  511|      0|    } else {
  512|      0|        if (pkey->ameth->set_pub_key == NULL) {
  ------------------
  |  Branch (512:13): [True: 0, False: 0]
  ------------------
  513|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  514|      0|            goto err;
  515|      0|        }
  516|       |
  517|      0|        if (!pkey->ameth->set_pub_key(pkey, key, len)) {
  ------------------
  |  Branch (517:13): [True: 0, False: 0]
  ------------------
  518|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  519|      0|            goto err;
  520|      0|        }
  521|      0|    }
  522|       |
  523|      0|    result = 1;
  524|     81| err:
  525|     81|    if (!result) {
  ------------------
  |  Branch (525:9): [True: 81, False: 0]
  ------------------
  526|     81|        EVP_PKEY_free(pkey);
  527|     81|        pkey = NULL;
  528|     81|    }
  529|     81|    EVP_PKEY_CTX_free(ctx);
  530|     81|    return pkey;
  531|      0|}
p_lib.c:pkey_set_type:
 1558|    830|{
 1559|    830|#ifndef FIPS_MODULE
 1560|    830|    const EVP_PKEY_ASN1_METHOD *ameth = NULL;
 1561|    830|    ENGINE **eptr = (e == NULL) ? &e :  NULL;
  ------------------
  |  Branch (1561:21): [True: 830, False: 0]
  ------------------
 1562|    830|#endif
 1563|       |
 1564|       |    /*
 1565|       |     * The setups can't set both legacy and provider side methods.
 1566|       |     * It is forbidden
 1567|       |     */
 1568|    830|    if (!ossl_assert(type == EVP_PKEY_NONE || keymgmt == NULL)
  ------------------
  |  |   52|  1.66k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 830, False: 0]
  |  |  |  Branch (52:43): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|  1.66k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1568:9): [True: 0, False: 830]
  ------------------
 1569|    830|        || !ossl_assert(e == NULL || keymgmt == NULL)) {
  ------------------
  |  |   52|    830|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 830, False: 0]
  |  |  |  Branch (52:43): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|    830|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1569:12): [True: 0, False: 830]
  ------------------
 1570|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1571|      0|        return 0;
 1572|      0|    }
 1573|       |
 1574|    830|    if (pkey != NULL) {
  ------------------
  |  Branch (1574:9): [True: 166, False: 664]
  ------------------
 1575|    166|        int free_it = 0;
 1576|       |
 1577|    166|#ifndef FIPS_MODULE
 1578|    166|        free_it = free_it || pkey->pkey.ptr != NULL;
  ------------------
  |  Branch (1578:19): [True: 0, False: 166]
  |  Branch (1578:30): [True: 0, False: 166]
  ------------------
 1579|    166|#endif
 1580|    166|        free_it = free_it || pkey->keydata != NULL;
  ------------------
  |  Branch (1580:19): [True: 0, False: 166]
  |  Branch (1580:30): [True: 0, False: 166]
  ------------------
 1581|    166|        if (free_it)
  ------------------
  |  Branch (1581:13): [True: 0, False: 166]
  ------------------
 1582|      0|            evp_pkey_free_it(pkey);
 1583|    166|#ifndef FIPS_MODULE
 1584|       |        /*
 1585|       |         * If key type matches and a method exists then this lookup has
 1586|       |         * succeeded once so just indicate success.
 1587|       |         */
 1588|    166|        if (pkey->type != EVP_PKEY_NONE
  ------------------
  |  |   62|    166|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    332|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1588:13): [True: 0, False: 166]
  ------------------
 1589|    166|            && type == pkey->save_type
  ------------------
  |  Branch (1589:16): [True: 0, False: 0]
  ------------------
 1590|    166|            && pkey->ameth != NULL)
  ------------------
  |  Branch (1590:16): [True: 0, False: 0]
  ------------------
 1591|      0|            return 1;
 1592|    166|# ifndef OPENSSL_NO_ENGINE
 1593|       |        /* If we have ENGINEs release them */
 1594|    166|        ENGINE_finish(pkey->engine);
 1595|    166|        pkey->engine = NULL;
 1596|    166|        ENGINE_finish(pkey->pmeth_engine);
 1597|    166|        pkey->pmeth_engine = NULL;
 1598|    166|# endif
 1599|    166|#endif
 1600|    166|    }
 1601|    830|#ifndef FIPS_MODULE
 1602|    830|    if (str != NULL)
  ------------------
  |  Branch (1602:9): [True: 664, False: 166]
  ------------------
 1603|    664|        ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
 1604|    166|    else if (type != EVP_PKEY_NONE)
  ------------------
  |  |   62|    166|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    166|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1604:14): [True: 0, False: 166]
  ------------------
 1605|      0|        ameth = EVP_PKEY_asn1_find(eptr, type);
 1606|    830|# ifndef OPENSSL_NO_ENGINE
 1607|    830|    if (pkey == NULL && eptr != NULL)
  ------------------
  |  Branch (1607:9): [True: 664, False: 166]
  |  Branch (1607:25): [True: 664, False: 0]
  ------------------
 1608|    664|        ENGINE_finish(e);
 1609|    830|# endif
 1610|    830|#endif
 1611|       |
 1612|       |
 1613|    830|    {
 1614|    830|        int check = 1;
 1615|       |
 1616|    830|#ifndef FIPS_MODULE
 1617|    830|        check = check && ameth == NULL;
  ------------------
  |  Branch (1617:17): [True: 830, False: 0]
  |  Branch (1617:26): [True: 830, False: 0]
  ------------------
 1618|    830|#endif
 1619|    830|        check = check && keymgmt == NULL;
  ------------------
  |  Branch (1619:17): [True: 830, False: 0]
  |  Branch (1619:26): [True: 664, False: 166]
  ------------------
 1620|    830|        if (check) {
  ------------------
  |  Branch (1620:13): [True: 664, False: 166]
  ------------------
 1621|    664|            ERR_raise(ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM);
  ------------------
  |  |  401|    664|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    664|    (ERR_new(),                                                 \
  |  |  |  |  404|    664|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|    664|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|    664|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|    664|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    664|     ERR_set_error)
  |  |  ------------------
  ------------------
 1622|    664|            return 0;
 1623|    664|        }
 1624|    830|    }
 1625|    166|    if (pkey != NULL) {
  ------------------
  |  Branch (1625:9): [True: 166, False: 0]
  ------------------
 1626|    166|        if (keymgmt != NULL && !EVP_KEYMGMT_up_ref(keymgmt)) {
  ------------------
  |  Branch (1626:13): [True: 166, False: 0]
  |  Branch (1626:32): [True: 0, False: 166]
  ------------------
 1627|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1628|      0|            return 0;
 1629|      0|        }
 1630|       |
 1631|    166|        pkey->keymgmt = keymgmt;
 1632|       |
 1633|    166|        pkey->save_type = type;
 1634|    166|        pkey->type = type;
 1635|       |
 1636|    166|#ifndef FIPS_MODULE
 1637|       |        /*
 1638|       |         * If the internal "origin" key is provider side, don't save |ameth|.
 1639|       |         * The main reason is that |ameth| is one factor to detect that the
 1640|       |         * internal "origin" key is a legacy one.
 1641|       |         */
 1642|    166|        if (keymgmt == NULL)
  ------------------
  |  Branch (1642:13): [True: 0, False: 166]
  ------------------
 1643|      0|            pkey->ameth = ameth;
 1644|       |
 1645|       |        /*
 1646|       |         * The EVP_PKEY_ASN1_METHOD |pkey_id| retains its legacy key purpose
 1647|       |         * for any key type that has a legacy implementation, regardless of
 1648|       |         * if the internal key is a legacy or a provider side one.  When
 1649|       |         * there is no legacy implementation for the key, the type becomes
 1650|       |         * EVP_PKEY_KEYMGMT, which indicates that one should be cautious
 1651|       |         * with functions that expect legacy internal keys.
 1652|       |         */
 1653|    166|        if (ameth != NULL) {
  ------------------
  |  Branch (1653:13): [True: 0, False: 166]
  ------------------
 1654|      0|            if (type == EVP_PKEY_NONE)
  ------------------
  |  |   62|      0|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|      0|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1654:17): [True: 0, False: 0]
  ------------------
 1655|      0|                pkey->type = ameth->pkey_id;
 1656|    166|        } else {
 1657|    166|            pkey->type = EVP_PKEY_KEYMGMT;
  ------------------
  |  |  103|    166|# define EVP_PKEY_KEYMGMT -1
  ------------------
 1658|    166|        }
 1659|    166|# ifndef OPENSSL_NO_ENGINE
 1660|    166|        if (eptr == NULL && e != NULL && !ENGINE_init(e)) {
  ------------------
  |  Branch (1660:13): [True: 0, False: 166]
  |  Branch (1660:29): [True: 0, False: 0]
  |  Branch (1660:42): [True: 0, False: 0]
  ------------------
 1661|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1662|      0|            return 0;
 1663|      0|        }
 1664|    166|# endif
 1665|    166|        pkey->engine = e;
 1666|    166|#endif
 1667|    166|    }
 1668|    166|    return 1;
 1669|    166|}
p_lib.c:find_ameth:
 1673|    664|{
 1674|    664|    const char **str = data;
 1675|       |
 1676|       |    /*
 1677|       |     * The error messages from pkey_set_type() are uninteresting here,
 1678|       |     * and misleading.
 1679|       |     */
 1680|    664|    ERR_set_mark();
 1681|       |
 1682|    664|    if (pkey_set_type(NULL, NULL, EVP_PKEY_NONE, name, strlen(name),
  ------------------
  |  |   62|    664|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    664|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1682:9): [True: 0, False: 664]
  ------------------
 1683|    664|                      NULL)) {
 1684|      0|        if (str[0] == NULL)
  ------------------
  |  Branch (1684:13): [True: 0, False: 0]
  ------------------
 1685|      0|            str[0] = name;
 1686|      0|        else if (str[1] == NULL)
  ------------------
  |  Branch (1686:18): [True: 0, False: 0]
  ------------------
 1687|      0|            str[1] = name;
 1688|      0|    }
 1689|       |
 1690|    664|    ERR_pop_to_mark();
 1691|    664|}
p_lib.c:evp_pkey_free_it:
 1834|    244|{
 1835|       |    /* internal function; x is never NULL */
 1836|    244|    evp_keymgmt_util_clear_operation_cache(x);
 1837|    244|#ifndef FIPS_MODULE
 1838|    244|    evp_pkey_free_legacy(x);
 1839|    244|#endif
 1840|       |
 1841|    244|    if (x->keymgmt != NULL) {
  ------------------
  |  Branch (1841:9): [True: 166, False: 78]
  ------------------
 1842|    166|        evp_keymgmt_freedata(x->keymgmt, x->keydata);
 1843|    166|        EVP_KEYMGMT_free(x->keymgmt);
 1844|    166|        x->keymgmt = NULL;
 1845|    166|        x->keydata = NULL;
 1846|    166|    }
 1847|    244|    x->type = EVP_PKEY_NONE;
  ------------------
  |  |   62|    244|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    244|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1848|    244|}

EVP_PKEY_keygen_init:
  100|    166|{
  101|    166|    return gen_init(ctx, EVP_PKEY_OP_KEYGEN);
  ------------------
  |  | 1746|    166|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  ------------------
  102|    166|}
EVP_PKEY_generate:
  129|    166|{
  130|    166|    int ret = 0;
  131|    166|    EVP_PKEY *allocated_pkey = NULL;
  132|       |    /* Legacy compatible keygen callback info, only used with provider impls */
  133|    166|    int gentmp[2];
  134|       |
  135|    166|    if (ppkey == NULL)
  ------------------
  |  Branch (135:9): [True: 0, False: 166]
  ------------------
  136|      0|        return -1;
  137|       |
  138|    166|    if (ctx == NULL)
  ------------------
  |  Branch (138:9): [True: 0, False: 166]
  ------------------
  139|      0|        goto not_supported;
  140|       |
  141|    166|    if ((ctx->operation & EVP_PKEY_OP_TYPE_GEN) == 0)
  ------------------
  |  | 1782|    166|    (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
  |  |  ------------------
  |  |  |  | 1745|    166|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  |  |  ------------------
  |  |                   (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
  |  |  ------------------
  |  |  |  | 1746|    166|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  |  |  ------------------
  ------------------
  |  Branch (141:9): [True: 0, False: 166]
  ------------------
  142|      0|        goto not_initialized;
  143|       |
  144|    166|    if (*ppkey == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 166]
  ------------------
  145|      0|        *ppkey = allocated_pkey = EVP_PKEY_new();
  146|       |
  147|    166|    if (*ppkey == NULL) {
  ------------------
  |  Branch (147:9): [True: 0, False: 166]
  ------------------
  148|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  149|      0|        return -1;
  150|      0|    }
  151|       |
  152|    166|    if (ctx->op.keymgmt.genctx == NULL)
  ------------------
  |  Branch (152:9): [True: 0, False: 166]
  ------------------
  153|      0|        goto legacy;
  154|       |
  155|       |    /*
  156|       |     * Assigning gentmp to ctx->keygen_info is something our legacy
  157|       |     * implementations do.  Because the provider implementations aren't
  158|       |     * allowed to reach into our EVP_PKEY_CTX, we need to provide similar
  159|       |     * space for backward compatibility.  It's ok that we attach a local
  160|       |     * variable, as it should only be useful in the calls down from here.
  161|       |     * This is cleared as soon as it isn't useful any more, i.e. directly
  162|       |     * after the evp_keymgmt_util_gen() call.
  163|       |     */
  164|    166|    ctx->keygen_info = gentmp;
  165|    166|    ctx->keygen_info_count = 2;
  166|       |
  167|    166|    ret = 1;
  168|    166|    if (ctx->pkey != NULL) {
  ------------------
  |  Branch (168:9): [True: 0, False: 166]
  ------------------
  169|      0|        EVP_KEYMGMT *tmp_keymgmt = ctx->keymgmt;
  170|      0|        void *keydata =
  171|      0|            evp_pkey_export_to_provider(ctx->pkey, ctx->libctx,
  172|      0|                                        &tmp_keymgmt, ctx->propquery);
  173|       |
  174|      0|        if (tmp_keymgmt == NULL)
  ------------------
  |  Branch (174:13): [True: 0, False: 0]
  ------------------
  175|      0|            goto not_supported;
  176|       |        /*
  177|       |         * It's ok if keydata is NULL here.  The backend is expected to deal
  178|       |         * with that as it sees fit.
  179|       |         */
  180|      0|        ret = evp_keymgmt_gen_set_template(ctx->keymgmt,
  181|      0|                                           ctx->op.keymgmt.genctx, keydata);
  182|      0|    }
  183|       |
  184|       |    /*
  185|       |     * the returned value from evp_keymgmt_util_gen() is cached in *ppkey,
  186|       |     * so we do not need to save it, just check it.
  187|       |     */
  188|    166|    ret = ret
  ------------------
  |  Branch (188:11): [True: 166, False: 0]
  ------------------
  189|    166|        && (evp_keymgmt_util_gen(*ppkey, ctx->keymgmt, ctx->op.keymgmt.genctx,
  ------------------
  |  Branch (189:12): [True: 166, False: 0]
  ------------------
  190|    166|                                 ossl_callback_to_pkey_gencb, ctx)
  191|    166|            != NULL);
  192|       |
  193|    166|    ctx->keygen_info = NULL;
  194|       |
  195|    166|#ifndef FIPS_MODULE
  196|       |    /* In case |*ppkey| was originally a legacy key */
  197|    166|    if (ret)
  ------------------
  |  Branch (197:9): [True: 166, False: 0]
  ------------------
  198|    166|        evp_pkey_free_legacy(*ppkey);
  199|    166|#endif
  200|       |
  201|       |    /*
  202|       |     * Because we still have legacy keys
  203|       |     */
  204|    166|    (*ppkey)->type = ctx->legacy_keytype;
  205|       |
  206|    166|    goto end;
  207|       |
  208|      0| legacy:
  209|       |#ifdef FIPS_MODULE
  210|       |    goto not_supported;
  211|       |#else
  212|       |    /*
  213|       |     * If we get here then we're using legacy paramgen/keygen. In that case
  214|       |     * the pkey in ctx (if there is one) had better not be provided (because the
  215|       |     * legacy methods may not know how to handle it). However we can only get
  216|       |     * here if ctx->op.keymgmt.genctx == NULL, but that should never be the case
  217|       |     * if ctx->pkey is provided because we don't allow this when we initialise
  218|       |     * the ctx.
  219|       |     */
  220|      0|    if (ctx->pkey != NULL && !ossl_assert(!evp_pkey_is_provided(ctx->pkey)))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (220:9): [True: 0, False: 0]
  |  Branch (220:30): [True: 0, False: 0]
  ------------------
  221|      0|        goto not_accessible;
  222|       |
  223|      0|    switch (ctx->operation) {
  224|      0|    case EVP_PKEY_OP_PARAMGEN:
  ------------------
  |  | 1745|      0|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  ------------------
  |  Branch (224:5): [True: 0, False: 0]
  ------------------
  225|      0|        ret = ctx->pmeth->paramgen(ctx, *ppkey);
  226|      0|        break;
  227|      0|    case EVP_PKEY_OP_KEYGEN:
  ------------------
  |  | 1746|      0|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  ------------------
  |  Branch (227:5): [True: 0, False: 0]
  ------------------
  228|      0|        ret = ctx->pmeth->keygen(ctx, *ppkey);
  229|      0|        break;
  230|      0|    default:
  ------------------
  |  Branch (230:5): [True: 0, False: 0]
  ------------------
  231|      0|        goto not_supported;
  232|      0|    }
  233|      0|#endif
  234|       |
  235|    166| end:
  236|    166|    if (ret <= 0) {
  ------------------
  |  Branch (236:9): [True: 0, False: 166]
  ------------------
  237|      0|        if (allocated_pkey != NULL)
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            *ppkey = NULL;
  239|      0|        EVP_PKEY_free(allocated_pkey);
  240|      0|    }
  241|    166|    return ret;
  242|       |
  243|      0| not_supported:
  244|      0|    ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  245|      0|    ret = -2;
  246|      0|    goto end;
  247|      0| not_initialized:
  248|      0|    ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  249|      0|    ret = -1;
  250|      0|    goto end;
  251|      0|#ifndef FIPS_MODULE
  252|      0| not_accessible:
  253|      0|    ERR_raise(ERR_LIB_EVP, EVP_R_INACCESSIBLE_DOMAIN_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|      0|    ret = -1;
  255|      0|    goto end;
  256|      0|#endif
  257|      0|}
EVP_PKEY_fromdata_init:
  359|     78|{
  360|     78|    return fromdata_init(ctx, EVP_PKEY_OP_FROMDATA);
  ------------------
  |  | 1747|     78|# define EVP_PKEY_OP_FROMDATA            (1 << 3)
  ------------------
  361|     78|}
EVP_PKEY_fromdata:
  365|     81|{
  366|     81|    void *keydata = NULL;
  367|     81|    EVP_PKEY *allocated_pkey = NULL;
  368|       |
  369|     81|    if (ctx == NULL || (ctx->operation & EVP_PKEY_OP_FROMDATA) == 0) {
  ------------------
  |  | 1747|     81|# define EVP_PKEY_OP_FROMDATA            (1 << 3)
  ------------------
  |  Branch (369:9): [True: 0, False: 81]
  |  Branch (369:24): [True: 3, False: 78]
  ------------------
  370|      3|        ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      3|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      3|     ERR_set_error)
  |  |  ------------------
  ------------------
  371|      3|        return -2;
  372|      3|    }
  373|       |
  374|     78|    if (ppkey == NULL)
  ------------------
  |  Branch (374:9): [True: 0, False: 78]
  ------------------
  375|      0|        return -1;
  376|       |
  377|     78|    if (*ppkey == NULL)
  ------------------
  |  Branch (377:9): [True: 78, False: 0]
  ------------------
  378|     78|        allocated_pkey = *ppkey = EVP_PKEY_new();
  379|       |
  380|     78|    if (*ppkey == NULL) {
  ------------------
  |  Branch (380:9): [True: 0, False: 78]
  ------------------
  381|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  382|      0|        return -1;
  383|      0|    }
  384|       |
  385|     78|    keydata = evp_keymgmt_util_fromdata(*ppkey, ctx->keymgmt, selection, params);
  386|     78|    if (keydata == NULL) {
  ------------------
  |  Branch (386:9): [True: 78, False: 0]
  ------------------
  387|     78|        if (allocated_pkey != NULL) {
  ------------------
  |  Branch (387:13): [True: 78, False: 0]
  ------------------
  388|     78|            *ppkey = NULL;
  389|     78|            EVP_PKEY_free(allocated_pkey);
  390|     78|        }
  391|     78|        return 0;
  392|     78|    }
  393|       |    /* keydata is cached in *ppkey, so we need not bother with it further */
  394|      0|    return 1;
  395|     78|}
EVP_PKEY_todata:
  416|      3|{
  417|      3|    if (params == NULL)
  ------------------
  |  Branch (417:9): [True: 0, False: 3]
  ------------------
  418|      0|        return 0;
  419|      3|    return EVP_PKEY_export(pkey, selection, ossl_pkey_todata_cb, params);
  420|      3|}
EVP_PKEY_export:
  440|      3|{
  441|      3|    if (pkey == NULL) {
  ------------------
  |  Branch (441:9): [True: 0, False: 3]
  ------------------
  442|      0|        ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  443|      0|        return 0;
  444|      0|    }
  445|      3|#ifndef FIPS_MODULE
  446|      3|    if (evp_pkey_is_legacy(pkey)) {
  ------------------
  |  |  647|      3|    ((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
  |  |  ------------------
  |  |  |  |   62|      3|# define EVP_PKEY_NONE   NID_undef
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      6|#define NID_undef                       0
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (647:6): [True: 3, False: 0]
  |  |  |  Branch (647:37): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  447|      0|        struct fake_import_data_st data;
  448|       |
  449|      0|        data.export_cb = export_cb;
  450|      0|        data.export_cbarg = export_cbarg;
  451|       |
  452|       |        /*
  453|       |         * We don't need to care about libctx or propq here, as we're only
  454|       |         * interested in the resulting OSSL_PARAM array.
  455|       |         */
  456|      0|        return pkey->ameth->export_to(pkey, &data, pkey_fake_import,
  457|      0|                                      NULL, NULL);
  458|      0|    }
  459|      3|#endif
  460|      3|    return evp_keymgmt_util_export(pkey, selection, export_cb, export_cbarg);
  461|      3|}
pmeth_gn.c:gen_init:
   26|    166|{
   27|    166|    int ret = 0;
   28|       |
   29|    166|    if (ctx == NULL)
  ------------------
  |  Branch (29:9): [True: 0, False: 166]
  ------------------
   30|      0|        goto not_supported;
   31|       |
   32|    166|    evp_pkey_ctx_free_old_ops(ctx);
   33|    166|    ctx->operation = operation;
   34|       |
   35|    166|    if (ctx->keymgmt == NULL || ctx->keymgmt->gen_init == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 166]
  |  Branch (35:33): [True: 0, False: 166]
  ------------------
   36|      0|        goto legacy;
   37|       |
   38|    166|    switch (operation) {
  ------------------
  |  Branch (38:13): [True: 0, False: 166]
  ------------------
   39|      0|    case EVP_PKEY_OP_PARAMGEN:
  ------------------
  |  | 1745|      0|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  ------------------
  |  Branch (39:5): [True: 0, False: 166]
  ------------------
   40|      0|        ctx->op.keymgmt.genctx =
   41|      0|            evp_keymgmt_gen_init(ctx->keymgmt,
   42|      0|                                 OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, NULL);
  ------------------
  |  |  647|      0|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  ------------------
  |  |  |  |  642|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  |  |  648|      0|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  643|      0|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
   43|      0|        break;
   44|    166|    case EVP_PKEY_OP_KEYGEN:
  ------------------
  |  | 1746|    166|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  ------------------
  |  Branch (44:5): [True: 166, False: 0]
  ------------------
   45|    166|        ctx->op.keymgmt.genctx =
   46|    166|            evp_keymgmt_gen_init(ctx->keymgmt, OSSL_KEYMGMT_SELECT_KEYPAIR,
  ------------------
  |  |  650|    166|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|    166|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|    166|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
   47|    166|                                 NULL);
   48|    166|        break;
   49|    166|    }
   50|       |
   51|    166|    if (ctx->op.keymgmt.genctx == NULL)
  ------------------
  |  Branch (51:9): [True: 0, False: 166]
  ------------------
   52|    166|        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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   53|    166|    else
   54|    166|        ret = 1;
   55|    166|    goto end;
   56|       |
   57|      0| legacy:
   58|       |#ifdef FIPS_MODULE
   59|       |    goto not_supported;
   60|       |#else
   61|      0|    if (ctx->pmeth == NULL
  ------------------
  |  Branch (61:9): [True: 0, False: 0]
  ------------------
   62|      0|        || (operation == EVP_PKEY_OP_PARAMGEN
  ------------------
  |  | 1745|      0|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  ------------------
  |  Branch (62:13): [True: 0, False: 0]
  ------------------
   63|      0|            && ctx->pmeth->paramgen == NULL)
  ------------------
  |  Branch (63:16): [True: 0, False: 0]
  ------------------
   64|      0|        || (operation == EVP_PKEY_OP_KEYGEN
  ------------------
  |  | 1746|      0|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  ------------------
  |  Branch (64:13): [True: 0, False: 0]
  ------------------
   65|      0|            && ctx->pmeth->keygen == NULL))
  ------------------
  |  Branch (65:16): [True: 0, False: 0]
  ------------------
   66|      0|        goto not_supported;
   67|       |
   68|      0|    ret = 1;
   69|      0|    switch (operation) {
  ------------------
  |  Branch (69:13): [True: 0, False: 0]
  ------------------
   70|      0|    case EVP_PKEY_OP_PARAMGEN:
  ------------------
  |  | 1745|      0|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  ------------------
  |  Branch (70:5): [True: 0, False: 0]
  ------------------
   71|      0|        if (ctx->pmeth->paramgen_init != NULL)
  ------------------
  |  Branch (71:13): [True: 0, False: 0]
  ------------------
   72|      0|            ret = ctx->pmeth->paramgen_init(ctx);
   73|      0|        break;
   74|      0|    case EVP_PKEY_OP_KEYGEN:
  ------------------
  |  | 1746|      0|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  ------------------
  |  Branch (74:5): [True: 0, False: 0]
  ------------------
   75|      0|        if (ctx->pmeth->keygen_init != NULL)
  ------------------
  |  Branch (75:13): [True: 0, False: 0]
  ------------------
   76|      0|            ret = ctx->pmeth->keygen_init(ctx);
   77|      0|        break;
   78|      0|    }
   79|      0|#endif
   80|       |
   81|    166| end:
   82|    166|    if (ret <= 0 && ctx != NULL) {
  ------------------
  |  Branch (82:9): [True: 0, False: 166]
  |  Branch (82:21): [True: 0, False: 0]
  ------------------
   83|      0|        evp_pkey_ctx_free_old_ops(ctx);
   84|      0|        ctx->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|      0|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
   85|      0|    }
   86|    166|    return ret;
   87|       |
   88|      0| not_supported:
   89|      0|    ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   90|      0|    ret = -2;
   91|      0|    goto end;
   92|      0|}
pmeth_gn.c:fromdata_init:
  340|     78|{
  341|     78|    if (ctx == NULL || ctx->keytype == NULL)
  ------------------
  |  Branch (341:9): [True: 0, False: 78]
  |  Branch (341:24): [True: 0, False: 78]
  ------------------
  342|      0|        goto not_supported;
  343|       |
  344|     78|    evp_pkey_ctx_free_old_ops(ctx);
  345|     78|    if (ctx->keymgmt == NULL)
  ------------------
  |  Branch (345:9): [True: 0, False: 78]
  ------------------
  346|      0|        goto not_supported;
  347|       |
  348|     78|    ctx->operation = operation;
  349|     78|    return 1;
  350|       |
  351|      0| not_supported:
  352|      0|    if (ctx != NULL)
  ------------------
  |  Branch (352:9): [True: 0, False: 0]
  ------------------
  353|      0|        ctx->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|      0|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
  354|      0|    ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  355|      0|    return -2;
  356|     78|}
pmeth_gn.c:ossl_pkey_todata_cb:
  408|      3|{
  409|      3|    OSSL_PARAM **ret = arg;
  410|       |
  411|      3|    *ret = OSSL_PARAM_dup(params);
  412|      3|    return 1;
  413|      3|}

EVP_PKEY_CTX_new_from_name:
  348|    247|{
  349|    247|    return int_ctx_new(libctx, NULL, NULL, name, propquery, -1);
  350|    247|}
EVP_PKEY_CTX_new_from_pkey:
  354|    115|{
  355|    115|    return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1);
  356|    115|}
evp_pkey_ctx_free_old_ops:
  359|    715|{
  360|    715|    if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
  ------------------
  |  |  741|    715|    (((ctx)->operation & EVP_PKEY_OP_TYPE_SIG) != 0)
  |  |  ------------------
  |  |  |  | 1764|    715|    (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1748|    715|# define EVP_PKEY_OP_SIGN                (1 << 4)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1758|    715|# define EVP_PKEY_OP_SIGNMSG             (1 << 14)
  |  |  |  |  ------------------
  |  |  |  | 1765|    715|     | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1749|    715|# define EVP_PKEY_OP_VERIFY              (1 << 5)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1759|    715|# define EVP_PKEY_OP_VERIFYMSG           (1 << 15)
  |  |  |  |  ------------------
  |  |  |  | 1766|    715|     | EVP_PKEY_OP_VERIFYRECOVER                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1750|    715|# define EVP_PKEY_OP_VERIFYRECOVER       (1 << 6)
  |  |  |  |  ------------------
  |  |  |  | 1767|    715|     | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1751|    715|# define EVP_PKEY_OP_SIGNCTX             (1 << 7)
  |  |  |  |  ------------------
  |  |  |  |                    | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1752|    715|# define EVP_PKEY_OP_VERIFYCTX           (1 << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (741:5): [True: 0, False: 715]
  |  |  ------------------
  ------------------
  361|      0|        if (ctx->op.sig.algctx != NULL && ctx->op.sig.signature != NULL)
  ------------------
  |  Branch (361:13): [True: 0, False: 0]
  |  Branch (361:43): [True: 0, False: 0]
  ------------------
  362|      0|            ctx->op.sig.signature->freectx(ctx->op.sig.algctx);
  363|      0|        EVP_SIGNATURE_free(ctx->op.sig.signature);
  364|      0|        ctx->op.sig.algctx = NULL;
  365|      0|        ctx->op.sig.signature = NULL;
  366|    715|    } else if (EVP_PKEY_CTX_IS_DERIVE_OP(ctx)) {
  ------------------
  |  |  744|    715|    (((ctx)->operation & EVP_PKEY_OP_TYPE_DERIVE) != 0)
  |  |  ------------------
  |  |  |  | 1773|    715|    (EVP_PKEY_OP_DERIVE)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1755|    715|# define EVP_PKEY_OP_DERIVE              (1 << 11)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (744:5): [True: 20, False: 695]
  |  |  ------------------
  ------------------
  367|     20|        if (ctx->op.kex.algctx != NULL && ctx->op.kex.exchange != NULL)
  ------------------
  |  Branch (367:13): [True: 0, False: 20]
  |  Branch (367:43): [True: 0, False: 0]
  ------------------
  368|      0|            ctx->op.kex.exchange->freectx(ctx->op.kex.algctx);
  369|     20|        EVP_KEYEXCH_free(ctx->op.kex.exchange);
  370|     20|        ctx->op.kex.algctx = NULL;
  371|     20|        ctx->op.kex.exchange = NULL;
  372|    695|    } else if (EVP_PKEY_CTX_IS_KEM_OP(ctx)) {
  ------------------
  |  |  756|    695|    (((ctx)->operation & EVP_PKEY_OP_TYPE_KEM) != 0)
  |  |  ------------------
  |  |  |  | 1779|    695|    (EVP_PKEY_OP_ENCAPSULATE | EVP_PKEY_OP_DECAPSULATE)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1756|    695|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_ENCAPSULATE | EVP_PKEY_OP_DECAPSULATE)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1757|    695|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (756:5): [True: 92, False: 603]
  |  |  ------------------
  ------------------
  373|     92|        if (ctx->op.encap.algctx != NULL && ctx->op.encap.kem != NULL)
  ------------------
  |  Branch (373:13): [True: 92, False: 0]
  |  Branch (373:45): [True: 92, False: 0]
  ------------------
  374|     92|            ctx->op.encap.kem->freectx(ctx->op.encap.algctx);
  375|     92|        EVP_KEM_free(ctx->op.encap.kem);
  376|     92|        ctx->op.encap.algctx = NULL;
  377|     92|        ctx->op.encap.kem = NULL;
  378|     92|    }
  379|    603|    else if (EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)) {
  ------------------
  |  |  747|    603|    (((ctx)->operation & EVP_PKEY_OP_TYPE_CRYPT) != 0)
  |  |  ------------------
  |  |  |  | 1770|    603|    (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1753|    603|# define EVP_PKEY_OP_ENCRYPT             (1 << 9)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1754|    603|# define EVP_PKEY_OP_DECRYPT             (1 << 10)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (747:5): [True: 0, False: 603]
  |  |  ------------------
  ------------------
  380|      0|        if (ctx->op.ciph.algctx != NULL && ctx->op.ciph.cipher != NULL)
  ------------------
  |  Branch (380:13): [True: 0, False: 0]
  |  Branch (380:44): [True: 0, False: 0]
  ------------------
  381|      0|            ctx->op.ciph.cipher->freectx(ctx->op.ciph.algctx);
  382|      0|        EVP_ASYM_CIPHER_free(ctx->op.ciph.cipher);
  383|      0|        ctx->op.ciph.algctx = NULL;
  384|      0|        ctx->op.ciph.cipher = NULL;
  385|    603|    } else if (EVP_PKEY_CTX_IS_GEN_OP(ctx)) {
  ------------------
  |  |  750|    603|    (((ctx)->operation & EVP_PKEY_OP_TYPE_GEN) != 0)
  |  |  ------------------
  |  |  |  | 1782|    603|    (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1745|    603|# define EVP_PKEY_OP_PARAMGEN            (1 << 1)
  |  |  |  |  ------------------
  |  |  |  |                   (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1746|    603|# define EVP_PKEY_OP_KEYGEN              (1 << 2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (750:5): [True: 166, False: 437]
  |  |  ------------------
  ------------------
  386|    166|        if (ctx->op.keymgmt.genctx != NULL && ctx->keymgmt != NULL)
  ------------------
  |  Branch (386:13): [True: 166, False: 0]
  |  Branch (386:47): [True: 166, False: 0]
  ------------------
  387|    166|            evp_keymgmt_gen_cleanup(ctx->keymgmt, ctx->op.keymgmt.genctx);
  388|    166|    }
  389|    715|}
EVP_PKEY_CTX_free:
  392|    660|{
  393|    660|    if (ctx == NULL)
  ------------------
  |  Branch (393:9): [True: 301, False: 359]
  ------------------
  394|    301|        return;
  395|    359|    if (ctx->pmeth && ctx->pmeth->cleanup)
  ------------------
  |  Branch (395:9): [True: 0, False: 359]
  |  Branch (395:23): [True: 0, False: 0]
  ------------------
  396|      0|        ctx->pmeth->cleanup(ctx);
  397|       |
  398|    359|    evp_pkey_ctx_free_old_ops(ctx);
  399|    359|#ifndef FIPS_MODULE
  400|    359|    evp_pkey_ctx_free_all_cached_data(ctx);
  401|    359|#endif
  402|    359|    EVP_KEYMGMT_free(ctx->keymgmt);
  403|       |
  404|    359|    OPENSSL_free(ctx->propquery);
  ------------------
  |  |  115|    359|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    359|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    359|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  405|    359|    EVP_PKEY_free(ctx->pkey);
  406|    359|    EVP_PKEY_free(ctx->peerkey);
  407|    359|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  408|    359|    ENGINE_finish(ctx->engine);
  409|    359|#endif
  410|    359|    BN_free(ctx->rsa_pubexp);
  411|    359|    OPENSSL_free(ctx);
  ------------------
  |  |  115|    359|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    359|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    359|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  412|    359|}
evp_app_cleanup_int:
  633|      1|{
  634|      1|    if (app_pkey_methods != NULL)
  ------------------
  |  Branch (634:9): [True: 0, False: 1]
  ------------------
  635|      0|        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
  636|      1|}
pmeth_lib.c:int_ctx_new:
  163|    362|{
  164|    362|    EVP_PKEY_CTX *ret = NULL;
  165|    362|    const EVP_PKEY_METHOD *pmeth = NULL, *app_pmeth = NULL;
  166|    362|    EVP_KEYMGMT *keymgmt = NULL;
  167|       |
  168|       |    /* Code below to be removed when legacy support is dropped. */
  169|       |    /* BEGIN legacy */
  170|    362|    if (id == -1) {
  ------------------
  |  Branch (170:9): [True: 362, False: 0]
  ------------------
  171|    362|        if (pkey != NULL && !evp_pkey_is_provided(pkey)) {
  ------------------
  |  |  649|    115|    ((pk)->keymgmt != NULL)
  ------------------
  |  Branch (171:13): [True: 115, False: 247]
  |  Branch (171:29): [True: 0, False: 115]
  ------------------
  172|      0|            id = pkey->type;
  173|    362|        } else {
  174|    362|            if (pkey != NULL) {
  ------------------
  |  Branch (174:17): [True: 115, False: 247]
  ------------------
  175|       |                /* Must be provided if we get here */
  176|    115|                keytype = EVP_KEYMGMT_get0_name(pkey->keymgmt);
  177|    115|            }
  178|    362|#ifndef FIPS_MODULE
  179|    362|            if (keytype != NULL) {
  ------------------
  |  Branch (179:17): [True: 362, False: 0]
  ------------------
  180|    362|                id = evp_pkey_name2type(keytype);
  181|    362|                if (id == NID_undef)
  ------------------
  |  |   18|    362|#define NID_undef                       0
  ------------------
  |  Branch (181:21): [True: 362, False: 0]
  ------------------
  182|    362|                    id = -1;
  183|    362|            }
  184|    362|#endif
  185|    362|        }
  186|    362|    }
  187|       |    /* If no ID was found here, we can only resort to find a keymgmt */
  188|    362|    if (id == -1) {
  ------------------
  |  Branch (188:9): [True: 362, False: 0]
  ------------------
  189|    362|#ifndef FIPS_MODULE
  190|       |        /* Using engine with a key without id will not work */
  191|    362|        if (e != NULL) {
  ------------------
  |  Branch (191:13): [True: 0, False: 362]
  ------------------
  192|      0|            ERR_raise(ERR_LIB_EVP, EVP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  193|      0|            return NULL;
  194|      0|        }
  195|    362|#endif
  196|    362|        goto common;
  197|    362|    }
  198|       |
  199|      0|#ifndef FIPS_MODULE
  200|       |    /*
  201|       |     * Here, we extract what information we can for the purpose of
  202|       |     * supporting usage with implementations from providers, to make
  203|       |     * for a smooth transition from legacy stuff to provider based stuff.
  204|       |     *
  205|       |     * If an engine is given, this is entirely legacy, and we should not
  206|       |     * pretend anything else, so we clear the name.
  207|       |     */
  208|      0|    if (e != NULL)
  ------------------
  |  Branch (208:9): [True: 0, False: 0]
  ------------------
  209|      0|        keytype = NULL;
  210|      0|    if (e == NULL && (pkey == NULL || pkey->foreign == 0))
  ------------------
  |  Branch (210:9): [True: 0, False: 0]
  |  Branch (210:23): [True: 0, False: 0]
  |  Branch (210:39): [True: 0, False: 0]
  ------------------
  211|      0|        keytype = OBJ_nid2sn(id);
  212|       |
  213|      0|# ifndef OPENSSL_NO_ENGINE
  214|      0|    if (e == NULL && pkey != NULL)
  ------------------
  |  Branch (214:9): [True: 0, False: 0]
  |  Branch (214:22): [True: 0, False: 0]
  ------------------
  215|      0|        e = pkey->pmeth_engine != NULL ? pkey->pmeth_engine : pkey->engine;
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|       |    /* Try to find an ENGINE which implements this method */
  217|      0|    if (e != NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 0]
  ------------------
  218|      0|        if (!ENGINE_init(e)) {
  ------------------
  |  Branch (218:13): [True: 0, False: 0]
  ------------------
  219|      0|            ERR_raise(ERR_LIB_EVP, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  220|      0|            return NULL;
  221|      0|        }
  222|      0|    } else {
  223|      0|        e = ENGINE_get_pkey_meth_engine(id);
  224|      0|    }
  225|       |
  226|       |    /*
  227|       |     * If an ENGINE handled this method look it up. Otherwise use internal
  228|       |     * tables.
  229|       |     */
  230|      0|    if (e != NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  ------------------
  231|      0|        pmeth = ENGINE_get_pkey_meth(e, id);
  232|      0|    else
  233|      0|# endif /* OPENSSL_NO_ENGINE */
  234|      0|    if (pkey != NULL && pkey->foreign)
  ------------------
  |  Branch (234:9): [True: 0, False: 0]
  |  Branch (234:25): [True: 0, False: 0]
  ------------------
  235|      0|        pmeth = EVP_PKEY_meth_find(id);
  236|      0|    else
  237|      0|        app_pmeth = pmeth = evp_pkey_meth_find_added_by_application(id);
  238|       |
  239|       |    /* END legacy */
  240|      0|#endif /* FIPS_MODULE */
  241|    362| common:
  242|       |    /*
  243|       |     * If there's no engine and no app supplied pmeth and there's a name, we try
  244|       |     * fetching a provider implementation.
  245|       |     */
  246|    362|    if (e == NULL && app_pmeth == NULL && keytype != NULL) {
  ------------------
  |  Branch (246:9): [True: 362, False: 0]
  |  Branch (246:22): [True: 362, False: 0]
  |  Branch (246:43): [True: 362, False: 0]
  ------------------
  247|       |        /*
  248|       |         * If |pkey| is given and is provided, we take a reference to its
  249|       |         * keymgmt.  Otherwise, we fetch one for the keytype we got. This
  250|       |         * is to ensure that operation init functions can access what they
  251|       |         * need through this single pointer.
  252|       |         */
  253|    362|        if (pkey != NULL && pkey->keymgmt != NULL) {
  ------------------
  |  Branch (253:13): [True: 115, False: 247]
  |  Branch (253:29): [True: 115, False: 0]
  ------------------
  254|    115|            if (!EVP_KEYMGMT_up_ref(pkey->keymgmt))
  ------------------
  |  Branch (254:17): [True: 0, False: 115]
  ------------------
  255|    115|                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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  256|    115|            else
  257|    115|                keymgmt = pkey->keymgmt;
  258|    247|        } else {
  259|    247|            keymgmt = EVP_KEYMGMT_fetch(libctx, keytype, propquery);
  260|    247|        }
  261|    362|        if (keymgmt == NULL)
  ------------------
  |  Branch (261:13): [True: 3, False: 359]
  ------------------
  262|      3|            return NULL;   /* EVP_KEYMGMT_fetch() recorded an error */
  263|       |
  264|    359|#ifndef FIPS_MODULE
  265|       |        /*
  266|       |         * Chase down the legacy NID, as that might be needed for diverse
  267|       |         * purposes, such as ensure that EVP_PKEY_type() can return sensible
  268|       |         * values. We go through all keymgmt names, because the keytype
  269|       |         * that's passed to this function doesn't necessarily translate
  270|       |         * directly.
  271|       |         */
  272|    359|        if (keymgmt != NULL) {
  ------------------
  |  Branch (272:13): [True: 359, False: 0]
  ------------------
  273|    359|            int tmp_id = evp_keymgmt_get_legacy_alg(keymgmt);
  274|       |
  275|    359|            if (tmp_id != NID_undef) {
  ------------------
  |  |   18|    359|#define NID_undef                       0
  ------------------
  |  Branch (275:17): [True: 0, False: 359]
  ------------------
  276|      0|                if (id == -1) {
  ------------------
  |  Branch (276:21): [True: 0, False: 0]
  ------------------
  277|      0|                    id = tmp_id;
  278|      0|                } else {
  279|       |                    /*
  280|       |                     * It really really shouldn't differ.  If it still does,
  281|       |                     * something is very wrong.
  282|       |                     */
  283|      0|                    if (!ossl_assert(id == tmp_id)) {
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (283:25): [True: 0, False: 0]
  ------------------
  284|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  285|      0|                        EVP_KEYMGMT_free(keymgmt);
  286|      0|                        return NULL;
  287|      0|                    }
  288|      0|                }
  289|      0|            }
  290|    359|        }
  291|    359|#endif
  292|    359|    }
  293|       |
  294|    359|    if (pmeth == NULL && keymgmt == NULL) {
  ------------------
  |  Branch (294:9): [True: 359, False: 0]
  |  Branch (294:26): [True: 0, False: 359]
  ------------------
  295|      0|        ERR_raise(ERR_LIB_EVP, EVP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  296|    359|    } else {
  297|    359|        ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |  104|    359|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    359|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    359|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  298|    359|    }
  299|       |
  300|    359|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  301|    359|    if ((ret == NULL || pmeth == NULL) && e != NULL)
  ------------------
  |  Branch (301:10): [True: 0, False: 359]
  |  Branch (301:25): [True: 359, False: 0]
  |  Branch (301:43): [True: 0, False: 359]
  ------------------
  302|      0|        ENGINE_finish(e);
  303|    359|#endif
  304|       |
  305|    359|    if (ret == NULL) {
  ------------------
  |  Branch (305:9): [True: 0, False: 359]
  ------------------
  306|      0|        EVP_KEYMGMT_free(keymgmt);
  307|      0|        return NULL;
  308|      0|    }
  309|    359|    if (propquery != NULL) {
  ------------------
  |  Branch (309:9): [True: 0, False: 359]
  ------------------
  310|      0|        ret->propquery = OPENSSL_strdup(propquery);
  ------------------
  |  |  119|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  311|      0|        if (ret->propquery == NULL) {
  ------------------
  |  Branch (311:13): [True: 0, False: 0]
  ------------------
  312|      0|            OPENSSL_free(ret);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  313|      0|            EVP_KEYMGMT_free(keymgmt);
  314|      0|            return NULL;
  315|      0|        }
  316|      0|    }
  317|    359|    ret->libctx = libctx;
  318|    359|    ret->keytype = keytype;
  319|    359|    ret->keymgmt = keymgmt;
  320|    359|    ret->legacy_keytype = id;
  321|    359|    ret->engine = e;
  322|    359|    ret->pmeth = pmeth;
  323|    359|    ret->operation = EVP_PKEY_OP_UNDEFINED;
  ------------------
  |  | 1744|    359|# define EVP_PKEY_OP_UNDEFINED           0
  ------------------
  324|       |
  325|    359|    if (pkey != NULL && !EVP_PKEY_up_ref(pkey)) {
  ------------------
  |  Branch (325:9): [True: 115, False: 244]
  |  Branch (325:25): [True: 0, False: 115]
  ------------------
  326|      0|        EVP_PKEY_CTX_free(ret);
  327|      0|        return NULL;
  328|      0|    }
  329|       |
  330|    359|    ret->pkey = pkey;
  331|       |
  332|    359|    if (pmeth != NULL && pmeth->init != NULL) {
  ------------------
  |  Branch (332:9): [True: 0, False: 359]
  |  Branch (332:26): [True: 0, False: 0]
  ------------------
  333|      0|        if (pmeth->init(ret) <= 0) {
  ------------------
  |  Branch (333:13): [True: 0, False: 0]
  ------------------
  334|      0|            ret->pmeth = NULL;
  335|      0|            EVP_PKEY_CTX_free(ret);
  336|      0|            return NULL;
  337|      0|        }
  338|      0|    }
  339|       |
  340|    359|    return ret;
  341|    359|}
pmeth_lib.c:decode_cmd:
 1443|    359|{
 1444|    359|    if (cmd == -1) {
  ------------------
  |  Branch (1444:9): [True: 0, False: 359]
  ------------------
 1445|       |        /*
 1446|       |         * The consequence of the assertion not being true is that this
 1447|       |         * function will return -1, which will cause the calling functions
 1448|       |         * to signal that the command is unsupported...  in non-debug mode.
 1449|       |         */
 1450|      0|        if (ossl_assert(name != NULL))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:26): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
 1451|      0|            if (strcmp(name, "distid") == 0 || strcmp(name, "hexdistid") == 0)
  ------------------
  |  Branch (1451:17): [True: 0, False: 0]
  |  Branch (1451:48): [True: 0, False: 0]
  ------------------
 1452|      0|                cmd = EVP_PKEY_CTRL_SET1_ID;
  ------------------
  |  | 1807|      0|# define EVP_PKEY_CTRL_SET1_ID           15
  ------------------
 1453|      0|    }
 1454|       |
 1455|    359|    return cmd;
 1456|    359|}
pmeth_lib.c:evp_pkey_ctx_free_cached_data:
 1529|    359|{
 1530|    359|    cmd = decode_cmd(cmd, name);
 1531|    359|    switch (cmd) {
  ------------------
  |  Branch (1531:13): [True: 0, False: 359]
  ------------------
 1532|    359|    case EVP_PKEY_CTRL_SET1_ID:
  ------------------
  |  | 1807|    359|# define EVP_PKEY_CTRL_SET1_ID           15
  ------------------
  |  Branch (1532:5): [True: 359, False: 0]
  ------------------
 1533|    359|        OPENSSL_free(ctx->cached_parameters.dist_id);
  ------------------
  |  |  115|    359|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    359|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    359|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1534|    359|        OPENSSL_free(ctx->cached_parameters.dist_id_name);
  ------------------
  |  |  115|    359|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    359|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    359|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1535|    359|        ctx->cached_parameters.dist_id = NULL;
 1536|    359|        ctx->cached_parameters.dist_id_name = NULL;
 1537|    359|        break;
 1538|    359|    }
 1539|    359|}
pmeth_lib.c:evp_pkey_ctx_free_all_cached_data:
 1542|    359|{
 1543|    359|    evp_pkey_ctx_free_cached_data(ctx, EVP_PKEY_CTRL_SET1_ID, NULL);
  ------------------
  |  | 1807|    359|# define EVP_PKEY_CTRL_SET1_ID           15
  ------------------
 1544|    359|}

ossl_do_ex_data_init:
   15|      1|{
   16|      1|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   17|       |
   18|      1|    if (global == NULL)
  ------------------
  |  Branch (18:9): [True: 0, False: 1]
  ------------------
   19|      0|        return 0;
   20|       |
   21|      1|    global->ex_data_lock = CRYPTO_THREAD_lock_new();
   22|      1|    return global->ex_data_lock != NULL;
   23|      1|}
ossl_crypto_cleanup_all_ex_data_int:
   73|      1|{
   74|      1|    int i;
   75|      1|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   76|       |
   77|      1|    if (global == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 1]
  ------------------
   78|      0|        return;
   79|       |
   80|     19|    for (i = 0; i < CRYPTO_EX_INDEX__COUNT; ++i) {
  ------------------
  |  |  248|     19|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (80:17): [True: 18, False: 1]
  ------------------
   81|     18|        EX_CALLBACKS *ip = &global->ex_data[i];
   82|       |
   83|     18|        sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb);
   84|     18|        ip->meth = NULL;
   85|     18|    }
   86|       |
   87|      1|    CRYPTO_THREAD_lock_free(global->ex_data_lock);
   88|      1|    global->ex_data_lock = NULL;
   89|      1|}
ossl_crypto_new_ex_data_ex:
  221|    244|{
  222|    244|    int mx, i;
  223|    244|    void *ptr;
  224|    244|    EX_CALLBACK **storage = NULL;
  225|    244|    EX_CALLBACK *stack[10];
  226|    244|    EX_CALLBACKS *ip;
  227|    244|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
  228|       |
  229|    244|    if (global == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 244]
  ------------------
  230|      0|        return 0;
  231|       |
  232|    244|    ip = get_and_lock(global, class_index, 1);
  233|    244|    if (ip == NULL)
  ------------------
  |  Branch (233:9): [True: 0, False: 244]
  ------------------
  234|      0|        return 0;
  235|       |
  236|    244|    ad->ctx = ctx;
  237|    244|    ad->sk = NULL;
  238|    244|    mx = sk_EX_CALLBACK_num(ip->meth);
  239|    244|    if (mx > 0) {
  ------------------
  |  Branch (239:9): [True: 0, False: 244]
  ------------------
  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);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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|    244|    CRYPTO_THREAD_unlock(global->ex_data_lock);
  249|       |
  250|    244|    if (mx > 0 && storage == NULL)
  ------------------
  |  Branch (250:9): [True: 0, False: 244]
  |  Branch (250:19): [True: 0, False: 0]
  ------------------
  251|      0|        return 0;
  252|    244|    for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (252:17): [True: 0, False: 244]
  ------------------
  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|    244|    if (storage != stack)
  ------------------
  |  Branch (259:9): [True: 244, False: 0]
  ------------------
  260|    244|        OPENSSL_free(storage);
  ------------------
  |  |  115|    244|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  261|    244|    return 1;
  262|    244|}
CRYPTO_new_ex_data:
  265|    244|{
  266|    244|    return ossl_crypto_new_ex_data_ex(NULL, class_index, obj, ad);
  267|    244|}
CRYPTO_free_ex_data:
  368|    244|{
  369|    244|    int mx, i;
  370|    244|    EX_CALLBACKS *ip;
  371|    244|    void *ptr;
  372|    244|    const EX_CALLBACK *f;
  373|    244|    struct ex_callback_entry stack[10];
  374|    244|    struct ex_callback_entry *storage = NULL;
  375|    244|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ad->ctx);
  376|       |
  377|    244|    if (global == NULL)
  ------------------
  |  Branch (377:9): [True: 0, False: 244]
  ------------------
  378|      0|        goto err;
  379|       |
  380|    244|    ip = get_and_lock(global, class_index, 1);
  381|    244|    if (ip == NULL)
  ------------------
  |  Branch (381:9): [True: 0, False: 244]
  ------------------
  382|      0|        goto err;
  383|       |
  384|    244|    mx = sk_EX_CALLBACK_num(ip->meth);
  385|    244|    if (mx > 0) {
  ------------------
  |  Branch (385:9): [True: 0, False: 244]
  ------------------
  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);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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|    244|    CRYPTO_THREAD_unlock(global->ex_data_lock);
  397|       |
  398|    244|    if (storage != NULL) {
  ------------------
  |  Branch (398:9): [True: 0, False: 244]
  ------------------
  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|    244|    if (storage != stack)
  ------------------
  |  Branch (411:9): [True: 244, False: 0]
  ------------------
  412|    244|        OPENSSL_free(storage);
  ------------------
  |  |  115|    244|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  413|    244| err:
  414|    244|    sk_void_free(ad->sk);
  ------------------
  |  |  204|    244|#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
  ------------------
  415|    244|    ad->sk = NULL;
  416|    244|    ad->ctx = NULL;
  417|    244|}
ex_data.c:get_and_lock:
   33|    488|{
   34|    488|    EX_CALLBACKS *ip;
   35|       |
   36|    488|    if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
  ------------------
  |  |  248|    488|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (36:9): [True: 0, False: 488]
  |  Branch (36:28): [True: 0, False: 488]
  ------------------
   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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   38|      0|        return NULL;
   39|      0|    }
   40|       |
   41|    488|    if (global->ex_data_lock == NULL) {
  ------------------
  |  Branch (41:9): [True: 0, False: 488]
  ------------------
   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|    488|    if (read) {
  ------------------
  |  Branch (49:9): [True: 488, False: 0]
  ------------------
   50|    488|        if (!CRYPTO_THREAD_read_lock(global->ex_data_lock))
  ------------------
  |  Branch (50:13): [True: 0, False: 488]
  ------------------
   51|      0|            return NULL;
   52|    488|    } else {
   53|      0|        if (!CRYPTO_THREAD_write_lock(global->ex_data_lock))
  ------------------
  |  Branch (53:13): [True: 0, False: 0]
  ------------------
   54|      0|            return NULL;
   55|      0|    }
   56|       |
   57|    488|    ip = &global->ex_data[class_index];
   58|    488|    return ip;
   59|    488|}

ossl_safe_getenv:
   19|      1|{
   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|      1|#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
   92|      1|# if __GLIBC_PREREQ(2, 17)
   93|      1|#  define SECURE_GETENV
   94|      1|    return secure_getenv(name);
   95|      1|# endif
   96|      1|#endif
   97|       |
   98|       |#ifndef SECURE_GETENV
   99|       |    if (OPENSSL_issetugid())
  100|       |        return NULL;
  101|       |    return getenv(name);
  102|       |#endif
  103|      1|}

ossl_fnv1a_hash:
   14|  3.72k|{
   15|  3.72k|    uint64_t hash = 0xcbf29ce484222325ULL;
   16|  3.72k|    size_t i;
   17|       |
   18|   242k|    for (i = 0; i < len; i++) {
  ------------------
  |  Branch (18:17): [True: 238k, False: 3.72k]
  ------------------
   19|   238k|        hash ^= key[i];
   20|   238k|        hash *= 0x00000100000001B3ULL;
   21|   238k|    }
   22|  3.72k|    return hash;
   23|  3.72k|}

ossl_ht_new:
  176|      1|{
  177|      1|    HT *new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  178|       |
  179|      1|    if (new == NULL)
  ------------------
  |  Branch (179:9): [True: 0, False: 1]
  ------------------
  180|      0|        return NULL;
  181|       |
  182|      1|    new->atomic_lock = CRYPTO_THREAD_lock_new();
  183|      1|    if (new->atomic_lock == NULL)
  ------------------
  |  Branch (183:9): [True: 0, False: 1]
  ------------------
  184|      0|        goto err;
  185|       |
  186|      1|    memcpy(&new->config, conf, sizeof(*conf));
  187|       |
  188|      1|    if (new->config.init_neighborhoods != 0) {
  ------------------
  |  Branch (188:9): [True: 1, False: 0]
  ------------------
  189|      1|        new->wpd.neighborhood_len = new->config.init_neighborhoods;
  190|       |        /* round up to the next power of 2 */
  191|      1|        new->wpd.neighborhood_len--;
  192|      1|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 1;
  193|      1|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 2;
  194|      1|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 4;
  195|      1|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 8;
  196|      1|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 16;
  197|      1|        new->wpd.neighborhood_len++;
  198|      1|    } else {
  199|      0|        new->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      0|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      0|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  200|      0|    }
  201|       |
  202|      1|    if (new->config.ht_free_fn == NULL)
  ------------------
  |  Branch (202:9): [True: 1, False: 0]
  ------------------
  203|      1|        new->config.ht_free_fn = internal_free_nop;
  204|       |
  205|      1|    new->md = OPENSSL_zalloc(sizeof(*new->md));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  206|      1|    if (new->md == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 1]
  ------------------
  207|      0|        goto err;
  208|       |
  209|      1|    new->md->neighborhoods =
  210|      1|        alloc_new_neighborhood_list(new->wpd.neighborhood_len,
  211|      1|                                    &new->md->neighborhood_ptr_to_free);
  212|      1|    if (new->md->neighborhoods == NULL)
  ------------------
  |  Branch (212:9): [True: 0, False: 1]
  ------------------
  213|      0|        goto err;
  214|      1|    new->md->neighborhood_mask = new->wpd.neighborhood_len - 1;
  215|       |
  216|      1|    new->lock = ossl_rcu_lock_new(1, conf->ctx);
  217|      1|    if (new->lock == NULL)
  ------------------
  |  Branch (217:9): [True: 0, False: 1]
  ------------------
  218|      0|        goto err;
  219|       |
  220|      1|    if (new->config.ht_hash_fn == NULL)
  ------------------
  |  Branch (220:9): [True: 1, False: 0]
  ------------------
  221|      1|        new->config.ht_hash_fn = ossl_fnv1a_hash;
  222|       |
  223|      1|    return new;
  224|       |
  225|      0|err:
  226|      0|    CRYPTO_THREAD_lock_free(new->atomic_lock);
  227|      0|    ossl_rcu_lock_free(new->lock);
  228|      0|    if (new->md != NULL)
  ------------------
  |  Branch (228:9): [True: 0, False: 0]
  ------------------
  229|      0|        OPENSSL_free(new->md->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|      0|    OPENSSL_free(new->md);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  231|      0|    OPENSSL_free(new);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  232|      0|    return NULL;
  233|      1|}
ossl_ht_write_lock:
  246|      1|{
  247|      1|    ossl_rcu_write_lock(htable->lock);
  248|      1|    htable->wpd.need_sync = 0;
  249|      1|}
ossl_ht_write_unlock:
  252|      1|{
  253|      1|    int need_sync = htable->wpd.need_sync;
  254|       |
  255|      1|    htable->wpd.need_sync = 0;
  256|      1|    ossl_rcu_write_unlock(htable->lock);
  257|      1|    if (need_sync)
  ------------------
  |  Branch (257:9): [True: 1, False: 0]
  ------------------
  258|      1|        ossl_synchronize_rcu(htable->lock);
  259|      1|}
ossl_ht_free:
  320|      1|{
  321|      1|    if (h == NULL)
  ------------------
  |  Branch (321:9): [True: 0, False: 1]
  ------------------
  322|      0|        return;
  323|       |
  324|      1|    ossl_ht_write_lock(h);
  325|      1|    ossl_ht_flush_internal(h);
  326|      1|    ossl_ht_write_unlock(h);
  327|       |    /* Freeing the lock does a final sync for us */
  328|      1|    CRYPTO_THREAD_lock_free(h->atomic_lock);
  329|      1|    ossl_rcu_lock_free(h->lock);
  330|      1|    OPENSSL_free(h->md->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  331|      1|    OPENSSL_free(h->md);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  332|      1|    OPENSSL_free(h);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  333|      1|    return;
  334|      1|}
ossl_ht_insert:
  629|    468|{
  630|    468|    struct ht_internal_value_st *newval = NULL;
  631|    468|    uint64_t hash;
  632|    468|    int rc = 0;
  633|    468|    int i;
  634|       |
  635|    468|    if (data->value == NULL)
  ------------------
  |  Branch (635:9): [True: 0, False: 468]
  ------------------
  636|      0|        goto out;
  637|       |
  638|    468|    newval = alloc_new_value(h, key, data->value, data->type_id);
  639|    468|    if (newval == NULL)
  ------------------
  |  Branch (639:9): [True: 0, False: 468]
  ------------------
  640|      0|        goto out;
  641|       |
  642|       |    /*
  643|       |     * we have to take our lock here to prevent other changes
  644|       |     * to the bucket list
  645|       |     */
  646|    468|    hash = h->config.ht_hash_fn(key->keybuf, key->keysize);
  647|       |
  648|    468|    for (i = 0;
  649|    468|         (rc = ossl_ht_insert_locked(h, hash, newval, olddata)) == -1
  ------------------
  |  Branch (649:10): [True: 0, False: 468]
  ------------------
  650|    468|         && i < 4;
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  ------------------
  651|    468|         ++i)
  652|      0|        if (!grow_hashtable(h, h->wpd.neighborhood_len)) {
  ------------------
  |  Branch (652:13): [True: 0, False: 0]
  ------------------
  653|      0|            rc = -1;
  654|      0|            break;
  655|      0|        }
  656|       |
  657|    468|    if (rc <= 0)
  ------------------
  |  Branch (657:9): [True: 0, False: 468]
  ------------------
  658|      0|        free_value(newval);
  659|       |
  660|    468|out:
  661|    468|    return rc;
  662|    468|}
ossl_ht_get:
  665|  3.25k|{
  666|  3.25k|    struct ht_mutable_data_st *md;
  667|  3.25k|    uint64_t hash;
  668|  3.25k|    uint64_t neigh_idx_start;
  669|  3.25k|    uint64_t neigh_idx;
  670|  3.25k|    struct ht_internal_value_st *ival = NULL;
  671|  3.25k|    size_t j;
  672|  3.25k|    uint64_t ehash;
  673|  3.25k|    int lockless_reads = h->config.lockless_reads;
  674|       |
  675|  3.25k|    hash = h->config.ht_hash_fn(key->keybuf, key->keysize);
  676|       |
  677|  3.25k|    md = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|  3.25k|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  678|  3.25k|    neigh_idx = neigh_idx_start = hash & md->neighborhood_mask;
  679|  3.25k|    do {
  680|  3.25k|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[neigh_idx]);
  ------------------
  |  |   83|  3.25k|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  681|  3.62k|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|  3.62k|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|  3.62k|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (681:21): [True: 3.62k, False: 0]
  ------------------
  682|  3.62k|            ival = ossl_rcu_deref(&md->neighborhoods[neigh_idx].entries[j].value);
  ------------------
  |  |   30|  3.62k|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  683|  3.62k|            if (ival == NULL) {
  ------------------
  |  Branch (683:17): [True: 686, False: 2.93k]
  ------------------
  684|    686|                if (lockless_reads)
  ------------------
  |  Branch (684:21): [True: 686, False: 0]
  ------------------
  685|       |                    /* lockless_reads implies no deletion, we can break out */
  686|    686|                    return NULL;
  687|      0|                continue;
  688|    686|            }
  689|  2.93k|            if (!CRYPTO_atomic_load(&md->neighborhoods[neigh_idx].entries[j].hash,
  ------------------
  |  Branch (689:17): [True: 0, False: 2.93k]
  ------------------
  690|  2.93k|                                    &ehash, h->atomic_lock))
  691|      0|                return NULL;
  692|  2.93k|            if (compare_hash(hash, ehash) && match_key(&ival->value.key, key))
  ------------------
  |  Branch (692:17): [True: 2.57k, False: 366]
  |  Branch (692:46): [True: 2.57k, False: 0]
  ------------------
  693|  2.57k|                return (HT_VALUE *)ival;
  694|  2.93k|        }
  695|      0|        if (!lockless_reads)
  ------------------
  |  Branch (695:13): [True: 0, False: 0]
  ------------------
  696|      0|            break;
  697|       |        /* Continue search in subsequent neighborhoods */
  698|      0|        neigh_idx = (neigh_idx + 1) & md->neighborhood_mask;
  699|      0|    } while (neigh_idx != neigh_idx_start);
  ------------------
  |  Branch (699:14): [True: 0, False: 0]
  ------------------
  700|       |
  701|      0|    return NULL;
  702|  3.25k|}
hashtable.c:internal_free_nop:
  171|    468|{
  172|    468|    return;
  173|    468|}
hashtable.c:alloc_new_neighborhood_list:
  154|      2|{
  155|      2|    struct ht_neighborhood_st *ret;
  156|       |
  157|      2|    ret = OPENSSL_aligned_alloc(sizeof(struct ht_neighborhood_st) * len,
  ------------------
  |  |  106|      2|        CRYPTO_aligned_alloc(num, alignment, freeptr, \
  |  |  107|      2|                             OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                                            OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  158|      2|                                CACHE_LINE_BYTES, freeptr);
  159|       |
  160|       |    /* fall back to regular malloc */
  161|      2|    if (ret == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 2]
  ------------------
  162|      0|        ret = *freeptr = OPENSSL_malloc(sizeof(struct ht_neighborhood_st) * len);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|      0|        if (ret == NULL)
  ------------------
  |  Branch (163:13): [True: 0, False: 0]
  ------------------
  164|      0|            return NULL;
  165|      0|    }
  166|      2|    memset(ret, 0, sizeof(struct ht_neighborhood_st) * len);
  167|      2|    return ret;
  168|      2|}
hashtable.c:ossl_ht_flush_internal:
  284|      1|{
  285|      1|    struct ht_mutable_data_st *newmd = NULL;
  286|      1|    struct ht_mutable_data_st *oldmd = NULL;
  287|       |
  288|      1|    newmd = OPENSSL_zalloc(sizeof(*newmd));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  289|      1|    if (newmd == NULL)
  ------------------
  |  Branch (289:9): [True: 0, False: 1]
  ------------------
  290|      0|        return 0;
  291|       |
  292|      1|    newmd->neighborhoods = alloc_new_neighborhood_list(DEFAULT_NEIGH_LEN,
  ------------------
  |  |   95|      1|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      1|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  293|      1|                                                       &newmd->neighborhood_ptr_to_free);
  294|      1|    if (newmd->neighborhoods == NULL) {
  ------------------
  |  Branch (294:9): [True: 0, False: 1]
  ------------------
  295|      0|        OPENSSL_free(newmd);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  296|      0|        return 0;
  297|      0|    }
  298|       |
  299|      1|    newmd->neighborhood_mask = DEFAULT_NEIGH_LEN - 1;
  ------------------
  |  |   95|      1|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      1|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  300|       |
  301|       |    /* Swap the old and new mutable data sets */
  302|      1|    oldmd = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      1|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  303|      1|    ossl_rcu_assign_ptr(&h->md, &newmd);
  ------------------
  |  |   31|      1|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  304|       |
  305|       |    /* Set the number of entries to 0 */
  306|      1|    h->wpd.value_count = 0;
  307|      1|    h->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      1|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      1|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  308|       |
  309|      1|    ossl_rcu_call(h->lock, free_oldmd, oldmd);
  310|      1|    h->wpd.need_sync = 1;
  311|      1|    return 1;
  312|      1|}
hashtable.c:free_oldmd:
  262|      1|{
  263|      1|    struct ht_mutable_data_st *oldmd = arg;
  264|      1|    size_t i, j;
  265|      1|    size_t neighborhood_len = (size_t)oldmd->neighborhood_mask + 1;
  266|      1|    struct ht_internal_value_st *v;
  267|       |
  268|  2.04k|    for (i = 0; i < neighborhood_len; i++) {
  ------------------
  |  Branch (268:17): [True: 2.04k, False: 1]
  ------------------
  269|  2.04k|        PREFETCH_NEIGHBORHOOD(oldmd->neighborhoods[i + 1]);
  ------------------
  |  |   83|  2.04k|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  270|  10.2k|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|  10.2k|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|  10.2k|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (270:21): [True: 8.19k, False: 2.04k]
  ------------------
  271|  8.19k|            if (oldmd->neighborhoods[i].entries[j].value != NULL) {
  ------------------
  |  Branch (271:17): [True: 468, False: 7.72k]
  ------------------
  272|    468|                v = oldmd->neighborhoods[i].entries[j].value;
  273|    468|                v->ht->config.ht_free_fn((HT_VALUE *)v);
  274|    468|                free_value(v);
  275|    468|            }
  276|  8.19k|        }
  277|  2.04k|    }
  278|       |
  279|      1|    OPENSSL_free(oldmd->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  280|      1|    OPENSSL_free(oldmd);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|      1|}
hashtable.c:alloc_new_value:
  597|    468|{
  598|    468|    struct ht_internal_value_st *tmp;
  599|    468|    size_t nvsize = sizeof(*tmp);
  600|       |
  601|    468|    if (h->config.collision_check == 1)
  ------------------
  |  Branch (601:9): [True: 468, False: 0]
  ------------------
  602|    468|        nvsize += key->keysize;
  603|       |
  604|    468|    tmp = OPENSSL_malloc(nvsize);
  ------------------
  |  |  102|    468|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    468|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    468|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  605|       |
  606|    468|    if (tmp == NULL)
  ------------------
  |  Branch (606:9): [True: 0, False: 468]
  ------------------
  607|      0|        return NULL;
  608|       |
  609|    468|    tmp->ht = h;
  610|    468|    tmp->value.value = data;
  611|    468|    tmp->value.type_id = type;
  612|    468|    tmp->value.key.keybuf = NULL;
  613|    468|    if (h->config.collision_check) {
  ------------------
  |  Branch (613:9): [True: 468, False: 0]
  ------------------
  614|    468|        tmp->value.key.keybuf = (uint8_t *)(tmp + 1);
  615|    468|        tmp->value.key.keysize = key->keysize;
  616|    468|        memcpy(tmp->value.key.keybuf, key->keybuf, key->keysize);
  617|    468|    }
  618|       |
  619|       |
  620|    468|    return tmp;
  621|    468|}
hashtable.c:ossl_ht_insert_locked:
  532|    468|{
  533|    468|    struct ht_mutable_data_st *md = h->md;
  534|    468|    uint64_t neigh_idx_start = hash & md->neighborhood_mask;
  535|    468|    uint64_t neigh_idx = neigh_idx_start;
  536|    468|    size_t j;
  537|    468|    uint64_t ihash;
  538|    468|    HT_VALUE *ival;
  539|    468|    size_t empty_idx = SIZE_MAX;
  540|    468|    int lockless_reads = h->config.lockless_reads;
  541|       |
  542|    468|    do {
  543|    468|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[neigh_idx]);
  ------------------
  |  |   83|    468|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  544|       |
  545|    509|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|    509|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|    509|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (545:21): [True: 509, False: 0]
  ------------------
  546|    509|            ival = ossl_rcu_deref(&md->neighborhoods[neigh_idx].entries[j].value);
  ------------------
  |  |   30|    509|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  547|    509|            if (ival == NULL) {
  ------------------
  |  Branch (547:17): [True: 468, False: 41]
  ------------------
  548|    468|                empty_idx = j;
  549|       |                /* lockless_reads implies no deletion, we can break out */
  550|    468|                if (lockless_reads)
  ------------------
  |  Branch (550:21): [True: 468, False: 0]
  ------------------
  551|    468|                    goto not_found;
  552|      0|                continue;
  553|    468|            }
  554|     41|            if (!CRYPTO_atomic_load(&md->neighborhoods[neigh_idx].entries[j].hash,
  ------------------
  |  Branch (554:17): [True: 0, False: 41]
  ------------------
  555|     41|                                    &ihash, h->atomic_lock))
  556|      0|                return 0;
  557|     41|            if (compare_hash(hash, ihash) && match_key(&newval->value.key,
  ------------------
  |  Branch (557:17): [True: 0, False: 41]
  |  Branch (557:46): [True: 0, False: 0]
  ------------------
  558|      0|                                                       &ival->key)) {
  559|      0|                if (olddata == NULL) {
  ------------------
  |  Branch (559:21): [True: 0, False: 0]
  ------------------
  560|       |                    /* This would insert a duplicate -> fail */
  561|      0|                    return 0;
  562|      0|                }
  563|       |                /* Do a replacement */
  564|      0|                if (!CRYPTO_atomic_store(&md->neighborhoods[neigh_idx].entries[j].hash,
  ------------------
  |  Branch (564:21): [True: 0, False: 0]
  ------------------
  565|      0|                                         hash, h->atomic_lock))
  566|      0|                    return 0;
  567|      0|                *olddata = (HT_VALUE *)md->neighborhoods[neigh_idx].entries[j].value;
  568|      0|                ossl_rcu_assign_ptr(&md->neighborhoods[neigh_idx].entries[j].value,
  ------------------
  |  |   31|      0|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  569|      0|                                    &newval);
  570|      0|                ossl_rcu_call(h->lock, free_old_ht_value, *olddata);
  571|      0|                h->wpd.need_sync = 1;
  572|      0|                return 1;
  573|      0|            }
  574|     41|        }
  575|      0|        if (!lockless_reads)
  ------------------
  |  Branch (575:13): [True: 0, False: 0]
  ------------------
  576|      0|            break;
  577|       |        /* Continue search in subsequent neighborhoods */
  578|      0|        neigh_idx = (neigh_idx + 1) & md->neighborhood_mask;
  579|      0|    } while (neigh_idx != neigh_idx_start);
  ------------------
  |  Branch (579:14): [True: 0, False: 0]
  ------------------
  580|       |
  581|    468| not_found:
  582|       |    /* If we get to here, its just an insert */
  583|    468|    if (empty_idx == SIZE_MAX)
  ------------------
  |  Branch (583:9): [True: 0, False: 468]
  ------------------
  584|      0|        return -1; /* out of space */
  585|    468|    if (!CRYPTO_atomic_store(&md->neighborhoods[neigh_idx].entries[empty_idx].hash,
  ------------------
  |  Branch (585:9): [True: 0, False: 468]
  ------------------
  586|    468|                             hash, h->atomic_lock))
  587|      0|        return 0;
  588|    468|    h->wpd.value_count++;
  589|    468|    ossl_rcu_assign_ptr(&md->neighborhoods[neigh_idx].entries[empty_idx].value,
  ------------------
  |  |   31|    468|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  590|    468|                        &newval);
  591|    468|    return 1;
  592|    468|}
hashtable.c:free_value:
  624|    468|{
  625|    468|    OPENSSL_free(v);
  ------------------
  |  |  115|    468|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    468|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    468|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  626|    468|}
hashtable.c:compare_hash:
  405|  2.97k|{
  406|  2.97k|    return (hash1 == hash2);
  407|  2.97k|}
hashtable.c:match_key:
  516|  2.57k|{
  517|       |    /*
  518|       |     * keys match if they are both present, the same size
  519|       |     * and compare equal in memory
  520|       |     */
  521|  2.57k|    PREFETCH(a->keybuf);
  ------------------
  |  |   84|  2.57k|# define PREFETCH(x) __builtin_prefetch(x)
  ------------------
  522|  2.57k|    PREFETCH(b->keybuf);
  ------------------
  |  |   84|  2.57k|# define PREFETCH(x) __builtin_prefetch(x)
  ------------------
  523|  2.57k|    if (a->keybuf != NULL && b->keybuf != NULL && a->keysize == b->keysize)
  ------------------
  |  Branch (523:9): [True: 2.57k, False: 0]
  |  Branch (523:30): [True: 2.57k, False: 0]
  |  Branch (523:51): [True: 2.57k, False: 0]
  ------------------
  524|  2.57k|        return !memcmp(a->keybuf, b->keybuf, a->keysize);
  525|       |
  526|      0|    return 1;
  527|  2.57k|}

ossl_err_load_HTTP_strings:
   80|      1|{
   81|      1|# ifndef OPENSSL_NO_ERR
   82|      1|    if (ERR_reason_error_string(HTTP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (82:9): [True: 1, False: 0]
  ------------------
   83|      1|        ERR_load_strings_const(HTTP_str_reasons);
   84|      1|# endif
   85|      1|    return 1;
   86|      1|}

ossl_indicator_set_callback_new:
   22|      1|{
   23|      1|    INDICATOR_CB *cb;
   24|       |
   25|      1|    cb = OPENSSL_zalloc(sizeof(*cb));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      1|    return cb;
   27|      1|}
ossl_indicator_set_callback_free:
   30|      1|{
   31|      1|    OPENSSL_free(cb);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   32|      1|}

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

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

OPENSSL_LH_set_thunks:
   52|    226|{
   53|       |
   54|    226|    if (lh == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 226]
  ------------------
   55|      0|        return NULL;
   56|    226|    lh->compw = cw;
   57|    226|    lh->hashw = hw;
   58|    226|    lh->daw = daw;
   59|    226|    lh->daaw = daaw;
   60|    226|    return lh;
   61|    226|}
OPENSSL_LH_new:
   64|    226|{
   65|    226|    OPENSSL_LHASH *ret;
   66|       |
   67|    226|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  104|    226|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    226|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    226|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (67:9): [True: 0, False: 226]
  ------------------
   68|      0|        return NULL;
   69|    226|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |  104|    226|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    226|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    226|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 226]
  ------------------
   70|      0|        goto err;
   71|    226|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (71:18): [True: 0, False: 226]
  ------------------
   72|    226|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (72:18): [True: 0, False: 226]
  ------------------
   73|    226|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|    226|#define MIN_NODES       16
  ------------------
   74|    226|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|    226|#define MIN_NODES       16
  ------------------
   75|    226|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|    226|#define MIN_NODES       16
  ------------------
   76|    226|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|    226|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   85|    226|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   77|    226|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|    226|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   85|    226|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   78|    226|    return ret;
   79|       |
   80|      0|err:
   81|      0|    OPENSSL_free(ret->b);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   82|      0|    OPENSSL_free(ret);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   83|      0|    return NULL;
   84|    226|}
OPENSSL_LH_free:
   87|    227|{
   88|    227|    if (lh == NULL)
  ------------------
  |  Branch (88:9): [True: 1, False: 226]
  ------------------
   89|      1|        return;
   90|       |
   91|    226|    OPENSSL_LH_flush(lh);
   92|    226|    OPENSSL_free(lh->b);
  ------------------
  |  |  115|    226|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    226|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    226|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|    226|    OPENSSL_free(lh);
  ------------------
  |  |  115|    226|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    226|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    226|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|    226|}
OPENSSL_LH_flush:
   97|    226|{
   98|    226|    unsigned int i;
   99|    226|    OPENSSL_LH_NODE *n, *nn;
  100|       |
  101|    226|    if (lh == NULL)
  ------------------
  |  Branch (101:9): [True: 0, False: 226]
  ------------------
  102|      0|        return;
  103|       |
  104|  2.90k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (104:17): [True: 2.67k, False: 226]
  ------------------
  105|  2.67k|        n = lh->b[i];
  106|  4.22k|        while (n != NULL) {
  ------------------
  |  Branch (106:16): [True: 1.54k, False: 2.67k]
  ------------------
  107|  1.54k|            nn = n->next;
  108|  1.54k|            OPENSSL_free(n);
  ------------------
  |  |  115|  1.54k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  1.54k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  1.54k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  109|  1.54k|            n = nn;
  110|  1.54k|        }
  111|  2.67k|        lh->b[i] = NULL;
  112|  2.67k|    }
  113|       |
  114|    226|    lh->num_items = 0;
  115|    226|}
OPENSSL_LH_insert:
  118|  4.75k|{
  119|  4.75k|    unsigned long hash;
  120|  4.75k|    OPENSSL_LH_NODE *nn, **rn;
  121|  4.75k|    void *ret;
  122|       |
  123|  4.75k|    lh->error = 0;
  124|  4.75k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   85|  4.75k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (124:9): [True: 867, False: 3.89k]
  |  Branch (124:76): [True: 0, False: 867]
  ------------------
  125|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  126|       |
  127|  4.75k|    rn = getrn(lh, data, &hash);
  128|       |
  129|  4.75k|    if (*rn == NULL) {
  ------------------
  |  Branch (129:9): [True: 1.78k, False: 2.97k]
  ------------------
  130|  1.78k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |  102|  1.78k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  1.78k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  1.78k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (130:13): [True: 0, False: 1.78k]
  ------------------
  131|      0|            lh->error++;
  132|      0|            return NULL;
  133|      0|        }
  134|  1.78k|        nn->data = data;
  135|  1.78k|        nn->next = NULL;
  136|  1.78k|        nn->hash = hash;
  137|  1.78k|        *rn = nn;
  138|  1.78k|        ret = NULL;
  139|  1.78k|        lh->num_items++;
  140|  2.97k|    } else {                    /* replace same key */
  141|  2.97k|        ret = (*rn)->data;
  142|  2.97k|        (*rn)->data = data;
  143|  2.97k|    }
  144|  4.75k|    return ret;
  145|  4.75k|}
OPENSSL_LH_delete:
  148|    242|{
  149|    242|    unsigned long hash;
  150|    242|    OPENSSL_LH_NODE *nn, **rn;
  151|    242|    void *ret;
  152|       |
  153|    242|    lh->error = 0;
  154|    242|    rn = getrn(lh, data, &hash);
  155|       |
  156|    242|    if (*rn == NULL) {
  ------------------
  |  Branch (156:9): [True: 0, False: 242]
  ------------------
  157|      0|        return NULL;
  158|    242|    } else {
  159|    242|        nn = *rn;
  160|    242|        *rn = nn->next;
  161|    242|        ret = nn->data;
  162|    242|        OPENSSL_free(nn);
  ------------------
  |  |  115|    242|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    242|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    242|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|    242|    }
  164|       |
  165|    242|    lh->num_items--;
  166|    242|    if ((lh->num_nodes > MIN_NODES) &&
  ------------------
  |  |   39|    242|#define MIN_NODES       16
  ------------------
  |  Branch (166:9): [True: 242, False: 0]
  ------------------
  167|    242|        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
  ------------------
  |  |   85|    242|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (167:9): [True: 1, False: 241]
  ------------------
  168|      1|        contract(lh);
  169|       |
  170|    242|    return ret;
  171|    242|}
OPENSSL_LH_retrieve:
  174|  2.36k|{
  175|  2.36k|    unsigned long hash;
  176|  2.36k|    OPENSSL_LH_NODE **rn;
  177|       |
  178|  2.36k|    if (lh->error != 0)
  ------------------
  |  Branch (178:9): [True: 0, False: 2.36k]
  ------------------
  179|      0|        lh->error = 0;
  180|       |
  181|  2.36k|    rn = getrn(lh, data, &hash);
  182|       |
  183|  2.36k|    return *rn == NULL ? NULL : (*rn)->data;
  ------------------
  |  Branch (183:12): [True: 254, False: 2.11k]
  ------------------
  184|  2.36k|}
OPENSSL_LH_doall:
  217|    228|{
  218|    228|    if (lh == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 228]
  ------------------
  219|      0|        return;
  220|       |
  221|    228|    doall_util_fn(lh, 0, lh->daw, func, (OPENSSL_LH_DOALL_FUNCARG)NULL,
  222|    228|                  (OPENSSL_LH_DOALL_FUNCARG_THUNK)NULL, NULL);
  223|    228|}
OPENSSL_LH_doall_arg_thunk:
  238|      2|{
  239|      2|    doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC_THUNK)NULL,
  240|      2|                  (OPENSSL_LH_DOALL_FUNC)NULL, fn, daaw, arg);
  241|      2|}
OPENSSL_LH_strhash:
  362|  1.67k|{
  363|  1.67k|    unsigned long ret = 0;
  364|  1.67k|    long n;
  365|  1.67k|    unsigned long v;
  366|  1.67k|    int r;
  367|       |
  368|  1.67k|    if ((c == NULL) || (*c == '\0'))
  ------------------
  |  Branch (368:9): [True: 0, False: 1.67k]
  |  Branch (368:24): [True: 1.42k, False: 250]
  ------------------
  369|  1.42k|        return ret;
  370|       |
  371|    250|    n = 0x100;
  372|  3.96k|    while (*c) {
  ------------------
  |  Branch (372:12): [True: 3.71k, False: 250]
  ------------------
  373|  3.71k|        v = n | (*c);
  374|  3.71k|        n += 0x100;
  375|  3.71k|        r = (int)((v >> 2) ^ v) & 0x0f;
  376|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  377|  3.71k|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  378|  3.71k|        ret &= 0xFFFFFFFFL;
  379|  3.71k|        ret ^= v * v;
  380|  3.71k|        c++;
  381|  3.71k|    }
  382|    250|    return (ret >> 16) ^ ret;
  383|  1.67k|}
ossl_lh_strcasehash:
  400|  1.31k|{
  401|  1.31k|    unsigned long ret = 0;
  402|  1.31k|    long n;
  403|  1.31k|    unsigned long v;
  404|  1.31k|    int r;
  405|       |#if defined(CHARSET_EBCDIC) && !defined(CHARSET_EBCDIC_TEST)
  406|       |    const long int case_adjust = ~0x40;
  407|       |#else
  408|  1.31k|    const long int case_adjust = ~0x20;
  409|  1.31k|#endif
  410|       |
  411|  1.31k|    if (c == NULL || *c == '\0')
  ------------------
  |  Branch (411:9): [True: 0, False: 1.31k]
  |  Branch (411:22): [True: 0, False: 1.31k]
  ------------------
  412|      0|        return ret;
  413|       |
  414|  16.9k|    for (n = 0x100; *c != '\0'; n += 0x100) {
  ------------------
  |  Branch (414:21): [True: 15.6k, False: 1.31k]
  ------------------
  415|  15.6k|        v = n | (case_adjust & *c);
  416|  15.6k|        r = (int)((v >> 2) ^ v) & 0x0f;
  417|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  418|  15.6k|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  419|  15.6k|        ret &= 0xFFFFFFFFL;
  420|  15.6k|        ret ^= v * v;
  421|  15.6k|        c++;
  422|  15.6k|    }
  423|  1.31k|    return (ret >> 16) ^ ret;
  424|  1.31k|}
OPENSSL_LH_get_down_load:
  432|      4|{
  433|      4|    return lh->down_load;
  434|      4|}
OPENSSL_LH_set_down_load:
  437|      7|{
  438|      7|    lh->down_load = down_load;
  439|      7|}
OPENSSL_LH_error:
  442|    266|{
  443|    266|    return lh->error;
  444|    266|}
lhash.c:doall_util_fn:
  192|    230|{
  193|    230|    int i;
  194|    230|    OPENSSL_LH_NODE *a, *n;
  195|       |
  196|    230|    if (lh == NULL)
  ------------------
  |  Branch (196:9): [True: 0, False: 230]
  ------------------
  197|      0|        return;
  198|       |
  199|       |    /*
  200|       |     * reverse the order so we search from 'top to bottom' We were having
  201|       |     * memory leaks otherwise
  202|       |     */
  203|  2.75k|    for (i = lh->num_nodes - 1; i >= 0; i--) {
  ------------------
  |  Branch (203:33): [True: 2.52k, False: 230]
  ------------------
  204|  2.52k|        a = lh->b[i];
  205|  3.57k|        while (a != NULL) {
  ------------------
  |  Branch (205:16): [True: 1.05k, False: 2.52k]
  ------------------
  206|  1.05k|            n = a->next;
  207|  1.05k|            if (use_arg)
  ------------------
  |  Branch (207:17): [True: 484, False: 567]
  ------------------
  208|    484|                wfunc_arg(a->data, arg, func_arg);
  209|    567|            else
  210|    567|                wfunc(a->data, func);
  211|  1.05k|            a = n;
  212|  1.05k|        }
  213|  2.52k|    }
  214|    230|}
lhash.c:expand:
  244|    867|{
  245|    867|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  246|    867|    unsigned int p, pmax, nni, j;
  247|    867|    unsigned long hash;
  248|       |
  249|    867|    nni = lh->num_alloc_nodes;
  250|    867|    p = lh->p;
  251|    867|    pmax = lh->pmax;
  252|    867|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (252:9): [True: 9, False: 858]
  ------------------
  253|      9|        j = nni * 2;
  254|      9|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  109|      9|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  255|      9|        if (n == NULL) {
  ------------------
  |  Branch (255:13): [True: 0, False: 9]
  ------------------
  256|      0|            lh->error++;
  257|      0|            return 0;
  258|      0|        }
  259|      9|        lh->b = n;
  260|      9|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  261|      9|        lh->pmax = nni;
  262|      9|        lh->num_alloc_nodes = j;
  263|      9|        lh->p = 0;
  264|    858|    } else {
  265|    858|        lh->p++;
  266|    858|    }
  267|       |
  268|    867|    lh->num_nodes++;
  269|    867|    n1 = &(lh->b[p]);
  270|    867|    n2 = &(lh->b[p + pmax]);
  271|    867|    *n2 = NULL;
  272|       |
  273|  3.93k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (273:20): [True: 3.06k, False: 867]
  ------------------
  274|  3.06k|        hash = np->hash;
  275|  3.06k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (275:13): [True: 551, False: 2.51k]
  ------------------
  276|    551|            *n1 = (*n1)->next;
  277|    551|            np->next = *n2;
  278|    551|            *n2 = np;
  279|    551|        } else
  280|  2.51k|            n1 = &((*n1)->next);
  281|  3.06k|        np = *n1;
  282|  3.06k|    }
  283|       |
  284|    867|    return 1;
  285|    867|}
lhash.c:contract:
  288|      1|{
  289|      1|    OPENSSL_LH_NODE **n, *n1, *np;
  290|       |
  291|      1|    np = lh->b[lh->p + lh->pmax - 1];
  292|      1|    lh->b[lh->p + lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */
  293|      1|    if (lh->p == 0) {
  ------------------
  |  Branch (293:9): [True: 0, False: 1]
  ------------------
  294|      0|        n = OPENSSL_realloc(lh->b,
  ------------------
  |  |  109|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  295|      0|                            (unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax));
  296|      0|        if (n == NULL) {
  ------------------
  |  Branch (296:13): [True: 0, False: 0]
  ------------------
  297|       |            /* fputs("realloc error in lhash", stderr); */
  298|      0|            lh->error++;
  299|      0|        } else {
  300|      0|            lh->b = n;
  301|      0|        }
  302|      0|        lh->num_alloc_nodes /= 2;
  303|      0|        lh->pmax /= 2;
  304|      0|        lh->p = lh->pmax - 1;
  305|      0|    } else
  306|      1|        lh->p--;
  307|       |
  308|      1|    lh->num_nodes--;
  309|       |
  310|      1|    n1 = lh->b[(int)lh->p];
  311|      1|    if (n1 == NULL)
  ------------------
  |  Branch (311:9): [True: 1, False: 0]
  ------------------
  312|      1|        lh->b[(int)lh->p] = np;
  313|      0|    else {
  314|      0|        while (n1->next != NULL)
  ------------------
  |  Branch (314:16): [True: 0, False: 0]
  ------------------
  315|      0|            n1 = n1->next;
  316|      0|        n1->next = np;
  317|      0|    }
  318|      1|}
lhash.c:getrn:
  322|  7.36k|{
  323|  7.36k|    OPENSSL_LH_NODE **ret, *n1;
  324|  7.36k|    unsigned long hash, nn;
  325|       |
  326|  7.36k|    if (lh->hashw != NULL)
  ------------------
  |  Branch (326:9): [True: 7.36k, False: 0]
  ------------------
  327|  7.36k|        hash = lh->hashw(data, lh->hash);
  328|      0|    else
  329|      0|        hash = lh->hash(data);
  330|       |
  331|  7.36k|    *rhash = hash;
  332|       |
  333|  7.36k|    nn = hash % lh->pmax;
  334|  7.36k|    if (nn < lh->p)
  ------------------
  |  Branch (334:9): [True: 3.03k, False: 4.33k]
  ------------------
  335|  3.03k|        nn = hash % lh->num_alloc_nodes;
  336|       |
  337|  7.36k|    ret = &(lh->b[(int)nn]);
  338|  15.9k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (338:21): [True: 13.8k, False: 2.04k]
  ------------------
  339|  13.8k|        if (n1->hash != hash) {
  ------------------
  |  Branch (339:13): [True: 8.39k, False: 5.48k]
  ------------------
  340|  8.39k|            ret = &(n1->next);
  341|  8.39k|            continue;
  342|  8.39k|        }
  343|       |
  344|  5.48k|        if (lh->compw != NULL) {
  ------------------
  |  Branch (344:13): [True: 5.48k, False: 0]
  ------------------
  345|  5.48k|            if (lh->compw(n1->data, data, lh->comp) == 0)
  ------------------
  |  Branch (345:17): [True: 5.32k, False: 158]
  ------------------
  346|  5.32k|                break;
  347|  5.48k|        } else {
  348|      0|            if (lh->comp(n1->data, data) == 0)
  ------------------
  |  Branch (348:17): [True: 0, False: 0]
  ------------------
  349|      0|                break;
  350|      0|        }
  351|    158|        ret = &(n1->next);
  352|    158|    }
  353|  7.36k|    return ret;
  354|  7.36k|}

CRYPTO_malloc:
  187|  11.5k|{
  188|  11.5k|    void *ptr;
  189|       |
  190|  11.5k|    INCREMENT(malloc_count);
  191|  11.5k|    if (malloc_impl != CRYPTO_malloc) {
  ------------------
  |  Branch (191:9): [True: 0, False: 11.5k]
  ------------------
  192|      0|        ptr = malloc_impl(num, file, line);
  193|      0|        if (ptr != NULL || num == 0)
  ------------------
  |  Branch (193:13): [True: 0, False: 0]
  |  Branch (193:28): [True: 0, False: 0]
  ------------------
  194|      0|            return ptr;
  195|      0|        goto err;
  196|      0|    }
  197|       |
  198|  11.5k|    if (num == 0)
  ------------------
  |  Branch (198:9): [True: 0, False: 11.5k]
  ------------------
  199|      0|        return NULL;
  200|       |
  201|  11.5k|    FAILTEST();
  202|  11.5k|    if (allow_customize) {
  ------------------
  |  Branch (202:9): [True: 1, False: 11.5k]
  ------------------
  203|       |        /*
  204|       |         * Disallow customization after the first allocation. We only set this
  205|       |         * if necessary to avoid a store to the same cache line on every
  206|       |         * allocation.
  207|       |         */
  208|      1|        allow_customize = 0;
  209|      1|    }
  210|       |
  211|  11.5k|    ptr = malloc(num);
  212|  11.5k|    if (ptr != NULL)
  ------------------
  |  Branch (212:9): [True: 11.5k, False: 0]
  ------------------
  213|  11.5k|        return ptr;
  214|      0| err:
  215|       |    /*
  216|       |     * ossl_err_get_state_int() in err.c uses CRYPTO_zalloc(num, NULL, 0) for
  217|       |     * ERR_STATE allocation. Prevent mem alloc error loop while reporting error.
  218|       |     */
  219|      0|    if (file != NULL || line != 0) {
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  |  Branch (219:25): [True: 0, False: 0]
  ------------------
  220|      0|        ERR_new();
  221|      0|        ERR_set_debug(file, line, NULL);
  222|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  223|      0|    }
  224|      0|    return NULL;
  225|  11.5k|}
CRYPTO_zalloc:
  228|  4.55k|{
  229|  4.55k|    void *ret;
  230|       |
  231|  4.55k|    ret = CRYPTO_malloc(num, file, line);
  232|  4.55k|    if (ret != NULL)
  ------------------
  |  Branch (232:9): [True: 4.55k, False: 0]
  ------------------
  233|  4.55k|        memset(ret, 0, num);
  234|       |
  235|  4.55k|    return ret;
  236|  4.55k|}
CRYPTO_aligned_alloc:
  240|      2|{
  241|      2|    void *ret;
  242|       |
  243|      2|    *freeptr = NULL;
  244|       |
  245|       |#if defined(OPENSSL_SMALL_FOOTPRINT)
  246|       |    ret = freeptr = NULL;
  247|       |    return ret;
  248|       |#endif
  249|       |
  250|       |    /* Allow non-malloc() allocations as long as no malloc_impl is provided. */
  251|      2|    if (malloc_impl == CRYPTO_malloc) {
  ------------------
  |  Branch (251:9): [True: 2, False: 0]
  ------------------
  252|      2|#if defined(_BSD_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
  253|      2|        if (posix_memalign(&ret, alignment, num))
  ------------------
  |  Branch (253:13): [True: 0, False: 2]
  ------------------
  254|      0|            return NULL;
  255|      2|        *freeptr = ret;
  256|      2|        return ret;
  257|       |#elif defined(_ISOC11_SOURCE)
  258|       |        ret = *freeptr = aligned_alloc(alignment, num);
  259|       |        return ret;
  260|       |#endif
  261|      2|    }
  262|       |
  263|       |    /* we have to do this the hard way */
  264|       |
  265|       |    /*
  266|       |     * Note: Windows supports an _aligned_malloc call, but we choose
  267|       |     * not to use it here, because allocations from that function
  268|       |     * require that they be freed via _aligned_free.  Given that
  269|       |     * we can't differentiate plain malloc blocks from blocks obtained
  270|       |     * via _aligned_malloc, just avoid its use entirely
  271|       |     */
  272|       |
  273|       |    /*
  274|       |     * Step 1: Allocate an amount of memory that is <alignment>
  275|       |     * bytes bigger than requested
  276|       |     */
  277|      0|    *freeptr = CRYPTO_malloc(num + alignment, file, line);
  278|      0|    if (*freeptr == NULL)
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|        return NULL;
  280|       |
  281|       |    /*
  282|       |     * Step 2: Add <alignment - 1> bytes to the pointer
  283|       |     * This will cross the alignment boundary that is
  284|       |     * requested
  285|       |     */
  286|      0|    ret = (void *)((char *)*freeptr + (alignment - 1));
  287|       |
  288|       |    /*
  289|       |     * Step 3: Use the alignment as a mask to translate the
  290|       |     * least significant bits of the allocation at the alignment
  291|       |     * boundary to 0.  ret now holds a pointer to the memory
  292|       |     * buffer at the requested alignment
  293|       |     * NOTE: It is a documented requirement that alignment be a
  294|       |     * power of 2, which is what allows this to work
  295|       |     */
  296|      0|    ret = (void *)((uintptr_t)ret & (uintptr_t)(~(alignment - 1)));
  297|      0|    return ret;
  298|      0|}
CRYPTO_realloc:
  301|    112|{
  302|    112|    INCREMENT(realloc_count);
  303|    112|    if (realloc_impl != CRYPTO_realloc)
  ------------------
  |  Branch (303:9): [True: 0, False: 112]
  ------------------
  304|      0|        return realloc_impl(str, num, file, line);
  305|       |
  306|    112|    if (str == NULL)
  ------------------
  |  Branch (306:9): [True: 16, False: 96]
  ------------------
  307|     16|        return CRYPTO_malloc(num, file, line);
  308|       |
  309|     96|    if (num == 0) {
  ------------------
  |  Branch (309:9): [True: 0, False: 96]
  ------------------
  310|      0|        CRYPTO_free(str, file, line);
  311|      0|        return NULL;
  312|      0|    }
  313|       |
  314|     96|    FAILTEST();
  315|     96|    return realloc(str, num);
  316|     96|}
CRYPTO_free:
  346|  16.5k|{
  347|  16.5k|    INCREMENT(free_count);
  348|  16.5k|    if (free_impl != CRYPTO_free) {
  ------------------
  |  Branch (348:9): [True: 0, False: 16.5k]
  ------------------
  349|      0|        free_impl(str, file, line);
  350|      0|        return;
  351|      0|    }
  352|       |
  353|  16.5k|    free(str);
  354|  16.5k|}
CRYPTO_clear_free:
  357|    903|{
  358|    903|    if (str == NULL)
  ------------------
  |  Branch (358:9): [True: 0, False: 903]
  ------------------
  359|      0|        return;
  360|    903|    if (num)
  ------------------
  |  Branch (360:9): [True: 903, False: 0]
  ------------------
  361|    903|        OPENSSL_cleanse(str, num);
  362|    903|    CRYPTO_free(str, file, line);
  363|    903|}

CRYPTO_secure_malloc_done:
  132|      1|{
  133|      1|#ifndef OPENSSL_NO_SECURE_MEMORY
  134|      1|    if (secure_mem_used == 0) {
  ------------------
  |  Branch (134:9): [True: 1, False: 0]
  ------------------
  135|      1|        sh_done();
  136|      1|        secure_mem_initialized = 0;
  137|      1|        CRYPTO_THREAD_lock_free(sec_malloc_lock);
  138|      1|        sec_malloc_lock = NULL;
  139|      1|        return 1;
  140|      1|    }
  141|      0|#endif /* OPENSSL_NO_SECURE_MEMORY */
  142|      0|    return 0;
  143|      1|}
CRYPTO_secure_malloc:
  155|      4|{
  156|      4|#ifndef OPENSSL_NO_SECURE_MEMORY
  157|      4|    void *ret = NULL;
  158|      4|    size_t actual_size;
  159|      4|    int reason = CRYPTO_R_SECURE_MALLOC_FAILURE;
  ------------------
  |  |   47|      4|# define CRYPTO_R_SECURE_MALLOC_FAILURE                   111
  ------------------
  160|       |
  161|      4|    if (!secure_mem_initialized) {
  ------------------
  |  Branch (161:9): [True: 4, False: 0]
  ------------------
  162|      4|        return CRYPTO_malloc(num, file, line);
  163|      4|    }
  164|      0|    if (!CRYPTO_THREAD_write_lock(sec_malloc_lock)) {
  ------------------
  |  Branch (164:9): [True: 0, False: 0]
  ------------------
  165|      0|        reason = ERR_R_CRYPTO_LIB;
  ------------------
  |  |  327|      0|# define ERR_R_CRYPTO_LIB       (ERR_LIB_CRYPTO/* 15 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  |  |  ------------------
  |  |               # define ERR_R_CRYPTO_LIB       (ERR_LIB_CRYPTO/* 15 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  166|      0|        goto err;
  167|      0|    }
  168|      0|    ret = sh_malloc(num);
  169|      0|    actual_size = ret ? sh_actual_size(ret) : 0;
  ------------------
  |  Branch (169:19): [True: 0, False: 0]
  ------------------
  170|      0|    secure_mem_used += actual_size;
  171|      0|    CRYPTO_THREAD_unlock(sec_malloc_lock);
  172|      0| err:
  173|      0|    if (ret == NULL && (file != NULL || line != 0)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 0]
  |  Branch (173:25): [True: 0, False: 0]
  |  Branch (173:41): [True: 0, False: 0]
  ------------------
  174|      0|        ERR_new();
  175|      0|        ERR_set_debug(file, line, NULL);
  176|      0|        ERR_set_error(ERR_LIB_CRYPTO, reason, NULL);
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
  177|      0|    }
  178|      0|    return ret;
  179|       |#else
  180|       |    return CRYPTO_malloc(num, file, line);
  181|       |#endif /* OPENSSL_NO_SECURE_MEMORY */
  182|      0|}
CRYPTO_secure_zalloc:
  185|     10|{
  186|     10|#ifndef OPENSSL_NO_SECURE_MEMORY
  187|     10|    if (secure_mem_initialized)
  ------------------
  |  Branch (187:9): [True: 0, False: 10]
  ------------------
  188|       |        /* CRYPTO_secure_malloc() zeroes allocations when it is implemented */
  189|      0|        return CRYPTO_secure_malloc(num, file, line);
  190|     10|#endif
  191|     10|    return CRYPTO_zalloc(num, file, line);
  192|     10|}
CRYPTO_secure_clear_free:
  219|     21|{
  220|     21|#ifndef OPENSSL_NO_SECURE_MEMORY
  221|     21|    size_t actual_size;
  222|       |
  223|     21|    if (ptr == NULL)
  ------------------
  |  Branch (223:9): [True: 7, False: 14]
  ------------------
  224|      7|        return;
  225|     14|    if (!CRYPTO_secure_allocated(ptr)) {
  ------------------
  |  Branch (225:9): [True: 14, False: 0]
  ------------------
  226|     14|        OPENSSL_cleanse(ptr, num);
  227|     14|        CRYPTO_free(ptr, file, line);
  228|     14|        return;
  229|     14|    }
  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|     41|{
  247|     41|#ifndef OPENSSL_NO_SECURE_MEMORY
  248|     41|    if (!secure_mem_initialized)
  ------------------
  |  Branch (248:9): [True: 41, False: 0]
  ------------------
  249|     41|        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|     41|}
mem_sec.c:sh_done:
  599|      1|{
  600|      1|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  601|      1|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  602|      1|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  603|      1|#if !defined(_WIN32)
  604|      1|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (604:9): [True: 1, False: 0]
  |  Branch (604:40): [True: 0, False: 1]
  ------------------
  605|      0|        munmap(sh.map_result, sh.map_size);
  606|       |#else
  607|       |    if (sh.map_result != NULL && sh.map_size)
  608|       |        VirtualFree(sh.map_result, 0, MEM_RELEASE);
  609|       |#endif
  610|      1|    memset(&sh, 0, sizeof(sh));
  611|      1|}

ossl_ml_kem_key_reset:
 1544|    284|{
 1545|    284|    if (key->t == NULL)
  ------------------
  |  Branch (1545:9): [True: 78, False: 206]
  ------------------
 1546|     78|        return;
 1547|       |    /*-
 1548|       |     * Cleanse any sensitive data:
 1549|       |     * - The private vector |s| is immediately followed by the FO failure
 1550|       |     *   secret |z|, and seed |d|, we can cleanse all three in one call.
 1551|       |     *
 1552|       |     * - Otherwise, when key->d is set, cleanse the stashed seed.
 1553|       |     */
 1554|    206|    if (ossl_ml_kem_have_prvkey(key))
  ------------------
  |  |  204|    206|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  |  |  ------------------
  |  |  |  Branch (204:41): [True: 185, False: 21]
  |  |  ------------------
  ------------------
 1555|    185|        OPENSSL_cleanse(key->s,
 1556|    185|                        key->vinfo->rank * sizeof(scalar) + 2 * ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    185|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1557|    206|    OPENSSL_free(key->t);
  ------------------
  |  |  115|    206|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1558|    206|    key->d = key->z = (uint8_t *)(key->s = key->m = key->t = NULL);
 1559|    206|}
ossl_ml_kem_get_vinfo:
 1570|    244|{
 1571|    244|    switch (evp_type) {
  ------------------
  |  Branch (1571:13): [True: 0, False: 244]
  ------------------
 1572|    101|    case EVP_PKEY_ML_KEM_512:
  ------------------
  |  |   93|    101|# define EVP_PKEY_ML_KEM_512            NID_ML_KEM_512
  |  |  ------------------
  |  |  |  | 6613|    101|#define NID_ML_KEM_512          1454
  |  |  ------------------
  ------------------
  |  Branch (1572:5): [True: 101, False: 143]
  ------------------
 1573|    101|        return &vinfo_map[ML_KEM_512_VINFO];
  ------------------
  |  |  173|    101|#define ML_KEM_512_VINFO    0
  ------------------
 1574|     49|    case EVP_PKEY_ML_KEM_768:
  ------------------
  |  |  103|     49|# define EVP_PKEY_ML_KEM_768            NID_ML_KEM_768
  |  |  ------------------
  |  |  |  | 6618|     49|#define NID_ML_KEM_768          1455
  |  |  ------------------
  ------------------
  |  Branch (1574:5): [True: 49, False: 195]
  ------------------
 1575|     49|        return &vinfo_map[ML_KEM_768_VINFO];
  ------------------
  |  |  174|     49|#define ML_KEM_768_VINFO    1
  ------------------
 1576|     94|    case EVP_PKEY_ML_KEM_1024:
  ------------------
  |  |  113|     94|# define EVP_PKEY_ML_KEM_1024           NID_ML_KEM_1024
  |  |  ------------------
  |  |  |  | 6623|     94|#define NID_ML_KEM_1024         1456
  |  |  ------------------
  ------------------
  |  Branch (1576:5): [True: 94, False: 150]
  ------------------
 1577|     94|        return &vinfo_map[ML_KEM_1024_VINFO];
  ------------------
  |  |  175|     94|#define ML_KEM_1024_VINFO   2
  ------------------
 1578|    244|    }
 1579|      0|    return NULL;
 1580|    244|}
ossl_ml_kem_key_new:
 1584|    244|{
 1585|    244|    const ML_KEM_VINFO *vinfo = ossl_ml_kem_get_vinfo(evp_type);
 1586|    244|    ML_KEM_KEY *key;
 1587|       |
 1588|    244|    if (vinfo == NULL)
  ------------------
  |  Branch (1588:9): [True: 0, False: 244]
  ------------------
 1589|      0|        return NULL;
 1590|       |
 1591|    244|    if ((key = OPENSSL_malloc(sizeof(*key))) == NULL)
  ------------------
  |  |  102|    244|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (1591:9): [True: 0, False: 244]
  ------------------
 1592|      0|        return NULL;
 1593|       |
 1594|    244|    key->vinfo = vinfo;
 1595|    244|    key->libctx = libctx;
 1596|    244|    key->prov_flags = ML_KEM_KEY_PROV_FLAGS_DEFAULT;
  ------------------
  |  |  132|    244|    (ML_KEM_KEY_RANDOM_PCT | ML_KEM_KEY_PREFER_SEED | ML_KEM_KEY_RETAIN_SEED)
  |  |  ------------------
  |  |  |  |  123|    244|# define ML_KEM_KEY_RANDOM_PCT  (1 << 0)
  |  |  ------------------
  |  |                   (ML_KEM_KEY_RANDOM_PCT | ML_KEM_KEY_PREFER_SEED | ML_KEM_KEY_RETAIN_SEED)
  |  |  ------------------
  |  |  |  |  125|    244|# define ML_KEM_KEY_PREFER_SEED (1 << 2)
  |  |  ------------------
  |  |                   (ML_KEM_KEY_RANDOM_PCT | ML_KEM_KEY_PREFER_SEED | ML_KEM_KEY_RETAIN_SEED)
  |  |  ------------------
  |  |  |  |  126|    244|# define ML_KEM_KEY_RETAIN_SEED (1 << 3)
  |  |  ------------------
  ------------------
 1597|    244|    key->shake128_md = EVP_MD_fetch(libctx, "SHAKE128", properties);
 1598|    244|    key->shake256_md = EVP_MD_fetch(libctx, "SHAKE256", properties);
 1599|    244|    key->sha3_256_md = EVP_MD_fetch(libctx, "SHA3-256", properties);
 1600|    244|    key->sha3_512_md = EVP_MD_fetch(libctx, "SHA3-512", properties);
 1601|    244|    key->d = key->z = key->rho = key->pkhash = key->encoded_dk = NULL;
 1602|    244|    key->s = key->m = key->t = NULL;
 1603|       |
 1604|    244|    if (key->shake128_md != NULL
  ------------------
  |  Branch (1604:9): [True: 244, False: 0]
  ------------------
 1605|    244|        && key->shake256_md != NULL
  ------------------
  |  Branch (1605:12): [True: 244, False: 0]
  ------------------
 1606|    244|        && key->sha3_256_md != NULL
  ------------------
  |  Branch (1606:12): [True: 244, False: 0]
  ------------------
 1607|    244|        && key->sha3_512_md != NULL)
  ------------------
  |  Branch (1607:12): [True: 244, False: 0]
  ------------------
 1608|    244|    return key;
 1609|       |
 1610|      0|    ossl_ml_kem_key_free(key);
 1611|      0|    return NULL;
 1612|    244|}
ossl_ml_kem_key_free:
 1669|    244|{
 1670|    244|    if (key == NULL)
  ------------------
  |  Branch (1670:9): [True: 0, False: 244]
  ------------------
 1671|      0|        return;
 1672|       |
 1673|    244|    EVP_MD_free(key->shake128_md);
 1674|    244|    EVP_MD_free(key->shake256_md);
 1675|    244|    EVP_MD_free(key->sha3_256_md);
 1676|    244|    EVP_MD_free(key->sha3_512_md);
 1677|       |
 1678|    244|    if (ossl_ml_kem_decoded_key(key)) {
  ------------------
  |  |  207|    244|# define ossl_ml_kem_decoded_key(key)   ((key)->encoded_dk != NULL \
  |  |  ------------------
  |  |  |  Branch (207:42): [True: 0, False: 244]
  |  |  ------------------
  |  |  208|    244|                                         || ((key)->s == NULL && (key)->d != NULL))
  |  |  ------------------
  |  |  |  Branch (208:46): [True: 78, False: 166]
  |  |  |  Branch (208:66): [True: 0, False: 78]
  |  |  ------------------
  ------------------
 1679|      0|        OPENSSL_cleanse(key->seedbuf, sizeof(key->seedbuf));
 1680|      0|        if (ossl_ml_kem_have_dkenc(key)) {
  ------------------
  |  |  206|      0|# define ossl_ml_kem_have_dkenc(key)    ((key)->encoded_dk != NULL)
  |  |  ------------------
  |  |  |  Branch (206:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1681|      0|            OPENSSL_cleanse(key->encoded_dk, key->vinfo->prvkey_bytes);
 1682|      0|            OPENSSL_free(key->encoded_dk);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1683|      0|        }
 1684|      0|    }
 1685|    244|    ossl_ml_kem_key_reset(key);
 1686|    244|    OPENSSL_free(key);
  ------------------
  |  |  115|    244|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    244|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    244|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1687|    244|}
ossl_ml_kem_encode_public_key:
 1692|      3|{
 1693|      3|    if (!ossl_ml_kem_have_pubkey(key)
  ------------------
  |  |  203|      6|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  |  Branch (1693:9): [True: 0, False: 3]
  ------------------
 1694|      3|        || len != key->vinfo->pubkey_bytes)
  ------------------
  |  Branch (1694:12): [True: 0, False: 3]
  ------------------
 1695|      0|        return 0;
 1696|      3|    encode_pubkey(out, key);
 1697|      3|    return 1;
 1698|      3|}
ossl_ml_kem_encode_private_key:
 1703|      3|{
 1704|      3|    if (!ossl_ml_kem_have_prvkey(key)
  ------------------
  |  |  204|      6|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  ------------------
  |  Branch (1704:9): [True: 0, False: 3]
  ------------------
 1705|      3|        || len != key->vinfo->prvkey_bytes)
  ------------------
  |  Branch (1705:12): [True: 0, False: 3]
  ------------------
 1706|      0|        return 0;
 1707|      3|    encode_prvkey(out, key);
 1708|      3|    return 1;
 1709|      3|}
ossl_ml_kem_encode_seed:
 1713|      3|{
 1714|      3|    if (key == NULL || key->d == NULL || len != ML_KEM_SEED_BYTES)
  ------------------
  |  |   48|      3|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  |  Branch (1714:9): [True: 0, False: 3]
  |  Branch (1714:24): [True: 0, False: 3]
  |  Branch (1714:42): [True: 0, False: 3]
  ------------------
 1715|      0|        return 0;
 1716|       |    /*
 1717|       |     * Both in the seed buffer, and in the allocated storage, the |d| component
 1718|       |     * of the seed is stored last, so we must copy each separately.
 1719|       |     */
 1720|      3|    memcpy(out, key->d, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1721|      3|    out += ML_KEM_RANDOM_BYTES;
  ------------------
  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1722|      3|    memcpy(out, key->z, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1723|      3|    return 1;
 1724|      3|}
ossl_ml_kem_parse_public_key:
 1752|     21|{
 1753|     21|    EVP_MD_CTX *mdctx = NULL;
 1754|     21|    const ML_KEM_VINFO *vinfo;
 1755|     21|    int ret = 0;
 1756|       |
 1757|       |    /* Keys with key material are immutable */
 1758|     21|    if (key == NULL
  ------------------
  |  Branch (1758:9): [True: 0, False: 21]
  ------------------
 1759|     21|        || ossl_ml_kem_have_pubkey(key)
  ------------------
  |  |  203|     42|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 0, False: 21]
  |  |  ------------------
  ------------------
 1760|     21|        || ossl_ml_kem_have_dkenc(key))
  ------------------
  |  |  206|     21|# define ossl_ml_kem_have_dkenc(key)    ((key)->encoded_dk != NULL)
  |  |  ------------------
  |  |  |  Branch (206:41): [True: 0, False: 21]
  |  |  ------------------
  ------------------
 1761|      0|        return 0;
 1762|     21|    vinfo = key->vinfo;
 1763|       |
 1764|     21|    if (len != vinfo->pubkey_bytes
  ------------------
  |  Branch (1764:9): [True: 0, False: 21]
  ------------------
 1765|     21|        || (mdctx = EVP_MD_CTX_new()) == NULL)
  ------------------
  |  Branch (1765:12): [True: 0, False: 21]
  ------------------
 1766|      0|        return 0;
 1767|       |
 1768|     21|    if (add_storage(OPENSSL_malloc(vinfo->puballoc), 0, key))
  ------------------
  |  |  102|     21|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     21|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     21|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (1768:9): [True: 21, False: 0]
  ------------------
 1769|     21|        ret = parse_pubkey(in, mdctx, key);
 1770|       |
 1771|     21|    if (!ret)
  ------------------
  |  Branch (1771:9): [True: 21, False: 0]
  ------------------
 1772|     21|        ossl_ml_kem_key_reset(key);
 1773|     21|    EVP_MD_CTX_free(mdctx);
 1774|     21|    return ret;
 1775|     21|}
ossl_ml_kem_parse_private_key:
 1780|     19|{
 1781|     19|    EVP_MD_CTX *mdctx = NULL;
 1782|     19|    const ML_KEM_VINFO *vinfo;
 1783|     19|    int ret = 0;
 1784|       |
 1785|       |    /* Keys with key material are immutable */
 1786|     19|    if (key == NULL
  ------------------
  |  Branch (1786:9): [True: 0, False: 19]
  ------------------
 1787|     19|        || ossl_ml_kem_have_pubkey(key)
  ------------------
  |  |  203|     38|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 0, False: 19]
  |  |  ------------------
  ------------------
 1788|     19|        || ossl_ml_kem_have_dkenc(key))
  ------------------
  |  |  206|     19|# define ossl_ml_kem_have_dkenc(key)    ((key)->encoded_dk != NULL)
  |  |  ------------------
  |  |  |  Branch (206:41): [True: 0, False: 19]
  |  |  ------------------
  ------------------
 1789|      0|        return 0;
 1790|     19|    vinfo = key->vinfo;
 1791|       |
 1792|     19|    if (len != vinfo->prvkey_bytes
  ------------------
  |  Branch (1792:9): [True: 0, False: 19]
  ------------------
 1793|     19|        || (mdctx = EVP_MD_CTX_new()) == NULL)
  ------------------
  |  Branch (1793:12): [True: 0, False: 19]
  ------------------
 1794|      0|        return 0;
 1795|       |
 1796|     19|    if (add_storage(OPENSSL_malloc(vinfo->prvalloc), 1, key))
  ------------------
  |  |  102|     19|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     19|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     19|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (1796:9): [True: 19, False: 0]
  ------------------
 1797|     19|        ret = parse_prvkey(in, mdctx, key);
 1798|       |
 1799|     19|    if (!ret)
  ------------------
  |  Branch (1799:9): [True: 19, False: 0]
  ------------------
 1800|     19|        ossl_ml_kem_key_reset(key);
 1801|     19|    EVP_MD_CTX_free(mdctx);
 1802|     19|    return ret;
 1803|     19|}
ossl_ml_kem_genkey:
 1810|    166|{
 1811|    166|    uint8_t seed[ML_KEM_SEED_BYTES];
 1812|    166|    EVP_MD_CTX *mdctx = NULL;
 1813|    166|    const ML_KEM_VINFO *vinfo;
 1814|    166|    int ret = 0;
 1815|       |
 1816|    166|    if (key == NULL
  ------------------
  |  Branch (1816:9): [True: 0, False: 166]
  ------------------
 1817|    166|        || ossl_ml_kem_have_pubkey(key)
  ------------------
  |  |  203|    332|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 0, False: 166]
  |  |  ------------------
  ------------------
 1818|    166|        || ossl_ml_kem_have_dkenc(key))
  ------------------
  |  |  206|    166|# define ossl_ml_kem_have_dkenc(key)    ((key)->encoded_dk != NULL)
  |  |  ------------------
  |  |  |  Branch (206:41): [True: 0, False: 166]
  |  |  ------------------
  ------------------
 1819|      0|        return 0;
 1820|    166|    vinfo = key->vinfo;
 1821|       |
 1822|    166|    if (pubenc != NULL && publen != vinfo->pubkey_bytes)
  ------------------
  |  Branch (1822:9): [True: 0, False: 166]
  |  Branch (1822:27): [True: 0, False: 0]
  ------------------
 1823|      0|        return 0;
 1824|       |
 1825|    166|    if (ossl_ml_kem_have_seed(key)) {
  ------------------
  |  |  205|    166|# define ossl_ml_kem_have_seed(key)     ((key)->d != NULL)
  |  |  ------------------
  |  |  |  Branch (205:41): [True: 0, False: 166]
  |  |  ------------------
  ------------------
 1826|      0|        if (!ossl_ml_kem_encode_seed(seed, sizeof(seed), key))
  ------------------
  |  Branch (1826:13): [True: 0, False: 0]
  ------------------
 1827|      0|            return 0;
 1828|      0|        key->d = key->z = NULL;
 1829|    166|    } else if (RAND_priv_bytes_ex(key->libctx, seed, sizeof(seed),
  ------------------
  |  Branch (1829:16): [True: 0, False: 166]
  ------------------
 1830|    166|                                  key->vinfo->secbits) <= 0) {
 1831|      0|        return 0;
 1832|      0|    }
 1833|       |
 1834|    166|    if ((mdctx = EVP_MD_CTX_new()) == NULL)
  ------------------
  |  Branch (1834:9): [True: 0, False: 166]
  ------------------
 1835|      0|        return 0;
 1836|       |
 1837|       |    /*
 1838|       |     * Data derived from (d, z) defaults secret, and to avoid side-channel
 1839|       |     * leaks should not influence control flow.
 1840|       |     */
 1841|    166|    CONSTTIME_SECRET(seed, ML_KEM_SEED_BYTES);
 1842|       |
 1843|    166|    if (add_storage(OPENSSL_malloc(vinfo->prvalloc), 1, key))
  ------------------
  |  |  102|    166|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (1843:9): [True: 166, False: 0]
  ------------------
 1844|    166|        ret = genkey(seed, mdctx, pubenc, key);
 1845|    166|    OPENSSL_cleanse(seed, sizeof(seed));
 1846|       |
 1847|       |    /* Declassify secret inputs and derived outputs before returning control */
 1848|    166|    CONSTTIME_DECLASSIFY(seed, ML_KEM_SEED_BYTES);
 1849|       |
 1850|    166|    EVP_MD_CTX_free(mdctx);
 1851|    166|    if (!ret) {
  ------------------
  |  Branch (1851:9): [True: 0, False: 166]
  ------------------
 1852|      0|        ossl_ml_kem_key_reset(key);
 1853|      0|        return 0;
 1854|      0|    }
 1855|       |
 1856|       |    /* The public components are already declassified */
 1857|    166|    CONSTTIME_DECLASSIFY(key->s, vinfo->rank * sizeof(scalar));
 1858|    166|    CONSTTIME_DECLASSIFY(key->z, 2 * ML_KEM_RANDOM_BYTES);
 1859|    166|    return 1;
 1860|    166|}
ossl_ml_kem_encap_seed:
 1870|     46|{
 1871|     46|    const ML_KEM_VINFO *vinfo;
 1872|     46|    EVP_MD_CTX *mdctx;
 1873|     46|    int ret = 0;
 1874|       |
 1875|     46|    if (key == NULL || !ossl_ml_kem_have_pubkey(key))
  ------------------
  |  |  203|     46|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  |  Branch (1875:9): [True: 0, False: 46]
  |  Branch (1875:24): [True: 0, False: 46]
  ------------------
 1876|      0|        return 0;
 1877|     46|    vinfo = key->vinfo;
 1878|       |
 1879|     46|    if (ctext == NULL || clen != vinfo->ctext_bytes
  ------------------
  |  Branch (1879:9): [True: 0, False: 46]
  |  Branch (1879:26): [True: 0, False: 46]
  ------------------
 1880|     46|        || shared_secret == NULL || slen != ML_KEM_SHARED_SECRET_BYTES
  ------------------
  |  |   51|     92|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  |  Branch (1880:12): [True: 0, False: 46]
  |  Branch (1880:37): [True: 0, False: 46]
  ------------------
 1881|     46|        || entropy == NULL || elen != ML_KEM_RANDOM_BYTES
  ------------------
  |  |   47|     92|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (1881:12): [True: 0, False: 46]
  |  Branch (1881:31): [True: 0, False: 46]
  ------------------
 1882|     46|        || (mdctx = EVP_MD_CTX_new()) == NULL)
  ------------------
  |  Branch (1882:12): [True: 0, False: 46]
  ------------------
 1883|      0|        return 0;
 1884|       |    /*
 1885|       |     * Data derived from the encap entropy defaults secret, and to avoid
 1886|       |     * side-channel leaks should not influence control flow.
 1887|       |     */
 1888|     46|    CONSTTIME_SECRET(entropy, elen);
 1889|       |
 1890|       |    /*-
 1891|       |     * This avoids the need to handle allocation failures for two (max 2KB
 1892|       |     * each) vectors, that are never retained on return from this function.
 1893|       |     * We stack-allocate these.
 1894|       |     */
 1895|     46|#   define case_encap_seed(bits)                                            \
 1896|     46|    case EVP_PKEY_ML_KEM_##bits:                                            \
 1897|     46|        {                                                                   \
 1898|     46|            scalar tmp[2 * ML_KEM_##bits##_RANK];                           \
 1899|     46|                                                                            \
 1900|     46|            ret = encap(ctext, shared_secret, entropy, tmp, mdctx, key);    \
 1901|     46|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                      \
 1902|     46|            break;                                                          \
 1903|     46|        }
 1904|     46|    switch (vinfo->evp_type) {
  ------------------
  |  Branch (1904:13): [True: 0, False: 46]
  ------------------
 1905|     27|    case_encap_seed(512);
  ------------------
  |  | 1896|     27|    case EVP_PKEY_ML_KEM_##bits:                                            \
  |  |  ------------------
  |  |  |  Branch (1896:5): [True: 27, False: 19]
  |  |  ------------------
  |  | 1897|     27|        {                                                                   \
  |  | 1898|     27|            scalar tmp[2 * ML_KEM_##bits##_RANK];                           \
  |  | 1899|     27|                                                                            \
  |  | 1900|     27|            ret = encap(ctext, shared_secret, entropy, tmp, mdctx, key);    \
  |  | 1901|     27|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                      \
  |  | 1902|     27|            break;                                                          \
  |  | 1903|     27|        }
  ------------------
 1906|     10|    case_encap_seed(768);
  ------------------
  |  | 1896|     10|    case EVP_PKEY_ML_KEM_##bits:                                            \
  |  |  ------------------
  |  |  |  Branch (1896:5): [True: 10, False: 36]
  |  |  ------------------
  |  | 1897|     10|        {                                                                   \
  |  | 1898|     10|            scalar tmp[2 * ML_KEM_##bits##_RANK];                           \
  |  | 1899|     10|                                                                            \
  |  | 1900|     10|            ret = encap(ctext, shared_secret, entropy, tmp, mdctx, key);    \
  |  | 1901|     10|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                      \
  |  | 1902|     10|            break;                                                          \
  |  | 1903|     10|        }
  ------------------
 1907|      9|    case_encap_seed(1024);
  ------------------
  |  | 1896|      9|    case EVP_PKEY_ML_KEM_##bits:                                            \
  |  |  ------------------
  |  |  |  Branch (1896:5): [True: 9, False: 37]
  |  |  ------------------
  |  | 1897|      9|        {                                                                   \
  |  | 1898|      9|            scalar tmp[2 * ML_KEM_##bits##_RANK];                           \
  |  | 1899|      9|                                                                            \
  |  | 1900|      9|            ret = encap(ctext, shared_secret, entropy, tmp, mdctx, key);    \
  |  | 1901|      9|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                      \
  |  | 1902|      9|            break;                                                          \
  |  | 1903|      9|        }
  ------------------
 1908|     46|    }
 1909|     46|#   undef case_encap_seed
 1910|       |
 1911|       |    /* Declassify secret inputs and derived outputs before returning control */
 1912|     46|    CONSTTIME_DECLASSIFY(entropy, elen);
 1913|     46|    CONSTTIME_DECLASSIFY(ctext, clen);
 1914|     46|    CONSTTIME_DECLASSIFY(shared_secret, slen);
 1915|       |
 1916|     46|    EVP_MD_CTX_free(mdctx);
 1917|     46|    return ret;
 1918|     46|}
ossl_ml_kem_encap_rand:
 1923|     46|{
 1924|     46|    uint8_t r[ML_KEM_RANDOM_BYTES];
 1925|       |
 1926|     46|    if (key == NULL)
  ------------------
  |  Branch (1926:9): [True: 0, False: 46]
  ------------------
 1927|      0|        return 0;
 1928|       |
 1929|     46|    if (RAND_bytes_ex(key->libctx, r, ML_KEM_RANDOM_BYTES,
  ------------------
  |  |   47|     46|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (1929:9): [True: 0, False: 46]
  ------------------
 1930|     46|                      key->vinfo->secbits) < 1)
 1931|      0|        return 0;
 1932|       |
 1933|     46|    return ossl_ml_kem_encap_seed(ctext, clen, shared_secret, slen,
 1934|     46|                                  r, sizeof(r), key);
 1935|     46|}
ossl_ml_kem_decap:
 1940|     46|{
 1941|     46|    const ML_KEM_VINFO *vinfo;
 1942|     46|    EVP_MD_CTX *mdctx;
 1943|     46|    int ret = 0;
 1944|       |#if defined(OPENSSL_CONSTANT_TIME_VALIDATION)
 1945|       |    int classify_bytes;
 1946|       |#endif
 1947|       |
 1948|       |    /* Need a private key here */
 1949|     46|    if (!ossl_ml_kem_have_prvkey(key))
  ------------------
  |  |  204|     46|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  ------------------
  |  Branch (1949:9): [True: 0, False: 46]
  ------------------
 1950|      0|        return 0;
 1951|     46|    vinfo = key->vinfo;
 1952|       |
 1953|     46|    if (shared_secret == NULL || slen != ML_KEM_SHARED_SECRET_BYTES
  ------------------
  |  |   51|     92|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  |  Branch (1953:9): [True: 0, False: 46]
  |  Branch (1953:34): [True: 0, False: 46]
  ------------------
 1954|     46|        || ctext == NULL || clen != vinfo->ctext_bytes
  ------------------
  |  Branch (1954:12): [True: 0, False: 46]
  |  Branch (1954:29): [True: 0, False: 46]
  ------------------
 1955|     46|        || (mdctx = EVP_MD_CTX_new()) == NULL) {
  ------------------
  |  Branch (1955:12): [True: 0, False: 46]
  ------------------
 1956|      0|        (void)RAND_bytes_ex(key->libctx, shared_secret,
 1957|      0|                            ML_KEM_SHARED_SECRET_BYTES, vinfo->secbits);
  ------------------
  |  |   51|      0|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1958|      0|        return 0;
 1959|      0|    }
 1960|       |#if defined(OPENSSL_CONSTANT_TIME_VALIDATION)
 1961|       |    /*
 1962|       |     * Data derived from |s| and |z| defaults secret, and to avoid side-channel
 1963|       |     * leaks should not influence control flow.
 1964|       |     */
 1965|       |    classify_bytes = 2 * sizeof(scalar) + ML_KEM_RANDOM_BYTES;
 1966|       |    CONSTTIME_SECRET(key->s, classify_bytes);
 1967|       |#endif
 1968|       |
 1969|       |    /*-
 1970|       |     * This avoids the need to handle allocation failures for two (max 2KB
 1971|       |     * each) vectors and an encoded ciphertext (max 1568 bytes), that are never
 1972|       |     * retained on return from this function.
 1973|       |     * We stack-allocate these.
 1974|       |     */
 1975|     46|#   define case_decap(bits)                                             \
 1976|     46|    case EVP_PKEY_ML_KEM_##bits:                                        \
 1977|     46|        {                                                               \
 1978|     46|            uint8_t cbuf[CTEXT_BYTES(bits)];                            \
 1979|     46|            scalar tmp[2 * ML_KEM_##bits##_RANK];                       \
 1980|     46|                                                                        \
 1981|     46|            ret = decap(shared_secret, ctext, cbuf, tmp, mdctx, key);   \
 1982|     46|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                  \
 1983|     46|            break;                                                      \
 1984|     46|        }
 1985|     46|    switch (vinfo->evp_type) {
  ------------------
  |  Branch (1985:13): [True: 0, False: 46]
  ------------------
 1986|     27|    case_decap(512);
  ------------------
  |  | 1976|     27|    case EVP_PKEY_ML_KEM_##bits:                                        \
  |  |  ------------------
  |  |  |  Branch (1976:5): [True: 27, False: 19]
  |  |  ------------------
  |  | 1977|     27|        {                                                               \
  |  | 1978|     27|            uint8_t cbuf[CTEXT_BYTES(bits)];                            \
  |  | 1979|     27|            scalar tmp[2 * ML_KEM_##bits##_RANK];                       \
  |  | 1980|     27|                                                                        \
  |  | 1981|     27|            ret = decap(shared_secret, ctext, cbuf, tmp, mdctx, key);   \
  |  | 1982|     27|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                  \
  |  | 1983|     27|            break;                                                      \
  |  | 1984|     27|        }
  ------------------
 1987|     10|    case_decap(768);
  ------------------
  |  | 1976|     10|    case EVP_PKEY_ML_KEM_##bits:                                        \
  |  |  ------------------
  |  |  |  Branch (1976:5): [True: 10, False: 36]
  |  |  ------------------
  |  | 1977|     10|        {                                                               \
  |  | 1978|     10|            uint8_t cbuf[CTEXT_BYTES(bits)];                            \
  |  | 1979|     10|            scalar tmp[2 * ML_KEM_##bits##_RANK];                       \
  |  | 1980|     10|                                                                        \
  |  | 1981|     10|            ret = decap(shared_secret, ctext, cbuf, tmp, mdctx, key);   \
  |  | 1982|     10|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                  \
  |  | 1983|     10|            break;                                                      \
  |  | 1984|     10|        }
  ------------------
 1988|      9|    case_decap(1024);
  ------------------
  |  | 1976|      9|    case EVP_PKEY_ML_KEM_##bits:                                        \
  |  |  ------------------
  |  |  |  Branch (1976:5): [True: 9, False: 37]
  |  |  ------------------
  |  | 1977|      9|        {                                                               \
  |  | 1978|      9|            uint8_t cbuf[CTEXT_BYTES(bits)];                            \
  |  | 1979|      9|            scalar tmp[2 * ML_KEM_##bits##_RANK];                       \
  |  | 1980|      9|                                                                        \
  |  | 1981|      9|            ret = decap(shared_secret, ctext, cbuf, tmp, mdctx, key);   \
  |  | 1982|      9|            OPENSSL_cleanse((void *)tmp, sizeof(tmp));                  \
  |  | 1983|      9|            break;                                                      \
  |  | 1984|      9|        }
  ------------------
 1989|     46|    }
 1990|       |
 1991|       |    /* Declassify secret inputs and derived outputs before returning control */
 1992|     46|    CONSTTIME_DECLASSIFY(key->s, classify_bytes);
 1993|     46|    CONSTTIME_DECLASSIFY(shared_secret, slen);
 1994|     46|    EVP_MD_CTX_free(mdctx);
 1995|       |
 1996|     46|    return ret;
 1997|     46|#   undef case_decap
 1998|     46|}
ossl_ml_kem_pubkey_cmp:
 2001|     16|{
 2002|       |    /*
 2003|       |     * This handles any unexpected differences in the ML-KEM variant rank,
 2004|       |     * giving different key component structures, barring SHA3-256 hash
 2005|       |     * collisions, the keys are the same size.
 2006|       |     */
 2007|     16|    if (ossl_ml_kem_have_pubkey(key1) && ossl_ml_kem_have_pubkey(key2))
  ------------------
  |  |  203|     32|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 16, False: 0]
  |  |  ------------------
  ------------------
                  if (ossl_ml_kem_have_pubkey(key1) && ossl_ml_kem_have_pubkey(key2))
  ------------------
  |  |  203|     16|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 16, False: 0]
  |  |  ------------------
  ------------------
 2008|     16|        return memcmp(key1->pkhash, key2->pkhash, ML_KEM_PKHASH_BYTES) == 0;
  ------------------
  |  |   50|     16|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 2009|       |
 2010|       |    /*
 2011|       |     * No match if just one of the public keys is not available, otherwise both
 2012|       |     * are unavailable, and for now such keys are considered equal.
 2013|       |     */
 2014|      0|    return (ossl_ml_kem_have_pubkey(key1) ^ ossl_ml_kem_have_pubkey(key2));
  ------------------
  |  |  203|      0|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
                  return (ossl_ml_kem_have_pubkey(key1) ^ ossl_ml_kem_have_pubkey(key2));
  ------------------
  |  |  203|      0|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
 2015|     16|}
ml_kem.c:add_storage:
 1508|    206|{
 1509|    206|    int rank = key->vinfo->rank;
 1510|       |
 1511|    206|    if (p == NULL)
  ------------------
  |  Branch (1511:9): [True: 0, False: 206]
  ------------------
 1512|      0|        return 0;
 1513|       |
 1514|       |    /*
 1515|       |     * We're adding key material, the seed buffer will now hold |rho| and
 1516|       |     * |pkhash|.
 1517|       |     */
 1518|    206|    memset(key->seedbuf, 0, sizeof(key->seedbuf));
 1519|    206|    key->rho = key->seedbuf;
 1520|    206|    key->pkhash = key->seedbuf + ML_KEM_RANDOM_BYTES;
  ------------------
  |  |   47|    206|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1521|    206|    key->d = key->z = NULL;
 1522|       |
 1523|       |    /* A public key needs space for |t| and |m| */
 1524|    206|    key->m = (key->t = p) + rank;
 1525|       |
 1526|       |    /*
 1527|       |     * A private key also needs space for |s| and |z|.
 1528|       |     * The |z| buffer always includes additional space for |d|, but a key's |d|
 1529|       |     * pointer is left NULL when parsed from the NIST format, which omits that
 1530|       |     * information.  Only keys generated from a (d, z) seed pair will have a
 1531|       |     * non-NULL |d| pointer.
 1532|       |     */
 1533|    206|    if (private)
  ------------------
  |  Branch (1533:9): [True: 185, False: 21]
  ------------------
 1534|    185|        key->z = (uint8_t *)(rank + (key->s = key->m + rank * rank));
 1535|    206|    return 1;
 1536|    206|}
ml_kem.c:encode_pubkey:
 1244|      6|{
 1245|      6|    const uint8_t *rho = key->rho;
 1246|      6|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1247|       |
 1248|      6|    vector_encode(out, key->t, 12, vinfo->rank);
 1249|      6|    memcpy(out + vinfo->vector_bytes, rho, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      6|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1250|      6|}
ml_kem.c:vector_encode:
  890|    101|{
  891|    101|    int stride = bits * DEGREE / 8;
  ------------------
  |  |   40|    101|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    101|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  892|       |
  893|    368|    for (; rank-- > 0; out += stride)
  ------------------
  |  Branch (893:12): [True: 267, False: 101]
  ------------------
  894|    267|        scalar_encode(out, a++, bits);
  895|    101|}
ml_kem.c:scalar_encode:
  641|    834|{
  642|    834|    const uint16_t *curr = s->c, *end = curr + DEGREE;
  ------------------
  |  |   40|    834|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    834|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  643|    834|    uint64_t accum = 0, element;
  644|    834|    int used = 0;
  645|       |
  646|   213k|    do {
  647|   213k|        element = *curr++;
  648|   213k|        if (used + bits < 64) {
  ------------------
  |  Branch (648:13): [True: 177k, False: 35.5k]
  ------------------
  649|   177k|            accum |= element << used;
  650|   177k|            used += bits;
  651|   177k|        } else if (used + bits > 64) {
  ------------------
  |  Branch (651:20): [True: 24.6k, False: 10.9k]
  ------------------
  652|  24.6k|            out = OPENSSL_store_u64_le(out, accum | (element << used));
  653|  24.6k|            accum = element >> (64 - used);
  654|  24.6k|            used = (used + bits) - 64;
  655|  24.6k|        } else {
  656|  10.9k|            out = OPENSSL_store_u64_le(out, accum | (element << used));
  657|  10.9k|            accum = 0;
  658|  10.9k|            used = 0;
  659|  10.9k|        }
  660|   213k|    } while (curr < end);
  ------------------
  |  Branch (660:14): [True: 212k, False: 834]
  ------------------
  661|    834|}
ml_kem.c:encode_prvkey:
 1259|      3|{
 1260|      3|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1261|       |
 1262|      3|    vector_encode(out, key->s, 12, vinfo->rank);
 1263|      3|    out += vinfo->vector_bytes;
 1264|      3|    encode_pubkey(out, key);
 1265|      3|    out += vinfo->pubkey_bytes;
 1266|      3|    memcpy(out, key->pkhash, ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   50|      3|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 1267|      3|    out += ML_KEM_PKHASH_BYTES;
  ------------------
  |  |   50|      3|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 1268|      3|    memcpy(out, key->z, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1269|      3|}
ml_kem.c:parse_pubkey:
 1280|     21|{
 1281|     21|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1282|       |
 1283|       |    /* Decode and check |t| */
 1284|     21|    if (!vector_decode_12(key->t, in, vinfo->rank))
  ------------------
  |  Branch (1284:9): [True: 21, False: 0]
  ------------------
 1285|     21|        return 0;
 1286|       |    /* Save the matrix |m| recovery seed |rho| */
 1287|      0|    memcpy(key->rho, in + vinfo->vector_bytes, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1288|       |    /*
 1289|       |     * Pre-compute the public key hash, needed for both encap and decap.
 1290|       |     * Also pre-compute the matrix expansion, stored with the public key.
 1291|       |     */
 1292|      0|    return hash_h(key->pkhash, in, vinfo->pubkey_bytes, mdctx, key)
  ------------------
  |  Branch (1292:12): [True: 0, False: 0]
  ------------------
 1293|      0|        && matrix_expand(mdctx, key);
  ------------------
  |  Branch (1293:12): [True: 0, False: 0]
  ------------------
 1294|     21|}
ml_kem.c:vector_decode_12:
  921|     40|{
  922|     40|    int stride = 3 * DEGREE / 2;
  ------------------
  |  |   40|     40|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|     40|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  923|       |
  924|     40|    for (; rank-- > 0; in += stride)
  ------------------
  |  Branch (924:12): [True: 40, False: 0]
  ------------------
  925|     40|        if (!scalar_decode_12(out++, in))
  ------------------
  |  Branch (925:13): [True: 40, False: 0]
  ------------------
  926|     40|            return 0;
  927|      0|    return 1;
  928|     40|}
ml_kem.c:scalar_decode_12:
  735|     40|{
  736|     40|    int i;
  737|     40|    uint16_t *c = out->c;
  738|       |
  739|    100|    for (i = 0; i < DEGREE / 2; ++i) {
  ------------------
  |  |   40|    100|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    100|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (739:17): [True: 100, False: 0]
  ------------------
  740|    100|        uint8_t b1 = *in++;
  741|    100|        uint8_t b2 = *in++;
  742|    100|        uint8_t b3 = *in++;
  743|    100|        int outOfRange1 = (*c++ = b1 | ((b2 & 0x0f) << 8)) >= kPrime;
  744|    100|        int outOfRange2 = (*c++ = (b2 >> 4) | (b3 << 4)) >= kPrime;
  745|       |
  746|    100|        if (outOfRange1 | outOfRange2)
  ------------------
  |  Branch (746:13): [True: 40, False: 60]
  ------------------
  747|     40|            return 0;
  748|    100|    }
  749|      0|    return 1;
  750|     40|}
ml_kem.c:single_keccak:
  334|  1.78k|{
  335|  1.78k|    unsigned int sz = (unsigned int) outlen;
  336|       |
  337|  1.78k|    if (!EVP_DigestUpdate(mdctx, in, inlen))
  ------------------
  |  Branch (337:9): [True: 0, False: 1.78k]
  ------------------
  338|      0|        return 0;
  339|  1.78k|    if (EVP_MD_xof(EVP_MD_CTX_get0_md(mdctx)))
  ------------------
  |  Branch (339:9): [True: 1.52k, False: 258]
  ------------------
  340|  1.52k|        return EVP_DigestFinalXOF(mdctx, out, outlen);
  341|    258|    return EVP_DigestFinal_ex(mdctx, out, &sz)
  ------------------
  |  Branch (341:12): [True: 258, False: 0]
  ------------------
  342|    258|        && ossl_assert((size_t) sz == outlen);
  ------------------
  |  |   52|    258|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:26): [True: 258, False: 0]
  |  |  ------------------
  |  |   53|    258|                                         __FILE__, __LINE__)
  ------------------
  343|  1.78k|}
ml_kem.c:matrix_expand:
  988|    166|{
  989|    166|    scalar *out = key->m;
  990|    166|    uint8_t input[ML_KEM_RANDOM_BYTES + 2];
  991|    166|    int rank = key->vinfo->rank;
  992|    166|    int i, j;
  993|       |
  994|    166|    memcpy(input, key->rho, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  995|    641|    for (i = 0; i < rank; i++) {
  ------------------
  |  Branch (995:17): [True: 475, False: 166]
  ------------------
  996|  1.95k|        for (j = 0; j < rank; j++) {
  ------------------
  |  Branch (996:21): [True: 1.47k, False: 475]
  ------------------
  997|  1.47k|            input[ML_KEM_RANDOM_BYTES] = i;
  ------------------
  |  |   47|  1.47k|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  998|  1.47k|            input[ML_KEM_RANDOM_BYTES + 1] = j;
  ------------------
  |  |   47|  1.47k|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  999|  1.47k|            if (!EVP_DigestInit_ex(mdctx, key->shake128_md, NULL)
  ------------------
  |  Branch (999:17): [True: 0, False: 1.47k]
  ------------------
 1000|  1.47k|                || !EVP_DigestUpdate(mdctx, input, sizeof(input))
  ------------------
  |  Branch (1000:20): [True: 0, False: 1.47k]
  ------------------
 1001|  1.47k|                || !sample_scalar(out++, mdctx))
  ------------------
  |  Branch (1001:20): [True: 0, False: 1.47k]
  ------------------
 1002|      0|                return 0;
 1003|  1.47k|        }
 1004|    475|    }
 1005|    166|    return 1;
 1006|    166|}
ml_kem.c:sample_scalar:
  434|  1.47k|{
  435|  1.47k|    uint16_t *curr = out->c, *endout = curr + DEGREE;
  ------------------
  |  |   40|  1.47k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  1.47k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  436|  1.47k|    uint8_t buf[SCALAR_SAMPLING_BUFSIZE], *in;
  437|  1.47k|    uint8_t *endin = buf + sizeof(buf);
  438|  1.47k|    uint16_t d;
  439|  1.47k|    uint8_t b1, b2, b3;
  440|       |
  441|  4.44k|    do {
  442|  4.44k|        if (!EVP_DigestSqueeze(mdctx, in = buf, sizeof(buf)))
  ------------------
  |  Branch (442:13): [True: 0, False: 4.44k]
  ------------------
  443|      0|            return 0;
  444|   233k|        do {
  445|   233k|            b1 = *in++;
  446|   233k|            b2 = *in++;
  447|   233k|            b3 = *in++;
  448|       |
  449|   233k|            if (curr >= endout)
  ------------------
  |  Branch (449:17): [True: 749, False: 232k]
  ------------------
  450|    749|                break;
  451|   232k|            if ((d = ((b2 & 0x0f) << 8) + b1) < kPrime)
  ------------------
  |  Branch (451:17): [True: 189k, False: 43.9k]
  ------------------
  452|   189k|                *curr++ = d;
  453|   232k|            if (curr >= endout)
  ------------------
  |  Branch (453:17): [True: 726, False: 232k]
  ------------------
  454|    726|                break;
  455|   232k|            if ((d = (b3 << 4) + (b2 >> 4)) < kPrime)
  ------------------
  |  Branch (455:17): [True: 189k, False: 43.1k]
  ------------------
  456|   189k|                *curr++ = d;
  457|   232k|        } while (in < endin);
  ------------------
  |  Branch (457:18): [True: 229k, False: 2.96k]
  ------------------
  458|  4.44k|    } while (curr < endout);
  ------------------
  |  Branch (458:14): [True: 2.96k, False: 1.47k]
  ------------------
  459|  1.47k|    return 1;
  460|  1.47k|}
ml_kem.c:parse_prvkey:
 1303|     19|{
 1304|     19|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1305|       |
 1306|       |    /* Decode and check |s|. */
 1307|     19|    if (!vector_decode_12(key->s, in, vinfo->rank))
  ------------------
  |  Branch (1307:9): [True: 19, False: 0]
  ------------------
 1308|     19|        return 0;
 1309|      0|    in += vinfo->vector_bytes;
 1310|       |
 1311|      0|    if (!parse_pubkey(in, mdctx, key))
  ------------------
  |  Branch (1311:9): [True: 0, False: 0]
  ------------------
 1312|      0|        return 0;
 1313|      0|    in += vinfo->pubkey_bytes;
 1314|       |
 1315|       |    /* Check public key hash. */
 1316|      0|    if (memcmp(key->pkhash, in, ML_KEM_PKHASH_BYTES) != 0)
  ------------------
  |  |   50|      0|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
  |  Branch (1316:9): [True: 0, False: 0]
  ------------------
 1317|      0|        return 0;
 1318|      0|    in += ML_KEM_PKHASH_BYTES;
  ------------------
  |  |   50|      0|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 1319|       |
 1320|      0|    memcpy(key->z, in, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1321|      0|    return 1;
 1322|      0|}
ml_kem.c:genkey:
 1352|    166|{
 1353|    166|    uint8_t hashed[2 * ML_KEM_RANDOM_BYTES];
 1354|    166|    const uint8_t *const sigma = hashed + ML_KEM_RANDOM_BYTES;
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1355|    166|    uint8_t augmented_seed[ML_KEM_RANDOM_BYTES + 1];
 1356|    166|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1357|    166|    CBD_FUNC cbd_1 = CBD1(vinfo->evp_type);
  ------------------
  |  | 1145|    166|#define CBD1(evp_type)  ((evp_type) == EVP_PKEY_ML_KEM_512 ? cbd_3 : cbd_2)
  |  |  ------------------
  |  |  |  |   93|    166|# define EVP_PKEY_ML_KEM_512            NID_ML_KEM_512
  |  |  |  |  ------------------
  |  |  |  |  |  | 6613|    166|#define NID_ML_KEM_512          1454
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1145:26): [True: 72, False: 94]
  |  |  ------------------
  ------------------
 1358|    166|    int rank = vinfo->rank;
 1359|    166|    uint8_t counter = 0;
 1360|    166|    int ret = 0;
 1361|       |
 1362|       |    /*
 1363|       |     * Use the "d" seed salted with the rank to derive the public and private
 1364|       |     * seeds rho and sigma.
 1365|       |     */
 1366|    166|    memcpy(augmented_seed, seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1367|    166|    augmented_seed[ML_KEM_RANDOM_BYTES] = (uint8_t) rank;
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1368|    166|    if (!hash_g(hashed, augmented_seed, sizeof(augmented_seed), mdctx, key))
  ------------------
  |  Branch (1368:9): [True: 0, False: 166]
  ------------------
 1369|      0|        goto end;
 1370|    166|    memcpy(key->rho, hashed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1371|       |    /* The |rho| matrix seed is public */
 1372|    166|    CONSTTIME_DECLASSIFY(key->rho, ML_KEM_RANDOM_BYTES);
 1373|       |
 1374|       |    /* FIPS 203 |e| vector is initial value of key->t */
 1375|    166|    if (!matrix_expand(mdctx, key)
  ------------------
  |  Branch (1375:9): [True: 0, False: 166]
  ------------------
 1376|    166|        || !gencbd_vector_ntt(key->s, cbd_1, &counter, sigma, rank, mdctx, key)
  ------------------
  |  Branch (1376:12): [True: 0, False: 166]
  ------------------
 1377|    166|        || !gencbd_vector_ntt(key->t, cbd_1, &counter, sigma, rank, mdctx, key))
  ------------------
  |  Branch (1377:12): [True: 0, False: 166]
  ------------------
 1378|      0|        goto end;
 1379|       |
 1380|       |    /* To |e| we now add the product of transpose |m| and |s|, giving |t|. */
 1381|    166|    matrix_mult_transpose_add(key->t, key->m, key->s, rank);
 1382|       |    /* The |t| vector is public */
 1383|    166|    CONSTTIME_DECLASSIFY(key->t, vinfo->rank * sizeof(scalar));
 1384|       |
 1385|    166|    if (pubenc == NULL) {
  ------------------
  |  Branch (1385:9): [True: 166, False: 0]
  ------------------
 1386|       |        /* Incremental digest of public key without in-full serialisation. */
 1387|    166|        if (!hash_h_pubkey(key->pkhash, mdctx, key))
  ------------------
  |  Branch (1387:13): [True: 0, False: 166]
  ------------------
 1388|      0|            goto end;
 1389|    166|    } else {
 1390|      0|        encode_pubkey(pubenc, key);
 1391|      0|        if (!hash_h(key->pkhash, pubenc, vinfo->pubkey_bytes, mdctx, key))
  ------------------
  |  Branch (1391:13): [True: 0, False: 0]
  ------------------
 1392|      0|            goto end;
 1393|      0|    }
 1394|       |
 1395|       |    /* Save |z| portion of seed for "implicit rejection" on failure. */
 1396|    166|    memcpy(key->z, seed + ML_KEM_RANDOM_BYTES, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
                  memcpy(key->z, seed + ML_KEM_RANDOM_BYTES, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1397|       |
 1398|       |    /* Optionally save the |d| portion of the seed */
 1399|    166|    key->d = key->z + ML_KEM_RANDOM_BYTES;
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1400|    166|    if (key->prov_flags & ML_KEM_KEY_RETAIN_SEED) {
  ------------------
  |  |  126|    166|# define ML_KEM_KEY_RETAIN_SEED (1 << 3)
  ------------------
  |  Branch (1400:9): [True: 166, False: 0]
  ------------------
 1401|    166|        memcpy(key->d, seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1402|    166|    } else {
 1403|      0|        OPENSSL_cleanse(key->d, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1404|      0|        key->d = NULL;
 1405|      0|    }
 1406|       |
 1407|    166|    ret = 1;
 1408|    166| end:
 1409|    166|    OPENSSL_cleanse((void *)augmented_seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1410|    166|    OPENSSL_cleanse((void *)sigma, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1411|    166|    return ret;
 1412|    166|}
ml_kem.c:cbd_3:
 1060|    396|{
 1061|    396|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|    396|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    396|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
 1062|    396|    uint8_t randbuf[6 * DEGREE / 8], *r = randbuf;  /* 64 * eta slots */
 1063|    396|    uint8_t b1, b2, b3;
 1064|    396|    uint16_t value, mask;
 1065|       |
 1066|    396|    if (!prf(randbuf, sizeof(randbuf), in, mdctx, key))
  ------------------
  |  Branch (1066:9): [True: 0, False: 396]
  ------------------
 1067|      0|        return 0;
 1068|       |
 1069|  25.3k|    do {
 1070|  25.3k|        b1 = *r++;
 1071|  25.3k|        b2 = *r++;
 1072|  25.3k|        b3 = *r++;
 1073|       |
 1074|       |        /*
 1075|       |         * Add |kPrime| if |value| underflowed.  See |constish_time_non_zero|
 1076|       |         * for a discussion on why the value barrier is by default omitted.
 1077|       |         * While this could have been written reduce_once(value + kPrime), this
 1078|       |         * is one extra addition and small range of |value| tempts some
 1079|       |         * versions of Clang to emit a branch.
 1080|       |         */
 1081|  25.3k|        value = bit0(b1) + bitn(1, b1) + bitn(2, b1);
  ------------------
  |  |   33|  25.3k|#define bit0(b)     ((b) & 1)
  ------------------
                      value = bit0(b1) + bitn(1, b1) + bitn(2, b1);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bit0(b1) + bitn(1, b1) + bitn(2, b1);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1082|  25.3k|        value -= bitn(3, b1)  + bitn(4, b1) + bitn(5, b1);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(3, b1)  + bitn(4, b1) + bitn(5, b1);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(3, b1)  + bitn(4, b1) + bitn(5, b1);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1083|  25.3k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|  25.3k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1084|  25.3k|        *curr++ = value + (kPrime & mask);
 1085|       |
 1086|  25.3k|        value = bitn(6, b1) + bitn(7, b1) + bit0(b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(6, b1) + bitn(7, b1) + bit0(b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(6, b1) + bitn(7, b1) + bit0(b2);
  ------------------
  |  |   33|  25.3k|#define bit0(b)     ((b) & 1)
  ------------------
 1087|  25.3k|        value -= bitn(1, b2) + bitn(2, b2) + bitn(3, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(1, b2) + bitn(2, b2) + bitn(3, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(1, b2) + bitn(2, b2) + bitn(3, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1088|  25.3k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|  25.3k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1089|  25.3k|        *curr++ = value + (kPrime & mask);
 1090|       |
 1091|  25.3k|        value = bitn(4, b2) + bitn(5, b2) + bitn(6, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(4, b2) + bitn(5, b2) + bitn(6, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(4, b2) + bitn(5, b2) + bitn(6, b2);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1092|  25.3k|        value -= bitn(7, b2) + bit0(b3) + bitn(1, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(7, b2) + bit0(b3) + bitn(1, b3);
  ------------------
  |  |   33|  25.3k|#define bit0(b)     ((b) & 1)
  ------------------
                      value -= bitn(7, b2) + bit0(b3) + bitn(1, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1093|  25.3k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|  25.3k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1094|  25.3k|        *curr++ = value + (kPrime & mask);
 1095|       |
 1096|  25.3k|        value = bitn(2, b3) + bitn(3, b3) + bitn(4, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(2, b3) + bitn(3, b3) + bitn(4, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(2, b3) + bitn(3, b3) + bitn(4, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1097|  25.3k|        value -= bitn(5, b3) + bitn(6, b3) + bitn(7, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(5, b3) + bitn(6, b3) + bitn(7, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(5, b3) + bitn(6, b3) + bitn(7, b3);
  ------------------
  |  |   34|  25.3k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1098|  25.3k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|  25.3k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1099|  25.3k|        *curr++ = value + (kPrime & mask);
 1100|  25.3k|    } while (curr < end);
  ------------------
  |  Branch (1100:14): [True: 24.9k, False: 396]
  ------------------
 1101|    396|    return 1;
 1102|    396|}
ml_kem.c:prf:
  352|  1.52k|{
  353|  1.52k|    return EVP_DigestInit_ex(mdctx, key->shake256_md, NULL)
  ------------------
  |  Branch (353:12): [True: 1.52k, False: 0]
  ------------------
  354|  1.52k|        && single_keccak(out, len, in, ML_KEM_RANDOM_BYTES + 1, mdctx);
  ------------------
  |  |   47|  1.52k|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (354:12): [True: 1.52k, False: 0]
  ------------------
  355|  1.52k|}
ml_kem.c:cbd_2:
 1019|  1.12k|{
 1020|  1.12k|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|  1.12k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  1.12k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
 1021|  1.12k|    uint8_t randbuf[4 * DEGREE / 8], *r = randbuf;  /* 64 * eta slots */
 1022|  1.12k|    uint16_t value, mask;
 1023|  1.12k|    uint8_t b;
 1024|       |
 1025|  1.12k|    if (!prf(randbuf, sizeof(randbuf), in, mdctx, key))
  ------------------
  |  Branch (1025:9): [True: 0, False: 1.12k]
  ------------------
 1026|      0|        return 0;
 1027|       |
 1028|   144k|    do {
 1029|   144k|        b = *r++;
 1030|       |
 1031|       |        /*
 1032|       |         * Add |kPrime| if |value| underflowed.  See |constish_time_non_zero|
 1033|       |         * for a discussion on why the value barrier is by default omitted.
 1034|       |         * While this could have been written reduce_once(value + kPrime), this
 1035|       |         * is one extra addition and small range of |value| tempts some
 1036|       |         * versions of Clang to emit a branch.
 1037|       |         */
 1038|   144k|        value = bit0(b) + bitn(1, b);
  ------------------
  |  |   33|   144k|#define bit0(b)     ((b) & 1)
  ------------------
                      value = bit0(b) + bitn(1, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1039|   144k|        value -= bitn(2, b) + bitn(3, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(2, b) + bitn(3, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1040|   144k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|   144k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1041|   144k|        *curr++ = value + (kPrime & mask);
 1042|       |
 1043|   144k|        value = bitn(4, b) + bitn(5, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value = bitn(4, b) + bitn(5, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1044|   144k|        value -= bitn(6, b) + bitn(7, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
                      value -= bitn(6, b) + bitn(7, b);
  ------------------
  |  |   34|   144k|#define bitn(n, b)  (((b) >> n) & 1)
  ------------------
 1045|   144k|        mask = constish_time_non_zero(value >> 15);
  ------------------
  |  |   69|   144k|# define constish_time_non_zero(b) (0u - (b))
  ------------------
 1046|   144k|        *curr++ = value + (kPrime & mask);
 1047|   144k|    } while (curr < end);
  ------------------
  |  Branch (1047:14): [True: 143k, False: 1.12k]
  ------------------
 1048|  1.12k|    return 1;
 1049|  1.12k|}
ml_kem.c:hash_g:
  403|    258|{
  404|    258|    return EVP_DigestInit_ex(mdctx, key->sha3_512_md, NULL)
  ------------------
  |  Branch (404:12): [True: 258, False: 0]
  ------------------
  405|    258|        && single_keccak(out, ML_KEM_SEED_BYTES, in, len, mdctx);
  ------------------
  |  |   48|    258|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|    258|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  |  Branch (405:12): [True: 258, False: 0]
  ------------------
  406|    258|}
ml_kem.c:gencbd_vector_ntt:
 1131|    424|{
 1132|    424|    uint8_t input[ML_KEM_RANDOM_BYTES + 1];
 1133|       |
 1134|    424|    memcpy(input, seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|    424|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1135|  1.19k|    do {
 1136|  1.19k|        input[ML_KEM_RANDOM_BYTES] = (*counter)++;
  ------------------
  |  |   47|  1.19k|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1137|  1.19k|        if (!cbd(out, input, mdctx, key))
  ------------------
  |  Branch (1137:13): [True: 0, False: 1.19k]
  ------------------
 1138|      0|            return 0;
 1139|  1.19k|        scalar_ntt(out++);
 1140|  1.19k|    } while (--rank > 0);
  ------------------
  |  Branch (1140:14): [True: 766, False: 424]
  ------------------
 1141|    424|    return 1;
 1142|    424|}
ml_kem.c:scalar_ntt:
  513|  1.31k|{
  514|  1.31k|    const uint16_t *roots = kNTTRoots;
  515|  1.31k|    uint16_t *end = s->c + DEGREE;
  ------------------
  |  |   40|  1.31k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  1.31k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  516|  1.31k|    int offset = DEGREE / 2;
  ------------------
  |  |   40|  1.31k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  1.31k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  517|       |
  518|  9.17k|    do {
  519|  9.17k|        uint16_t *curr = s->c, *peer;
  520|       |
  521|   166k|        do {
  522|   166k|            uint16_t *pause = curr + offset, even, odd;
  523|   166k|            uint32_t zeta = *++roots;
  524|       |
  525|   166k|            peer = pause;
  526|  1.17M|            do {
  527|  1.17M|                even = *curr;
  528|  1.17M|                odd = reduce(*peer * zeta);
  529|  1.17M|                *peer++ = reduce_once(even - odd + kPrime);
  530|  1.17M|                *curr++ = reduce_once(odd + even);
  531|  1.17M|            } while (curr < pause);
  ------------------
  |  Branch (531:22): [True: 1.00M, False: 166k]
  ------------------
  532|   166k|        } while ((curr = peer) < end);
  ------------------
  |  Branch (532:18): [True: 157k, False: 9.17k]
  ------------------
  533|  9.17k|    } while ((offset >>= 1) >= 2);
  ------------------
  |  Branch (533:14): [True: 7.86k, False: 1.31k]
  ------------------
  534|  1.31k|}
ml_kem.c:reduce:
  484|  2.57M|{
  485|  2.57M|    uint64_t product = (uint64_t)x * kBarrettMultiplier;
  486|  2.57M|    uint32_t quotient = (uint32_t)(product >> kBarrettShift);
  487|  2.57M|    uint32_t remainder = x - quotient * kPrime;
  488|       |
  489|  2.57M|    return reduce_once(remainder);
  490|  2.57M|}
ml_kem.c:reduce_once:
  470|  5.38M|{
  471|  5.38M|    const uint16_t subtracted = x - kPrime;
  472|  5.38M|    uint16_t mask = constish_time_non_zero(subtracted >> 15);
  ------------------
  |  |   69|  5.38M|# define constish_time_non_zero(b) (0u - (b))
  ------------------
  473|       |
  474|  5.38M|    return (mask & x) | (~mask & subtracted);
  475|  5.38M|}
ml_kem.c:matrix_mult_transpose_add:
  968|    166|{
  969|    166|    const scalar *mc = m, *mr, *ar;
  970|    166|    int i, j;
  971|       |
  972|    641|    for (i = rank; i-- > 0; ++out) {
  ------------------
  |  Branch (972:20): [True: 475, False: 166]
  ------------------
  973|    475|        scalar_mult_add(out, mr = mc++, ar = a);
  974|  1.47k|        for (j = rank; --j > 0; )
  ------------------
  |  Branch (974:24): [True: 1.00k, False: 475]
  ------------------
  975|  1.00k|            scalar_mult_add(out, (mr += rank), ++ar);
  976|    475|    }
  977|    166|}
ml_kem.c:scalar_mult_add:
  619|  2.14k|{
  620|  2.14k|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|  2.14k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  2.14k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  621|  2.14k|    const uint16_t *lc = lhs->c, *rc = rhs->c;
  622|  2.14k|    const uint16_t *roots = kModRoots;
  623|       |
  624|   274k|    do {
  625|   274k|        uint32_t l0 = *lc++, r0 = *rc++;
  626|   274k|        uint32_t l1 = *lc++, r1 = *rc++;
  627|   274k|        uint16_t *c0 = curr++;
  628|   274k|        uint16_t *c1 = curr++;
  629|   274k|        uint32_t zetapow = *roots++;
  630|       |
  631|   274k|        *c0 = reduce(*c0 + l0 * r0 + reduce(l1 * r1) * zetapow);
  632|   274k|        *c1 = reduce(*c1 + l0 * r1 + l1 * r0);
  633|   274k|    } while (curr < end);
  ------------------
  |  Branch (633:14): [True: 272k, False: 2.14k]
  ------------------
  634|  2.14k|}
ml_kem.c:hash_h_pubkey:
  373|    166|{
  374|    166|    const ML_KEM_VINFO *vinfo = key->vinfo;
  375|    166|    const scalar *t = key->t, *end = t + vinfo->rank;
  376|    166|    unsigned int sz;
  377|       |
  378|    166|    if (!EVP_DigestInit_ex(mdctx, key->sha3_256_md, NULL))
  ------------------
  |  Branch (378:9): [True: 0, False: 166]
  ------------------
  379|      0|        return 0;
  380|       |
  381|    475|    do {
  382|    475|        uint8_t buf[3 * DEGREE / 2];
  383|       |
  384|    475|        scalar_encode(buf, t++, 12);
  385|    475|        if (!EVP_DigestUpdate(mdctx, buf, sizeof(buf)))
  ------------------
  |  Branch (385:13): [True: 0, False: 475]
  ------------------
  386|      0|            return 0;
  387|    475|    } while (t < end);
  ------------------
  |  Branch (387:14): [True: 309, False: 166]
  ------------------
  388|       |
  389|    166|    if (!EVP_DigestUpdate(mdctx, key->rho, ML_KEM_RANDOM_BYTES))
  ------------------
  |  |   47|    166|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (389:9): [True: 0, False: 166]
  ------------------
  390|      0|        return 0;
  391|    166|    return EVP_DigestFinal_ex(mdctx, pkhash, &sz)
  ------------------
  |  Branch (391:12): [True: 166, False: 0]
  ------------------
  392|    166|        && ossl_assert(sz == ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   52|    166|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:26): [True: 166, False: 0]
  |  |  ------------------
  |  |   53|    166|                                         __FILE__, __LINE__)
  ------------------
  393|    166|}
ml_kem.c:encap:
 1426|     46|{
 1427|     46|    uint8_t input[ML_KEM_RANDOM_BYTES + ML_KEM_PKHASH_BYTES];
 1428|     46|    uint8_t Kr[ML_KEM_SHARED_SECRET_BYTES + ML_KEM_RANDOM_BYTES];
 1429|     46|    uint8_t *r = Kr + ML_KEM_SHARED_SECRET_BYTES;
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1430|     46|    int ret;
 1431|       |
 1432|     46|    memcpy(input, entropy, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|     46|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1433|     46|    memcpy(input + ML_KEM_RANDOM_BYTES, key->pkhash, ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   47|     46|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
                  memcpy(input + ML_KEM_RANDOM_BYTES, key->pkhash, ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   50|     46|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 1434|     46|    ret = hash_g(Kr, input, sizeof(input), mdctx, key)
  ------------------
  |  Branch (1434:11): [True: 46, False: 0]
  ------------------
 1435|     46|        && encrypt_cpa(ctext, entropy, r, tmp, mdctx, key);
  ------------------
  |  Branch (1435:12): [True: 46, False: 0]
  ------------------
 1436|       |
 1437|     46|    if (ret)
  ------------------
  |  Branch (1437:9): [True: 46, False: 0]
  ------------------
 1438|     46|        memcpy(secret, Kr, ML_KEM_SHARED_SECRET_BYTES);
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1439|     46|    OPENSSL_cleanse((void *)input, sizeof(input));
 1440|     46|    return ret;
 1441|     46|}
ml_kem.c:encrypt_cpa:
 1168|     92|{
 1169|     92|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1170|     92|    CBD_FUNC cbd_1 = CBD1(vinfo->evp_type);
  ------------------
  |  | 1145|     92|#define CBD1(evp_type)  ((evp_type) == EVP_PKEY_ML_KEM_512 ? cbd_3 : cbd_2)
  |  |  ------------------
  |  |  |  |   93|     92|# define EVP_PKEY_ML_KEM_512            NID_ML_KEM_512
  |  |  |  |  ------------------
  |  |  |  |  |  | 6613|     92|#define NID_ML_KEM_512          1454
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1145:26): [True: 54, False: 38]
  |  |  ------------------
  ------------------
 1171|     92|    int rank = vinfo->rank;
 1172|       |    /* We can use tmp[0..rank-1] as storage for |y|, then |e1|, ... */
 1173|     92|    scalar *y = &tmp[0], *e1 = y, *e2 = y;
 1174|       |    /* We can use tmp[rank]..tmp[2*rank - 1] for |u| */
 1175|     92|    scalar *u = &tmp[rank];
 1176|     92|    scalar v;
 1177|     92|    uint8_t input[ML_KEM_RANDOM_BYTES + 1];
 1178|     92|    uint8_t counter = 0;
 1179|     92|    int du = vinfo->du;
 1180|     92|    int dv = vinfo->dv;
 1181|       |
 1182|       |    /* FIPS 203 "y" vector */
 1183|     92|    if (!gencbd_vector_ntt(y, cbd_1, &counter, r, rank, mdctx, key))
  ------------------
  |  Branch (1183:9): [True: 0, False: 92]
  ------------------
 1184|      0|        return 0;
 1185|       |    /* FIPS 203 "v" scalar */
 1186|     92|    inner_product(&v, key->t, y, rank);
 1187|     92|    scalar_inverse_ntt(&v);
 1188|       |    /* FIPS 203 "u" vector */
 1189|     92|    matrix_mult_intt(u, key->m, y, rank);
 1190|       |
 1191|       |    /* All done with |y|, now free to reuse tmp[0] for FIPS 203 |e1| */
 1192|     92|    if (!gencbd_vector(e1, cbd_2, &counter, r, rank, mdctx, key))
  ------------------
  |  Branch (1192:9): [True: 0, False: 92]
  ------------------
 1193|      0|        return 0;
 1194|     92|    vector_add(u, e1, rank);
 1195|     92|    vector_compress(u, du, rank);
 1196|     92|    vector_encode(out, u, du, rank);
 1197|       |
 1198|       |    /* All done with |e1|, now free to reuse tmp[0] for FIPS 203 |e2| */
 1199|     92|    memcpy(input, r, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|     92|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1200|     92|    input[ML_KEM_RANDOM_BYTES] = counter;
  ------------------
  |  |   47|     92|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1201|     92|    if (!cbd_2(e2, input, mdctx, key))
  ------------------
  |  Branch (1201:9): [True: 0, False: 92]
  ------------------
 1202|      0|        return 0;
 1203|     92|    scalar_add(&v, e2);
 1204|       |
 1205|       |    /* Combine message with |v| */
 1206|     92|    scalar_decode_decompress_add(&v, message);
 1207|     92|    scalar_compress(&v, dv);
 1208|     92|    scalar_encode(out + vinfo->u_vector_bytes, &v, dv);
 1209|     92|    return 1;
 1210|     92|}
ml_kem.c:inner_product:
  941|    138|{
  942|    138|    scalar_mult(out, lhs, rhs);
  943|    360|    while (--rank > 0)
  ------------------
  |  Branch (943:12): [True: 222, False: 138]
  ------------------
  944|    222|        scalar_mult_add(out, ++lhs, ++rhs);
  945|    138|}
ml_kem.c:scalar_mult:
  600|    378|{
  601|    378|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|    378|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    378|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  602|    378|    const uint16_t *lc = lhs->c, *rc = rhs->c;
  603|    378|    const uint16_t *roots = kModRoots;
  604|       |
  605|  48.3k|    do {
  606|  48.3k|        uint32_t l0 = *lc++, r0 = *rc++;
  607|  48.3k|        uint32_t l1 = *lc++, r1 = *rc++;
  608|  48.3k|        uint32_t zetapow = *roots++;
  609|       |
  610|  48.3k|        *curr++ = reduce(l0 * r0 + reduce(l1 * r1) * zetapow);
  611|  48.3k|        *curr++ = reduce(l0 * r1 + l1 * r0);
  612|  48.3k|    } while (curr < end);
  ------------------
  |  Branch (612:14): [True: 48.0k, False: 378]
  ------------------
  613|    378|}
ml_kem.c:scalar_inverse_ntt:
  545|    378|{
  546|    378|    const uint16_t *roots = kInverseNTTRoots;
  547|    378|    uint16_t *end = s->c + DEGREE;
  ------------------
  |  |   40|    378|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    378|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  548|    378|    int offset = 2;
  549|       |
  550|  2.64k|    do {
  551|  2.64k|        uint16_t *curr = s->c, *peer;
  552|       |
  553|  48.0k|        do {
  554|  48.0k|            uint16_t *pause = curr + offset, even, odd;
  555|  48.0k|            uint32_t zeta = *++roots;
  556|       |
  557|  48.0k|            peer = pause;
  558|   338k|            do {
  559|   338k|                even = *curr;
  560|   338k|                odd = *peer;
  561|   338k|                *peer++ = reduce(zeta * (even - odd + kPrime));
  562|   338k|                *curr++ = reduce_once(odd + even);
  563|   338k|            } while (curr < pause);
  ------------------
  |  Branch (563:22): [True: 290k, False: 48.0k]
  ------------------
  564|  48.0k|        } while ((curr = peer) < end);
  ------------------
  |  Branch (564:18): [True: 45.3k, False: 2.64k]
  ------------------
  565|  2.64k|    } while ((offset <<= 1) < DEGREE);
  ------------------
  |  |   40|  2.64k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  2.64k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (565:14): [True: 2.26k, False: 378]
  ------------------
  566|    378|    scalar_mult_const(s, kInverseDegree);
  567|    378|}
ml_kem.c:scalar_mult_const:
  494|    378|{
  495|    378|    uint16_t *curr = s->c, *end = curr + DEGREE, tmp;
  ------------------
  |  |   40|    378|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    378|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  496|       |
  497|  96.7k|    do {
  498|  96.7k|        tmp = reduce(*curr * a);
  499|  96.7k|        *curr++ = tmp;
  500|  96.7k|    } while (curr < end);
  ------------------
  |  Branch (500:14): [True: 96.3k, False: 378]
  ------------------
  501|    378|}
ml_kem.c:matrix_mult_intt:
  953|     92|{
  954|     92|    const scalar *ar;
  955|     92|    int i, j;
  956|       |
  957|    332|    for (i = rank; i-- > 0; ++out) {
  ------------------
  |  Branch (957:20): [True: 240, False: 92]
  ------------------
  958|    240|        scalar_mult(out, m++, ar = a);
  959|    684|        for (j = rank - 1; j > 0; --j)
  ------------------
  |  Branch (959:28): [True: 444, False: 240]
  ------------------
  960|    444|            scalar_mult_add(out, m++, ++ar);
  961|    240|        scalar_inverse_ntt(out);
  962|    240|    }
  963|     92|}
ml_kem.c:gencbd_vector:
 1112|     92|{
 1113|     92|    uint8_t input[ML_KEM_RANDOM_BYTES + 1];
 1114|       |
 1115|     92|    memcpy(input, seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|     92|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1116|    240|    do {
 1117|    240|        input[ML_KEM_RANDOM_BYTES] = (*counter)++;
  ------------------
  |  |   47|    240|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
 1118|    240|        if (!cbd(out++, input, mdctx, key))
  ------------------
  |  Branch (1118:13): [True: 0, False: 240]
  ------------------
 1119|      0|            return 0;
 1120|    240|    } while (--rank > 0);
  ------------------
  |  Branch (1120:14): [True: 148, False: 92]
  ------------------
 1121|     92|    return 1;
 1122|     92|}
ml_kem.c:vector_add:
  878|     92|{
  879|    240|    do {
  880|    240|        scalar_add(lhs++, rhs++);
  881|    240|    } while (--rank > 0);
  ------------------
  |  Branch (881:14): [True: 148, False: 92]
  ------------------
  882|     92|}
ml_kem.c:vector_compress:
  932|     92|{
  933|    240|    do {
  934|    240|        scalar_compress(a++, bits);
  935|    240|    } while (--rank > 0);
  ------------------
  |  Branch (935:14): [True: 148, False: 92]
  ------------------
  936|     92|}
ml_kem.c:scalar_add:
  571|    332|{
  572|    332|    int i;
  573|       |
  574|  85.3k|    for (i = 0; i < DEGREE; i++)
  ------------------
  |  |   40|  85.3k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  85.3k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (574:17): [True: 84.9k, False: 332]
  ------------------
  575|  84.9k|        lhs->c[i] = reduce_once(lhs->c[i] + rhs->c[i]);
  576|    332|}
ml_kem.c:scalar_decode_decompress_add:
  766|     92|{
  767|     92|    static const uint16_t half_q_plus_1 = (ML_KEM_PRIME >> 1) + 1;
  ------------------
  |  |   26|     92|# define ML_KEM_PRIME          (ML_KEM_DEGREE * 13 + 1)
  |  |  ------------------
  |  |  |  |   19|     92|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  768|     92|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|     92|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|     92|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  769|     92|    uint16_t mask;
  770|     92|    uint8_t b;
  771|       |
  772|       |    /*
  773|       |     * Add |half_q_plus_1| if the bit is set, without exposing a side-channel,
  774|       |     * avoiding the "clangover" attack.  See |constish_time_non_zero| for a
  775|       |     * discussion on why the value barrier is by default omitted.
  776|       |     */
  777|     92|#define decode_decompress_add_bit                               \
  778|     92|        mask = constish_time_non_zero(bit0(b));                 \
  779|     92|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  780|     92|        curr++;                                                 \
  781|     92|        b >>= 1
  782|       |
  783|       |    /* Unrolled to process each byte in one iteration */
  784|  2.94k|    do {
  785|  2.94k|        b = *in++;
  786|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  787|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  788|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  789|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  790|       |
  791|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  792|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  793|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  794|  2.94k|        decode_decompress_add_bit;
  ------------------
  |  |  778|  2.94k|        mask = constish_time_non_zero(bit0(b));                 \
  |  |  ------------------
  |  |  |  |   69|  2.94k|# define constish_time_non_zero(b) (0u - (b))
  |  |  ------------------
  |  |  779|  2.94k|        *curr = reduce_once(*curr + (mask & half_q_plus_1));    \
  |  |  780|  2.94k|        curr++;                                                 \
  |  |  781|  2.94k|        b >>= 1
  ------------------
  795|  2.94k|    } while (curr < end);
  ------------------
  |  Branch (795:14): [True: 2.85k, False: 92]
  ------------------
  796|     92|#undef decode_decompress_add_bit
  797|     92|}
ml_kem.c:scalar_compress:
  857|    378|{
  858|    378|    int i;
  859|       |
  860|  97.1k|    for (i = 0; i < DEGREE; i++)
  ------------------
  |  |   40|  97.1k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  97.1k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (860:17): [True: 96.7k, False: 378]
  ------------------
  861|  96.7k|        s->c[i] = compress(s->c[i], bits);
  862|    378|}
ml_kem.c:compress:
  810|  96.7k|{
  811|  96.7k|    uint32_t shifted = (uint32_t)x << bits;
  812|  96.7k|    uint64_t product = (uint64_t)shifted * kBarrettMultiplier;
  813|  96.7k|    uint32_t quotient = (uint32_t)(product >> kBarrettShift);
  814|  96.7k|    uint32_t remainder = shifted - quotient * kPrime;
  815|       |
  816|       |    /*
  817|       |     * Adjust the quotient to round correctly:
  818|       |     *   0 <= remainder <= kHalfPrime round to 0
  819|       |     *   kHalfPrime < remainder <= kPrime + kHalfPrime round to 1
  820|       |     *   kPrime + kHalfPrime < remainder < 2 * kPrime round to 2
  821|       |     */
  822|  96.7k|    quotient += 1 & constant_time_lt_32(kHalfPrime, remainder);
  823|  96.7k|    quotient += 1 & constant_time_lt_32(kPrime + kHalfPrime, remainder);
  824|  96.7k|    return quotient & ((1 << bits) - 1);
  825|  96.7k|}
ml_kem.c:decap:
 1458|     46|{
 1459|     46|    uint8_t decrypted[ML_KEM_SHARED_SECRET_BYTES + ML_KEM_PKHASH_BYTES];
 1460|     46|    uint8_t failure_key[ML_KEM_RANDOM_BYTES];
 1461|     46|    uint8_t Kr[ML_KEM_SHARED_SECRET_BYTES + ML_KEM_RANDOM_BYTES];
 1462|     46|    uint8_t *r = Kr + ML_KEM_SHARED_SECRET_BYTES;
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1463|     46|    const uint8_t *pkhash = key->pkhash;
 1464|     46|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1465|     46|    int i;
 1466|     46|    uint8_t mask;
 1467|       |
 1468|       |    /*
 1469|       |     * If our KDF is unavailable, fail early! Otherwise, keep going ignoring
 1470|       |     * any further errors, returning success, and whatever we got for a shared
 1471|       |     * secret.  The decrypt_cpa() function is just arithmetic on secret data,
 1472|       |     * so should not be subject to failure that makes its output predictable.
 1473|       |     *
 1474|       |     * We guard against "should never happen" catastrophic failure of the
 1475|       |     * "pure" function |hash_g| by overwriting the shared secret with the
 1476|       |     * content of the failure key and returning early, if nevertheless hash_g
 1477|       |     * fails.  This is not constant-time, but a failure of |hash_g| already
 1478|       |     * implies loss of side-channel resistance.
 1479|       |     *
 1480|       |     * The same action is taken, if also |encrypt_cpa| should catastrophically
 1481|       |     * fail, due to failure of the |PRF| underlying the CBD functions.
 1482|       |     */
 1483|     46|    if (!kdf(failure_key, key->z, ctext, vinfo->ctext_bytes, mdctx, key))
  ------------------
  |  Branch (1483:9): [True: 0, False: 46]
  ------------------
 1484|      0|        return 0;
 1485|     46|    decrypt_cpa(decrypted, ctext, tmp, key);
 1486|     46|    memcpy(decrypted + ML_KEM_SHARED_SECRET_BYTES, pkhash, ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
                  memcpy(decrypted + ML_KEM_SHARED_SECRET_BYTES, pkhash, ML_KEM_PKHASH_BYTES);
  ------------------
  |  |   50|     46|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
 1487|     46|    if (!hash_g(Kr, decrypted, sizeof(decrypted), mdctx, key)
  ------------------
  |  Branch (1487:9): [True: 0, False: 46]
  ------------------
 1488|     46|        || !encrypt_cpa(tmp_ctext, decrypted, r, tmp, mdctx, key)) {
  ------------------
  |  Branch (1488:12): [True: 0, False: 46]
  ------------------
 1489|      0|        memcpy(secret, failure_key, ML_KEM_SHARED_SECRET_BYTES);
  ------------------
  |  |   51|      0|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1490|      0|        OPENSSL_cleanse(decrypted, ML_KEM_SHARED_SECRET_BYTES);
  ------------------
  |  |   51|      0|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1491|      0|        return 1;
 1492|      0|    }
 1493|     46|    mask = constant_time_eq_int_8(0,
 1494|     46|        CRYPTO_memcmp(ctext, tmp_ctext, vinfo->ctext_bytes));
  ------------------
  |  |  319|     46|#  define CRYPTO_memcmp memcmp
  ------------------
 1495|  1.51k|    for (i = 0; i < ML_KEM_SHARED_SECRET_BYTES; i++)
  ------------------
  |  |   51|  1.51k|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  |  Branch (1495:17): [True: 1.47k, False: 46]
  ------------------
 1496|  1.47k|        secret[i] = constant_time_select_8(mask, Kr[i], failure_key[i]);
 1497|     46|    OPENSSL_cleanse(decrypted, ML_KEM_SHARED_SECRET_BYTES);
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
 1498|     46|    OPENSSL_cleanse(Kr, sizeof(Kr));
 1499|     46|    return 1;
 1500|     46|}
ml_kem.c:kdf:
  419|     46|{
  420|     46|    return EVP_DigestInit_ex(mdctx, key->shake256_md, NULL)
  ------------------
  |  Branch (420:12): [True: 46, False: 0]
  ------------------
  421|     46|        && EVP_DigestUpdate(mdctx, z, ML_KEM_RANDOM_BYTES)
  ------------------
  |  |   47|     46|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (421:12): [True: 46, False: 0]
  ------------------
  422|     46|        && EVP_DigestUpdate(mdctx, ctext, len)
  ------------------
  |  Branch (422:12): [True: 46, False: 0]
  ------------------
  423|     46|        && EVP_DigestFinalXOF(mdctx, out, ML_KEM_SHARED_SECRET_BYTES);
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  |  Branch (423:12): [True: 46, False: 0]
  ------------------
  424|     46|}
ml_kem.c:decrypt_cpa:
 1218|     46|{
 1219|     46|    const ML_KEM_VINFO *vinfo = key->vinfo;
 1220|     46|    scalar v, mask;
 1221|     46|    int rank = vinfo->rank;
 1222|     46|    int du = vinfo->du;
 1223|     46|    int dv = vinfo->dv;
 1224|       |
 1225|     46|    vector_decode_decompress_ntt(u, ctext, du, rank);
 1226|     46|    scalar_decode(&v, ctext + vinfo->u_vector_bytes, dv);
 1227|     46|    scalar_decompress(&v, dv);
 1228|     46|    inner_product(&mask, key->s, u, rank);
 1229|     46|    scalar_inverse_ntt(&mask);
 1230|     46|    scalar_sub(&v, &mask);
 1231|     46|    scalar_compress(&v, 1);
 1232|     46|    scalar_encode_1(out, &v);
 1233|     46|}
ml_kem.c:vector_decode_decompress_ntt:
  908|     46|{
  909|     46|    int stride = bits * DEGREE / 8;
  ------------------
  |  |   40|     46|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|     46|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  910|       |
  911|    166|    for (; rank-- > 0; in += stride, ++out) {
  ------------------
  |  Branch (911:12): [True: 120, False: 46]
  ------------------
  912|    120|        scalar_decode(out, in, bits);
  913|    120|        scalar_decompress(out, bits);
  914|    120|        scalar_ntt(out);
  915|    120|    }
  916|     46|}
ml_kem.c:scalar_decode:
  689|    166|{
  690|    166|    uint16_t *curr = out->c, *end = curr + DEGREE;
  ------------------
  |  |   40|    166|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|    166|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  691|    166|    uint64_t accum = 0;
  692|    166|    int accum_bits = 0, todo = bits;
  693|    166|    uint16_t bitmask = (((uint16_t) 1) << bits) - 1, mask = bitmask;
  694|    166|    uint16_t element = 0;
  695|       |
  696|  46.7k|    do {
  697|  46.7k|        if (accum_bits == 0) {
  ------------------
  |  Branch (697:13): [True: 5.71k, False: 41.0k]
  ------------------
  698|  5.71k|            in = OPENSSL_load_u64_le(&accum, in);
  699|  5.71k|            accum_bits = 64;
  700|  5.71k|        }
  701|  46.7k|        if (todo == bits && accum_bits >= bits) {
  ------------------
  |  Branch (701:13): [True: 42.4k, False: 4.27k]
  |  Branch (701:29): [True: 38.2k, False: 4.27k]
  ------------------
  702|       |            /* No partial "element", and all the required bits available */
  703|  38.2k|            *curr++ = ((uint16_t) accum) & mask;
  704|  38.2k|            accum >>= bits;
  705|  38.2k|            accum_bits -= bits;
  706|  38.2k|        } else if (accum_bits >= todo) {
  ------------------
  |  Branch (706:20): [True: 4.27k, False: 4.27k]
  ------------------
  707|       |            /* A partial "element", and all the required bits available */
  708|  4.27k|            *curr++ = element | ((((uint16_t) accum) & mask) << (bits - todo));
  709|  4.27k|            accum >>= todo;
  710|  4.27k|            accum_bits -= todo;
  711|  4.27k|            element = 0;
  712|  4.27k|            todo = bits;
  713|  4.27k|            mask = bitmask;
  714|  4.27k|        } else {
  715|       |            /*
  716|       |             * Only some of the requisite bits accumulated, store |accum_bits|
  717|       |             * of these in |element|.  The accumulated bitcount becomes 0, but
  718|       |             * as soon as we have more bits we'll want to merge accum_bits
  719|       |             * fewer of them into the final |element|.
  720|       |             *
  721|       |             * Note that with a 64-bit accumulator and |bits| always 12 or
  722|       |             * less, if we're here, the previous iteration had all the
  723|       |             * requisite bits, and so there are no kept bits in |element|.
  724|       |             */
  725|  4.27k|            element = ((uint16_t) accum) & mask;
  726|  4.27k|            todo -= accum_bits;
  727|  4.27k|            mask = bitmask >> accum_bits;
  728|  4.27k|            accum_bits = 0;
  729|  4.27k|        }
  730|  46.7k|    } while (curr < end);
  ------------------
  |  Branch (730:14): [True: 46.6k, False: 166]
  ------------------
  731|    166|}
ml_kem.c:scalar_decompress:
  869|    166|{
  870|    166|    int i;
  871|       |
  872|  42.6k|    for (i = 0; i < DEGREE; i++)
  ------------------
  |  |   40|  42.6k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  42.6k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (872:17): [True: 42.4k, False: 166]
  ------------------
  873|  42.4k|        s->c[i] = decompress(s->c[i], bits);
  874|    166|}
ml_kem.c:decompress:
  835|  42.4k|{
  836|  42.4k|    uint32_t product = (uint32_t)x * kPrime;
  837|  42.4k|    uint32_t power = 1 << bits;
  838|       |    /* This is |product| % power, since |power| is a power of 2. */
  839|  42.4k|    uint32_t remainder = product & (power - 1);
  840|       |    /* This is |product| / power, since |power| is a power of 2. */
  841|  42.4k|    uint32_t lower = product >> bits;
  842|       |
  843|       |    /*
  844|       |     * The rounding logic works since the first half of numbers mod |power|
  845|       |     * have a 0 as first bit, and the second half has a 1 as first bit, since
  846|       |     * |power| is a power of 2. As a 12 bit number, |remainder| is always
  847|       |     * positive, so we will shift in 0s for a right shift.
  848|       |     */
  849|  42.4k|    return lower + (remainder >> (bits - 1));
  850|  42.4k|}
ml_kem.c:scalar_sub:
  580|     46|{
  581|     46|    int i;
  582|       |
  583|  11.8k|    for (i = 0; i < DEGREE; i++)
  ------------------
  |  |   40|  11.8k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  11.8k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (583:17): [True: 11.7k, False: 46]
  ------------------
  584|  11.7k|        lhs->c[i] = reduce_once(lhs->c[i] - rhs->c[i] + kPrime);
  585|     46|}
ml_kem.c:scalar_encode_1:
  667|     46|{
  668|     46|    int i, j;
  669|     46|    uint8_t out_byte;
  670|       |
  671|  1.51k|    for (i = 0; i < DEGREE; i += 8) {
  ------------------
  |  |   40|  1.51k|#define DEGREE          ML_KEM_DEGREE
  |  |  ------------------
  |  |  |  |   19|  1.51k|# define ML_KEM_DEGREE 256
  |  |  ------------------
  ------------------
  |  Branch (671:17): [True: 1.47k, False: 46]
  ------------------
  672|  1.47k|        out_byte = 0;
  673|  13.2k|        for (j = 0; j < 8; j++)
  ------------------
  |  Branch (673:21): [True: 11.7k, False: 1.47k]
  ------------------
  674|  11.7k|            out_byte |= bit0(s->c[i + j]) << j;
  ------------------
  |  |   33|  11.7k|#define bit0(b)     ((b) & 1)
  ------------------
  675|  1.47k|        *out = out_byte;
  676|  1.47k|        out++;
  677|  1.47k|    }
  678|     46|}

CRYPTO_ctr128_encrypt_ctr32:
  155|    341|{
  156|    341|    unsigned int n, ctr32;
  157|       |
  158|    341|   n = *num;
  159|       |
  160|    341|    while (n && len) {
  ------------------
  |  Branch (160:12): [True: 0, False: 341]
  |  Branch (160:17): [True: 0, False: 0]
  ------------------
  161|      0|        *(out++) = *(in++) ^ ecount_buf[n];
  162|      0|        --len;
  163|      0|        n = (n + 1) % 16;
  164|      0|    }
  165|       |
  166|    341|    ctr32 = GETU32(ivec + 12);
  ------------------
  |  |  103|    341|# define GETU32(p)       ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
  ------------------
  167|    677|    while (len >= 16) {
  ------------------
  |  Branch (167:12): [True: 336, False: 341]
  ------------------
  168|    336|        size_t blocks = len / 16;
  169|       |        /*
  170|       |         * 1<<28 is just a not-so-small yet not-so-large number...
  171|       |         * Below condition is practically never met, but it has to
  172|       |         * be checked for code correctness.
  173|       |         */
  174|    336|        if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28))
  ------------------
  |  Branch (174:13): [Folded - Ignored]
  |  Branch (174:54): [True: 0, False: 336]
  ------------------
  175|      0|            blocks = (1U << 28);
  176|       |        /*
  177|       |         * As (*func) operates on 32-bit counter, caller
  178|       |         * has to handle overflow. 'if' below detects the
  179|       |         * overflow, which is then handled by limiting the
  180|       |         * amount of blocks to the exact overflow point...
  181|       |         */
  182|    336|        ctr32 += (u32)blocks;
  183|    336|        if (ctr32 < blocks) {
  ------------------
  |  Branch (183:13): [True: 0, False: 336]
  ------------------
  184|      0|            blocks -= ctr32;
  185|      0|            ctr32 = 0;
  186|      0|        }
  187|    336|        (*func) (in, out, blocks, key, ivec);
  188|       |        /* (*ctr) does not update ivec, caller does: */
  189|    336|        PUTU32(ivec + 12, ctr32);
  ------------------
  |  |  104|    336|# define PUTU32(p,v)     ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
  ------------------
  190|       |        /* ... overflow was detected, propagate carry. */
  191|    336|        if (ctr32 == 0)
  ------------------
  |  Branch (191:13): [True: 0, False: 336]
  ------------------
  192|      0|            ctr96_inc(ivec);
  193|    336|        blocks *= 16;
  194|    336|        len -= blocks;
  195|    336|        out += blocks;
  196|    336|        in += blocks;
  197|    336|    }
  198|    341|    if (len) {
  ------------------
  |  Branch (198:9): [True: 34, False: 307]
  ------------------
  199|     34|        memset(ecount_buf, 0, 16);
  200|     34|        (*func) (ecount_buf, ecount_buf, 1, key, ivec);
  201|     34|        ++ctr32;
  202|     34|        PUTU32(ivec + 12, ctr32);
  ------------------
  |  |  104|     34|# define PUTU32(p,v)     ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
  ------------------
  203|     34|        if (ctr32 == 0)
  ------------------
  |  Branch (203:13): [True: 0, False: 34]
  ------------------
  204|      0|            ctr96_inc(ivec);
  205|    378|        while (len--) {
  ------------------
  |  Branch (205:16): [True: 344, False: 34]
  ------------------
  206|    344|            out[n] = in[n] ^ ecount_buf[n];
  207|    344|            ++n;
  208|    344|        }
  209|     34|    }
  210|       |
  211|    341|    *num = n;
  212|    341|}

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

CRYPTO_strdup:
   23|    691|{
   24|    691|    char *ret;
   25|       |
   26|    691|    if (str == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 691]
  ------------------
   27|      0|        return NULL;
   28|    691|    ret = CRYPTO_malloc(strlen(str) + 1, file, line);
   29|    691|    if (ret != NULL)
  ------------------
  |  Branch (29:9): [True: 691, False: 0]
  ------------------
   30|    691|        strcpy(ret, str);
   31|    691|    return ret;
   32|    691|}
CRYPTO_strndup:
   35|    223|{
   36|    223|    size_t maxlen;
   37|    223|    char *ret;
   38|       |
   39|    223|    if (str == NULL)
  ------------------
  |  Branch (39:9): [True: 0, False: 223]
  ------------------
   40|      0|        return NULL;
   41|       |
   42|    223|    maxlen = OPENSSL_strnlen(str, s);
   43|       |
   44|    223|    ret = CRYPTO_malloc(maxlen + 1, file, line);
   45|    223|    if (ret) {
  ------------------
  |  Branch (45:9): [True: 223, False: 0]
  ------------------
   46|    223|        memcpy(ret, str, maxlen);
   47|    223|        ret[maxlen] = CH_ZERO;
  ------------------
  |  |   20|    223|#define CH_ZERO '\0'
  ------------------
   48|    223|    }
   49|    223|    return ret;
   50|    223|}
OPENSSL_strnlen:
   66|    357|{
   67|    357|    const char *p;
   68|       |
   69|  4.97k|    for (p = str; maxlen-- != 0 && *p != CH_ZERO; ++p) ;
  ------------------
  |  |   20|  4.75k|#define CH_ZERO '\0'
  ------------------
  |  Branch (69:19): [True: 4.75k, False: 223]
  |  Branch (69:36): [True: 4.61k, False: 134]
  ------------------
   70|       |
   71|    357|    return p - str;
   72|    357|}
OPENSSL_strlcpy:
   75|  1.38k|{
   76|  1.38k|    size_t l = 0;
   77|  5.27k|    for (; size > 1 && *src; size--) {
  ------------------
  |  Branch (77:12): [True: 5.27k, False: 0]
  |  Branch (77:24): [True: 3.89k, False: 1.38k]
  ------------------
   78|  3.89k|        *dst++ = *src++;
   79|  3.89k|        l++;
   80|  3.89k|    }
   81|  1.38k|    if (size)
  ------------------
  |  Branch (81:9): [True: 1.38k, False: 0]
  ------------------
   82|  1.38k|        *dst = CH_ZERO;
  ------------------
  |  |   20|  1.38k|#define CH_ZERO '\0'
  ------------------
   83|  1.38k|    return l + strlen(src);
   84|  1.38k|}
OPENSSL_strcasecmp:
  407|  6.48k|{
  408|  6.48k|    int t;
  409|       |
  410|  18.2k|    while ((t = ossl_tolower(*s1) - ossl_tolower(*s2++)) == 0)
  ------------------
  |  Branch (410:12): [True: 12.9k, False: 5.31k]
  ------------------
  411|  12.9k|        if (*s1++ == '\0')
  ------------------
  |  Branch (411:13): [True: 1.17k, False: 11.7k]
  ------------------
  412|  1.17k|            return 0;
  413|  5.31k|    return t;
  414|  6.48k|}
OPENSSL_strncasecmp:
  417|    117|{
  418|    117|    int t;
  419|    117|    size_t i;
  420|       |
  421|    117|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (421:17): [True: 117, False: 0]
  ------------------
  422|    117|        if ((t = ossl_tolower(*s1) - ossl_tolower(*s2++)) != 0)
  ------------------
  |  Branch (422:13): [True: 117, False: 0]
  ------------------
  423|    117|            return t;
  424|      0|        else if (*s1++ == '\0')
  ------------------
  |  Branch (424:18): [True: 0, False: 0]
  ------------------
  425|      0|            return 0;
  426|      0|    return 0;
  427|    117|}

OBJ_NAME_init:
   64|  1.22k|{
   65|  1.22k|    return RUN_ONCE(&init, o_names_init);
  ------------------
  |  |  130|  1.22k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1.22k, False: 0]
  |  |  ------------------
  ------------------
   66|  1.22k|}
OBJ_NAME_get:
  152|    556|{
  153|    556|    OBJ_NAME on, *ret;
  154|    556|    int num = 0, alias;
  155|    556|    const char *value = NULL;
  156|       |
  157|    556|    if (name == NULL)
  ------------------
  |  Branch (157:9): [True: 0, False: 556]
  ------------------
  158|      0|        return NULL;
  159|    556|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (159:9): [True: 0, False: 556]
  ------------------
  160|      0|        return NULL;
  161|    556|    if (!CRYPTO_THREAD_read_lock(obj_lock))
  ------------------
  |  Branch (161:9): [True: 0, False: 556]
  ------------------
  162|      0|        return NULL;
  163|       |
  164|    556|    alias = type & OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    556|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  165|    556|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    556|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  166|       |
  167|    556|    on.name = name;
  168|    556|    on.type = type;
  169|       |
  170|    651|    for (;;) {
  171|    651|        ret = lh_OBJ_NAME_retrieve(names_lh, &on);
  172|    651|        if (ret == NULL)
  ------------------
  |  Branch (172:13): [True: 157, False: 494]
  ------------------
  173|    157|            break;
  174|    494|        if ((ret->alias) && !alias) {
  ------------------
  |  Branch (174:13): [True: 95, False: 399]
  |  Branch (174:29): [True: 95, False: 0]
  ------------------
  175|     95|            if (++num > 10)
  ------------------
  |  Branch (175:17): [True: 0, False: 95]
  ------------------
  176|      0|                break;
  177|     95|            on.name = ret->data;
  178|    399|        } else {
  179|    399|            value = ret->data;
  180|    399|            break;
  181|    399|        }
  182|    494|    }
  183|       |
  184|    556|    CRYPTO_THREAD_unlock(obj_lock);
  185|    556|    return value;
  186|    556|}
OBJ_NAME_add:
  189|    424|{
  190|    424|    OBJ_NAME *onp, *ret;
  191|    424|    int alias, ok = 0;
  192|       |
  193|    424|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (193:9): [True: 0, False: 424]
  ------------------
  194|      0|        return 0;
  195|       |
  196|    424|    alias = type & OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    424|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  197|    424|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    424|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  198|       |
  199|    424|    onp = OPENSSL_malloc(sizeof(*onp));
  ------------------
  |  |  102|    424|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    424|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    424|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  200|    424|    if (onp == NULL)
  ------------------
  |  Branch (200:9): [True: 0, False: 424]
  ------------------
  201|      0|        return 0;
  202|       |
  203|    424|    onp->name = name;
  204|    424|    onp->alias = alias;
  205|    424|    onp->type = type;
  206|    424|    onp->data = data;
  207|       |
  208|    424|    if (!CRYPTO_THREAD_write_lock(obj_lock)) {
  ------------------
  |  Branch (208:9): [True: 0, False: 424]
  ------------------
  209|      0|        OPENSSL_free(onp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  210|      0|        return 0;
  211|      0|    }
  212|       |
  213|    424|    ret = lh_OBJ_NAME_insert(names_lh, onp);
  214|    424|    if (ret != NULL) {
  ------------------
  |  Branch (214:9): [True: 182, False: 242]
  ------------------
  215|       |        /* free things */
  216|    182|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (216:13): [True: 0, False: 182]
  ------------------
  217|    182|            && (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|    182|        OPENSSL_free(ret);
  ------------------
  |  |  115|    182|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    182|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    182|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  227|    242|    } else {
  228|    242|        if (lh_OBJ_NAME_error(names_lh)) {
  ------------------
  |  Branch (228:13): [True: 0, False: 242]
  ------------------
  229|       |            /* ERROR */
  230|      0|            OPENSSL_free(onp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  231|      0|            goto unlock;
  232|      0|        }
  233|    242|    }
  234|       |
  235|    424|    ok = 1;
  236|       |
  237|    424|unlock:
  238|    424|    CRYPTO_THREAD_unlock(obj_lock);
  239|    424|    return ok;
  240|    424|}
OBJ_NAME_remove:
  243|    242|{
  244|    242|    OBJ_NAME on, *ret;
  245|    242|    int ok = 0;
  246|       |
  247|    242|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (247:9): [True: 0, False: 242]
  ------------------
  248|      0|        return 0;
  249|       |
  250|    242|    if (!CRYPTO_THREAD_write_lock(obj_lock))
  ------------------
  |  Branch (250:9): [True: 0, False: 242]
  ------------------
  251|      0|        return 0;
  252|       |
  253|    242|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    242|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  254|    242|    on.name = name;
  255|    242|    on.type = type;
  256|    242|    ret = lh_OBJ_NAME_delete(names_lh, &on);
  257|    242|    if (ret != NULL) {
  ------------------
  |  Branch (257:9): [True: 242, False: 0]
  ------------------
  258|       |        /* free things */
  259|    242|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (259:13): [True: 0, False: 242]
  ------------------
  260|    242|            && (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|    242|        OPENSSL_free(ret);
  ------------------
  |  |  115|    242|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    242|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    242|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  270|    242|        ok = 1;
  271|    242|    }
  272|       |
  273|    242|    CRYPTO_THREAD_unlock(obj_lock);
  274|    242|    return ok;
  275|    242|}
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|      4|{
  369|      4|    unsigned long down_load;
  370|       |
  371|      4|    if (names_lh == NULL)
  ------------------
  |  Branch (371:9): [True: 0, False: 4]
  ------------------
  372|      0|        return;
  373|       |
  374|      4|    free_type = type;
  375|      4|    down_load = lh_OBJ_NAME_get_down_load(names_lh);
  376|      4|    lh_OBJ_NAME_set_down_load(names_lh, 0);
  377|       |
  378|      4|    lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
  379|      4|    if (type < 0) {
  ------------------
  |  Branch (379:9): [True: 1, False: 3]
  ------------------
  380|      1|        lh_OBJ_NAME_free(names_lh);
  381|      1|        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
  382|      1|        CRYPTO_THREAD_lock_free(obj_lock);
  383|      1|        names_lh = NULL;
  384|      1|        name_funcs_stack = NULL;
  385|      1|        obj_lock = NULL;
  386|      1|    } else
  387|      3|        lh_OBJ_NAME_set_down_load(names_lh, down_load);
  388|      4|}
o_names.c:o_names_init:
   51|      1|{
   52|      1|    names_lh = NULL;
   53|      1|    obj_lock = CRYPTO_THREAD_lock_new();
   54|      1|    if (obj_lock != NULL)
  ------------------
  |  Branch (54:9): [True: 1, False: 0]
  ------------------
   55|      1|        names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
   56|      1|    if (names_lh == NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 1]
  ------------------
   57|      0|        CRYPTO_THREAD_lock_free(obj_lock);
   58|      0|        obj_lock = NULL;
   59|      0|    }
   60|      1|    return names_lh != NULL && obj_lock != NULL;
  ------------------
  |  Branch (60:12): [True: 1, False: 0]
  |  Branch (60:32): [True: 1, False: 0]
  ------------------
   61|      1|}
o_names.c:obj_name_hash:
  136|  1.31k|{
  137|  1.31k|    unsigned long ret;
  138|       |
  139|  1.31k|    if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 1.31k]
  ------------------
  140|  1.31k|        && (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.31k|    } else {
  145|  1.31k|        ret = ossl_lh_strcasehash(a->name);
  146|  1.31k|    }
  147|  1.31k|    ret ^= a->type;
  148|  1.31k|    return ret;
  149|  1.31k|}
o_names.c:obj_name_cmp:
  120|    918|{
  121|    918|    int ret;
  122|       |
  123|    918|    ret = a->type - b->type;
  124|    918|    if (ret == 0) {
  ------------------
  |  Branch (124:9): [True: 918, False: 0]
  ------------------
  125|    918|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (125:13): [True: 0, False: 918]
  ------------------
  126|    918|            && (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|    918|            ret = OPENSSL_strcasecmp(a->name, b->name);
  131|    918|    }
  132|    918|    return ret;
  133|    918|}
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|    543|{
  355|    543|    if (onp == NULL)
  ------------------
  |  Branch (355:9): [True: 0, False: 543]
  ------------------
  356|      0|        return;
  357|       |
  358|    543|    if (free_type < 0 || free_type == onp->type)
  ------------------
  |  Branch (358:9): [True: 0, False: 543]
  |  Branch (358:26): [True: 242, False: 301]
  ------------------
  359|    242|        OBJ_NAME_remove(onp->name, onp->type);
  360|    543|}

ossl_obj_cleanup_int:
  212|      1|{
  213|      1|    if (added != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 1]
  ------------------
  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|      1|    objs_free_locks();
  222|      1|}
OBJ_nid2obj:
  331|  1.16k|{
  332|  1.16k|    ADDED_OBJ ad, *adp = NULL;
  333|  1.16k|    ASN1_OBJECT ob;
  334|       |
  335|  1.16k|    if (n == NID_undef
  ------------------
  |  |   18|  2.32k|#define NID_undef                       0
  ------------------
  |  Branch (335:9): [True: 1, False: 1.16k]
  ------------------
  336|  1.16k|        || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef))
  ------------------
  |  | 1353|  2.32k|#define NUM_NID 1496
  ------------------
                      || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef))
  ------------------
  |  |   18|  1.16k|#define NID_undef                       0
  ------------------
  |  Branch (336:13): [True: 1.16k, False: 0]
  |  Branch (336:22): [True: 1.16k, False: 0]
  |  Branch (336:37): [True: 1.16k, False: 0]
  ------------------
  337|  1.16k|        return (ASN1_OBJECT *)&(nid_objs[n]);
  338|       |
  339|      0|    ad.type = ADDED_NID;
  ------------------
  |  |   33|      0|#define ADDED_NID       3
  ------------------
  340|      0|    ad.obj = &ob;
  341|      0|    ob.nid = n;
  342|      0|    if (!ossl_obj_read_lock(1)) {
  ------------------
  |  Branch (342:9): [True: 0, False: 0]
  ------------------
  343|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  344|      0|        return NULL;
  345|      0|    }
  346|      0|    if (added != NULL)
  ------------------
  |  Branch (346:9): [True: 0, False: 0]
  ------------------
  347|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  348|      0|    ossl_obj_unlock(1);
  349|      0|    if (adp != NULL)
  ------------------
  |  Branch (349:9): [True: 0, False: 0]
  ------------------
  350|      0|        return adp->obj;
  351|       |
  352|      0|    ERR_raise(ERR_LIB_OBJ, OBJ_R_UNKNOWN_NID);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  353|      0|    return NULL;
  354|      0|}
OBJ_nid2sn:
  357|    397|{
  358|    397|    ASN1_OBJECT *ob = OBJ_nid2obj(n);
  359|       |
  360|    397|    return ob == NULL ? NULL : ob->sn;
  ------------------
  |  Branch (360:12): [True: 0, False: 397]
  ------------------
  361|    397|}
OBJ_nid2ln:
  364|    396|{
  365|    396|    ASN1_OBJECT *ob = OBJ_nid2obj(n);
  366|       |
  367|    396|    return ob == NULL ? NULL : ob->ln;
  ------------------
  |  Branch (367:12): [True: 0, False: 396]
  ------------------
  368|    396|}
OBJ_obj2txt:
  469|    210|{
  470|    210|    int i, n = 0, len, nid, first, use_bn;
  471|    210|    BIGNUM *bl;
  472|    210|    unsigned long l;
  473|    210|    const unsigned char *p;
  474|    210|    char tbuf[DECIMAL_SIZE(i) + DECIMAL_SIZE(l) + 2];
  475|    210|    const char *s;
  476|       |
  477|       |    /* Ensure that, at every state, |buf| is NUL-terminated. */
  478|    210|    if (buf != NULL && buf_len > 0)
  ------------------
  |  Branch (478:9): [True: 210, False: 0]
  |  Branch (478:24): [True: 210, False: 0]
  ------------------
  479|    210|        buf[0] = '\0';
  480|       |
  481|    210|    if (a == NULL || a->data == NULL)
  ------------------
  |  Branch (481:9): [True: 0, False: 210]
  |  Branch (481:22): [True: 1, False: 209]
  ------------------
  482|      1|        return 0;
  483|       |
  484|    209|    if (!no_name && (nid = OBJ_obj2nid(a)) != NID_undef) {
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (484:9): [True: 0, False: 209]
  |  Branch (484:21): [True: 0, False: 0]
  ------------------
  485|      0|        s = OBJ_nid2ln(nid);
  486|      0|        if (s == NULL)
  ------------------
  |  Branch (486:13): [True: 0, False: 0]
  ------------------
  487|      0|            s = OBJ_nid2sn(nid);
  488|      0|        if (s != NULL) {
  ------------------
  |  Branch (488:13): [True: 0, False: 0]
  ------------------
  489|      0|            if (buf != NULL)
  ------------------
  |  Branch (489:17): [True: 0, False: 0]
  ------------------
  490|      0|                OPENSSL_strlcpy(buf, s, buf_len);
  491|      0|            return (int)strlen(s);
  492|      0|        }
  493|      0|    }
  494|       |
  495|    209|    len = a->length;
  496|    209|    p = a->data;
  497|       |
  498|    209|    first = 1;
  499|    209|    bl = NULL;
  500|       |
  501|       |    /*
  502|       |     * RFC 2578 (STD 58) says this about OBJECT IDENTIFIERs:
  503|       |     *
  504|       |     * > 3.5. OBJECT IDENTIFIER values
  505|       |     * >
  506|       |     * > An OBJECT IDENTIFIER value is an ordered list of non-negative
  507|       |     * > numbers. For the SMIv2, each number in the list is referred to as a
  508|       |     * > sub-identifier, there are at most 128 sub-identifiers in a value,
  509|       |     * > and each sub-identifier has a maximum value of 2^32-1 (4294967295
  510|       |     * > decimal).
  511|       |     *
  512|       |     * So a legitimate OID according to this RFC is at most (32 * 128 / 7),
  513|       |     * i.e. 586 bytes long.
  514|       |     *
  515|       |     * Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
  516|       |     */
  517|    209|    if (len > 586)
  ------------------
  |  Branch (517:9): [True: 0, False: 209]
  ------------------
  518|      0|        goto err;
  519|       |
  520|  1.59k|    while (len > 0) {
  ------------------
  |  Branch (520:12): [True: 1.38k, False: 209]
  ------------------
  521|  1.38k|        l = 0;
  522|  1.38k|        use_bn = 0;
  523|  1.70k|        for (;;) {
  524|  1.70k|            unsigned char c = *p++;
  525|       |
  526|  1.70k|            len--;
  527|  1.70k|            if (len == 0 && (c & 0x80) != 0)
  ------------------
  |  Branch (527:17): [True: 209, False: 1.49k]
  |  Branch (527:29): [True: 0, False: 209]
  ------------------
  528|      0|                goto err;
  529|  1.70k|            if (use_bn) {
  ------------------
  |  Branch (529:17): [True: 0, False: 1.70k]
  ------------------
  530|      0|                if (!BN_add_word(bl, c & 0x7f))
  ------------------
  |  Branch (530:21): [True: 0, False: 0]
  ------------------
  531|      0|                    goto err;
  532|  1.70k|            } else {
  533|  1.70k|                l |= c & 0x7f;
  534|  1.70k|            }
  535|  1.70k|            if ((c & 0x80) == 0)
  ------------------
  |  Branch (535:17): [True: 1.38k, False: 322]
  ------------------
  536|  1.38k|                break;
  537|    322|            if (!use_bn && l > (ULONG_MAX >> 7L)) {
  ------------------
  |  Branch (537:17): [True: 322, False: 0]
  |  Branch (537:28): [True: 0, False: 322]
  ------------------
  538|      0|                if (bl == NULL && (bl = BN_new()) == NULL)
  ------------------
  |  Branch (538:21): [True: 0, False: 0]
  |  Branch (538:35): [True: 0, False: 0]
  ------------------
  539|      0|                    goto err;
  540|      0|                if (!BN_set_word(bl, l))
  ------------------
  |  Branch (540:21): [True: 0, False: 0]
  ------------------
  541|      0|                    goto err;
  542|      0|                use_bn = 1;
  543|      0|            }
  544|    322|            if (use_bn) {
  ------------------
  |  Branch (544:17): [True: 0, False: 322]
  ------------------
  545|      0|                if (!BN_lshift(bl, bl, 7))
  ------------------
  |  Branch (545:21): [True: 0, False: 0]
  ------------------
  546|      0|                    goto err;
  547|    322|            } else {
  548|    322|                l <<= 7L;
  549|    322|            }
  550|    322|        }
  551|       |
  552|  1.38k|        if (first) {
  ------------------
  |  Branch (552:13): [True: 209, False: 1.17k]
  ------------------
  553|    209|            first = 0;
  554|    209|            if (l >= 80) {
  ------------------
  |  Branch (554:17): [True: 81, False: 128]
  ------------------
  555|     81|                i = 2;
  556|     81|                if (use_bn) {
  ------------------
  |  Branch (556:21): [True: 0, False: 81]
  ------------------
  557|      0|                    if (!BN_sub_word(bl, 80))
  ------------------
  |  Branch (557:25): [True: 0, False: 0]
  ------------------
  558|      0|                        goto err;
  559|     81|                } else {
  560|     81|                    l -= 80;
  561|     81|                }
  562|    128|            } else {
  563|    128|                i = (int)(l / 40);
  564|    128|                l -= (long)(i * 40);
  565|    128|            }
  566|    209|            if (buf != NULL && buf_len > 1) {
  ------------------
  |  Branch (566:17): [True: 209, False: 0]
  |  Branch (566:32): [True: 209, False: 0]
  ------------------
  567|    209|                *buf++ = i + '0';
  568|    209|                *buf = '\0';
  569|    209|                buf_len--;
  570|    209|            }
  571|    209|            n++;
  572|    209|        }
  573|       |
  574|  1.38k|        if (use_bn) {
  ------------------
  |  Branch (574:13): [True: 0, False: 1.38k]
  ------------------
  575|      0|            char *bndec;
  576|      0|            bndec = BN_bn2dec(bl);
  577|      0|            if (!bndec)
  ------------------
  |  Branch (577:17): [True: 0, False: 0]
  ------------------
  578|      0|                goto err;
  579|      0|            i = strlen(bndec);
  580|      0|            if (buf != NULL) {
  ------------------
  |  Branch (580:17): [True: 0, False: 0]
  ------------------
  581|      0|                if (buf_len > 1) {
  ------------------
  |  Branch (581:21): [True: 0, False: 0]
  ------------------
  582|      0|                    *buf++ = '.';
  583|      0|                    *buf = '\0';
  584|      0|                    buf_len--;
  585|      0|                }
  586|      0|                OPENSSL_strlcpy(buf, bndec, buf_len);
  587|      0|                if (i > buf_len) {
  ------------------
  |  Branch (587:21): [True: 0, False: 0]
  ------------------
  588|      0|                    buf += buf_len;
  589|      0|                    buf_len = 0;
  590|      0|                } else {
  591|      0|                    buf += i;
  592|      0|                    buf_len -= i;
  593|      0|                }
  594|      0|            }
  595|      0|            n++;
  596|      0|            n += i;
  597|      0|            OPENSSL_free(bndec);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  598|  1.38k|        } else {
  599|  1.38k|            BIO_snprintf(tbuf, sizeof(tbuf), ".%lu", l);
  600|  1.38k|            i = strlen(tbuf);
  601|  1.38k|            if (buf && buf_len > 0) {
  ------------------
  |  Branch (601:17): [True: 1.38k, False: 0]
  |  Branch (601:24): [True: 1.38k, False: 0]
  ------------------
  602|  1.38k|                OPENSSL_strlcpy(buf, tbuf, buf_len);
  603|  1.38k|                if (i > buf_len) {
  ------------------
  |  Branch (603:21): [True: 0, False: 1.38k]
  ------------------
  604|      0|                    buf += buf_len;
  605|      0|                    buf_len = 0;
  606|  1.38k|                } else {
  607|  1.38k|                    buf += i;
  608|  1.38k|                    buf_len -= i;
  609|  1.38k|                }
  610|  1.38k|            }
  611|  1.38k|            n += i;
  612|  1.38k|            l = 0;
  613|  1.38k|        }
  614|  1.38k|    }
  615|       |
  616|    209|    BN_free(bl);
  617|    209|    return n;
  618|       |
  619|      0| err:
  620|      0|    BN_free(bl);
  621|      0|    return -1;
  622|    209|}
OBJ_ln2nid:
  637|    435|{
  638|    435|    ASN1_OBJECT o;
  639|    435|    const ASN1_OBJECT *oo = &o;
  640|    435|    ADDED_OBJ ad, *adp;
  641|    435|    const unsigned int *op;
  642|    435|    int nid = NID_undef;
  ------------------
  |  |   18|    435|#define NID_undef                       0
  ------------------
  643|       |
  644|    435|    o.ln = s;
  645|    435|    op = OBJ_bsearch_ln(&oo, ln_objs, NUM_LN);
  ------------------
  |  | 4344|    435|#define NUM_LN 1487
  ------------------
  646|    435|    if (op != NULL)
  ------------------
  |  Branch (646:9): [True: 377, False: 58]
  ------------------
  647|    377|        return nid_objs[*op].nid;
  648|     58|    if (!ossl_obj_read_lock(1)) {
  ------------------
  |  Branch (648:9): [True: 0, False: 58]
  ------------------
  649|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  650|      0|        return NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  651|      0|    }
  652|     58|    if (added != NULL) {
  ------------------
  |  Branch (652:9): [True: 0, False: 58]
  ------------------
  653|      0|        ad.type = ADDED_LNAME;
  ------------------
  |  |   32|      0|#define ADDED_LNAME     2
  ------------------
  654|      0|        ad.obj = &o;
  655|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  656|      0|        if (adp != NULL)
  ------------------
  |  Branch (656:13): [True: 0, False: 0]
  ------------------
  657|      0|            nid = adp->obj->nid;
  658|      0|    }
  659|     58|    ossl_obj_unlock(1);
  660|     58|    return nid;
  661|     58|}
OBJ_sn2nid:
  664|    440|{
  665|    440|    ASN1_OBJECT o;
  666|    440|    const ASN1_OBJECT *oo = &o;
  667|    440|    ADDED_OBJ ad, *adp;
  668|    440|    const unsigned int *op;
  669|    440|    int nid = NID_undef;
  ------------------
  |  |   18|    440|#define NID_undef                       0
  ------------------
  670|       |
  671|    440|    o.sn = s;
  672|    440|    op = OBJ_bsearch_sn(&oo, sn_objs, NUM_SN);
  ------------------
  |  | 2853|    440|#define NUM_SN 1487
  ------------------
  673|    440|    if (op != NULL)
  ------------------
  |  Branch (673:9): [True: 29, False: 411]
  ------------------
  674|     29|        return nid_objs[*op].nid;
  675|    411|    if (!ossl_obj_read_lock(1)) {
  ------------------
  |  Branch (675:9): [True: 0, False: 411]
  ------------------
  676|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  677|      0|        return NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  678|      0|    }
  679|    411|    if (added != NULL) {
  ------------------
  |  Branch (679:9): [True: 0, False: 411]
  ------------------
  680|      0|        ad.type = ADDED_SNAME;
  ------------------
  |  |   31|      0|#define ADDED_SNAME     1
  ------------------
  681|      0|        ad.obj = &o;
  682|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  683|      0|        if (adp != NULL)
  ------------------
  |  Branch (683:13): [True: 0, False: 0]
  ------------------
  684|      0|            nid = adp->obj->nid;
  685|      0|    }
  686|    411|    ossl_obj_unlock(1);
  687|    411|    return nid;
  688|    411|}
OBJ_bsearch_:
  692|  1.75k|{
  693|  1.75k|    return OBJ_bsearch_ex_(key, base, num, size, cmp, 0);
  694|  1.75k|}
OBJ_bsearch_ex_:
  700|  1.75k|{
  701|  1.75k|    const char *p = ossl_bsearch(key, base, num, size, cmp, flags);
  702|       |
  703|       |#ifdef CHARSET_EBCDIC
  704|       |    /*
  705|       |     * THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and I
  706|       |     * don't have perl (yet), we revert to a *LINEAR* search when the object
  707|       |     * wasn't found in the binary search.
  708|       |     */
  709|       |    if (p == NULL) {
  710|       |        const char *base_ = base;
  711|       |        int l, h, i = 0, c = 0;
  712|       |        char *p1;
  713|       |
  714|       |        for (i = 0; i < num; ++i) {
  715|       |            p1 = &(base_[i * size]);
  716|       |            c = (*cmp) (key, p1);
  717|       |            if (c == 0
  718|       |                || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)))
  719|       |                return p1;
  720|       |        }
  721|       |    }
  722|       |#endif
  723|  1.75k|    return p;
  724|  1.75k|}
OBJ_get0_data:
  851|    159|{
  852|    159|    if (obj == NULL)
  ------------------
  |  Branch (852:9): [True: 0, False: 159]
  ------------------
  853|      0|        return NULL;
  854|    159|    return obj->data;
  855|    159|}
obj_dat.c:objs_free_locks:
   49|      1|{
   50|      1|    CRYPTO_THREAD_lock_free(ossl_obj_lock);
   51|      1|    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|      1|}
obj_dat.c:ossl_obj_read_lock:
   93|    469|{
   94|    469|    if (!lock)
  ------------------
  |  Branch (94:9): [True: 0, False: 469]
  ------------------
   95|      0|        return 1;
   96|    469|    if (!ossl_init_added_lock())
  ------------------
  |  Branch (96:9): [True: 0, False: 469]
  ------------------
   97|      0|        return 0;
   98|    469|    return CRYPTO_THREAD_read_lock(ossl_obj_lock);
   99|    469|}
obj_dat.c:ossl_init_added_lock:
   75|    469|{
   76|    469|#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
   77|       |    /* Make sure we've loaded config before checking for any "added" objects */
   78|    469|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  472|    469|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
   79|    469|#endif
   80|    469|    return RUN_ONCE(&ossl_obj_lock_init, obj_lock_initialise);
  ------------------
  |  |  130|    469|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 469, False: 0]
  |  |  ------------------
  ------------------
   81|    469|}
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|    469|{
  103|    469|    if (lock)
  ------------------
  |  Branch (103:9): [True: 469, False: 0]
  ------------------
  104|    469|        CRYPTO_THREAD_unlock(ossl_obj_lock);
  105|    469|}
obj_dat.c:ln_cmp:
  115|  4.43k|{
  116|  4.43k|    return strcmp((*a)->ln, nid_objs[*b].ln);
  117|  4.43k|}
obj_dat.c:sn_cmp:
  108|  4.79k|{
  109|  4.79k|    return strcmp((*a)->sn, nid_objs[*b].sn);
  110|  4.79k|}

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

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

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

OSSL_PARAM_BLD_new:
   92|      3|{
   93|      3|    OSSL_PARAM_BLD *r = OPENSSL_zalloc(sizeof(OSSL_PARAM_BLD));
  ------------------
  |  |  104|      3|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|       |
   95|      3|    if (r != NULL) {
  ------------------
  |  Branch (95:9): [True: 3, False: 0]
  ------------------
   96|      3|        r->params = sk_OSSL_PARAM_BLD_DEF_new_null();
   97|      3|        if (r->params == NULL) {
  ------------------
  |  Branch (97:13): [True: 0, False: 3]
  ------------------
   98|      0|            OPENSSL_free(r);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   99|      0|            r = NULL;
  100|      0|        }
  101|      3|    }
  102|      3|    return r;
  103|      3|}
OSSL_PARAM_BLD_free:
  114|      3|{
  115|      3|    if (bld == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 3]
  ------------------
  116|      0|        return;
  117|      3|    free_all_params(bld);
  118|      3|    sk_OSSL_PARAM_BLD_DEF_free(bld->params);
  119|      3|    OPENSSL_free(bld);
  ------------------
  |  |  115|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  120|      3|}
OSSL_PARAM_BLD_push_octet_string:
  284|      9|{
  285|      9|    OSSL_PARAM_BLD_DEF *pd;
  286|      9|    int secure;
  287|       |
  288|      9|    secure = CRYPTO_secure_allocated(buf);
  289|      9|    pd = param_push(bld, key, bsize, bsize, OSSL_PARAM_OCTET_STRING, secure);
  ------------------
  |  |  123|      9|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  290|      9|    if (pd == NULL)
  ------------------
  |  Branch (290:9): [True: 0, False: 9]
  ------------------
  291|      0|        return 0;
  292|      9|    pd->string = buf;
  293|      9|    return 1;
  294|      9|}
OSSL_PARAM_BLD_to_param:
  362|      3|{
  363|      3|    OSSL_PARAM_ALIGNED_BLOCK *blk, *s = NULL;
  364|      3|    OSSL_PARAM *params, *last;
  365|      3|    const int num = sk_OSSL_PARAM_BLD_DEF_num(bld->params);
  366|      3|    const size_t p_blks = ossl_param_bytes_to_blocks((1 + num) * sizeof(*params));
  367|      3|    const size_t total = OSSL_PARAM_ALIGN_SIZE * (p_blks + bld->total_blocks);
  ------------------
  |  |   22|      3|# define OSSL_PARAM_ALIGN_SIZE  sizeof(OSSL_PARAM_ALIGNED_BLOCK)
  ------------------
  368|      3|    const size_t ss = OSSL_PARAM_ALIGN_SIZE * bld->secure_blocks;
  ------------------
  |  |   22|      3|# define OSSL_PARAM_ALIGN_SIZE  sizeof(OSSL_PARAM_ALIGNED_BLOCK)
  ------------------
  369|       |
  370|      3|    if (ss > 0) {
  ------------------
  |  Branch (370:9): [True: 0, False: 3]
  ------------------
  371|      0|        s = OPENSSL_secure_malloc(ss);
  ------------------
  |  |  123|      0|        CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  372|      0|        if (s == NULL) {
  ------------------
  |  Branch (372:13): [True: 0, False: 0]
  ------------------
  373|      0|            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_SECURE_MALLOC_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  374|      0|            return NULL;
  375|      0|        }
  376|      0|    }
  377|      3|    params = OPENSSL_malloc(total);
  ------------------
  |  |  102|      3|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  378|      3|    if (params == NULL) {
  ------------------
  |  Branch (378:9): [True: 0, False: 3]
  ------------------
  379|      0|        OPENSSL_secure_free(s);
  ------------------
  |  |  127|      0|        CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  380|      0|        return NULL;
  381|      0|    }
  382|      3|    blk = p_blks + (OSSL_PARAM_ALIGNED_BLOCK *)(params);
  383|      3|    last = param_bld_convert(bld, params, blk, s);
  384|      3|    ossl_param_set_secure_block(last, s, ss);
  385|       |
  386|       |    /* Reset builder for reuse */
  387|      3|    bld->total_blocks = 0;
  388|      3|    bld->secure_blocks = 0;
  389|      3|    free_all_params(bld);
  390|      3|    return params;
  391|      3|}
param_build.c:free_all_params:
  106|      6|{
  107|      6|    int i, n = sk_OSSL_PARAM_BLD_DEF_num(bld->params);
  108|       |
  109|     15|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (109:17): [True: 9, False: 6]
  ------------------
  110|      9|        OPENSSL_free(sk_OSSL_PARAM_BLD_DEF_pop(bld->params));
  ------------------
  |  |  115|      9|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  111|      6|}
param_build.c:param_push:
   54|      9|{
   55|      9|    OSSL_PARAM_BLD_DEF *pd = OPENSSL_zalloc(sizeof(*pd));
  ------------------
  |  |  104|      9|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|       |
   57|      9|    if (pd == NULL)
  ------------------
  |  Branch (57:9): [True: 0, False: 9]
  ------------------
   58|      0|        return NULL;
   59|      9|    pd->key = key;
   60|      9|    pd->type = type;
   61|      9|    pd->size = size;
   62|      9|    pd->alloc_blocks = ossl_param_bytes_to_blocks(alloc);
   63|      9|    if ((pd->secure = secure) != 0)
  ------------------
  |  Branch (63:9): [True: 0, False: 9]
  ------------------
   64|      0|        bld->secure_blocks += pd->alloc_blocks;
   65|      9|    else
   66|      9|        bld->total_blocks += pd->alloc_blocks;
   67|      9|    if (sk_OSSL_PARAM_BLD_DEF_push(bld->params, pd) <= 0) {
  ------------------
  |  Branch (67:9): [True: 0, False: 9]
  ------------------
   68|      0|        OPENSSL_free(pd);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   69|      0|        pd = NULL;
   70|      0|    }
   71|      9|    return pd;
   72|      9|}
param_build.c:param_bld_convert:
  311|      3|{
  312|      3|    int i, num = sk_OSSL_PARAM_BLD_DEF_num(bld->params);
  313|      3|    OSSL_PARAM_BLD_DEF *pd;
  314|      3|    void *p;
  315|       |
  316|     12|    for (i = 0; i < num; i++) {
  ------------------
  |  Branch (316:17): [True: 9, False: 3]
  ------------------
  317|      9|        pd = sk_OSSL_PARAM_BLD_DEF_value(bld->params, i);
  318|      9|        param[i].key = pd->key;
  319|      9|        param[i].data_type = pd->type;
  320|      9|        param[i].data_size = pd->size;
  321|      9|        param[i].return_size = OSSL_PARAM_UNMODIFIED;
  ------------------
  |  |   22|      9|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  ------------------
  322|       |
  323|      9|        if (pd->secure) {
  ------------------
  |  Branch (323:13): [True: 0, False: 9]
  ------------------
  324|      0|            p = secure;
  325|      0|            secure += pd->alloc_blocks;
  326|      9|        } else {
  327|      9|            p = blk;
  328|      9|            blk += pd->alloc_blocks;
  329|      9|        }
  330|      9|        param[i].data = p;
  331|      9|        if (pd->bn != NULL) {
  ------------------
  |  Branch (331:13): [True: 0, False: 9]
  ------------------
  332|       |            /* BIGNUM */
  333|      0|            if (pd->type == OSSL_PARAM_UNSIGNED_INTEGER)
  ------------------
  |  |  107|      0|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (333:17): [True: 0, False: 0]
  ------------------
  334|      0|                BN_bn2nativepad(pd->bn, (unsigned char *)p, pd->size);
  335|      0|            else
  336|      0|                BN_signed_bn2native(pd->bn, (unsigned char *)p, pd->size);
  337|      9|        } else if (pd->type == OSSL_PARAM_OCTET_PTR
  ------------------
  |  |  160|     18|# define OSSL_PARAM_OCTET_PTR            7
  ------------------
  |  Branch (337:20): [True: 0, False: 9]
  ------------------
  338|      9|                   || pd->type == OSSL_PARAM_UTF8_PTR) {
  ------------------
  |  |  141|      9|# define OSSL_PARAM_UTF8_PTR             6
  ------------------
  |  Branch (338:23): [True: 0, False: 9]
  ------------------
  339|       |            /* PTR */
  340|      0|            *(const void **)p = pd->string;
  341|      9|        } else if (pd->type == OSSL_PARAM_OCTET_STRING
  ------------------
  |  |  123|     18|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (341:20): [True: 9, False: 0]
  ------------------
  342|      9|                   || pd->type == OSSL_PARAM_UTF8_STRING) {
  ------------------
  |  |  117|      0|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (342:23): [True: 0, False: 0]
  ------------------
  343|      9|            if (pd->string != NULL)
  ------------------
  |  Branch (343:17): [True: 9, False: 0]
  ------------------
  344|      9|                memcpy(p, pd->string, pd->size);
  345|      0|            else
  346|      0|                memset(p, 0, pd->size);
  347|      9|            if (pd->type == OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|      9|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (347:17): [True: 0, False: 9]
  ------------------
  348|      0|                ((char *)p)[pd->size] = '\0';
  349|      9|        } else {
  350|       |            /* Number, but could also be a NULL BIGNUM */
  351|      0|            if (pd->size > sizeof(pd->num))
  ------------------
  |  Branch (351:17): [True: 0, False: 0]
  ------------------
  352|      0|                memset(p, 0, pd->size);
  353|      0|            else if (pd->size > 0)
  ------------------
  |  Branch (353:22): [True: 0, False: 0]
  ------------------
  354|      0|                memcpy(p, &pd->num, pd->size);
  355|      0|        }
  356|      9|    }
  357|      3|    param[i] = OSSL_PARAM_construct_end();
  358|      3|    return param + i;
  359|      3|}

ossl_param_build_set_octet_string:
   59|      9|{
   60|      9|    if (bld != NULL)
  ------------------
  |  Branch (60:9): [True: 9, False: 0]
  ------------------
   61|      9|        return OSSL_PARAM_BLD_push_octet_string(bld, key, data, data_len);
   62|       |
   63|      0|    p = OSSL_PARAM_locate(p, key);
   64|      0|    if (p != NULL)
  ------------------
  |  Branch (64:9): [True: 0, False: 0]
  ------------------
   65|      0|        return OSSL_PARAM_set_octet_string(p, data, data_len);
   66|      0|    return 1;
   67|      0|}

OSSL_PARAM_locate:
   54|  6.88k|{
   55|  6.88k|    if (p != NULL && key != NULL)
  ------------------
  |  Branch (55:9): [True: 6.88k, False: 0]
  |  Branch (55:22): [True: 6.88k, False: 0]
  ------------------
   56|  17.0k|        for (; p->key != NULL; p++)
  ------------------
  |  Branch (56:16): [True: 13.8k, False: 3.19k]
  ------------------
   57|  13.8k|            if (strcmp(key, p->key) == 0)
  ------------------
  |  Branch (57:17): [True: 3.69k, False: 10.1k]
  ------------------
   58|  3.69k|                return p;
   59|  3.19k|    return NULL;
   60|  6.88k|}
OSSL_PARAM_locate_const:
   63|  1.72k|{
   64|  1.72k|    return OSSL_PARAM_locate((OSSL_PARAM *)p, key);
   65|  1.72k|}
OSSL_PARAM_modified:
   81|    735|{
   82|    735|    return p != NULL && p->return_size != OSSL_PARAM_UNMODIFIED;
  ------------------
  |  |   22|    735|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  ------------------
  |  Branch (82:12): [True: 735, False: 0]
  |  Branch (82:25): [True: 3, False: 732]
  ------------------
   83|    735|}
OSSL_PARAM_get_int:
  267|     15|{
  268|     15|#ifndef OPENSSL_SMALL_FOOTPRINT
  269|     15|    switch (sizeof(int)) {
  ------------------
  |  Branch (269:13): [Folded - Ignored]
  ------------------
  270|     15|    case sizeof(int32_t):
  ------------------
  |  Branch (270:5): [True: 15, False: 0]
  ------------------
  271|     15|        return OSSL_PARAM_get_int32(p, (int32_t *)val);
  272|      0|    case sizeof(int64_t):
  ------------------
  |  Branch (272:5): [True: 0, False: 15]
  ------------------
  273|      0|        return OSSL_PARAM_get_int64(p, (int64_t *)val);
  274|     15|    }
  275|      0|#endif
  276|      0|    return general_get_int(p, val, sizeof(*val));
  277|     15|}
OSSL_PARAM_set_int:
  280|  1.50k|{
  281|  1.50k|#ifndef OPENSSL_SMALL_FOOTPRINT
  282|  1.50k|    switch (sizeof(int)) {
  ------------------
  |  Branch (282:13): [Folded - Ignored]
  ------------------
  283|  1.50k|    case sizeof(int32_t):
  ------------------
  |  Branch (283:5): [True: 1.50k, False: 0]
  ------------------
  284|  1.50k|        return OSSL_PARAM_set_int32(p, (int32_t)val);
  285|      0|    case sizeof(int64_t):
  ------------------
  |  Branch (285:5): [True: 0, False: 1.50k]
  ------------------
  286|      0|        return OSSL_PARAM_set_int64(p, (int64_t)val);
  287|  1.50k|    }
  288|      0|#endif
  289|      0|    return general_set_int(p, &val, sizeof(val));
  290|  1.50k|}
OSSL_PARAM_construct_int:
  293|  1.50k|{
  294|  1.50k|    return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));
  ------------------
  |  |  106|  1.50k|# define OSSL_PARAM_INTEGER              1
  ------------------
  295|  1.50k|}
OSSL_PARAM_get_uint:
  298|      3|{
  299|      3|#ifndef OPENSSL_SMALL_FOOTPRINT
  300|      3|    switch (sizeof(unsigned int)) {
  ------------------
  |  Branch (300:13): [Folded - Ignored]
  ------------------
  301|      3|    case sizeof(uint32_t):
  ------------------
  |  Branch (301:5): [True: 3, False: 0]
  ------------------
  302|      3|        return OSSL_PARAM_get_uint32(p, (uint32_t *)val);
  303|      0|    case sizeof(uint64_t):
  ------------------
  |  Branch (303:5): [True: 0, False: 3]
  ------------------
  304|      0|        return OSSL_PARAM_get_uint64(p, (uint64_t *)val);
  305|      3|    }
  306|      0|#endif
  307|      0|    return general_get_uint(p, val, sizeof(*val));
  308|      3|}
OSSL_PARAM_set_uint:
  311|    469|{
  312|    469|#ifndef OPENSSL_SMALL_FOOTPRINT
  313|    469|    switch (sizeof(unsigned int)) {
  ------------------
  |  Branch (313:13): [Folded - Ignored]
  ------------------
  314|    469|    case sizeof(uint32_t):
  ------------------
  |  Branch (314:5): [True: 469, False: 0]
  ------------------
  315|    469|        return OSSL_PARAM_set_uint32(p, (uint32_t)val);
  316|      0|    case sizeof(uint64_t):
  ------------------
  |  Branch (316:5): [True: 0, False: 469]
  ------------------
  317|      0|        return OSSL_PARAM_set_uint64(p, (uint64_t)val);
  318|    469|    }
  319|      0|#endif
  320|      0|    return general_set_uint(p, &val, sizeof(val));
  321|    469|}
OSSL_PARAM_construct_uint:
  324|    484|{
  325|    484|    return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
  ------------------
  |  |  107|    484|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  326|    484|                                sizeof(unsigned int));
  327|    484|}
OSSL_PARAM_get_int32:
  393|     15|{
  394|     15|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (394:9): [True: 0, False: 15]
  |  Branch (394:24): [True: 0, False: 15]
  ------------------
  395|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  396|      0|        return 0;
  397|      0|    }
  398|       |
  399|     15|    if (p->data == NULL) {
  ------------------
  |  Branch (399:9): [True: 0, False: 15]
  ------------------
  400|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  401|      0|        return 0;
  402|      0|    }
  403|       |
  404|     15|    if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|     15|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (404:9): [True: 3, False: 12]
  ------------------
  405|      3|#ifndef OPENSSL_SMALL_FOOTPRINT
  406|      3|        int64_t i64;
  407|       |
  408|      3|        switch (p->data_size) {
  ------------------
  |  Branch (408:17): [True: 0, False: 3]
  ------------------
  409|      3|        case sizeof(int32_t):
  ------------------
  |  Branch (409:9): [True: 3, False: 0]
  ------------------
  410|      3|            *val = *(const int32_t *)p->data;
  411|      3|            return 1;
  412|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (412:9): [True: 0, False: 3]
  ------------------
  413|      0|            i64 = *(const int64_t *)p->data;
  414|      0|            if (i64 >= INT32_MIN && i64 <= INT32_MAX) {
  ------------------
  |  Branch (414:17): [True: 0, False: 0]
  |  Branch (414:37): [True: 0, False: 0]
  ------------------
  415|      0|                *val = (int32_t)i64;
  416|      0|                return 1;
  417|      0|            }
  418|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  419|      0|            return 0;
  420|      3|        }
  421|      0|#endif
  422|      0|        return general_get_int(p, val, sizeof(*val));
  423|       |
  424|     12|    } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|     12|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (424:16): [True: 12, False: 0]
  ------------------
  425|     12|#ifndef OPENSSL_SMALL_FOOTPRINT
  426|     12|        uint32_t u32;
  427|     12|        uint64_t u64;
  428|       |
  429|     12|        switch (p->data_size) {
  ------------------
  |  Branch (429:17): [True: 0, False: 12]
  ------------------
  430|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (430:9): [True: 0, False: 12]
  ------------------
  431|      0|            u32 = *(const uint32_t *)p->data;
  432|      0|            if (u32 <= INT32_MAX) {
  ------------------
  |  Branch (432:17): [True: 0, False: 0]
  ------------------
  433|      0|                *val = (int32_t)u32;
  434|      0|                return 1;
  435|      0|            }
  436|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  437|      0|            return 0;
  438|     12|        case sizeof(uint64_t):
  ------------------
  |  Branch (438:9): [True: 12, False: 0]
  ------------------
  439|     12|            u64 = *(const uint64_t *)p->data;
  440|     12|            if (u64 <= INT32_MAX) {
  ------------------
  |  Branch (440:17): [True: 12, False: 0]
  ------------------
  441|     12|                *val = (int32_t)u64;
  442|     12|                return 1;
  443|     12|            }
  444|      0|            err_out_of_range;
  ------------------
  |  |   25|     12|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  445|      0|            return 0;
  446|     12|        }
  447|      0|#endif
  448|      0|        return general_get_int(p, val, sizeof(*val));
  449|       |
  450|     12|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (450:16): [True: 0, False: 0]
  ------------------
  451|      0|#ifndef OPENSSL_SYS_UEFI
  452|      0|        double d;
  453|       |
  454|      0|        switch (p->data_size) {
  ------------------
  |  Branch (454:17): [True: 0, False: 0]
  ------------------
  455|      0|        case sizeof(double):
  ------------------
  |  Branch (455:9): [True: 0, False: 0]
  ------------------
  456|      0|            d = *(const double *)p->data;
  457|      0|            if (d >= INT32_MIN && d <= INT32_MAX && d == (int32_t)d) {
  ------------------
  |  Branch (457:17): [True: 0, False: 0]
  |  Branch (457:35): [True: 0, False: 0]
  |  Branch (457:53): [True: 0, False: 0]
  ------------------
  458|      0|                *val = (int32_t)d;
  459|      0|                return 1;
  460|      0|            }
  461|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  462|      0|            return 0;
  463|      0|        }
  464|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  465|      0|        return 0;
  466|      0|#endif
  467|      0|    }
  468|      0|    err_bad_type;
  ------------------
  |  |   35|     15|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  469|      0|    return 0;
  470|     15|}
OSSL_PARAM_set_int32:
  473|  1.50k|{
  474|  1.50k|    if (p == NULL) {
  ------------------
  |  Branch (474:9): [True: 0, False: 1.50k]
  ------------------
  475|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  476|      0|        return 0;
  477|      0|    }
  478|  1.50k|    p->return_size = 0;
  479|  1.50k|    if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|  1.50k|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (479:9): [True: 1.49k, False: 8]
  ------------------
  480|  1.49k|#ifndef OPENSSL_SMALL_FOOTPRINT
  481|  1.49k|        p->return_size = sizeof(int32_t); /* Minimum expected size */
  482|  1.49k|        if (p->data == NULL)
  ------------------
  |  Branch (482:13): [True: 0, False: 1.49k]
  ------------------
  483|      0|            return 1;
  484|  1.49k|        switch (p->data_size) {
  ------------------
  |  Branch (484:17): [True: 0, False: 1.49k]
  ------------------
  485|  1.49k|        case sizeof(int32_t):
  ------------------
  |  Branch (485:9): [True: 1.49k, False: 0]
  ------------------
  486|  1.49k|            *(int32_t *)p->data = val;
  487|  1.49k|            return 1;
  488|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (488:9): [True: 0, False: 1.49k]
  ------------------
  489|      0|            p->return_size = sizeof(int64_t);
  490|      0|            *(int64_t *)p->data = (int64_t)val;
  491|      0|            return 1;
  492|  1.49k|        }
  493|      0|#endif
  494|      0|        return general_set_int(p, &val, sizeof(val));
  495|  1.49k|    } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
  ------------------
  |  |  107|     16|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (495:16): [True: 8, False: 0]
  |  Branch (495:63): [True: 8, False: 0]
  ------------------
  496|      8|#ifndef OPENSSL_SMALL_FOOTPRINT
  497|      8|        p->return_size = sizeof(uint32_t); /* Minimum expected size */
  498|      8|        if (p->data == NULL)
  ------------------
  |  Branch (498:13): [True: 0, False: 8]
  ------------------
  499|      0|            return 1;
  500|      8|        switch (p->data_size) {
  ------------------
  |  Branch (500:17): [True: 0, False: 8]
  ------------------
  501|      8|        case sizeof(uint32_t):
  ------------------
  |  Branch (501:9): [True: 8, False: 0]
  ------------------
  502|      8|            *(uint32_t *)p->data = (uint32_t)val;
  503|      8|            return 1;
  504|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (504:9): [True: 0, False: 8]
  ------------------
  505|      0|            p->return_size = sizeof(uint64_t);
  506|      0|            *(uint64_t *)p->data = (uint64_t)val;
  507|      0|            return 1;
  508|      8|        }
  509|      0|#endif
  510|      0|        return general_set_int(p, &val, sizeof(val));
  511|      8|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (511:16): [True: 0, False: 0]
  ------------------
  512|      0|#ifndef OPENSSL_SYS_UEFI
  513|      0|        uint32_t u32;
  514|      0|        unsigned int shift;
  515|       |
  516|      0|        p->return_size = sizeof(double);
  517|      0|        if (p->data == NULL)
  ------------------
  |  Branch (517:13): [True: 0, False: 0]
  ------------------
  518|      0|            return 1;
  519|      0|        switch (p->data_size) {
  ------------------
  |  Branch (519:17): [True: 0, False: 0]
  ------------------
  520|      0|        case sizeof(double):
  ------------------
  |  Branch (520:9): [True: 0, False: 0]
  ------------------
  521|      0|            shift = real_shift();
  522|      0|            if (shift < 8 * sizeof(val) - 1) {
  ------------------
  |  Branch (522:17): [True: 0, False: 0]
  ------------------
  523|      0|                u32 = val < 0 ? -val : val;
  ------------------
  |  Branch (523:23): [True: 0, False: 0]
  ------------------
  524|      0|                if ((u32 >> shift) != 0) {
  ------------------
  |  Branch (524:21): [True: 0, False: 0]
  ------------------
  525|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  526|      0|                    return 0;
  527|      0|                }
  528|      0|            }
  529|      0|            *(double *)p->data = (double)val;
  530|      0|            return 1;
  531|      0|        }
  532|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  533|      0|        return 0;
  534|      0|#endif
  535|      0|    }
  536|      0|    err_bad_type;
  ------------------
  |  |   35|  1.50k|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  537|      0|    return 0;
  538|  1.50k|}
OSSL_PARAM_get_uint32:
  547|      3|{
  548|      3|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (548:9): [True: 0, False: 3]
  |  Branch (548:24): [True: 0, False: 3]
  ------------------
  549|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  550|      0|        return 0;
  551|      0|    }
  552|       |
  553|      3|    if (p->data == NULL) {
  ------------------
  |  Branch (553:9): [True: 0, False: 3]
  ------------------
  554|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  555|      0|        return 0;
  556|      0|    }
  557|       |
  558|      3|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|      3|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (558:9): [True: 3, False: 0]
  ------------------
  559|      3|#ifndef OPENSSL_SMALL_FOOTPRINT
  560|      3|        uint64_t u64;
  561|       |
  562|      3|        switch (p->data_size) {
  ------------------
  |  Branch (562:17): [True: 0, False: 3]
  ------------------
  563|      3|        case sizeof(uint32_t):
  ------------------
  |  Branch (563:9): [True: 3, False: 0]
  ------------------
  564|      3|            *val = *(const uint32_t *)p->data;
  565|      3|            return 1;
  566|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (566:9): [True: 0, False: 3]
  ------------------
  567|      0|            u64 = *(const uint64_t *)p->data;
  568|      0|            if (u64 <= UINT32_MAX) {
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                *val = (uint32_t)u64;
  570|      0|                return 1;
  571|      0|            }
  572|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  573|      0|            return 0;
  574|      3|        }
  575|      0|#endif
  576|      0|        return general_get_uint(p, val, sizeof(*val));
  577|      3|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (577:16): [True: 0, False: 0]
  ------------------
  578|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  579|      0|        int32_t i32;
  580|      0|        int64_t i64;
  581|       |
  582|      0|        switch (p->data_size) {
  ------------------
  |  Branch (582:17): [True: 0, False: 0]
  ------------------
  583|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (583:9): [True: 0, False: 0]
  ------------------
  584|      0|            i32 = *(const int32_t *)p->data;
  585|      0|            if (i32 >= 0) {
  ------------------
  |  Branch (585:17): [True: 0, False: 0]
  ------------------
  586|      0|                *val = i32;
  587|      0|                return 1;
  588|      0|            }
  589|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  590|      0|            return 0;
  591|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (591:9): [True: 0, False: 0]
  ------------------
  592|      0|            i64 = *(const int64_t *)p->data;
  593|      0|            if (i64 >= 0 && i64 <= UINT32_MAX) {
  ------------------
  |  Branch (593:17): [True: 0, False: 0]
  |  Branch (593:29): [True: 0, False: 0]
  ------------------
  594|      0|                *val = (uint32_t)i64;
  595|      0|                return 1;
  596|      0|            }
  597|      0|            if (i64 < 0)
  ------------------
  |  Branch (597:17): [True: 0, False: 0]
  ------------------
  598|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  599|      0|            else
  600|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  601|      0|            return 0;
  602|      0|        }
  603|      0|#endif
  604|      0|        return general_get_uint(p, val, sizeof(*val));
  605|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (605:16): [True: 0, False: 0]
  ------------------
  606|      0|#ifndef OPENSSL_SYS_UEFI
  607|      0|        double d;
  608|       |
  609|      0|        switch (p->data_size) {
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|        case sizeof(double):
  ------------------
  |  Branch (610:9): [True: 0, False: 0]
  ------------------
  611|      0|            d = *(const double *)p->data;
  612|      0|            if (d >= 0 && d <= UINT32_MAX && d == (uint32_t)d) {
  ------------------
  |  Branch (612:17): [True: 0, False: 0]
  |  Branch (612:27): [True: 0, False: 0]
  |  Branch (612:46): [True: 0, False: 0]
  ------------------
  613|      0|                *val = (uint32_t)d;
  614|      0|                return 1;
  615|      0|            }
  616|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  617|      0|            return 0;
  618|      0|        }
  619|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  620|      0|        return 0;
  621|      0|#endif
  622|      0|    }
  623|      0|    err_bad_type;
  ------------------
  |  |   35|      3|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  624|      0|    return 0;
  625|      3|}
OSSL_PARAM_set_uint32:
  628|    469|{
  629|    469|    if (p == NULL) {
  ------------------
  |  Branch (629:9): [True: 0, False: 469]
  ------------------
  630|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  631|      0|        return 0;
  632|      0|    }
  633|    469|    p->return_size = 0;
  634|       |
  635|    469|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|    469|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (635:9): [True: 469, False: 0]
  ------------------
  636|    469|#ifndef OPENSSL_SMALL_FOOTPRINT
  637|    469|        p->return_size = sizeof(uint32_t); /* Minimum expected size */
  638|    469|        if (p->data == NULL)
  ------------------
  |  Branch (638:13): [True: 0, False: 469]
  ------------------
  639|      0|            return 1;
  640|    469|        switch (p->data_size) {
  ------------------
  |  Branch (640:17): [True: 0, False: 469]
  ------------------
  641|    469|        case sizeof(uint32_t):
  ------------------
  |  Branch (641:9): [True: 469, False: 0]
  ------------------
  642|    469|            *(uint32_t *)p->data = val;
  643|    469|            return 1;
  644|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (644:9): [True: 0, False: 469]
  ------------------
  645|      0|            p->return_size = sizeof(uint64_t);
  646|      0|            *(uint64_t *)p->data = val;
  647|      0|            return 1;
  648|    469|        }
  649|      0|#endif
  650|      0|        return general_set_uint(p, &val, sizeof(val));
  651|    469|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (651:16): [True: 0, False: 0]
  ------------------
  652|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  653|      0|        p->return_size = sizeof(int32_t); /* Minimum expected size */
  654|      0|        if (p->data == NULL)
  ------------------
  |  Branch (654:13): [True: 0, False: 0]
  ------------------
  655|      0|            return 1;
  656|      0|        switch (p->data_size) {
  ------------------
  |  Branch (656:17): [True: 0, False: 0]
  ------------------
  657|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (657:9): [True: 0, False: 0]
  ------------------
  658|      0|            if (val <= INT32_MAX) {
  ------------------
  |  Branch (658:17): [True: 0, False: 0]
  ------------------
  659|      0|                *(int32_t *)p->data = (int32_t)val;
  660|      0|                return 1;
  661|      0|            }
  662|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  663|      0|            return 0;
  664|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (664:9): [True: 0, False: 0]
  ------------------
  665|      0|            p->return_size = sizeof(int64_t);
  666|      0|            *(int64_t *)p->data = (int64_t)val;
  667|      0|            return 1;
  668|      0|        }
  669|      0|#endif
  670|      0|        return general_set_uint(p, &val, sizeof(val));
  671|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (671:16): [True: 0, False: 0]
  ------------------
  672|      0|#ifndef OPENSSL_SYS_UEFI
  673|      0|        unsigned int shift;
  674|       |
  675|      0|        if (p->data == NULL) {
  ------------------
  |  Branch (675:13): [True: 0, False: 0]
  ------------------
  676|      0|            p->return_size = sizeof(double);
  677|      0|            return 1;
  678|      0|        }
  679|      0|        switch (p->data_size) {
  ------------------
  |  Branch (679:17): [True: 0, False: 0]
  ------------------
  680|      0|        case sizeof(double):
  ------------------
  |  Branch (680:9): [True: 0, False: 0]
  ------------------
  681|      0|            shift = real_shift();
  682|      0|            if (shift < 8 * sizeof(val) && (val >> shift) != 0) {
  ------------------
  |  Branch (682:17): [True: 0, False: 0]
  |  Branch (682:44): [True: 0, False: 0]
  ------------------
  683|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  684|      0|                return 0;
  685|      0|            }
  686|      0|            *(double *)p->data = (double)val;
  687|      0|            p->return_size = sizeof(double);
  688|      0|            return 1;
  689|      0|        }
  690|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  691|      0|        return 0;
  692|      0|#endif
  693|      0|    }
  694|      0|    err_bad_type;
  ------------------
  |  |   35|    469|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  695|      0|    return 0;
  696|    469|}
OSSL_PARAM_get_int64:
  705|      3|{
  706|      3|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (706:9): [True: 0, False: 3]
  |  Branch (706:24): [True: 0, False: 3]
  ------------------
  707|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  708|      0|        return 0;
  709|      0|    }
  710|       |
  711|      3|    if (p->data == NULL) {
  ------------------
  |  Branch (711:9): [True: 0, False: 3]
  ------------------
  712|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  713|      0|        return 0;
  714|      0|    }
  715|       |
  716|      3|    if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      3|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (716:9): [True: 3, False: 0]
  ------------------
  717|      3|#ifndef OPENSSL_SMALL_FOOTPRINT
  718|      3|        switch (p->data_size) {
  ------------------
  |  Branch (718:17): [True: 0, False: 3]
  ------------------
  719|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (719:9): [True: 0, False: 3]
  ------------------
  720|      0|            *val = *(const int32_t *)p->data;
  721|      0|            return 1;
  722|      3|        case sizeof(int64_t):
  ------------------
  |  Branch (722:9): [True: 3, False: 0]
  ------------------
  723|      3|            *val = *(const int64_t *)p->data;
  724|      3|            return 1;
  725|      3|        }
  726|      0|#endif
  727|      0|        return general_get_int(p, val, sizeof(*val));
  728|      3|    } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|      0|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (728:16): [True: 0, False: 0]
  ------------------
  729|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  730|      0|        uint64_t u64;
  731|       |
  732|      0|        switch (p->data_size) {
  ------------------
  |  Branch (732:17): [True: 0, False: 0]
  ------------------
  733|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (733:9): [True: 0, False: 0]
  ------------------
  734|      0|            *val = *(const uint32_t *)p->data;
  735|      0|            return 1;
  736|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (736:9): [True: 0, False: 0]
  ------------------
  737|      0|            u64 = *(const uint64_t *)p->data;
  738|      0|            if (u64 <= INT64_MAX) {
  ------------------
  |  Branch (738:17): [True: 0, False: 0]
  ------------------
  739|      0|                *val = (int64_t)u64;
  740|      0|                return 1;
  741|      0|            }
  742|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  743|      0|            return 0;
  744|      0|        }
  745|      0|#endif
  746|      0|        return general_get_int(p, val, sizeof(*val));
  747|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (747:16): [True: 0, False: 0]
  ------------------
  748|      0|#ifndef OPENSSL_SYS_UEFI
  749|      0|        double d;
  750|       |
  751|      0|        switch (p->data_size) {
  ------------------
  |  Branch (751:17): [True: 0, False: 0]
  ------------------
  752|      0|        case sizeof(double):
  ------------------
  |  Branch (752:9): [True: 0, False: 0]
  ------------------
  753|      0|            d = *(const double *)p->data;
  754|      0|            if (d >= INT64_MIN
  ------------------
  |  Branch (754:17): [True: 0, False: 0]
  ------------------
  755|       |                    /*
  756|       |                     * By subtracting 65535 (2^16-1) we cancel the low order
  757|       |                     * 15 bits of INT64_MAX to avoid using imprecise floating
  758|       |                     * point values.
  759|       |                     */
  760|      0|                    && d < (double)(INT64_MAX - 65535) + 65536.0
  ------------------
  |  Branch (760:24): [True: 0, False: 0]
  ------------------
  761|      0|                    && d == (int64_t)d) {
  ------------------
  |  Branch (761:24): [True: 0, False: 0]
  ------------------
  762|      0|                *val = (int64_t)d;
  763|      0|                return 1;
  764|      0|            }
  765|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  766|      0|            return 0;
  767|      0|        }
  768|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  769|      0|        return 0;
  770|      0|#endif
  771|      0|    }
  772|      0|    err_bad_type;
  ------------------
  |  |   35|      3|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  773|      0|    return 0;
  774|      3|}
OSSL_PARAM_get_uint64:
  860|  1.56k|{
  861|  1.56k|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (861:9): [True: 0, False: 1.56k]
  |  Branch (861:24): [True: 0, False: 1.56k]
  ------------------
  862|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  863|      0|        return 0;
  864|      0|    }
  865|       |
  866|  1.56k|    if (p->data == NULL) {
  ------------------
  |  Branch (866:9): [True: 0, False: 1.56k]
  ------------------
  867|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  868|      0|        return 0;
  869|      0|    }
  870|       |
  871|  1.56k|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|  1.56k|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (871:9): [True: 1.56k, False: 0]
  ------------------
  872|  1.56k|#ifndef OPENSSL_SMALL_FOOTPRINT
  873|  1.56k|        switch (p->data_size) {
  ------------------
  |  Branch (873:17): [True: 0, False: 1.56k]
  ------------------
  874|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (874:9): [True: 0, False: 1.56k]
  ------------------
  875|      0|            *val = *(const uint32_t *)p->data;
  876|      0|            return 1;
  877|  1.56k|        case sizeof(uint64_t):
  ------------------
  |  Branch (877:9): [True: 1.56k, False: 0]
  ------------------
  878|  1.56k|            *val = *(const uint64_t *)p->data;
  879|  1.56k|            return 1;
  880|  1.56k|        }
  881|      0|#endif
  882|      0|        return general_get_uint(p, val, sizeof(*val));
  883|  1.56k|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (883:16): [True: 0, False: 0]
  ------------------
  884|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  885|      0|        int32_t i32;
  886|      0|        int64_t i64;
  887|       |
  888|      0|        switch (p->data_size) {
  ------------------
  |  Branch (888:17): [True: 0, False: 0]
  ------------------
  889|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (889:9): [True: 0, False: 0]
  ------------------
  890|      0|            i32 = *(const int32_t *)p->data;
  891|      0|            if (i32 >= 0) {
  ------------------
  |  Branch (891:17): [True: 0, False: 0]
  ------------------
  892|      0|                *val = (uint64_t)i32;
  893|      0|                return 1;
  894|      0|            }
  895|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  896|      0|            return 0;
  897|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (897:9): [True: 0, False: 0]
  ------------------
  898|      0|            i64 = *(const int64_t *)p->data;
  899|      0|            if (i64 >= 0) {
  ------------------
  |  Branch (899:17): [True: 0, False: 0]
  ------------------
  900|      0|                *val = (uint64_t)i64;
  901|      0|                return 1;
  902|      0|            }
  903|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  904|      0|            return 0;
  905|      0|        }
  906|      0|#endif
  907|      0|        return general_get_uint(p, val, sizeof(*val));
  908|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (908:16): [True: 0, False: 0]
  ------------------
  909|      0|#ifndef OPENSSL_SYS_UEFI
  910|      0|        double d;
  911|       |
  912|      0|        switch (p->data_size) {
  ------------------
  |  Branch (912:17): [True: 0, False: 0]
  ------------------
  913|      0|        case sizeof(double):
  ------------------
  |  Branch (913:9): [True: 0, False: 0]
  ------------------
  914|      0|            d = *(const double *)p->data;
  915|      0|            if (d >= 0
  ------------------
  |  Branch (915:17): [True: 0, False: 0]
  ------------------
  916|       |                    /*
  917|       |                     * By subtracting 65535 (2^16-1) we cancel the low order
  918|       |                     * 15 bits of UINT64_MAX to avoid using imprecise floating
  919|       |                     * point values.
  920|       |                     */
  921|      0|                    && d < (double)(UINT64_MAX - 65535) + 65536.0
  ------------------
  |  Branch (921:24): [True: 0, False: 0]
  ------------------
  922|      0|                    && d == (uint64_t)d) {
  ------------------
  |  Branch (922:24): [True: 0, False: 0]
  ------------------
  923|      0|                *val = (uint64_t)d;
  924|      0|                return 1;
  925|      0|            }
  926|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  927|      0|            return 0;
  928|      0|        }
  929|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  930|      0|        return 0;
  931|      0|#endif
  932|      0|    }
  933|      0|    err_bad_type;
  ------------------
  |  |   35|  1.56k|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  934|      0|    return 0;
  935|  1.56k|}
OSSL_PARAM_set_uint64:
  938|    795|{
  939|    795|    if (p == NULL) {
  ------------------
  |  Branch (939:9): [True: 0, False: 795]
  ------------------
  940|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  941|      0|        return 0;
  942|      0|    }
  943|    795|    p->return_size = 0;
  944|       |
  945|    795|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|    795|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (945:9): [True: 795, False: 0]
  ------------------
  946|    795|#ifndef OPENSSL_SMALL_FOOTPRINT
  947|    795|        if (p->data == NULL) {
  ------------------
  |  Branch (947:13): [True: 0, False: 795]
  ------------------
  948|      0|            p->return_size = sizeof(uint64_t); /* Expected size */
  949|      0|            return 1;
  950|      0|        }
  951|    795|        switch (p->data_size) {
  ------------------
  |  Branch (951:17): [True: 0, False: 795]
  ------------------
  952|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (952:9): [True: 0, False: 795]
  ------------------
  953|      0|            if (val <= UINT32_MAX) {
  ------------------
  |  Branch (953:17): [True: 0, False: 0]
  ------------------
  954|      0|                p->return_size = sizeof(uint32_t);
  955|      0|                *(uint32_t *)p->data = (uint32_t)val;
  956|      0|                return 1;
  957|      0|            }
  958|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  959|      0|            return 0;
  960|    795|        case sizeof(uint64_t):
  ------------------
  |  Branch (960:9): [True: 795, False: 0]
  ------------------
  961|    795|            p->return_size = sizeof(uint64_t);
  962|    795|            *(uint64_t *)p->data = val;
  963|    795|            return 1;
  964|    795|        }
  965|      0|#endif
  966|      0|        return general_set_uint(p, &val, sizeof(val));
  967|    795|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (967:16): [True: 0, False: 0]
  ------------------
  968|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  969|      0|        if (p->data == NULL) {
  ------------------
  |  Branch (969:13): [True: 0, False: 0]
  ------------------
  970|      0|            p->return_size = sizeof(int64_t); /* Expected size */
  971|      0|            return 1;
  972|      0|        }
  973|      0|        switch (p->data_size) {
  ------------------
  |  Branch (973:17): [True: 0, False: 0]
  ------------------
  974|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (974:9): [True: 0, False: 0]
  ------------------
  975|      0|            if (val <= INT32_MAX) {
  ------------------
  |  Branch (975:17): [True: 0, False: 0]
  ------------------
  976|      0|                p->return_size = sizeof(int32_t);
  977|      0|                *(int32_t *)p->data = (int32_t)val;
  978|      0|                return 1;
  979|      0|            }
  980|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  981|      0|            return 0;
  982|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (982:9): [True: 0, False: 0]
  ------------------
  983|      0|            if (val <= INT64_MAX) {
  ------------------
  |  Branch (983:17): [True: 0, False: 0]
  ------------------
  984|      0|                p->return_size = sizeof(int64_t);
  985|      0|                *(int64_t *)p->data = (int64_t)val;
  986|      0|                return 1;
  987|      0|            }
  988|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  989|      0|            return 0;
  990|      0|        }
  991|      0|#endif
  992|      0|        return general_set_uint(p, &val, sizeof(val));
  993|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (993:16): [True: 0, False: 0]
  ------------------
  994|      0|#ifndef OPENSSL_SYS_UEFI
  995|      0|        switch (p->data_size) {
  ------------------
  |  Branch (995:17): [True: 0, False: 0]
  ------------------
  996|      0|        case sizeof(double):
  ------------------
  |  Branch (996:9): [True: 0, False: 0]
  ------------------
  997|      0|            if ((val >> real_shift()) == 0) {
  ------------------
  |  Branch (997:17): [True: 0, False: 0]
  ------------------
  998|      0|                p->return_size = sizeof(double);
  999|      0|                *(double *)p->data = (double)val;
 1000|      0|                return 1;
 1001|      0|            }
 1002|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
 1003|      0|            return 0;
 1004|      0|        }
 1005|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1006|      0|        return 0;
 1007|      0|#endif
 1008|      0|    }
 1009|      0|    err_bad_type;
  ------------------
  |  |   35|    795|    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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1010|      0|    return 0;
 1011|    795|}
OSSL_PARAM_get_size_t:
 1020|  1.56k|{
 1021|  1.56k|#ifndef OPENSSL_SMALL_FOOTPRINT
 1022|  1.56k|    switch (sizeof(size_t)) {
  ------------------
  |  Branch (1022:13): [Folded - Ignored]
  ------------------
 1023|      0|    case sizeof(uint32_t):
  ------------------
  |  Branch (1023:5): [True: 0, False: 1.56k]
  ------------------
 1024|      0|        return OSSL_PARAM_get_uint32(p, (uint32_t *)val);
 1025|  1.56k|    case sizeof(uint64_t):
  ------------------
  |  Branch (1025:5): [True: 1.56k, False: 0]
  ------------------
 1026|  1.56k|        return OSSL_PARAM_get_uint64(p, (uint64_t *)val);
 1027|  1.56k|    }
 1028|      0|#endif
 1029|      0|    return general_get_uint(p, val, sizeof(*val));
 1030|  1.56k|}
OSSL_PARAM_set_size_t:
 1033|    795|{
 1034|    795|#ifndef OPENSSL_SMALL_FOOTPRINT
 1035|    795|    switch (sizeof(size_t)) {
  ------------------
  |  Branch (1035:13): [Folded - Ignored]
  ------------------
 1036|      0|    case sizeof(uint32_t):
  ------------------
  |  Branch (1036:5): [True: 0, False: 795]
  ------------------
 1037|      0|        return OSSL_PARAM_set_uint32(p, (uint32_t)val);
 1038|    795|    case sizeof(uint64_t):
  ------------------
  |  Branch (1038:5): [True: 795, False: 0]
  ------------------
 1039|    795|        return OSSL_PARAM_set_uint64(p, (uint64_t)val);
 1040|    795|    }
 1041|      0|#endif
 1042|      0|    return general_set_uint(p, &val, sizeof(val));
 1043|    795|}
OSSL_PARAM_construct_size_t:
 1046|  2.36k|{
 1047|  2.36k|    return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
  ------------------
  |  |  107|  2.36k|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
 1048|  2.36k|                                sizeof(size_t));
 1049|  2.36k|}
OSSL_PARAM_get_time_t:
 1052|      3|{
 1053|      3|#ifndef OPENSSL_SMALL_FOOTPRINT
 1054|      3|    switch (sizeof(time_t)) {
  ------------------
  |  Branch (1054:13): [Folded - Ignored]
  ------------------
 1055|      0|    case sizeof(int32_t):
  ------------------
  |  Branch (1055:5): [True: 0, False: 3]
  ------------------
 1056|      0|        return OSSL_PARAM_get_int32(p, (int32_t *)val);
 1057|      3|    case sizeof(int64_t):
  ------------------
  |  Branch (1057:5): [True: 3, False: 0]
  ------------------
 1058|      3|        return OSSL_PARAM_get_int64(p, (int64_t *)val);
 1059|      3|    }
 1060|      0|#endif
 1061|      0|    return general_get_int(p, val, sizeof(*val));
 1062|      3|}
OSSL_PARAM_construct_time_t:
 1078|      3|{
 1079|      3|    return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(time_t));
  ------------------
  |  |  106|      3|# define OSSL_PARAM_INTEGER              1
  ------------------
 1080|      3|}
OSSL_PARAM_construct_utf8_string:
 1462|      6|{
 1463|      6|    if (buf != NULL && bsize == 0)
  ------------------
  |  Branch (1463:9): [True: 6, False: 0]
  |  Branch (1463:24): [True: 6, False: 0]
  ------------------
 1464|      6|        bsize = strlen(buf);
 1465|      6|    return ossl_param_construct(key, OSSL_PARAM_UTF8_STRING, buf, bsize);
  ------------------
  |  |  117|      6|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
 1466|      6|}
OSSL_PARAM_construct_octet_string:
 1470|     78|{
 1471|     78|    return ossl_param_construct(key, OSSL_PARAM_OCTET_STRING, buf, bsize);
  ------------------
  |  |  123|     78|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
 1472|     78|}
OSSL_PARAM_construct_end:
 1661|  1.89k|{
 1662|  1.89k|    OSSL_PARAM end = OSSL_PARAM_END;
  ------------------
  |  |   25|  1.89k|    { NULL, 0, NULL, 0, 0 }
  ------------------
 1663|       |
 1664|  1.89k|    return end;
 1665|  1.89k|}
OSSL_PARAM_get_octet_string_ptr:
 1698|     78|{
 1699|     78|    return get_string_ptr_internal(p, (const void **)val, used_len,
 1700|     78|                                   OSSL_PARAM_OCTET_PTR,
  ------------------
  |  |  160|     78|# define OSSL_PARAM_OCTET_PTR            7
  ------------------
 1701|     78|                                   OSSL_PARAM_OCTET_STRING);
  ------------------
  |  |  123|     78|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
 1702|     78|}
params.c:ossl_param_construct:
   69|  4.43k|{
   70|  4.43k|    OSSL_PARAM res;
   71|       |
   72|  4.43k|    res.key = key;
   73|  4.43k|    res.data_type = data_type;
   74|  4.43k|    res.data = data;
   75|  4.43k|    res.data_size = data_size;
   76|  4.43k|    res.return_size = OSSL_PARAM_UNMODIFIED;
  ------------------
  |  |   22|  4.43k|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  ------------------
   77|  4.43k|    return res;
   78|  4.43k|}
params.c:get_string_ptr_internal:
 1670|     78|{
 1671|     78|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (1671:9): [True: 0, False: 78]
  |  Branch (1671:24): [True: 0, False: 78]
  ------------------
 1672|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1673|      0|        return 0;
 1674|      0|    }
 1675|       |
 1676|     78|    if (p->data_type == ref_type)
  ------------------
  |  Branch (1676:9): [True: 0, False: 78]
  ------------------
 1677|      0|        return get_ptr_internal_skip_checks(p, (const void **)val, used_len);
 1678|       |
 1679|     78|    if (p->data_type != type) {
  ------------------
  |  Branch (1679:9): [True: 0, False: 78]
  ------------------
 1680|      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),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1681|      0|        return 0;
 1682|      0|    }
 1683|     78|    if (used_len != NULL)
  ------------------
  |  Branch (1683:9): [True: 78, False: 0]
  ------------------
 1684|     78|        *used_len = p->data_size;
 1685|     78|    *val = p->data;
 1686|     78|    return 1;
 1687|     78|}

ossl_param_bytes_to_blocks:
   30|     33|{
   31|     33|    return (bytes + OSSL_PARAM_ALIGN_SIZE - 1) / OSSL_PARAM_ALIGN_SIZE;
  ------------------
  |  |   22|     33|# define OSSL_PARAM_ALIGN_SIZE  sizeof(OSSL_PARAM_ALIGNED_BLOCK)
  ------------------
                  return (bytes + OSSL_PARAM_ALIGN_SIZE - 1) / OSSL_PARAM_ALIGN_SIZE;
  ------------------
  |  |   22|     33|# define OSSL_PARAM_ALIGN_SIZE  sizeof(OSSL_PARAM_ALIGNED_BLOCK)
  ------------------
   32|     33|}
ossl_param_set_secure_block:
   49|      6|{
   50|      6|    last->key = NULL;
   51|      6|    last->data_size = secure_buffer_sz;
   52|      6|    last->data = secure_buffer;
   53|      6|    last->data_type = OSSL_PARAM_ALLOCATED_END;
  ------------------
  |  |   15|      6|#define OSSL_PARAM_ALLOCATED_END    127
  ------------------
   54|      6|}
OSSL_PARAM_dup:
   99|      3|{
  100|      3|    size_t param_blocks;
  101|      3|    OSSL_PARAM_BUF buf[OSSL_PARAM_BUF_MAX];
  102|      3|    OSSL_PARAM *last, *dst;
  103|      3|    int param_count = 1; /* Include terminator in the count */
  104|       |
  105|      3|    if (src == NULL) {
  ------------------
  |  Branch (105:9): [True: 0, False: 3]
  ------------------
  106|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  107|      0|        return NULL;
  108|      0|    }
  109|       |
  110|      3|    memset(buf, 0, sizeof(buf));
  111|       |
  112|       |    /* First Pass: get the param_count and block sizes required */
  113|      3|    (void)ossl_param_dup(src, NULL, buf, &param_count);
  114|       |
  115|      3|    param_blocks = ossl_param_bytes_to_blocks(param_count * sizeof(*src));
  116|       |    /*
  117|       |     * The allocated buffer consists of an array of OSSL_PARAM followed by
  118|       |     * aligned data bytes that the array elements will point to.
  119|       |     */
  120|      3|    if (!ossl_param_buf_alloc(&buf[OSSL_PARAM_BUF_PUBLIC], param_blocks, 0))
  ------------------
  |  |   18|      3|#define OSSL_PARAM_BUF_PUBLIC 0
  ------------------
  |  Branch (120:9): [True: 0, False: 3]
  ------------------
  121|      0|        return NULL;
  122|       |
  123|       |    /* Allocate a secure memory buffer if required */
  124|      3|    if (buf[OSSL_PARAM_BUF_SECURE].blocks > 0
  ------------------
  |  |   19|      3|#define OSSL_PARAM_BUF_SECURE 1
  ------------------
  |  Branch (124:9): [True: 0, False: 3]
  ------------------
  125|      3|        && !ossl_param_buf_alloc(&buf[OSSL_PARAM_BUF_SECURE], 0, 1)) {
  ------------------
  |  |   19|      0|#define OSSL_PARAM_BUF_SECURE 1
  ------------------
  |  Branch (125:12): [True: 0, False: 0]
  ------------------
  126|      0|        OPENSSL_free(buf[OSSL_PARAM_BUF_PUBLIC].alloc);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  127|      0|        return NULL;
  128|      0|    }
  129|       |
  130|      3|    dst = (OSSL_PARAM *)buf[OSSL_PARAM_BUF_PUBLIC].alloc;
  ------------------
  |  |   18|      3|#define OSSL_PARAM_BUF_PUBLIC 0
  ------------------
  131|      3|    last = ossl_param_dup(src, dst, buf, NULL);
  132|       |    /* Store the allocated secure memory buffer in the last param block */
  133|      3|    ossl_param_set_secure_block(last, buf[OSSL_PARAM_BUF_SECURE].alloc,
  ------------------
  |  |   19|      3|#define OSSL_PARAM_BUF_SECURE 1
  ------------------
  134|      3|                                buf[OSSL_PARAM_BUF_SECURE].alloc_sz);
  ------------------
  |  |   19|      3|#define OSSL_PARAM_BUF_SECURE 1
  ------------------
  135|      3|    return dst;
  136|      3|}
OSSL_PARAM_free:
  226|      6|{
  227|      6|    if (params != NULL) {
  ------------------
  |  Branch (227:9): [True: 6, False: 0]
  ------------------
  228|      6|        OSSL_PARAM *p;
  229|       |
  230|     24|        for (p = params; p->key != NULL; p++)
  ------------------
  |  Branch (230:26): [True: 18, False: 6]
  ------------------
  231|     18|            ;
  232|      6|        if (p->data_type == OSSL_PARAM_ALLOCATED_END)
  ------------------
  |  |   15|      6|#define OSSL_PARAM_ALLOCATED_END    127
  ------------------
  |  Branch (232:13): [True: 6, False: 0]
  ------------------
  233|      6|            OPENSSL_secure_clear_free(p->data, p->data_size);
  ------------------
  |  |  129|      6|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  234|      6|        OPENSSL_free(params);
  ------------------
  |  |  115|      6|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  235|      6|    }
  236|      6|}
params_dup.c:ossl_param_dup:
   59|      6|{
   60|      6|    const OSSL_PARAM *in;
   61|      6|    int has_dst = (dst != NULL);
   62|      6|    int is_secure;
   63|      6|    size_t param_sz, blks;
   64|       |
   65|     24|    for (in = src; in->key != NULL; in++) {
  ------------------
  |  Branch (65:20): [True: 18, False: 6]
  ------------------
   66|     18|        is_secure = CRYPTO_secure_allocated(in->data);
   67|     18|        if (has_dst) {
  ------------------
  |  Branch (67:13): [True: 9, False: 9]
  ------------------
   68|      9|            *dst = *in;
   69|      9|            dst->data = buf[is_secure].cur;
   70|      9|        }
   71|       |
   72|     18|        if (in->data_type == OSSL_PARAM_OCTET_PTR
  ------------------
  |  |  160|     36|# define OSSL_PARAM_OCTET_PTR            7
  ------------------
  |  Branch (72:13): [True: 0, False: 18]
  ------------------
   73|     18|            || in->data_type == OSSL_PARAM_UTF8_PTR) {
  ------------------
  |  |  141|     18|# define OSSL_PARAM_UTF8_PTR             6
  ------------------
  |  Branch (73:16): [True: 0, False: 18]
  ------------------
   74|      0|            param_sz = sizeof(in->data);
   75|      0|            if (has_dst)
  ------------------
  |  Branch (75:17): [True: 0, False: 0]
  ------------------
   76|      0|                *((const void **)dst->data) = *(const void **)in->data;
   77|     18|        } else {
   78|     18|            param_sz = in->data_size;
   79|     18|            if (has_dst)
  ------------------
  |  Branch (79:17): [True: 9, False: 9]
  ------------------
   80|      9|                memcpy(dst->data, in->data, param_sz);
   81|     18|        }
   82|     18|        if (in->data_type == OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|     18|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (82:13): [True: 0, False: 18]
  ------------------
   83|      0|            param_sz++; /* NULL terminator */
   84|     18|        blks = ossl_param_bytes_to_blocks(param_sz);
   85|       |
   86|     18|        if (has_dst) {
  ------------------
  |  Branch (86:13): [True: 9, False: 9]
  ------------------
   87|      9|            dst++;
   88|      9|            buf[is_secure].cur += blks;
   89|      9|        } else {
   90|      9|            buf[is_secure].blocks += blks;
   91|      9|        }
   92|     18|        if (param_count != NULL)
  ------------------
  |  Branch (92:13): [True: 9, False: 9]
  ------------------
   93|      9|            ++*param_count;
   94|     18|    }
   95|      6|    return dst;
   96|      6|}
params_dup.c:ossl_param_buf_alloc:
   36|      3|{
   37|      3|    size_t sz = OSSL_PARAM_ALIGN_SIZE * (extra_blocks + out->blocks);
  ------------------
  |  |   22|      3|# define OSSL_PARAM_ALIGN_SIZE  sizeof(OSSL_PARAM_ALIGNED_BLOCK)
  ------------------
   38|       |
   39|      3|    out->alloc = is_secure ? OPENSSL_secure_zalloc(sz) : OPENSSL_zalloc(sz);
  ------------------
  |  |  125|      0|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
                  out->alloc = is_secure ? OPENSSL_secure_zalloc(sz) : OPENSSL_zalloc(sz);
  ------------------
  |  |  104|      6|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (39:18): [True: 0, False: 3]
  ------------------
   40|      3|    if (out->alloc == NULL)
  ------------------
  |  Branch (40:9): [True: 0, False: 3]
  ------------------
   41|      0|        return 0;
   42|      3|    out->alloc_sz = sz;
   43|      3|    out->cur = out->alloc + extra_blocks;
   44|      3|    return 1;
   45|      3|}

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

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

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

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

ossl_ctx_global_properties_free:
  115|      1|{
  116|      1|    OSSL_GLOBAL_PROPERTIES *globp = vglobp;
  117|       |
  118|      1|    if (globp != NULL) {
  ------------------
  |  Branch (118:9): [True: 1, False: 0]
  ------------------
  119|      1|        ossl_property_free(globp->list);
  120|      1|        OPENSSL_free(globp);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  121|      1|    }
  122|      1|}
ossl_ctx_global_properties_new:
  125|      1|{
  126|      1|    return OPENSSL_zalloc(sizeof(OSSL_GLOBAL_PROPERTIES));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  127|      1|}
ossl_ctx_global_properties:
  131|     14|{
  132|     14|    OSSL_GLOBAL_PROPERTIES *globp;
  133|       |
  134|     14|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  135|     14|    if (loadconfig && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
  ------------------
  |  |  472|      0|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (135:9): [True: 0, False: 14]
  |  Branch (135:23): [True: 0, False: 0]
  ------------------
  136|      0|        return NULL;
  137|     14|#endif
  138|     14|    globp = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_GLOBAL_PROPERTIES);
  ------------------
  |  |  114|     14|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  139|       |
  140|     14|    return globp != NULL ? &globp->list : NULL;
  ------------------
  |  Branch (140:12): [True: 14, False: 0]
  ------------------
  141|     14|}
ossl_method_store_new:
  244|      4|{
  245|      4|    OSSL_METHOD_STORE *res;
  246|       |
  247|      4|    res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  248|      4|    if (res != NULL) {
  ------------------
  |  Branch (248:9): [True: 4, False: 0]
  ------------------
  249|      4|        res->ctx = ctx;
  250|      4|        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL
  ------------------
  |  Branch (250:13): [True: 0, False: 4]
  ------------------
  251|      4|            || (res->lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (251:16): [True: 0, False: 4]
  ------------------
  252|      4|            || (res->biglock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (252:16): [True: 0, False: 4]
  ------------------
  253|      0|            ossl_method_store_free(res);
  254|      0|            return NULL;
  255|      0|        }
  256|      4|    }
  257|      4|    return res;
  258|      4|}
ossl_method_store_free:
  261|      4|{
  262|      4|    if (store != NULL) {
  ------------------
  |  Branch (262:9): [True: 4, False: 0]
  ------------------
  263|      4|        if (store->algs != NULL)
  ------------------
  |  Branch (263:13): [True: 4, False: 0]
  ------------------
  264|      4|            ossl_sa_ALGORITHM_doall_arg(store->algs, &alg_cleanup, store);
  265|      4|        ossl_sa_ALGORITHM_free(store->algs);
  266|      4|        CRYPTO_THREAD_lock_free(store->lock);
  267|      4|        CRYPTO_THREAD_lock_free(store->biglock);
  268|      4|        OPENSSL_free(store);
  ------------------
  |  |  115|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  269|      4|    }
  270|      4|}
ossl_method_lock_store:
  273|     57|{
  274|     57|    return store != NULL ? CRYPTO_THREAD_write_lock(store->biglock) : 0;
  ------------------
  |  Branch (274:12): [True: 57, False: 0]
  ------------------
  275|     57|}
ossl_method_unlock_store:
  278|     57|{
  279|     57|    return store != NULL ? CRYPTO_THREAD_unlock(store->biglock) : 0;
  ------------------
  |  Branch (279:12): [True: 57, False: 0]
  ------------------
  280|     57|}
ossl_method_store_add:
  321|    220|{
  322|    220|    ALGORITHM *alg = NULL;
  323|    220|    IMPLEMENTATION *impl;
  324|    220|    int ret = 0;
  325|    220|    int i;
  326|       |
  327|    220|    if (nid <= 0 || method == NULL || store == NULL)
  ------------------
  |  Branch (327:9): [True: 0, False: 220]
  |  Branch (327:21): [True: 0, False: 220]
  |  Branch (327:39): [True: 0, False: 220]
  ------------------
  328|      0|        return 0;
  329|       |
  330|    220|    if (properties == NULL)
  ------------------
  |  Branch (330:9): [True: 0, False: 220]
  ------------------
  331|      0|        properties = "";
  332|       |
  333|    220|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|    220|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    220|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (333:9): [True: 0, False: 220]
  ------------------
  334|      0|        return 0;
  335|       |
  336|       |    /* Create new entry */
  337|    220|    impl = OPENSSL_malloc(sizeof(*impl));
  ------------------
  |  |  102|    220|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  338|    220|    if (impl == NULL)
  ------------------
  |  Branch (338:9): [True: 0, False: 220]
  ------------------
  339|      0|        return 0;
  340|    220|    impl->method.method = method;
  341|    220|    impl->method.up_ref = method_up_ref;
  342|    220|    impl->method.free = method_destruct;
  343|    220|    if (!ossl_method_up_ref(&impl->method)) {
  ------------------
  |  Branch (343:9): [True: 0, False: 220]
  ------------------
  344|      0|        OPENSSL_free(impl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  345|      0|        return 0;
  346|      0|    }
  347|    220|    impl->provider = prov;
  348|       |
  349|       |    /* Insert into the hash table if required */
  350|    220|    if (!ossl_property_write_lock(store)) {
  ------------------
  |  Branch (350:9): [True: 0, False: 220]
  ------------------
  351|      0|        impl_free(impl);
  352|      0|        return 0;
  353|      0|    }
  354|       |
  355|       |    /*
  356|       |     * Flush the alg cache of any implementation that already exists
  357|       |     * for this id.
  358|       |     * This is done to ensure that on the next lookup we go through the
  359|       |     * provider comparison in ossl_method_store_fetch.  If we don't do this
  360|       |     * then this new method won't be given a chance to get selected.
  361|       |     * NOTE: This doesn't actually remove the method from the backing store
  362|       |     * It just ensures that we query the backing store when (re)-adding a
  363|       |     * method to the algorithm cache, in case the one selected by the next
  364|       |     * query selects a different implementation
  365|       |     */
  366|    220|    ossl_method_cache_flush(store, nid);
  367|       |
  368|       |    /*
  369|       |     * Parse the properties associated with this method, and convert it to a
  370|       |     * property list stored against the implementation for later comparison
  371|       |     * during fetch operations
  372|       |     */
  373|    220|    if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
  ------------------
  |  Branch (373:9): [True: 1, False: 219]
  ------------------
  374|      1|        impl->properties = ossl_parse_property(store->ctx, properties);
  375|      1|        if (impl->properties == NULL)
  ------------------
  |  Branch (375:13): [True: 0, False: 1]
  ------------------
  376|      0|            goto err;
  377|      1|        if (!ossl_prop_defn_set(store->ctx, properties, &impl->properties)) {
  ------------------
  |  Branch (377:13): [True: 0, False: 1]
  ------------------
  378|      0|            ossl_property_free(impl->properties);
  379|      0|            impl->properties = NULL;
  380|      0|            goto err;
  381|      0|        }
  382|      1|    }
  383|       |
  384|       |    /*
  385|       |     * Check if we have an algorithm cache already for this nid.  If so use
  386|       |     * it, otherwise, create it, and insert it into the store
  387|       |     */
  388|    220|    alg = ossl_method_store_retrieve(store, nid);
  389|    220|    if (alg == NULL) {
  ------------------
  |  Branch (389:9): [True: 220, False: 0]
  ------------------
  390|    220|        if ((alg = OPENSSL_zalloc(sizeof(*alg))) == NULL
  ------------------
  |  |  104|    220|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (390:13): [True: 0, False: 220]
  ------------------
  391|    220|                || (alg->impls = sk_IMPLEMENTATION_new_null()) == NULL
  ------------------
  |  Branch (391:20): [True: 0, False: 220]
  ------------------
  392|    220|                || (alg->cache = lh_QUERY_new(&query_hash, &query_cmp)) == NULL)
  ------------------
  |  Branch (392:20): [True: 0, False: 220]
  ------------------
  393|      0|            goto err;
  394|    220|        alg->nid = nid;
  395|    220|        if (!ossl_method_store_insert(store, alg))
  ------------------
  |  Branch (395:13): [True: 0, False: 220]
  ------------------
  396|      0|            goto err;
  397|    220|        OSSL_TRACE2(QUERY, "Inserted an alg with nid %d into the store %p\n", nid, (void *)store);
  ------------------
  |  |  293|    220|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2))
  |  |  ------------------
  |  |  |  |  283|    220|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  398|    220|    }
  399|       |
  400|       |    /* Push onto stack if there isn't one there already */
  401|    220|    for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) {
  ------------------
  |  Branch (401:17): [True: 0, False: 220]
  ------------------
  402|      0|        const IMPLEMENTATION *tmpimpl = sk_IMPLEMENTATION_value(alg->impls, i);
  403|       |
  404|      0|        if (tmpimpl->provider == impl->provider
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  ------------------
  405|      0|            && tmpimpl->properties == impl->properties)
  ------------------
  |  Branch (405:16): [True: 0, False: 0]
  ------------------
  406|      0|            break;
  407|      0|    }
  408|       |
  409|    220|    if (i == sk_IMPLEMENTATION_num(alg->impls)
  ------------------
  |  Branch (409:9): [True: 220, False: 0]
  ------------------
  410|    220|        && sk_IMPLEMENTATION_push(alg->impls, impl)) {
  ------------------
  |  Branch (410:12): [True: 220, False: 0]
  ------------------
  411|    220|        ret = 1;
  412|    220|#ifndef FIPS_MODULE
  413|    220|        OSSL_TRACE_BEGIN(QUERY) {
  ------------------
  |  |  220|    220|    do {                                        \
  |  |  221|    220|        BIO *trc_out = NULL;                    \
  |  |  222|    220|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  414|      0|            BIO_printf(trc_out, "Adding to method store "
  415|      0|                       "nid: %d\nproperties: %s\nprovider: %s\n",
  416|      0|                       nid, properties,
  417|      0|                       ossl_provider_name(prov) == NULL ? "none" :
  ------------------
  |  Branch (417:24): [True: 0, False: 0]
  ------------------
  418|      0|                       ossl_provider_name(prov));
  419|    220|        } OSSL_TRACE_END(QUERY);
  ------------------
  |  |  225|    220|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  420|    220|#endif
  421|    220|    }
  422|    220|    ossl_property_unlock(store);
  423|    220|    if (ret == 0)
  ------------------
  |  Branch (423:9): [True: 0, False: 220]
  ------------------
  424|      0|        impl_free(impl);
  425|    220|    return ret;
  426|       |
  427|      0|err:
  428|      0|    ossl_property_unlock(store);
  429|      0|    alg_cleanup(0, alg, NULL);
  430|      0|    impl_free(impl);
  431|      0|    return 0;
  432|    220|}
ossl_method_store_fetch:
  624|     54|{
  625|     54|    OSSL_PROPERTY_LIST **plp;
  626|     54|    ALGORITHM *alg;
  627|     54|    IMPLEMENTATION *impl, *best_impl = NULL;
  628|     54|    OSSL_PROPERTY_LIST *pq = NULL, *p2 = NULL;
  629|     54|    const OSSL_PROVIDER *prov = prov_rw != NULL ? *prov_rw : NULL;
  ------------------
  |  Branch (629:33): [True: 54, False: 0]
  ------------------
  630|     54|    int ret = 0;
  631|     54|    int j, best = -1, score, optional;
  632|       |
  633|     54|    if (nid <= 0 || method == NULL || store == NULL)
  ------------------
  |  Branch (633:9): [True: 0, False: 54]
  |  Branch (633:21): [True: 0, False: 54]
  |  Branch (633:39): [True: 0, False: 54]
  ------------------
  634|      0|        return 0;
  635|       |
  636|     54|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  637|     54|    if (ossl_lib_ctx_is_default(store->ctx)
  ------------------
  |  Branch (637:9): [True: 54, False: 0]
  ------------------
  638|     54|            && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
  ------------------
  |  |  472|     54|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (638:16): [True: 0, False: 54]
  ------------------
  639|      0|        return 0;
  640|     54|#endif
  641|       |
  642|       |    /* This only needs to be a read lock, because the query won't create anything */
  643|     54|    if (!ossl_property_read_lock(store))
  ------------------
  |  Branch (643:9): [True: 0, False: 54]
  ------------------
  644|      0|        return 0;
  645|       |
  646|     54|    OSSL_TRACE2(QUERY, "Retrieving by nid %d from store %p\n", nid, (void *)store);
  ------------------
  |  |  293|     54|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2))
  |  |  ------------------
  |  |  |  |  283|     54|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  647|     54|    alg = ossl_method_store_retrieve(store, nid);
  648|     54|    if (alg == NULL) {
  ------------------
  |  Branch (648:9): [True: 40, False: 14]
  ------------------
  649|     40|        ossl_property_unlock(store);
  650|     40|        OSSL_TRACE2(QUERY, "Failed to retrieve by nid %d from store %p\n", nid, (void *)store);
  ------------------
  |  |  293|     40|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2))
  |  |  ------------------
  |  |  |  |  283|     40|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  651|     40|        return 0;
  652|     40|    }
  653|     14|    OSSL_TRACE2(QUERY, "Retrieved by nid %d from store %p\n", nid, (void *)store);
  ------------------
  |  |  293|     14|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2))
  |  |  ------------------
  |  |  |  |  283|     14|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  654|       |
  655|       |    /*
  656|       |     * If a property query string is provided, convert it to an
  657|       |     * OSSL_PROPERTY_LIST structure
  658|       |     */
  659|     14|    if (prop_query != NULL)
  ------------------
  |  Branch (659:9): [True: 14, False: 0]
  ------------------
  660|     14|        p2 = pq = ossl_parse_query(store->ctx, prop_query, 0);
  661|       |
  662|       |    /*
  663|       |     * If the library context has default properties specified
  664|       |     * then merge those with the properties passed to this function
  665|       |     */
  666|     14|    plp = ossl_ctx_global_properties(store->ctx, 0);
  667|     14|    if (plp != NULL && *plp != NULL) {
  ------------------
  |  Branch (667:9): [True: 14, False: 0]
  |  Branch (667:24): [True: 0, False: 14]
  ------------------
  668|      0|        if (pq == NULL) {
  ------------------
  |  Branch (668:13): [True: 0, False: 0]
  ------------------
  669|      0|            pq = *plp;
  670|      0|        } else {
  671|      0|            p2 = ossl_property_merge(pq, *plp);
  672|      0|            ossl_property_free(pq);
  673|      0|            if (p2 == NULL)
  ------------------
  |  Branch (673:17): [True: 0, False: 0]
  ------------------
  674|      0|                goto fin;
  675|      0|            pq = p2;
  676|      0|        }
  677|      0|    }
  678|       |
  679|       |    /*
  680|       |     * Search for a provider that provides this implementation.
  681|       |     * If the requested provider is NULL, then any provider will do,
  682|       |     * otherwise we should try to find the one that matches the requested
  683|       |     * provider.  Note that providers are given implicit preference via the
  684|       |     * ordering of the implementation stack
  685|       |     */
  686|     14|    if (pq == NULL) {
  ------------------
  |  Branch (686:9): [True: 0, False: 14]
  ------------------
  687|      0|        for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) {
  ------------------
  |  Branch (687:21): [True: 0, False: 0]
  ------------------
  688|      0|            if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL
  ------------------
  |  Branch (688:17): [True: 0, False: 0]
  ------------------
  689|      0|                && (prov == NULL || impl->provider == prov)) {
  ------------------
  |  Branch (689:21): [True: 0, False: 0]
  |  Branch (689:37): [True: 0, False: 0]
  ------------------
  690|      0|                best_impl = impl;
  691|      0|                ret = 1;
  692|      0|                break;
  693|      0|            }
  694|      0|        }
  695|      0|        goto fin;
  696|      0|    }
  697|       |
  698|       |    /*
  699|       |     * If there are optional properties specified
  700|       |     * then run the search again, and select the provider that matches the
  701|       |     * most options
  702|       |     */
  703|     14|    optional = ossl_property_has_optional(pq);
  704|     14|    for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) {
  ------------------
  |  Branch (704:17): [True: 14, False: 0]
  ------------------
  705|     14|        if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL
  ------------------
  |  Branch (705:13): [True: 14, False: 0]
  ------------------
  706|     14|            && (prov == NULL || impl->provider == prov)) {
  ------------------
  |  Branch (706:17): [True: 12, False: 2]
  |  Branch (706:33): [True: 2, False: 0]
  ------------------
  707|     14|            score = ossl_property_match_count(pq, impl->properties);
  708|     14|            if (score > best) {
  ------------------
  |  Branch (708:17): [True: 14, False: 0]
  ------------------
  709|     14|                best_impl = impl;
  710|     14|                best = score;
  711|     14|                ret = 1;
  712|     14|                if (!optional)
  ------------------
  |  Branch (712:21): [True: 14, False: 0]
  ------------------
  713|     14|                    goto fin;
  714|     14|            }
  715|     14|        }
  716|     14|    }
  717|     14|fin:
  718|     14|    if (ret && ossl_method_up_ref(&best_impl->method)) {
  ------------------
  |  Branch (718:9): [True: 14, False: 0]
  |  Branch (718:16): [True: 14, False: 0]
  ------------------
  719|     14|        *method = best_impl->method.method;
  720|     14|        if (prov_rw != NULL)
  ------------------
  |  Branch (720:13): [True: 14, False: 0]
  ------------------
  721|     14|            *prov_rw = best_impl->provider;
  722|     14|    } else {
  723|      0|        ret = 0;
  724|      0|    }
  725|       |
  726|     14|#ifndef FIPS_MODULE
  727|     14|    OSSL_TRACE_BEGIN(QUERY) {
  ------------------
  |  |  220|     14|    do {                                        \
  |  |  221|     14|        BIO *trc_out = NULL;                    \
  |  |  222|     14|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  728|      0|        char buf[512];
  729|      0|        int size;
  730|       |
  731|      0|        size = ossl_property_list_to_string(NULL, pq, buf, 512);
  732|      0|        BIO_printf(trc_out, "method store query with properties %s "
  733|      0|                   "resolves to provider %s\n",
  734|      0|                   size == 0 ? "none" : buf,
  ------------------
  |  Branch (734:20): [True: 0, False: 0]
  ------------------
  735|      0|                   best_impl == NULL ? "none" :
  ------------------
  |  Branch (735:20): [True: 0, False: 0]
  ------------------
  736|      0|                   ossl_provider_name(best_impl->provider));
  737|     14|    } OSSL_TRACE_END(QUERY);
  ------------------
  |  |  225|     14|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  738|     14|#endif
  739|       |
  740|     14|    ossl_property_unlock(store);
  741|     14|    ossl_property_free(p2);
  742|     14|    return ret;
  743|     14|}
ossl_method_store_cache_get:
  846|  1.45k|{
  847|  1.45k|    ALGORITHM *alg;
  848|  1.45k|    QUERY elem, *r;
  849|  1.45k|    int res = 0;
  850|       |
  851|  1.45k|    if (nid <= 0 || store == NULL || prop_query == NULL)
  ------------------
  |  Branch (851:9): [True: 0, False: 1.45k]
  |  Branch (851:21): [True: 0, False: 1.45k]
  |  Branch (851:38): [True: 0, False: 1.45k]
  ------------------
  852|      0|        return 0;
  853|       |
  854|  1.45k|    if (!ossl_property_read_lock(store))
  ------------------
  |  Branch (854:9): [True: 0, False: 1.45k]
  ------------------
  855|      0|        return 0;
  856|  1.45k|    alg = ossl_method_store_retrieve(store, nid);
  857|  1.45k|    if (alg == NULL)
  ------------------
  |  Branch (857:9): [True: 42, False: 1.40k]
  ------------------
  858|     42|        goto err;
  859|       |
  860|  1.40k|    elem.query = prop_query;
  861|  1.40k|    elem.provider = prov;
  862|  1.40k|    r = lh_QUERY_retrieve(alg->cache, &elem);
  863|  1.40k|    if (r == NULL)
  ------------------
  |  Branch (863:9): [True: 9, False: 1.40k]
  ------------------
  864|      9|        goto err;
  865|  1.40k|    if (ossl_method_up_ref(&r->method)) {
  ------------------
  |  Branch (865:9): [True: 1.40k, False: 0]
  ------------------
  866|  1.40k|        *method = r->method.method;
  867|  1.40k|        res = 1;
  868|  1.40k|    }
  869|  1.45k|err:
  870|  1.45k|    ossl_property_unlock(store);
  871|  1.45k|    return res;
  872|  1.40k|}
ossl_method_store_cache_set:
  878|     14|{
  879|     14|    QUERY elem, *old, *p = NULL;
  880|     14|    ALGORITHM *alg;
  881|     14|    size_t len;
  882|     14|    int res = 1;
  883|       |
  884|     14|    if (nid <= 0 || store == NULL || prop_query == NULL)
  ------------------
  |  Branch (884:9): [True: 0, False: 14]
  |  Branch (884:21): [True: 0, False: 14]
  |  Branch (884:38): [True: 0, False: 14]
  ------------------
  885|      0|        return 0;
  886|       |
  887|     14|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|     14|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     14|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (887:9): [True: 0, False: 14]
  ------------------
  888|      0|        return 0;
  889|       |
  890|     14|    if (!ossl_property_write_lock(store))
  ------------------
  |  Branch (890:9): [True: 0, False: 14]
  ------------------
  891|      0|        return 0;
  892|     14|    if (store->cache_need_flush)
  ------------------
  |  Branch (892:9): [True: 0, False: 14]
  ------------------
  893|      0|        ossl_method_cache_flush_some(store);
  894|     14|    alg = ossl_method_store_retrieve(store, nid);
  895|     14|    if (alg == NULL)
  ------------------
  |  Branch (895:9): [True: 0, False: 14]
  ------------------
  896|      0|        goto err;
  897|       |
  898|     14|    if (method == NULL) {
  ------------------
  |  Branch (898:9): [True: 0, False: 14]
  ------------------
  899|      0|        elem.query = prop_query;
  900|      0|        elem.provider = prov;
  901|      0|        if ((old = lh_QUERY_delete(alg->cache, &elem)) != NULL) {
  ------------------
  |  Branch (901:13): [True: 0, False: 0]
  ------------------
  902|      0|            impl_cache_free(old);
  903|      0|            store->cache_nelem--;
  904|      0|        }
  905|      0|        goto end;
  906|      0|    }
  907|     14|    p = OPENSSL_malloc(sizeof(*p) + (len = strlen(prop_query)));
  ------------------
  |  |  102|     14|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     14|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     14|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  908|     14|    if (p != NULL) {
  ------------------
  |  Branch (908:9): [True: 14, False: 0]
  ------------------
  909|     14|        p->query = p->body;
  910|     14|        p->provider = prov;
  911|     14|        p->method.method = method;
  912|     14|        p->method.up_ref = method_up_ref;
  913|     14|        p->method.free = method_destruct;
  914|     14|        if (!ossl_method_up_ref(&p->method))
  ------------------
  |  Branch (914:13): [True: 0, False: 14]
  ------------------
  915|      0|            goto err;
  916|     14|        memcpy((char *)p->query, prop_query, len + 1);
  917|     14|        if ((old = lh_QUERY_insert(alg->cache, p)) != NULL) {
  ------------------
  |  Branch (917:13): [True: 0, False: 14]
  ------------------
  918|      0|            impl_cache_free(old);
  919|      0|            goto end;
  920|      0|        }
  921|     14|        if (!lh_QUERY_error(alg->cache)) {
  ------------------
  |  Branch (921:13): [True: 14, False: 0]
  ------------------
  922|     14|            if (++store->cache_nelem >= IMPL_CACHE_FLUSH_THRESHOLD)
  ------------------
  |  |   34|     14|#define IMPL_CACHE_FLUSH_THRESHOLD  500
  ------------------
  |  Branch (922:17): [True: 0, False: 14]
  ------------------
  923|      0|                store->cache_need_flush = 1;
  924|     14|            goto end;
  925|     14|        }
  926|      0|        ossl_method_free(&p->method);
  927|      0|    }
  928|      0|err:
  929|      0|    res = 0;
  930|      0|    OPENSSL_free(p);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  931|     14|end:
  932|     14|    ossl_property_unlock(store);
  933|     14|    return res;
  934|      0|}
property.c:alg_cleanup:
  226|    220|{
  227|    220|    OSSL_METHOD_STORE *store = arg;
  228|       |
  229|    220|    if (a != NULL) {
  ------------------
  |  Branch (229:9): [True: 220, False: 0]
  ------------------
  230|    220|        sk_IMPLEMENTATION_pop_free(a->impls, &impl_free);
  231|    220|        lh_QUERY_doall(a->cache, &impl_cache_free);
  232|    220|        lh_QUERY_free(a->cache);
  233|    220|        OPENSSL_free(a);
  ------------------
  |  |  115|    220|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  234|    220|    }
  235|    220|    if (store != NULL)
  ------------------
  |  Branch (235:9): [True: 220, False: 0]
  ------------------
  236|    220|        ossl_sa_ALGORITHM_set(store->algs, idx, NULL);
  237|    220|}
property.c:ossl_method_up_ref:
  163|  1.64k|{
  164|  1.64k|    return (*method->up_ref)(method->method);
  165|  1.64k|}
property.c:ossl_property_write_lock:
  178|    234|{
  179|    234|    return p != NULL ? CRYPTO_THREAD_write_lock(p->lock) : 0;
  ------------------
  |  Branch (179:12): [True: 234, False: 0]
  ------------------
  180|    234|}
property.c:impl_free:
  204|    220|{
  205|    220|    if (impl != NULL) {
  ------------------
  |  Branch (205:9): [True: 220, False: 0]
  ------------------
  206|    220|        ossl_method_free(&impl->method);
  207|    220|        OPENSSL_free(impl);
  ------------------
  |  |  115|    220|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    220|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    220|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  208|    220|    }
  209|    220|}
property.c:ossl_method_store_retrieve:
  283|  1.95k|{
  284|  1.95k|    return ossl_sa_ALGORITHM_get(store->algs, nid);
  285|  1.95k|}
property.c:query_hash:
  188|  1.42k|{
  189|  1.42k|    return OPENSSL_LH_strhash(a->query);
  190|  1.42k|}
property.c:query_cmp:
  193|  1.40k|{
  194|  1.40k|    int res = strcmp(a->query, b->query);
  195|       |
  196|  1.40k|    if (res == 0 && a->provider != NULL && b->provider != NULL)
  ------------------
  |  Branch (196:9): [True: 1.40k, False: 0]
  |  Branch (196:21): [True: 1.40k, False: 0]
  |  Branch (196:44): [True: 96, False: 1.30k]
  ------------------
  197|     96|        res = b->provider > a->provider ? 1
  ------------------
  |  Branch (197:15): [True: 0, False: 96]
  ------------------
  198|     96|            : b->provider < a->provider ? -1
  ------------------
  |  Branch (198:15): [True: 0, False: 96]
  ------------------
  199|     96|            : 0;
  200|  1.40k|    return res;
  201|  1.40k|}
property.c:ossl_method_store_insert:
  288|    220|{
  289|    220|    return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg);
  290|    220|}
property.c:ossl_property_unlock:
  183|  1.73k|{
  184|  1.73k|    return p != 0 ? CRYPTO_THREAD_unlock(p->lock) : 0;
  ------------------
  |  Branch (184:12): [True: 1.73k, False: 0]
  ------------------
  185|  1.73k|}
property.c:ossl_property_read_lock:
  173|  1.50k|{
  174|  1.50k|    return p != NULL ? CRYPTO_THREAD_read_lock(p->lock) : 0;
  ------------------
  |  Branch (174:12): [True: 1.50k, False: 0]
  ------------------
  175|  1.50k|}
property.c:ossl_method_cache_flush:
  753|    220|{
  754|    220|    ALGORITHM *alg = ossl_method_store_retrieve(store, nid);
  755|       |
  756|    220|    if (alg != NULL)
  ------------------
  |  Branch (756:9): [True: 0, False: 220]
  ------------------
  757|      0|        ossl_method_cache_flush_alg(store, alg);
  758|    220|}
property.c:impl_cache_free:
  212|     14|{
  213|     14|    if (elem != NULL) {
  ------------------
  |  Branch (213:9): [True: 14, False: 0]
  ------------------
  214|     14|        ossl_method_free(&elem->method);
  215|     14|        OPENSSL_free(elem);
  ------------------
  |  |  115|     14|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     14|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     14|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  216|     14|    }
  217|     14|}
property.c:ossl_method_free:
  168|    234|{
  169|    234|    (*method->free)(method->method);
  170|    234|}

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

ossl_parse_property:
  346|      1|{
  347|      1|    OSSL_PROPERTY_DEFINITION *prop = NULL;
  348|      1|    OSSL_PROPERTY_LIST *res = NULL;
  349|      1|    STACK_OF(OSSL_PROPERTY_DEFINITION) *sk;
  ------------------
  |  |   31|      1|# define STACK_OF(type) struct stack_st_##type
  ------------------
  350|      1|    const char *s = defn;
  351|      1|    int done;
  352|       |
  353|      1|    if (s == NULL || (sk = sk_OSSL_PROPERTY_DEFINITION_new(&pd_compare)) == NULL)
  ------------------
  |  Branch (353:9): [True: 0, False: 1]
  |  Branch (353:22): [True: 0, False: 1]
  ------------------
  354|      0|        return NULL;
  355|       |
  356|      1|    s = skip_space(s);
  357|      1|    done = *s == '\0';
  358|      2|    while (!done) {
  ------------------
  |  Branch (358:12): [True: 1, False: 1]
  ------------------
  359|      1|        const char *start = s;
  360|       |
  361|      1|        prop = OPENSSL_malloc(sizeof(*prop));
  ------------------
  |  |  102|      1|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  362|      1|        if (prop == NULL)
  ------------------
  |  Branch (362:13): [True: 0, False: 1]
  ------------------
  363|      0|            goto err;
  364|      1|        memset(&prop->v, 0, sizeof(prop->v));
  365|      1|        prop->optional = 0;
  366|      1|        if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (366:13): [True: 0, False: 1]
  ------------------
  367|      0|            goto err;
  368|      1|        prop->oper = OSSL_PROPERTY_OPER_EQ;
  369|      1|        if (prop->name_idx == 0) {
  ------------------
  |  Branch (369:13): [True: 0, False: 1]
  ------------------
  370|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  371|      0|                           "Unknown name HERE-->%s", start);
  372|      0|            goto err;
  373|      0|        }
  374|      1|        if (match_ch(&s, '=')) {
  ------------------
  |  Branch (374:13): [True: 1, False: 0]
  ------------------
  375|      1|            if (!parse_value(ctx, &s, prop, 1)) {
  ------------------
  |  Branch (375:17): [True: 0, False: 1]
  ------------------
  376|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  377|      0|                               "HERE-->%s", start);
  378|      0|                goto err;
  379|      0|            }
  380|      1|        } else {
  381|       |            /* A name alone means a true Boolean */
  382|      0|            prop->type = OSSL_PROPERTY_TYPE_STRING;
  383|      0|            prop->v.str_val = OSSL_PROPERTY_TRUE;
  ------------------
  |  |   37|      0|#define OSSL_PROPERTY_TRUE      1
  ------------------
  384|      0|        }
  385|       |
  386|      1|        if (!sk_OSSL_PROPERTY_DEFINITION_push(sk, prop))
  ------------------
  |  Branch (386:13): [True: 0, False: 1]
  ------------------
  387|      0|            goto err;
  388|      1|        prop = NULL;
  389|      1|        done = !match_ch(&s, ',');
  390|      1|    }
  391|      1|    if (*s != '\0') {
  ------------------
  |  Branch (391:9): [True: 0, False: 1]
  ------------------
  392|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  393|      0|                       "HERE-->%s", s);
  394|      0|        goto err;
  395|      0|    }
  396|      1|    res = stack_to_property_list(ctx, sk);
  397|       |
  398|      1|err:
  399|      1|    OPENSSL_free(prop);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  400|      1|    sk_OSSL_PROPERTY_DEFINITION_pop_free(sk, &pd_free);
  401|      1|    return res;
  402|      1|}
ossl_parse_query:
  406|     14|{
  407|     14|    STACK_OF(OSSL_PROPERTY_DEFINITION) *sk;
  ------------------
  |  |   31|     14|# define STACK_OF(type) struct stack_st_##type
  ------------------
  408|     14|    OSSL_PROPERTY_LIST *res = NULL;
  409|     14|    OSSL_PROPERTY_DEFINITION *prop = NULL;
  410|     14|    int done;
  411|       |
  412|     14|    if (s == NULL || (sk = sk_OSSL_PROPERTY_DEFINITION_new(&pd_compare)) == NULL)
  ------------------
  |  Branch (412:9): [True: 0, False: 14]
  |  Branch (412:22): [True: 0, False: 14]
  ------------------
  413|      0|        return NULL;
  414|       |
  415|     14|    s = skip_space(s);
  416|     14|    done = *s == '\0';
  417|     14|    while (!done) {
  ------------------
  |  Branch (417:12): [True: 0, False: 14]
  ------------------
  418|      0|        prop = OPENSSL_malloc(sizeof(*prop));
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  419|      0|        if (prop == NULL)
  ------------------
  |  Branch (419:13): [True: 0, False: 0]
  ------------------
  420|      0|            goto err;
  421|      0|        memset(&prop->v, 0, sizeof(prop->v));
  422|       |
  423|      0|        if (match_ch(&s, '-')) {
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|            prop->oper = OSSL_PROPERTY_OVERRIDE;
  425|      0|            prop->optional = 0;
  426|      0|            if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (426:17): [True: 0, False: 0]
  ------------------
  427|      0|                goto err;
  428|      0|            goto skip_value;
  429|      0|        }
  430|      0|        prop->optional = match_ch(&s, '?');
  431|      0|        if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (431:13): [True: 0, False: 0]
  ------------------
  432|      0|            goto err;
  433|       |
  434|      0|        if (match_ch(&s, '=')) {
  ------------------
  |  Branch (434:13): [True: 0, False: 0]
  ------------------
  435|      0|            prop->oper = OSSL_PROPERTY_OPER_EQ;
  436|      0|        } else if (MATCH(&s, "!=")) {
  ------------------
  |  |   43|      0|#define MATCH(s, m) match(s, m, sizeof(m) - 1)
  |  |  ------------------
  |  |  |  Branch (43:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  437|      0|            prop->oper = OSSL_PROPERTY_OPER_NE;
  438|      0|        } else {
  439|       |            /* A name alone is a Boolean comparison for true */
  440|      0|            prop->oper = OSSL_PROPERTY_OPER_EQ;
  441|      0|            prop->type = OSSL_PROPERTY_TYPE_STRING;
  442|      0|            prop->v.str_val = OSSL_PROPERTY_TRUE;
  ------------------
  |  |   37|      0|#define OSSL_PROPERTY_TRUE      1
  ------------------
  443|      0|            goto skip_value;
  444|      0|        }
  445|      0|        if (!parse_value(ctx, &s, prop, create_values))
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|            prop->type = OSSL_PROPERTY_TYPE_VALUE_UNDEFINED;
  447|       |
  448|      0|skip_value:
  449|      0|        if (!sk_OSSL_PROPERTY_DEFINITION_push(sk, prop))
  ------------------
  |  Branch (449:13): [True: 0, False: 0]
  ------------------
  450|      0|            goto err;
  451|      0|        prop = NULL;
  452|      0|        done = !match_ch(&s, ',');
  453|      0|    }
  454|     14|    if (*s != '\0') {
  ------------------
  |  Branch (454:9): [True: 0, False: 14]
  ------------------
  455|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  456|      0|                       "HERE-->%s", s);
  457|      0|        goto err;
  458|      0|    }
  459|     14|    res = stack_to_property_list(ctx, sk);
  460|       |
  461|     14|err:
  462|     14|    OPENSSL_free(prop);
  ------------------
  |  |  115|     14|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     14|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     14|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  463|     14|    sk_OSSL_PROPERTY_DEFINITION_pop_free(sk, &pd_free);
  464|     14|    return res;
  465|     14|}
ossl_property_match_count:
  473|     14|{
  474|     14|    const OSSL_PROPERTY_DEFINITION *const q = query->properties;
  475|     14|    const OSSL_PROPERTY_DEFINITION *const d = defn->properties;
  476|     14|    int i = 0, j = 0, matches = 0;
  477|     14|    OSSL_PROPERTY_OPER oper;
  478|       |
  479|     14|    while (i < query->num_properties) {
  ------------------
  |  Branch (479:12): [True: 0, False: 14]
  ------------------
  480|      0|        if ((oper = q[i].oper) == OSSL_PROPERTY_OVERRIDE) {
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|            i++;
  482|      0|            continue;
  483|      0|        }
  484|      0|        if (j < defn->num_properties) {
  ------------------
  |  Branch (484:13): [True: 0, False: 0]
  ------------------
  485|      0|            if (q[i].name_idx > d[j].name_idx) {  /* skip defn, not in query */
  ------------------
  |  Branch (485:17): [True: 0, False: 0]
  ------------------
  486|      0|                j++;
  487|      0|                continue;
  488|      0|            }
  489|      0|            if (q[i].name_idx == d[j].name_idx) { /* both in defn and query */
  ------------------
  |  Branch (489:17): [True: 0, False: 0]
  ------------------
  490|      0|                const int eq = q[i].type == d[j].type
  ------------------
  |  Branch (490:32): [True: 0, False: 0]
  ------------------
  491|      0|                               && memcmp(&q[i].v, &d[j].v, sizeof(q[i].v)) == 0;
  ------------------
  |  Branch (491:35): [True: 0, False: 0]
  ------------------
  492|       |
  493|      0|                if ((eq && oper == OSSL_PROPERTY_OPER_EQ)
  ------------------
  |  Branch (493:22): [True: 0, False: 0]
  |  Branch (493:28): [True: 0, False: 0]
  ------------------
  494|      0|                    || (!eq && oper == OSSL_PROPERTY_OPER_NE))
  ------------------
  |  Branch (494:25): [True: 0, False: 0]
  |  Branch (494:32): [True: 0, False: 0]
  ------------------
  495|      0|                    matches++;
  496|      0|                else if (!q[i].optional)
  ------------------
  |  Branch (496:26): [True: 0, False: 0]
  ------------------
  497|      0|                    return -1;
  498|      0|                i++;
  499|      0|                j++;
  500|      0|                continue;
  501|      0|            }
  502|      0|        }
  503|       |
  504|       |        /*
  505|       |         * Handle the cases of a missing value and a query with no corresponding
  506|       |         * definition.  The former fails for any comparison except inequality,
  507|       |         * the latter is treated as a comparison against the Boolean false.
  508|       |         */
  509|      0|        if (q[i].type == OSSL_PROPERTY_TYPE_VALUE_UNDEFINED) {
  ------------------
  |  Branch (509:13): [True: 0, False: 0]
  ------------------
  510|      0|            if (oper == OSSL_PROPERTY_OPER_NE)
  ------------------
  |  Branch (510:17): [True: 0, False: 0]
  ------------------
  511|      0|                matches++;
  512|      0|            else if (!q[i].optional)
  ------------------
  |  Branch (512:22): [True: 0, False: 0]
  ------------------
  513|      0|                return -1;
  514|      0|        } else if (q[i].type != OSSL_PROPERTY_TYPE_STRING
  ------------------
  |  Branch (514:20): [True: 0, False: 0]
  ------------------
  515|      0|                   || (oper == OSSL_PROPERTY_OPER_EQ
  ------------------
  |  Branch (515:24): [True: 0, False: 0]
  ------------------
  516|      0|                       && q[i].v.str_val != OSSL_PROPERTY_FALSE)
  ------------------
  |  |   38|      0|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (516:27): [True: 0, False: 0]
  ------------------
  517|      0|                   || (oper == OSSL_PROPERTY_OPER_NE
  ------------------
  |  Branch (517:24): [True: 0, False: 0]
  ------------------
  518|      0|                       && q[i].v.str_val == OSSL_PROPERTY_FALSE)) {
  ------------------
  |  |   38|      0|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (518:27): [True: 0, False: 0]
  ------------------
  519|      0|            if (!q[i].optional)
  ------------------
  |  Branch (519:17): [True: 0, False: 0]
  ------------------
  520|      0|                return -1;
  521|      0|        } else {
  522|      0|            matches++;
  523|      0|        }
  524|      0|        i++;
  525|      0|    }
  526|     14|    return matches;
  527|     14|}
ossl_property_free:
  530|     16|{
  531|     16|    OPENSSL_free(p);
  ------------------
  |  |  115|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  532|     16|}
ossl_property_parse_init:
  575|      1|{
  576|      1|    static const char *const predefined_names[] = {
  577|      1|        "provider",     /* Name of provider (default, legacy, fips) */
  578|      1|        "version",      /* Version number of this provider */
  579|      1|        "fips",         /* FIPS validated or FIPS supporting algorithm */
  580|      1|        "output",       /* Output type for encoders */
  581|      1|        "input",        /* Input type for decoders */
  582|      1|        "structure",    /* Structure name for encoders and decoders */
  583|      1|    };
  584|      1|    size_t i;
  585|       |
  586|      7|    for (i = 0; i < OSSL_NELEM(predefined_names); i++)
  ------------------
  |  |   14|      7|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (586:17): [True: 6, False: 1]
  ------------------
  587|      6|        if (ossl_property_name(ctx, predefined_names[i], 1) == 0)
  ------------------
  |  Branch (587:13): [True: 0, False: 6]
  ------------------
  588|      0|            goto err;
  589|       |
  590|       |    /*
  591|       |     * Pre-populate the two Boolean values. We must do them before any other
  592|       |     * values and in this order so that we get the same index as the global
  593|       |     * OSSL_PROPERTY_TRUE and OSSL_PROPERTY_FALSE values
  594|       |     */
  595|      1|    if ((ossl_property_value(ctx, "yes", 1) != OSSL_PROPERTY_TRUE)
  ------------------
  |  |   37|      1|#define OSSL_PROPERTY_TRUE      1
  ------------------
  |  Branch (595:9): [True: 0, False: 1]
  ------------------
  596|      1|        || (ossl_property_value(ctx, "no", 1) != OSSL_PROPERTY_FALSE))
  ------------------
  |  |   38|      1|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (596:12): [True: 0, False: 1]
  ------------------
  597|      0|        goto err;
  598|       |
  599|      1|    return 1;
  600|      0|err:
  601|      0|    return 0;
  602|      1|}
property_parse.c:skip_space:
   26|     18|{
   27|     18|    while (ossl_isspace(*s))
  ------------------
  |  |   82|     18|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|     18|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 0, False: 18]
  |  |  ------------------
  ------------------
   28|      0|        s++;
   29|     18|    return s;
   30|     18|}
property_parse.c:parse_name:
   58|      1|{
   59|      1|    char name[100];
   60|      1|    int err = 0;
   61|      1|    size_t i = 0;
   62|      1|    const char *s = *t;
   63|      1|    int user_name = 0;
   64|       |
   65|      1|    for (;;) {
   66|      1|        if (!ossl_isalpha(*s)) {
  ------------------
  |  |   71|      1|# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
  |  |  ------------------
  |  |  |  |   40|      1|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|      1|# define CTYPE_MASK_lower       0x1
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|      1|# define CTYPE_MASK_upper       0x2
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (66:13): [True: 0, False: 1]
  ------------------
   67|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
   68|      0|                           "HERE-->%s", *t);
   69|      0|            return 0;
   70|      0|        }
   71|      8|        do {
   72|      8|            if (i < sizeof(name) - 1)
  ------------------
  |  Branch (72:17): [True: 8, False: 0]
  ------------------
   73|      8|                name[i++] = ossl_tolower(*s);
   74|      0|            else
   75|      0|                err = 1;
   76|      8|        } while (*++s == '_' || ossl_isalnum(*s));
  ------------------
  |  |   70|      8|# define ossl_isalnum(c)        (ossl_ctype_check((c), CTYPE_MASK_alnum))
  |  |  ------------------
  |  |  |  |   41|      8|# define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|      8|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   27|      8|# define CTYPE_MASK_lower       0x1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   28|      8|# define CTYPE_MASK_upper       0x2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|      8|# define CTYPE_MASK_digit       0x4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (70:33): [True: 7, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (76:18): [True: 0, False: 8]
  ------------------
   77|      1|        if (*s != '.')
  ------------------
  |  Branch (77:13): [True: 1, False: 0]
  ------------------
   78|      1|            break;
   79|      0|        user_name = 1;
   80|      0|        if (i < sizeof(name) - 1)
  ------------------
  |  Branch (80:13): [True: 0, False: 0]
  ------------------
   81|      0|            name[i++] = *s;
   82|      0|        else
   83|      0|            err = 1;
   84|      0|        s++;
   85|      0|    }
   86|      1|    name[i] = '\0';
   87|      1|    if (err) {
  ------------------
  |  Branch (87:9): [True: 0, False: 1]
  ------------------
   88|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
   89|      0|        return 0;
   90|      0|    }
   91|      1|    *t = skip_space(s);
   92|      1|    *idx = ossl_property_name(ctx, name, user_name && create);
  ------------------
  |  Branch (92:42): [True: 0, False: 1]
  |  Branch (92:55): [True: 0, False: 0]
  ------------------
   93|      1|    return 1;
   94|      1|}
property_parse.c:match_ch:
   33|      2|{
   34|      2|    const char *s = *t;
   35|       |
   36|      2|    if (*s == m) {
  ------------------
  |  Branch (36:9): [True: 1, False: 1]
  ------------------
   37|      1|        *t = skip_space(s + 1);
   38|      1|        return 1;
   39|      1|    }
   40|      1|    return 0;
   41|      2|}
property_parse.c:parse_value:
  258|      1|{
  259|      1|    const char *s = *t;
  260|      1|    int r = 0;
  261|       |
  262|      1|    if (*s == '"' || *s == '\'') {
  ------------------
  |  Branch (262:9): [True: 0, False: 1]
  |  Branch (262:22): [True: 0, False: 1]
  ------------------
  263|      0|        s++;
  264|      0|        r = parse_string(ctx, &s, s[-1], res, create);
  265|      1|    } else if (*s == '+') {
  ------------------
  |  Branch (265:16): [True: 0, False: 1]
  ------------------
  266|      0|        s++;
  267|      0|        r = parse_number(&s, res);
  268|      1|    } else if (*s == '-') {
  ------------------
  |  Branch (268:16): [True: 0, False: 1]
  ------------------
  269|      0|        s++;
  270|      0|        r = parse_number(&s, res);
  271|      0|        res->v.int_val = -res->v.int_val;
  272|      1|    } else if (*s == '0' && s[1] == 'x') {
  ------------------
  |  Branch (272:16): [True: 0, False: 1]
  |  Branch (272:29): [True: 0, False: 0]
  ------------------
  273|      0|        s += 2;
  274|      0|        r = parse_hex(&s, res);
  275|      1|    } else if (*s == '0' && ossl_isdigit(s[1])) {
  ------------------
  |  Branch (275:16): [True: 0, False: 1]
  |  Branch (275:29): [True: 0, False: 0]
  ------------------
  276|      0|        s++;
  277|      0|        r = parse_oct(&s, res);
  278|      1|    } else if (ossl_isdigit(*s)) {
  ------------------
  |  Branch (278:16): [True: 0, False: 1]
  ------------------
  279|      0|        return parse_number(t, res);
  280|      1|    } else if (ossl_isalpha(*s))
  ------------------
  |  |   71|      1|# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
  |  |  ------------------
  |  |  |  |   40|      1|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|      1|# define CTYPE_MASK_lower       0x1
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|      1|# define CTYPE_MASK_upper       0x2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:33): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  281|      1|        return parse_unquoted(ctx, t, res, create);
  282|      0|    if (r)
  ------------------
  |  Branch (282:9): [True: 0, False: 0]
  ------------------
  283|      0|        *t = s;
  284|      0|    return r;
  285|      1|}
property_parse.c:parse_unquoted:
  226|      1|{
  227|      1|    char v[1000];
  228|      1|    const char *s = *t;
  229|      1|    size_t i = 0;
  230|      1|    int err = 0;
  231|       |
  232|      1|    if (*s == '\0' || *s == ',')
  ------------------
  |  Branch (232:9): [True: 0, False: 1]
  |  Branch (232:23): [True: 0, False: 1]
  ------------------
  233|      0|        return 0;
  234|      8|    while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
  ------------------
  |  |   80|     16|# define ossl_isprint(c)        (ossl_ctype_check((c), CTYPE_MASK_print))
  |  |  ------------------
  |  |  |  |   35|      8|# define CTYPE_MASK_print       0x100
  |  |  ------------------
  |  |  |  Branch (80:33): [True: 7, False: 1]
  |  |  ------------------
  ------------------
                  while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
  ------------------
  |  |   82|     15|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|      7|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  ------------------
  |  Branch (234:32): [True: 7, False: 0]
  |  Branch (234:53): [True: 7, False: 0]
  ------------------
  235|      7|        if (i < sizeof(v) - 1)
  ------------------
  |  Branch (235:13): [True: 7, False: 0]
  ------------------
  236|      7|            v[i++] = ossl_tolower(*s);
  237|      0|        else
  238|      0|            err = 1;
  239|      7|        s++;
  240|      7|    }
  241|      1|    if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
  ------------------
  |  |   82|      2|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|      1|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  ------------------
  |  Branch (241:9): [True: 1, False: 0]
  |  Branch (241:30): [True: 0, False: 1]
  |  Branch (241:44): [True: 0, False: 0]
  ------------------
  242|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  243|      0|                       "HERE-->%s", s);
  244|      0|        return 0;
  245|      0|    }
  246|      1|    v[i] = 0;
  247|      1|    if (err)
  ------------------
  |  Branch (247:9): [True: 0, False: 1]
  ------------------
  248|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  249|      1|    else if ((res->v.str_val = ossl_property_value(ctx, v, create)) == 0)
  ------------------
  |  Branch (249:14): [True: 0, False: 1]
  ------------------
  250|      0|        err = 1;
  251|      1|    *t = skip_space(s);
  252|      1|    res->type = OSSL_PROPERTY_TYPE_STRING;
  253|      1|    return !err;
  254|      1|}
property_parse.c:stack_to_property_list:
  314|     15|{
  315|     15|    const int n = sk_OSSL_PROPERTY_DEFINITION_num(sk);
  316|     15|    OSSL_PROPERTY_LIST *r;
  317|     15|    OSSL_PROPERTY_IDX prev_name_idx = 0;
  318|     15|    int i;
  319|       |
  320|     15|    r = OPENSSL_malloc(sizeof(*r)
  ------------------
  |  |  102|     30|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     15|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     15|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (102:23): [True: 14, False: 1]
  |  |  ------------------
  ------------------
  321|     15|                       + (n <= 0 ? 0 : n - 1) * sizeof(r->properties[0]));
  322|     15|    if (r != NULL) {
  ------------------
  |  Branch (322:9): [True: 15, False: 0]
  ------------------
  323|     15|        sk_OSSL_PROPERTY_DEFINITION_sort(sk);
  324|       |
  325|     15|        r->has_optional = 0;
  326|     16|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (326:21): [True: 1, False: 15]
  ------------------
  327|      1|            r->properties[i] = *sk_OSSL_PROPERTY_DEFINITION_value(sk, i);
  328|      1|            r->has_optional |= r->properties[i].optional;
  329|       |
  330|       |            /* Check for duplicated names */
  331|      1|            if (i > 0 && r->properties[i].name_idx == prev_name_idx) {
  ------------------
  |  Branch (331:17): [True: 0, False: 1]
  |  Branch (331:26): [True: 0, False: 0]
  ------------------
  332|      0|                OPENSSL_free(r);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  333|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  ------------------
  334|      0|                               "Duplicated name `%s'",
  335|      0|                               ossl_property_name_str(ctx, prev_name_idx));
  336|      0|                return NULL;
  337|      0|            }
  338|      1|            prev_name_idx = r->properties[i].name_idx;
  339|      1|        }
  340|     15|        r->num_properties = n;
  341|     15|    }
  342|     15|    return r;
  343|     15|}
property_parse.c:pd_free:
  301|      1|{
  302|      1|    OPENSSL_free(pd);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  303|      1|}

ossl_property_has_optional:
   63|     14|{
   64|     14|    return query->has_optional ? 1 : 0;
  ------------------
  |  Branch (64:12): [True: 0, False: 14]
  ------------------
   65|     14|}

ossl_property_string_data_free:
   77|      1|{
   78|      1|    PROPERTY_STRING_DATA *propdata = vpropdata;
   79|       |
   80|      1|    if (propdata == NULL)
  ------------------
  |  Branch (80:9): [True: 0, False: 1]
  ------------------
   81|      0|        return;
   82|       |
   83|      1|    CRYPTO_THREAD_lock_free(propdata->lock);
   84|      1|    property_table_free(&propdata->prop_names);
   85|      1|    property_table_free(&propdata->prop_values);
   86|      1|#ifndef OPENSSL_SMALL_FOOTPRINT
   87|      1|    sk_OPENSSL_CSTRING_free(propdata->prop_namelist);
  ------------------
  |  |  261|      1|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   88|      1|    sk_OPENSSL_CSTRING_free(propdata->prop_valuelist);
  ------------------
  |  |  261|      1|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   89|      1|    propdata->prop_namelist = propdata->prop_valuelist = NULL;
   90|      1|#endif
   91|      1|    propdata->prop_name_idx = propdata->prop_value_idx = 0;
   92|       |
   93|      1|    OPENSSL_free(propdata);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|      1|}
ossl_property_string_data_new:
   96|      1|void *ossl_property_string_data_new(OSSL_LIB_CTX *ctx) {
   97|      1|    PROPERTY_STRING_DATA *propdata = OPENSSL_zalloc(sizeof(*propdata));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   98|       |
   99|      1|    if (propdata == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 1]
  ------------------
  100|      0|        return NULL;
  101|       |
  102|      1|    propdata->lock = CRYPTO_THREAD_lock_new();
  103|      1|    propdata->prop_names = lh_PROPERTY_STRING_new(&property_hash,
  104|      1|                                                  &property_cmp);
  105|      1|    propdata->prop_values = lh_PROPERTY_STRING_new(&property_hash,
  106|      1|                                                   &property_cmp);
  107|      1|#ifndef OPENSSL_SMALL_FOOTPRINT
  108|      1|    propdata->prop_namelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  258|      1|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  109|      1|    propdata->prop_valuelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  258|      1|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  110|      1|#endif
  111|      1|    if (propdata->lock == NULL
  ------------------
  |  Branch (111:9): [True: 0, False: 1]
  ------------------
  112|      1|#ifndef OPENSSL_SMALL_FOOTPRINT
  113|      1|            || propdata->prop_namelist == NULL
  ------------------
  |  Branch (113:16): [True: 0, False: 1]
  ------------------
  114|      1|            || propdata->prop_valuelist == NULL
  ------------------
  |  Branch (114:16): [True: 0, False: 1]
  ------------------
  115|      1|#endif
  116|      1|            || propdata->prop_names == NULL
  ------------------
  |  Branch (116:16): [True: 0, False: 1]
  ------------------
  117|      1|            || propdata->prop_values == NULL) {
  ------------------
  |  Branch (117:16): [True: 0, False: 1]
  ------------------
  118|      0|        ossl_property_string_data_free(propdata);
  119|      0|        return NULL;
  120|      0|    }
  121|      1|    return propdata;
  122|      1|}
ossl_property_name:
  253|      7|{
  254|      7|    return ossl_property_string(ctx, 1, create, s);
  255|      7|}
ossl_property_value:
  264|      3|{
  265|      3|    return ossl_property_string(ctx, 0, create, s);
  266|      3|}
property_string.c:property_table_free:
   66|      2|{
   67|      2|    PROP_TABLE *t = *pt;
   68|       |
   69|      2|    if (t != NULL) {
  ------------------
  |  Branch (69:9): [True: 2, False: 0]
  ------------------
   70|      2|        lh_PROPERTY_STRING_doall(t, &property_free);
   71|      2|        lh_PROPERTY_STRING_free(t);
   72|      2|        *pt = NULL;
   73|      2|    }
   74|      2|}
property_string.c:property_free:
   61|      9|{
   62|      9|    OPENSSL_free(ps);
  ------------------
  |  |  115|      9|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   63|      9|}
property_string.c:property_hash:
   51|     28|{
   52|     28|    return OPENSSL_LH_strhash(a->s);
   53|     28|}
property_string.c:property_cmp:
   56|      1|{
   57|      1|    return strcmp(a->s, b->s);
   58|      1|}
property_string.c:ossl_property_string:
  144|     10|{
  145|     10|    PROPERTY_STRING p, *ps, *ps_new;
  146|     10|    PROP_TABLE *t;
  147|     10|    OSSL_PROPERTY_IDX *pidx;
  148|     10|    PROPERTY_STRING_DATA *propdata
  149|     10|        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX);
  ------------------
  |  |  101|     10|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  150|       |
  151|     10|    if (propdata == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 10]
  ------------------
  152|      0|        return 0;
  153|       |
  154|     10|    t = name ? propdata->prop_names : propdata->prop_values;
  ------------------
  |  Branch (154:9): [True: 7, False: 3]
  ------------------
  155|     10|    p.s = s;
  156|     10|    if (!CRYPTO_THREAD_read_lock(propdata->lock)) {
  ------------------
  |  Branch (156:9): [True: 0, False: 10]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  158|      0|        return 0;
  159|      0|    }
  160|     10|    ps = lh_PROPERTY_STRING_retrieve(t, &p);
  161|     10|    if (ps == NULL && create) {
  ------------------
  |  Branch (161:9): [True: 9, False: 1]
  |  Branch (161:23): [True: 9, False: 0]
  ------------------
  162|      9|        CRYPTO_THREAD_unlock(propdata->lock);
  163|      9|        if (!CRYPTO_THREAD_write_lock(propdata->lock)) {
  ------------------
  |  Branch (163:13): [True: 0, False: 9]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  165|      0|            return 0;
  166|      0|        }
  167|      9|        pidx = name ? &propdata->prop_name_idx : &propdata->prop_value_idx;
  ------------------
  |  Branch (167:16): [True: 6, False: 3]
  ------------------
  168|      9|        ps = lh_PROPERTY_STRING_retrieve(t, &p);
  169|      9|        if (ps == NULL && (ps_new = new_property_string(s, pidx)) != NULL) {
  ------------------
  |  Branch (169:13): [True: 9, False: 0]
  |  Branch (169:27): [True: 9, False: 0]
  ------------------
  170|      9|#ifndef OPENSSL_SMALL_FOOTPRINT
  171|      9|            STACK_OF(OPENSSL_CSTRING) *slist;
  ------------------
  |  |   31|      9|# define STACK_OF(type) struct stack_st_##type
  ------------------
  172|       |
  173|      9|            slist = name ? propdata->prop_namelist : propdata->prop_valuelist;
  ------------------
  |  Branch (173:21): [True: 6, False: 3]
  ------------------
  174|      9|            if (sk_OPENSSL_CSTRING_push(slist, ps_new->s) <= 0) {
  ------------------
  |  |  265|      9|#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: 9]
  ------------------
  175|      0|                property_free(ps_new);
  176|      0|                CRYPTO_THREAD_unlock(propdata->lock);
  177|      0|                return 0;
  178|      0|            }
  179|      9|#endif
  180|      9|            lh_PROPERTY_STRING_insert(t, ps_new);
  181|      9|            if (lh_PROPERTY_STRING_error(t)) {
  ------------------
  |  Branch (181:17): [True: 0, False: 9]
  ------------------
  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);
  ------------------
  |  |  267|      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|      9|            ps = ps_new;
  195|      9|        }
  196|      9|    }
  197|     10|    CRYPTO_THREAD_unlock(propdata->lock);
  198|     10|    return ps != NULL ? ps->idx : 0;
  ------------------
  |  Branch (198:12): [True: 10, False: 0]
  ------------------
  199|     10|}
property_string.c:new_property_string:
  126|      9|{
  127|      9|    const size_t l = strlen(s);
  128|      9|    PROPERTY_STRING *ps = OPENSSL_malloc(sizeof(*ps) + l);
  ------------------
  |  |  102|      9|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  129|       |
  130|      9|    if (ps != NULL) {
  ------------------
  |  Branch (130:9): [True: 9, False: 0]
  ------------------
  131|      9|        memcpy(ps->body, s, l + 1);
  132|      9|        ps->s = ps->body;
  133|      9|        ps->idx = ++*pidx;
  134|      9|        if (ps->idx == 0) {
  ------------------
  |  Branch (134:13): [True: 0, False: 9]
  ------------------
  135|      0|            OPENSSL_free(ps);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|      0|            return NULL;
  137|      0|        }
  138|      9|    }
  139|      9|    return ps;
  140|      9|}

ossl_child_prov_ctx_new:
   38|      1|{
   39|      1|    return OPENSSL_zalloc(sizeof(struct child_prov_globals));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      1|}
ossl_child_prov_ctx_free:
   43|      1|{
   44|      1|    struct child_prov_globals *gbl = vgbl;
   45|       |
   46|      1|    CRYPTO_THREAD_lock_free(gbl->lock);
   47|      1|    OPENSSL_free(gbl);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   48|      1|}

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

ossl_provider_store_free:
  288|      1|{
  289|      1|    struct provider_store_st *store = vstore;
  290|      1|    size_t i;
  291|       |
  292|      1|    if (store == NULL)
  ------------------
  |  Branch (292:9): [True: 0, False: 1]
  ------------------
  293|      0|        return;
  294|      1|    store->freeing = 1;
  295|      1|    OPENSSL_free(store->default_path);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  296|      1|    sk_OSSL_PROVIDER_pop_free(store->providers, provider_deactivate_free);
  297|      1|#ifndef FIPS_MODULE
  298|      1|    sk_OSSL_PROVIDER_CHILD_CB_pop_free(store->child_cbs,
  299|      1|                                       ossl_provider_child_cb_free);
  300|      1|#endif
  301|      1|    CRYPTO_THREAD_lock_free(store->default_path_lock);
  302|      1|    CRYPTO_THREAD_lock_free(store->lock);
  303|      1|    for (i = 0; i < store->numprovinfo; i++)
  ------------------
  |  Branch (303:17): [True: 0, False: 1]
  ------------------
  304|      0|        ossl_provider_info_clear(&store->provinfo[i]);
  305|      1|    OPENSSL_free(store->provinfo);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  306|      1|    OPENSSL_free(store);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|      1|}
ossl_provider_store_new:
  310|      1|{
  311|      1|    struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  312|       |
  313|      1|    if (store == NULL
  ------------------
  |  Branch (313:9): [True: 0, False: 1]
  ------------------
  314|      1|        || (store->providers = sk_OSSL_PROVIDER_new(ossl_provider_cmp)) == NULL
  ------------------
  |  Branch (314:12): [True: 0, False: 1]
  ------------------
  315|      1|        || (store->default_path_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (315:12): [True: 0, False: 1]
  ------------------
  316|      1|#ifndef FIPS_MODULE
  317|      1|        || (store->child_cbs = sk_OSSL_PROVIDER_CHILD_CB_new_null()) == NULL
  ------------------
  |  Branch (317:12): [True: 0, False: 1]
  ------------------
  318|      1|#endif
  319|      1|        || (store->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (319:12): [True: 0, False: 1]
  ------------------
  320|      0|        ossl_provider_store_free(store);
  321|      0|        return NULL;
  322|      0|    }
  323|      1|    store->libctx = ctx;
  324|      1|    store->use_fallbacks = 1;
  325|       |
  326|      1|    return store;
  327|      1|}
ossl_provider_find:
  401|      3|{
  402|      3|    struct provider_store_st *store = NULL;
  403|      3|    OSSL_PROVIDER *prov = NULL;
  404|       |
  405|      3|    if ((store = get_provider_store(libctx)) != NULL) {
  ------------------
  |  Branch (405:9): [True: 3, False: 0]
  ------------------
  406|      3|        OSSL_PROVIDER tmpl = { 0, };
  407|      3|        int i;
  408|       |
  409|      3|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  410|       |        /*
  411|       |         * Make sure any providers are loaded from config before we try to find
  412|       |         * them.
  413|       |         */
  414|      3|        if (!noconfig) {
  ------------------
  |  Branch (414:13): [True: 0, False: 3]
  ------------------
  415|      0|            if (ossl_lib_ctx_is_default(libctx))
  ------------------
  |  Branch (415:17): [True: 0, False: 0]
  ------------------
  416|      0|                OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  472|      0|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  417|      0|        }
  418|      3|#endif
  419|       |
  420|      3|        tmpl.name = (char *)name;
  421|      3|        if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (421:13): [True: 0, False: 3]
  ------------------
  422|      0|            return NULL;
  423|      3|        sk_OSSL_PROVIDER_sort(store->providers);
  424|      3|        if ((i = sk_OSSL_PROVIDER_find(store->providers, &tmpl)) != -1)
  ------------------
  |  Branch (424:13): [True: 3, False: 0]
  ------------------
  425|      3|            prov = sk_OSSL_PROVIDER_value(store->providers, i);
  426|      3|        CRYPTO_THREAD_unlock(store->lock);
  427|      3|        if (prov != NULL && !ossl_provider_up_ref(prov))
  ------------------
  |  Branch (427:13): [True: 3, False: 0]
  |  Branch (427:29): [True: 0, False: 3]
  ------------------
  428|      0|            prov = NULL;
  429|      3|    }
  430|       |
  431|      3|    return prov;
  432|      3|}
ossl_provider_up_ref:
  477|    223|{
  478|    223|    int ref = 0;
  479|       |
  480|    223|    if (CRYPTO_UP_REF(&prov->refcnt, &ref) <= 0)
  ------------------
  |  Branch (480:9): [True: 0, False: 223]
  ------------------
  481|      0|        return 0;
  482|       |
  483|    223|#ifndef FIPS_MODULE
  484|    223|    if (prov->ischild) {
  ------------------
  |  Branch (484:9): [True: 0, False: 223]
  ------------------
  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|    223|#endif
  491|       |
  492|    223|    return ref;
  493|    223|}
ossl_provider_free:
  725|    224|{
  726|    224|    if (prov != NULL) {
  ------------------
  |  Branch (726:9): [True: 224, False: 0]
  ------------------
  727|    224|        int ref = 0;
  728|       |
  729|    224|        CRYPTO_DOWN_REF(&prov->refcnt, &ref);
  730|       |
  731|       |        /*
  732|       |         * When the refcount drops to zero, we clean up the provider.
  733|       |         * Note that this also does teardown, which may seem late,
  734|       |         * considering that init happens on first activation.  However,
  735|       |         * there may be other structures hanging on to the provider after
  736|       |         * the last deactivation and may therefore need full access to the
  737|       |         * provider's services.  Therefore, we deinit late.
  738|       |         */
  739|    224|        if (ref == 0) {
  ------------------
  |  Branch (739:13): [True: 1, False: 223]
  ------------------
  740|      1|            if (prov->flag_initialized) {
  ------------------
  |  Branch (740:17): [True: 1, False: 0]
  ------------------
  741|      1|                ossl_provider_teardown(prov);
  742|      1|#ifndef OPENSSL_NO_ERR
  743|      1|# ifndef FIPS_MODULE
  744|      1|                if (prov->error_strings != NULL) {
  ------------------
  |  Branch (744:21): [True: 0, False: 1]
  ------------------
  745|      0|                    ERR_unload_strings(prov->error_lib, prov->error_strings);
  746|      0|                    OPENSSL_free(prov->error_strings);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  747|      0|                    prov->error_strings = NULL;
  748|      0|                }
  749|      1|# endif
  750|      1|#endif
  751|      1|                OPENSSL_free(prov->operation_bits);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  752|      1|                prov->operation_bits = NULL;
  753|      1|                prov->operation_bits_sz = 0;
  754|      1|                prov->flag_initialized = 0;
  755|      1|            }
  756|       |
  757|      1|#ifndef FIPS_MODULE
  758|       |            /*
  759|       |             * We deregister thread handling whether or not the provider was
  760|       |             * initialized. If init was attempted but was not successful then
  761|       |             * the provider may still have registered a thread handler.
  762|       |             */
  763|      1|            ossl_init_thread_deregister(prov);
  764|      1|            DSO_free(prov->module);
  765|      1|#endif
  766|      1|            OPENSSL_free(prov->name);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  767|      1|            OPENSSL_free(prov->path);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  768|      1|            sk_INFOPAIR_pop_free(prov->parameters, infopair_free);
  769|      1|            CRYPTO_THREAD_lock_free(prov->opbits_lock);
  770|      1|            CRYPTO_THREAD_lock_free(prov->flag_lock);
  771|      1|            CRYPTO_THREAD_lock_free(prov->activatecnt_lock);
  772|      1|            CRYPTO_FREE_REF(&prov->refcnt);
  773|      1|            OPENSSL_free(prov);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  774|      1|        }
  775|    223|#ifndef FIPS_MODULE
  776|    223|        else if (prov->ischild) {
  ------------------
  |  Branch (776:18): [True: 0, False: 223]
  ------------------
  777|      0|            ossl_provider_free_parent(prov, 0);
  778|      0|        }
  779|    224|#endif
  780|    224|    }
  781|    224|}
OSSL_PROVIDER_get_conf_parameters:
  831|    732|{
  832|    732|    int i;
  833|       |
  834|    732|    if (prov->parameters == NULL)
  ------------------
  |  Branch (834:9): [True: 0, False: 732]
  ------------------
  835|      0|        return 1;
  836|       |
  837|    732|    for (i = 0; i < sk_INFOPAIR_num(prov->parameters); i++) {
  ------------------
  |  Branch (837:17): [True: 0, False: 732]
  ------------------
  838|      0|        INFOPAIR *pair = sk_INFOPAIR_value(prov->parameters, i);
  839|      0|        OSSL_PARAM *p = OSSL_PARAM_locate(params, pair->name);
  840|       |
  841|      0|        if (p != NULL
  ------------------
  |  Branch (841:13): [True: 0, False: 0]
  ------------------
  842|      0|            && !OSSL_PARAM_set_utf8_ptr(p, pair->value))
  ------------------
  |  Branch (842:16): [True: 0, False: 0]
  ------------------
  843|      0|            return 0;
  844|      0|    }
  845|    732|    return 1;
  846|    732|}
ossl_provider_deactivate:
 1417|      1|{
 1418|      1|    int count;
 1419|       |
 1420|      1|    if (prov == NULL
  ------------------
  |  Branch (1420:9): [True: 0, False: 1]
  ------------------
 1421|      1|            || (count = provider_deactivate(prov, 1, removechildren)) < 0)
  ------------------
  |  Branch (1421:16): [True: 0, False: 1]
  ------------------
 1422|      0|        return 0;
 1423|      1|    return count == 0 ? provider_remove_store_methods(prov) : 1;
  ------------------
  |  Branch (1423:12): [True: 1, False: 0]
  ------------------
 1424|      1|}
ossl_provider_ctx:
 1427|  1.37k|{
 1428|  1.37k|    return prov != NULL ? prov->provctx : NULL;
  ------------------
  |  Branch (1428:12): [True: 1.37k, False: 0]
  ------------------
 1429|  1.37k|}
ossl_provider_doall_activated:
 1528|     35|{
 1529|     35|    int ret = 0, curr, max, ref = 0;
 1530|     35|    struct provider_store_st *store = get_provider_store(ctx);
 1531|     35|    STACK_OF(OSSL_PROVIDER) *provs = NULL;
  ------------------
  |  |   31|     35|# define STACK_OF(type) struct stack_st_##type
  ------------------
 1532|       |
 1533|     35|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
 1534|       |    /*
 1535|       |     * Make sure any providers are loaded from config before we try to use
 1536|       |     * them.
 1537|       |     */
 1538|     35|    if (ossl_lib_ctx_is_default(ctx))
  ------------------
  |  Branch (1538:9): [True: 35, False: 0]
  ------------------
 1539|     35|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  472|     35|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
 1540|     35|#endif
 1541|       |
 1542|     35|    if (store == NULL)
  ------------------
  |  Branch (1542:9): [True: 0, False: 35]
  ------------------
 1543|      0|        return 1;
 1544|     35|    if (!provider_activate_fallbacks(store))
  ------------------
  |  Branch (1544:9): [True: 0, False: 35]
  ------------------
 1545|      0|        return 0;
 1546|       |
 1547|       |    /*
 1548|       |     * Under lock, grab a copy of the provider list and up_ref each
 1549|       |     * provider so that they don't disappear underneath us.
 1550|       |     */
 1551|     35|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1551:9): [True: 0, False: 35]
  ------------------
 1552|      0|        return 0;
 1553|     35|    provs = sk_OSSL_PROVIDER_dup(store->providers);
 1554|     35|    if (provs == NULL) {
  ------------------
  |  Branch (1554:9): [True: 0, False: 35]
  ------------------
 1555|      0|        CRYPTO_THREAD_unlock(store->lock);
 1556|      0|        return 0;
 1557|      0|    }
 1558|     35|    max = sk_OSSL_PROVIDER_num(provs);
 1559|       |    /*
 1560|       |     * We work backwards through the stack so that we can safely delete items
 1561|       |     * as we go.
 1562|       |     */
 1563|     70|    for (curr = max - 1; curr >= 0; curr--) {
  ------------------
  |  Branch (1563:26): [True: 35, False: 35]
  ------------------
 1564|     35|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1565|       |
 1566|     35|        if (!CRYPTO_THREAD_read_lock(prov->flag_lock))
  ------------------
  |  Branch (1566:13): [True: 0, False: 35]
  ------------------
 1567|      0|            goto err_unlock;
 1568|     35|        if (prov->flag_activated) {
  ------------------
  |  Branch (1568:13): [True: 35, False: 0]
  ------------------
 1569|       |            /*
 1570|       |             * We call CRYPTO_UP_REF directly rather than ossl_provider_up_ref
 1571|       |             * to avoid upping the ref count on the parent provider, which we
 1572|       |             * must not do while holding locks.
 1573|       |             */
 1574|     35|            if (CRYPTO_UP_REF(&prov->refcnt, &ref) <= 0) {
  ------------------
  |  Branch (1574:17): [True: 0, False: 35]
  ------------------
 1575|      0|                CRYPTO_THREAD_unlock(prov->flag_lock);
 1576|      0|                goto err_unlock;
 1577|      0|            }
 1578|       |            /*
 1579|       |             * It's already activated, but we up the activated count to ensure
 1580|       |             * it remains activated until after we've called the user callback.
 1581|       |             * In theory this could mean the parent provider goes inactive,
 1582|       |             * whilst still activated in the child for a short period. That's ok.
 1583|       |             */
 1584|     35|            if (!CRYPTO_atomic_add(&prov->activatecnt, 1, &ref,
  ------------------
  |  Branch (1584:17): [True: 0, False: 35]
  ------------------
 1585|     35|                                   prov->activatecnt_lock)) {
 1586|      0|                CRYPTO_DOWN_REF(&prov->refcnt, &ref);
 1587|      0|                CRYPTO_THREAD_unlock(prov->flag_lock);
 1588|      0|                goto err_unlock;
 1589|      0|            }
 1590|     35|        } else {
 1591|      0|            sk_OSSL_PROVIDER_delete(provs, curr);
 1592|      0|            max--;
 1593|      0|        }
 1594|     35|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1595|     35|    }
 1596|     35|    CRYPTO_THREAD_unlock(store->lock);
 1597|       |
 1598|       |    /*
 1599|       |     * Now, we sweep through all providers not under lock
 1600|       |     */
 1601|     70|    for (curr = 0; curr < max; curr++) {
  ------------------
  |  Branch (1601:20): [True: 35, False: 35]
  ------------------
 1602|     35|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1603|       |
 1604|     35|        if (!cb(prov, cbdata)) {
  ------------------
  |  Branch (1604:13): [True: 0, False: 35]
  ------------------
 1605|      0|            curr = -1;
 1606|      0|            goto finish;
 1607|      0|        }
 1608|     35|    }
 1609|     35|    curr = -1;
 1610|       |
 1611|     35|    ret = 1;
 1612|     35|    goto finish;
 1613|       |
 1614|      0| err_unlock:
 1615|      0|    CRYPTO_THREAD_unlock(store->lock);
 1616|     35| finish:
 1617|       |    /*
 1618|       |     * The pop_free call doesn't do what we want on an error condition. We
 1619|       |     * either start from the first item in the stack, or part way through if
 1620|       |     * we only processed some of the items.
 1621|       |     */
 1622|     70|    for (curr++; curr < max; curr++) {
  ------------------
  |  Branch (1622:18): [True: 35, False: 35]
  ------------------
 1623|     35|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1624|       |
 1625|     35|        if (!CRYPTO_atomic_add(&prov->activatecnt, -1, &ref,
  ------------------
  |  Branch (1625:13): [True: 0, False: 35]
  ------------------
 1626|     35|                               prov->activatecnt_lock)) {
 1627|      0|            ret = 0;
 1628|      0|            continue;
 1629|      0|        }
 1630|     35|        if (ref < 1) {
  ------------------
  |  Branch (1630:13): [True: 0, False: 35]
  ------------------
 1631|       |            /*
 1632|       |             * Looks like we need to deactivate properly. We could just have
 1633|       |             * done this originally, but it involves taking a write lock so
 1634|       |             * we avoid it. We up the count again and do a full deactivation
 1635|       |             */
 1636|      0|            if (CRYPTO_atomic_add(&prov->activatecnt, 1, &ref,
  ------------------
  |  Branch (1636:17): [True: 0, False: 0]
  ------------------
 1637|      0|                                  prov->activatecnt_lock))
 1638|      0|                provider_deactivate(prov, 0, 1);
 1639|      0|            else
 1640|      0|                ret = 0;
 1641|      0|        }
 1642|       |        /*
 1643|       |         * As above where we did the up-ref, we don't call ossl_provider_free
 1644|       |         * to avoid making upcalls. There should always be at least one ref
 1645|       |         * to the provider in the store, so this should never drop to 0.
 1646|       |         */
 1647|     35|        if (!CRYPTO_DOWN_REF(&prov->refcnt, &ref)) {
  ------------------
  |  Branch (1647:13): [True: 0, False: 35]
  ------------------
 1648|      0|            ret = 0;
 1649|      0|            continue;
 1650|      0|        }
 1651|       |        /*
 1652|       |         * Not much we can do if this assert ever fails. So we don't use
 1653|       |         * ossl_assert here.
 1654|       |         */
 1655|     35|        assert(ref > 0);
 1656|     35|    }
 1657|     35|    sk_OSSL_PROVIDER_free(provs);
 1658|     35|    return ret;
 1659|     35|}
ossl_provider_name:
 1683|      3|{
 1684|      3|    return prov->name;
 1685|      3|}
ossl_provider_libctx:
 1720|    726|{
 1721|    726|    return prov != NULL ? prov->libctx : NULL;
  ------------------
  |  Branch (1721:12): [True: 726, False: 0]
  ------------------
 1722|    726|}
ossl_provider_teardown:
 1737|      1|{
 1738|      1|    if (prov->teardown != NULL
  ------------------
  |  Branch (1738:9): [True: 1, False: 0]
  ------------------
 1739|      1|#ifndef FIPS_MODULE
 1740|      1|            && !prov->ischild
  ------------------
  |  Branch (1740:16): [True: 1, False: 0]
  ------------------
 1741|      1|#endif
 1742|      1|        ) {
 1743|      1|#ifndef FIPS_MODULE
 1744|      1|        OSSL_TRACE_BEGIN(PROVIDER) {
  ------------------
  |  |  220|      1|    do {                                        \
  |  |  221|      1|        BIO *trc_out = NULL;                    \
  |  |  222|      1|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1745|      0|            BIO_printf(trc_out, "(provider %s) calling teardown\n",
 1746|      0|                       ossl_provider_name(prov));
 1747|      1|        } OSSL_TRACE_END(PROVIDER);
  ------------------
  |  |  225|      1|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1748|      1|#endif
 1749|      1|        prov->teardown(prov->provctx);
 1750|      1|    }
 1751|      1|}
ossl_provider_query_operation:
 1936|     57|{
 1937|     57|    const OSSL_ALGORITHM *res;
 1938|       |
 1939|     57|    if (prov->query_operation == NULL) {
  ------------------
  |  Branch (1939:9): [True: 0, False: 57]
  ------------------
 1940|      0|#ifndef FIPS_MODULE
 1941|      0|        OSSL_TRACE_BEGIN(PROVIDER) {
  ------------------
  |  |  220|      0|    do {                                        \
  |  |  221|      0|        BIO *trc_out = NULL;                    \
  |  |  222|      0|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1942|      0|            BIO_printf(trc_out, "provider %s lacks query operation!\n",
 1943|      0|                       prov->name);
 1944|      0|        } OSSL_TRACE_END(PROVIDER);
  ------------------
  |  |  225|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1945|      0|#endif
 1946|      0|        return NULL;
 1947|      0|    }
 1948|       |
 1949|     57|    res = prov->query_operation(prov->provctx, operation_id, no_cache);
 1950|     57|#ifndef FIPS_MODULE
 1951|     57|    OSSL_TRACE_BEGIN(PROVIDER) {
  ------------------
  |  |  220|     57|    do {                                        \
  |  |  221|     57|        BIO *trc_out = NULL;                    \
  |  |  222|     57|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1952|      0|        const OSSL_ALGORITHM *idx;
 1953|      0|        if (res != NULL) {
  ------------------
  |  Branch (1953:13): [True: 0, False: 0]
  ------------------
 1954|      0|            BIO_printf(trc_out,
 1955|      0|                       "(provider %s) Calling query, available algs are:\n", prov->name);
 1956|       |
 1957|      0|            for (idx = res; idx->algorithm_names != NULL; idx++) {
  ------------------
  |  Branch (1957:29): [True: 0, False: 0]
  ------------------
 1958|      0|                BIO_printf(trc_out,
 1959|      0|                           "(provider %s) names %s, prop_def %s, desc %s\n",
 1960|      0|                           prov->name,
 1961|      0|                           idx->algorithm_names == NULL ? "none" :
  ------------------
  |  Branch (1961:28): [True: 0, False: 0]
  ------------------
 1962|      0|                           idx->algorithm_names,
 1963|      0|                           idx->property_definition == NULL ? "none" :
  ------------------
  |  Branch (1963:28): [True: 0, False: 0]
  ------------------
 1964|      0|                           idx->property_definition,
 1965|      0|                           idx->algorithm_description == NULL ? "none" :
  ------------------
  |  Branch (1965:28): [True: 0, False: 0]
  ------------------
 1966|      0|                           idx->algorithm_description);
 1967|      0|            }
 1968|      0|        } else {
 1969|      0|            BIO_printf(trc_out, "(provider %s) query_operation failed\n", prov->name);
 1970|      0|        }
 1971|     57|    } OSSL_TRACE_END(PROVIDER);
  ------------------
  |  |  225|     57|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1972|     57|#endif
 1973|       |
 1974|       |#if defined(OPENSSL_NO_CACHED_FETCH)
 1975|       |    /* Forcing the non-caching of queries */
 1976|       |    if (no_cache != NULL)
 1977|       |        *no_cache = 1;
 1978|       |#endif
 1979|     57|    return res;
 1980|     57|}
ossl_provider_unquery_operation:
 1999|     57|{
 2000|     57|    if (prov->unquery_operation != NULL) {
  ------------------
  |  Branch (2000:9): [True: 0, False: 57]
  ------------------
 2001|      0|#ifndef FIPS_MODULE
 2002|      0|        OSSL_TRACE_BEGIN(PROVIDER) {
  ------------------
  |  |  220|      0|    do {                                        \
  |  |  221|      0|        BIO *trc_out = NULL;                    \
  |  |  222|      0|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2003|      0|            BIO_printf(trc_out,
 2004|      0|                       "(provider %s) Calling unquery"
 2005|      0|                       " with operation %d\n",
 2006|      0|                       prov->name,
 2007|      0|                       operation_id);
 2008|      0|        } OSSL_TRACE_END(PROVIDER);
  ------------------
  |  |  225|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2009|      0|#endif
 2010|      0|        prov->unquery_operation(prov->provctx, operation_id, algs);
 2011|      0|    }
 2012|     57|}
ossl_provider_set_operation_bit:
 2015|      6|{
 2016|      6|    size_t byte = bitnum / 8;
 2017|      6|    unsigned char bit = (1 << (bitnum % 8)) & 0xFF;
 2018|       |
 2019|      6|    if (!CRYPTO_THREAD_write_lock(provider->opbits_lock))
  ------------------
  |  Branch (2019:9): [True: 0, False: 6]
  ------------------
 2020|      0|        return 0;
 2021|      6|    if (provider->operation_bits_sz <= byte) {
  ------------------
  |  Branch (2021:9): [True: 1, False: 5]
  ------------------
 2022|      1|        unsigned char *tmp = OPENSSL_realloc(provider->operation_bits,
  ------------------
  |  |  109|      1|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2023|      1|                                             byte + 1);
 2024|       |
 2025|      1|        if (tmp == NULL) {
  ------------------
  |  Branch (2025:13): [True: 0, False: 1]
  ------------------
 2026|      0|            CRYPTO_THREAD_unlock(provider->opbits_lock);
 2027|      0|            return 0;
 2028|      0|        }
 2029|      1|        provider->operation_bits = tmp;
 2030|      1|        memset(provider->operation_bits + provider->operation_bits_sz,
 2031|      1|               '\0', byte + 1 - provider->operation_bits_sz);
 2032|      1|        provider->operation_bits_sz = byte + 1;
 2033|      1|    }
 2034|      6|    provider->operation_bits[byte] |= bit;
 2035|      6|    CRYPTO_THREAD_unlock(provider->opbits_lock);
 2036|      6|    return 1;
 2037|      6|}
ossl_provider_test_operation_bit:
 2041|     57|{
 2042|     57|    size_t byte = bitnum / 8;
 2043|     57|    unsigned char bit = (1 << (bitnum % 8)) & 0xFF;
 2044|       |
 2045|     57|    if (!ossl_assert(result != NULL)) {
  ------------------
  |  |   52|     57|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     57|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (2045:9): [True: 0, False: 57]
  ------------------
 2046|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2047|      0|        return 0;
 2048|      0|    }
 2049|       |
 2050|     57|    *result = 0;
 2051|     57|    if (!CRYPTO_THREAD_read_lock(provider->opbits_lock))
  ------------------
  |  Branch (2051:9): [True: 0, False: 57]
  ------------------
 2052|      0|        return 0;
 2053|     57|    if (provider->operation_bits_sz > byte)
  ------------------
  |  Branch (2053:9): [True: 56, False: 1]
  ------------------
 2054|     56|        *result = ((provider->operation_bits[byte] & bit) != 0);
 2055|     57|    CRYPTO_THREAD_unlock(provider->opbits_lock);
 2056|     57|    return 1;
 2057|     57|}
provider_core.c:provider_deactivate_free:
  237|      1|{
  238|      1|    if (prov->flag_activated)
  ------------------
  |  Branch (238:9): [True: 1, False: 0]
  ------------------
  239|      1|        ossl_provider_deactivate(prov, 1);
  240|      1|    ossl_provider_free(prov);
  241|      1|}
provider_core.c:ossl_provider_cmp:
  204|      3|{
  205|      3|    return strcmp((*a)->name, (*b)->name);
  206|      3|}
provider_core.c:get_provider_store:
  330|     40|{
  331|     40|    struct provider_store_st *store = NULL;
  332|       |
  333|     40|    store = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_STORE_INDEX);
  ------------------
  |  |   99|     40|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  334|     40|    if (store == NULL)
  ------------------
  |  Branch (334:9): [True: 0, False: 40]
  ------------------
  335|     40|        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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  336|     40|    return store;
  337|     40|}
provider_core.c:provider_new:
  442|      1|{
  443|      1|    OSSL_PROVIDER *prov = NULL;
  444|       |
  445|      1|    if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL)
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (445:9): [True: 0, False: 1]
  ------------------
  446|      0|        return NULL;
  447|      1|    if (!CRYPTO_NEW_REF(&prov->refcnt, 1)) {
  ------------------
  |  Branch (447:9): [True: 0, False: 1]
  ------------------
  448|      0|        OPENSSL_free(prov);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  449|      0|        return NULL;
  450|      0|    }
  451|      1|    if ((prov->activatecnt_lock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (451:9): [True: 0, False: 1]
  ------------------
  452|      0|        ossl_provider_free(prov);
  453|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  454|      0|        return NULL;
  455|      0|    }
  456|       |
  457|      1|    if ((prov->opbits_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (457:9): [True: 0, False: 1]
  ------------------
  458|      1|        || (prov->flag_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (458:12): [True: 0, False: 1]
  ------------------
  459|      1|        || (prov->parameters = sk_INFOPAIR_deep_copy(parameters,
  ------------------
  |  Branch (459:12): [True: 0, False: 1]
  ------------------
  460|      1|                                                     infopair_copy,
  461|      1|                                                     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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  464|      0|        return NULL;
  465|      0|    }
  466|      1|    if ((prov->name = OPENSSL_strdup(name)) == NULL) {
  ------------------
  |  |  119|      1|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (466:9): [True: 0, False: 1]
  ------------------
  467|      0|        ossl_provider_free(prov);
  468|      0|        return NULL;
  469|      0|    }
  470|       |
  471|      1|    prov->init_function = init_function;
  472|       |
  473|      1|    return prov;
  474|      1|}
provider_core.c:provider_activate:
 1257|      1|{
 1258|      1|    int count = -1;
 1259|      1|    struct provider_store_st *store;
 1260|      1|    int ret = 1;
 1261|       |
 1262|      1|    store = prov->store;
 1263|       |    /*
 1264|       |    * If the provider hasn't been added to the store, then we don't need
 1265|       |    * any locks because we've not shared it with other threads.
 1266|       |    */
 1267|      1|    if (store == NULL) {
  ------------------
  |  Branch (1267:9): [True: 1, False: 0]
  ------------------
 1268|      1|        lock = 0;
 1269|      1|        if (!provider_init(prov))
  ------------------
  |  Branch (1269:13): [True: 0, False: 1]
  ------------------
 1270|      0|            return -1;
 1271|      1|    }
 1272|       |
 1273|      1|#ifndef FIPS_MODULE
 1274|      1|    if (prov->random_bytes != NULL
  ------------------
  |  Branch (1274:9): [True: 0, False: 1]
  ------------------
 1275|      1|            && !ossl_rand_check_random_provider_on_load(prov->libctx, prov))
  ------------------
  |  Branch (1275:16): [True: 0, False: 0]
  ------------------
 1276|      0|        return -1;
 1277|       |
 1278|      1|    if (prov->ischild && upcalls && !ossl_provider_up_ref_parent(prov, 1))
  ------------------
  |  Branch (1278:9): [True: 0, False: 1]
  |  Branch (1278:26): [True: 0, False: 0]
  |  Branch (1278:37): [True: 0, False: 0]
  ------------------
 1279|      0|        return -1;
 1280|      1|#endif
 1281|       |
 1282|      1|    if (lock && !CRYPTO_THREAD_read_lock(store->lock)) {
  ------------------
  |  Branch (1282:9): [True: 0, False: 1]
  |  Branch (1282:17): [True: 0, False: 0]
  ------------------
 1283|      0|#ifndef FIPS_MODULE
 1284|      0|        if (prov->ischild && upcalls)
  ------------------
  |  Branch (1284:13): [True: 0, False: 0]
  |  Branch (1284:30): [True: 0, False: 0]
  ------------------
 1285|      0|            ossl_provider_free_parent(prov, 1);
 1286|      0|#endif
 1287|      0|        return -1;
 1288|      0|    }
 1289|       |
 1290|      1|    if (lock && !CRYPTO_THREAD_write_lock(prov->flag_lock)) {
  ------------------
  |  Branch (1290:9): [True: 0, False: 1]
  |  Branch (1290:17): [True: 0, False: 0]
  ------------------
 1291|      0|        CRYPTO_THREAD_unlock(store->lock);
 1292|      0|#ifndef FIPS_MODULE
 1293|      0|        if (prov->ischild && upcalls)
  ------------------
  |  Branch (1293:13): [True: 0, False: 0]
  |  Branch (1293:30): [True: 0, False: 0]
  ------------------
 1294|      0|            ossl_provider_free_parent(prov, 1);
 1295|      0|#endif
 1296|      0|        return -1;
 1297|      0|    }
 1298|      1|    if (CRYPTO_atomic_add(&prov->activatecnt, 1, &count, prov->activatecnt_lock)) {
  ------------------
  |  Branch (1298:9): [True: 1, False: 0]
  ------------------
 1299|      1|        prov->flag_activated = 1;
 1300|       |
 1301|      1|        if (count == 1 && store != NULL) {
  ------------------
  |  Branch (1301:13): [True: 1, False: 0]
  |  Branch (1301:27): [True: 0, False: 1]
  ------------------
 1302|      0|            ret = create_provider_children(prov);
 1303|      0|        }
 1304|      1|    }
 1305|      1|    if (lock) {
  ------------------
  |  Branch (1305:9): [True: 0, False: 1]
  ------------------
 1306|      0|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1307|      0|        CRYPTO_THREAD_unlock(store->lock);
 1308|       |        /*
 1309|       |         * This can be done outside the lock. We tolerate other threads getting
 1310|       |         * the wrong result briefly when creating OSSL_DECODER_CTXs.
 1311|       |         */
 1312|      0|#ifndef FIPS_MODULE
 1313|      0|        if (count == 1)
  ------------------
  |  Branch (1313:13): [True: 0, False: 0]
  ------------------
 1314|      0|            ossl_decoder_cache_flush(prov->libctx);
 1315|      0|#endif
 1316|      0|    }
 1317|       |
 1318|      1|    if (!ret)
  ------------------
  |  Branch (1318:9): [True: 0, False: 1]
  ------------------
 1319|      0|        return -1;
 1320|       |
 1321|      1|    return count;
 1322|      1|}
provider_core.c:provider_init:
  940|      1|{
  941|      1|    const OSSL_DISPATCH *provider_dispatch = NULL;
  942|      1|    void *tmp_provctx = NULL;    /* safety measure */
  943|      1|#ifndef OPENSSL_NO_ERR
  944|      1|# ifndef FIPS_MODULE
  945|      1|    OSSL_FUNC_provider_get_reason_strings_fn *p_get_reason_strings = NULL;
  946|      1|# endif
  947|      1|#endif
  948|      1|    int ok = 0;
  949|       |
  950|      1|    if (!ossl_assert(!prov->flag_initialized)) {
  ------------------
  |  |   52|      1|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      1|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (950:9): [True: 0, False: 1]
  ------------------
  951|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  952|      0|        goto end;
  953|      0|    }
  954|       |
  955|       |    /*
  956|       |     * If the init function isn't set, it indicates that this provider is
  957|       |     * a loadable module.
  958|       |     */
  959|      1|    if (prov->init_function == NULL) {
  ------------------
  |  Branch (959:9): [True: 0, False: 1]
  ------------------
  960|       |#ifdef FIPS_MODULE
  961|       |        goto end;
  962|       |#else
  963|      0|        if (prov->module == NULL) {
  ------------------
  |  Branch (963:13): [True: 0, False: 0]
  ------------------
  964|      0|            char *allocated_path = NULL;
  965|      0|            const char *module_path = NULL;
  966|      0|            char *merged_path = NULL;
  967|      0|            const char *load_dir = NULL;
  968|      0|            char *allocated_load_dir = NULL;
  969|      0|            struct provider_store_st *store;
  970|       |
  971|      0|            if ((prov->module = DSO_new()) == NULL) {
  ------------------
  |  Branch (971:17): [True: 0, False: 0]
  ------------------
  972|       |                /* DSO_new() generates an error already */
  973|      0|                goto end;
  974|      0|            }
  975|       |
  976|      0|            if ((store = get_provider_store(prov->libctx)) == NULL
  ------------------
  |  Branch (976:17): [True: 0, False: 0]
  ------------------
  977|      0|                    || !CRYPTO_THREAD_read_lock(store->default_path_lock))
  ------------------
  |  Branch (977:24): [True: 0, False: 0]
  ------------------
  978|      0|                goto end;
  979|       |
  980|      0|            if (store->default_path != NULL) {
  ------------------
  |  Branch (980:17): [True: 0, False: 0]
  ------------------
  981|      0|                allocated_load_dir = OPENSSL_strdup(store->default_path);
  ------------------
  |  |  119|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  982|      0|                CRYPTO_THREAD_unlock(store->default_path_lock);
  983|      0|                if (allocated_load_dir == NULL)
  ------------------
  |  Branch (983:21): [True: 0, False: 0]
  ------------------
  984|      0|                    goto end;
  985|      0|                load_dir = allocated_load_dir;
  986|      0|            } else {
  987|      0|                CRYPTO_THREAD_unlock(store->default_path_lock);
  988|      0|            }
  989|       |
  990|      0|            if (load_dir == NULL) {
  ------------------
  |  Branch (990:17): [True: 0, False: 0]
  ------------------
  991|      0|                load_dir = ossl_safe_getenv("OPENSSL_MODULES");
  992|      0|                if (load_dir == NULL)
  ------------------
  |  Branch (992:21): [True: 0, False: 0]
  ------------------
  993|      0|                    load_dir = ossl_get_modulesdir();
  994|      0|            }
  995|       |
  996|      0|            DSO_ctrl(prov->module, DSO_CTRL_SET_FLAGS,
  ------------------
  |  |   19|      0|# define DSO_CTRL_SET_FLAGS      2
  ------------------
  997|      0|                     DSO_FLAG_NAME_TRANSLATION_EXT_ONLY, NULL);
  ------------------
  |  |   41|      0|# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY      0x02
  ------------------
  998|       |
  999|      0|            module_path = prov->path;
 1000|      0|            if (module_path == NULL)
  ------------------
  |  Branch (1000:17): [True: 0, False: 0]
  ------------------
 1001|      0|                module_path = allocated_path =
 1002|      0|                    DSO_convert_filename(prov->module, prov->name);
 1003|      0|            if (module_path != NULL)
  ------------------
  |  Branch (1003:17): [True: 0, False: 0]
  ------------------
 1004|      0|                merged_path = DSO_merge(prov->module, module_path, load_dir);
 1005|       |
 1006|      0|            if (merged_path == NULL
  ------------------
  |  Branch (1006:17): [True: 0, False: 0]
  ------------------
 1007|      0|                || (DSO_load(prov->module, merged_path, NULL, 0)) == NULL) {
  ------------------
  |  Branch (1007:20): [True: 0, False: 0]
  ------------------
 1008|      0|                DSO_free(prov->module);
 1009|      0|                prov->module = NULL;
 1010|      0|            }
 1011|       |
 1012|      0|            OPENSSL_free(merged_path);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1013|      0|            OPENSSL_free(allocated_path);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1014|      0|            OPENSSL_free(allocated_load_dir);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1015|      0|        }
 1016|       |
 1017|      0|        if (prov->module == NULL) {
  ------------------
  |  Branch (1017:13): [True: 0, False: 0]
  ------------------
 1018|       |            /* DSO has already recorded errors, this is just a tracepoint */
 1019|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1020|      0|                           "name=%s", prov->name);
 1021|      0|            goto end;
 1022|      0|        }
 1023|       |
 1024|      0|        prov->init_function = (OSSL_provider_init_fn *)
 1025|      0|            DSO_bind_func(prov->module, "OSSL_provider_init");
 1026|      0|#endif
 1027|      0|    }
 1028|       |
 1029|       |    /* Check for and call the initialise function for the provider. */
 1030|      1|    if (prov->init_function == NULL) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 1]
  ------------------
 1031|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1032|      0|                       "name=%s, provider has no provider init function",
 1033|      0|                       prov->name);
 1034|      0|        goto end;
 1035|      0|    }
 1036|      1|#ifndef FIPS_MODULE
 1037|      1|    OSSL_TRACE_BEGIN(PROVIDER) {
  ------------------
  |  |  220|      1|    do {                                        \
  |  |  221|      1|        BIO *trc_out = NULL;                    \
  |  |  222|      1|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1038|      0|        BIO_printf(trc_out,
 1039|      0|                   "(provider %s) initalizing\n", prov->name);
 1040|      1|    } OSSL_TRACE_END(PROVIDER);
  ------------------
  |  |  225|      1|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1041|      1|#endif
 1042|       |
 1043|      1|    if (!prov->init_function((OSSL_CORE_HANDLE *)prov, core_dispatch,
  ------------------
  |  Branch (1043:9): [True: 0, False: 1]
  ------------------
 1044|      1|                             &provider_dispatch, &tmp_provctx)) {
 1045|      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),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1046|      0|                       "name=%s", prov->name);
 1047|      0|        goto end;
 1048|      0|    }
 1049|      1|    prov->provctx = tmp_provctx;
 1050|      1|    prov->dispatch = provider_dispatch;
 1051|       |
 1052|      1|    if (provider_dispatch != NULL) {
  ------------------
  |  Branch (1052:9): [True: 1, False: 0]
  ------------------
 1053|      6|        for (; provider_dispatch->function_id != 0; provider_dispatch++) {
  ------------------
  |  Branch (1053:16): [True: 5, False: 1]
  ------------------
 1054|      5|            switch (provider_dispatch->function_id) {
  ------------------
  |  Branch (1054:21): [True: 0, False: 5]
  ------------------
 1055|      1|            case OSSL_FUNC_PROVIDER_TEARDOWN:
  ------------------
  |  |  257|      1|# define OSSL_FUNC_PROVIDER_TEARDOWN           1024
  ------------------
  |  Branch (1055:13): [True: 1, False: 4]
  ------------------
 1056|      1|                prov->teardown =
 1057|      1|                    OSSL_FUNC_provider_teardown(provider_dispatch);
 1058|      1|                break;
 1059|      1|            case OSSL_FUNC_PROVIDER_GETTABLE_PARAMS:
  ------------------
  |  |  259|      1|# define OSSL_FUNC_PROVIDER_GETTABLE_PARAMS    1025
  ------------------
  |  Branch (1059:13): [True: 1, False: 4]
  ------------------
 1060|      1|                prov->gettable_params =
 1061|      1|                    OSSL_FUNC_provider_gettable_params(provider_dispatch);
 1062|      1|                break;
 1063|      1|            case OSSL_FUNC_PROVIDER_GET_PARAMS:
  ------------------
  |  |  262|      1|# define OSSL_FUNC_PROVIDER_GET_PARAMS         1026
  ------------------
  |  Branch (1063:13): [True: 1, False: 4]
  ------------------
 1064|      1|                prov->get_params =
 1065|      1|                    OSSL_FUNC_provider_get_params(provider_dispatch);
 1066|      1|                break;
 1067|      0|            case OSSL_FUNC_PROVIDER_SELF_TEST:
  ------------------
  |  |  277|      0|# define OSSL_FUNC_PROVIDER_SELF_TEST          1031
  ------------------
  |  Branch (1067:13): [True: 0, False: 5]
  ------------------
 1068|      0|                prov->self_test =
 1069|      0|                    OSSL_FUNC_provider_self_test(provider_dispatch);
 1070|      0|                break;
 1071|      0|            case OSSL_FUNC_PROVIDER_RANDOM_BYTES:
  ------------------
  |  |  279|      0|# define OSSL_FUNC_PROVIDER_RANDOM_BYTES       1032
  ------------------
  |  Branch (1071:13): [True: 0, False: 5]
  ------------------
 1072|      0|                prov->random_bytes =
 1073|      0|                    OSSL_FUNC_provider_random_bytes(provider_dispatch);
 1074|      0|                break;
 1075|      1|            case OSSL_FUNC_PROVIDER_GET_CAPABILITIES:
  ------------------
  |  |  274|      1|# define OSSL_FUNC_PROVIDER_GET_CAPABILITIES   1030
  ------------------
  |  Branch (1075:13): [True: 1, False: 4]
  ------------------
 1076|      1|                prov->get_capabilities =
 1077|      1|                    OSSL_FUNC_provider_get_capabilities(provider_dispatch);
 1078|      1|                break;
 1079|      1|            case OSSL_FUNC_PROVIDER_QUERY_OPERATION:
  ------------------
  |  |  265|      1|# define OSSL_FUNC_PROVIDER_QUERY_OPERATION    1027
  ------------------
  |  Branch (1079:13): [True: 1, False: 4]
  ------------------
 1080|      1|                prov->query_operation =
 1081|      1|                    OSSL_FUNC_provider_query_operation(provider_dispatch);
 1082|      1|                break;
 1083|      0|            case OSSL_FUNC_PROVIDER_UNQUERY_OPERATION:
  ------------------
  |  |  268|      0|# define OSSL_FUNC_PROVIDER_UNQUERY_OPERATION  1028
  ------------------
  |  Branch (1083:13): [True: 0, False: 5]
  ------------------
 1084|      0|                prov->unquery_operation =
 1085|      0|                    OSSL_FUNC_provider_unquery_operation(provider_dispatch);
 1086|      0|                break;
 1087|      0|#ifndef OPENSSL_NO_ERR
 1088|      0|# ifndef FIPS_MODULE
 1089|      0|            case OSSL_FUNC_PROVIDER_GET_REASON_STRINGS:
  ------------------
  |  |  271|      0|# define OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 1029
  ------------------
  |  Branch (1089:13): [True: 0, False: 5]
  ------------------
 1090|      0|                p_get_reason_strings =
 1091|      0|                    OSSL_FUNC_provider_get_reason_strings(provider_dispatch);
 1092|      0|                break;
 1093|      5|# endif
 1094|      5|#endif
 1095|      5|            }
 1096|      5|        }
 1097|      1|    }
 1098|       |
 1099|      1|#ifndef OPENSSL_NO_ERR
 1100|      1|# ifndef FIPS_MODULE
 1101|      1|    if (p_get_reason_strings != NULL) {
  ------------------
  |  Branch (1101:9): [True: 0, False: 1]
  ------------------
 1102|      0|        const OSSL_ITEM *reasonstrings = p_get_reason_strings(prov->provctx);
 1103|      0|        size_t cnt, cnt2;
 1104|       |
 1105|       |        /*
 1106|       |         * ERR_load_strings() handles ERR_STRING_DATA rather than OSSL_ITEM,
 1107|       |         * although they are essentially the same type.
 1108|       |         * Furthermore, ERR_load_strings() patches the array's error number
 1109|       |         * with the error library number, so we need to make a copy of that
 1110|       |         * array either way.
 1111|       |         */
 1112|      0|        cnt = 0;
 1113|      0|        while (reasonstrings[cnt].id != 0) {
  ------------------
  |  Branch (1113:16): [True: 0, False: 0]
  ------------------
 1114|      0|            if (ERR_GET_LIB(reasonstrings[cnt].id) != 0)
  ------------------
  |  Branch (1114:17): [True: 0, False: 0]
  ------------------
 1115|      0|                goto end;
 1116|      0|            cnt++;
 1117|      0|        }
 1118|      0|        cnt++;                   /* One for the terminating item */
 1119|       |
 1120|       |        /* Allocate one extra item for the "library" name */
 1121|      0|        prov->error_strings =
 1122|      0|            OPENSSL_zalloc(sizeof(ERR_STRING_DATA) * (cnt + 1));
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1123|      0|        if (prov->error_strings == NULL)
  ------------------
  |  Branch (1123:13): [True: 0, False: 0]
  ------------------
 1124|      0|            goto end;
 1125|       |
 1126|       |        /*
 1127|       |         * Set the "library" name.
 1128|       |         */
 1129|      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
  |  |  ------------------
  ------------------
 1130|      0|        prov->error_strings[0].string = prov->name;
 1131|       |        /*
 1132|       |         * Copy reasonstrings item 0..cnt-1 to prov->error_trings positions
 1133|       |         * 1..cnt.
 1134|       |         */
 1135|      0|        for (cnt2 = 1; cnt2 <= cnt; cnt2++) {
  ------------------
  |  Branch (1135:24): [True: 0, False: 0]
  ------------------
 1136|      0|            prov->error_strings[cnt2].error = (int)reasonstrings[cnt2-1].id;
 1137|      0|            prov->error_strings[cnt2].string = reasonstrings[cnt2-1].ptr;
 1138|      0|        }
 1139|       |
 1140|      0|        ERR_load_strings(prov->error_lib, prov->error_strings);
 1141|      0|    }
 1142|      1|# endif
 1143|      1|#endif
 1144|       |
 1145|       |    /* With this flag set, this provider has become fully "loaded". */
 1146|      1|    prov->flag_initialized = 1;
 1147|      1|    ok = 1;
 1148|       |
 1149|      1| end:
 1150|      1|    return ok;
 1151|      1|}
provider_core.c:core_get_params:
 2309|    732|{
 2310|    732|    OSSL_PARAM *p;
 2311|       |    /*
 2312|       |     * We created this object originally and we know it is actually an
 2313|       |     * OSSL_PROVIDER *, so the cast is safe
 2314|       |     */
 2315|    732|    OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle;
 2316|       |
 2317|    732|    if ((p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_CORE_VERSION)) != NULL)
  ------------------
  |  |  495|    732|# define OSSL_PROV_PARAM_CORE_VERSION "openssl-version"
  ------------------
  |  Branch (2317:9): [True: 0, False: 732]
  ------------------
 2318|      0|        OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR);
  ------------------
  |  |   77|      0|# define OPENSSL_VERSION_STR "3.6.0"
  ------------------
 2319|    732|    if ((p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_CORE_PROV_NAME)) != NULL)
  ------------------
  |  |  494|    732|# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name"
  ------------------
  |  Branch (2319:9): [True: 0, False: 732]
  ------------------
 2320|      0|        OSSL_PARAM_set_utf8_ptr(p, prov->name);
 2321|       |
 2322|    732|#ifndef FIPS_MODULE
 2323|    732|    if ((p = OSSL_PARAM_locate(params,
  ------------------
  |  Branch (2323:9): [True: 0, False: 732]
  ------------------
 2324|    732|                               OSSL_PROV_PARAM_CORE_MODULE_FILENAME)) != NULL)
  ------------------
  |  |  493|    732|# define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename"
  ------------------
 2325|      0|        OSSL_PARAM_set_utf8_ptr(p, ossl_provider_module_path(prov));
 2326|    732|#endif
 2327|       |
 2328|    732|    return OSSL_PROVIDER_get_conf_parameters(prov, params);
 2329|    732|}
provider_core.c:core_get_libctx:
 2332|      1|{
 2333|       |    /*
 2334|       |     * We created this object originally and we know it is actually an
 2335|       |     * OSSL_PROVIDER *, so the cast is safe
 2336|       |     */
 2337|      1|    OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle;
 2338|       |
 2339|       |    /*
 2340|       |     * Using ossl_provider_libctx would be wrong as that returns
 2341|       |     * NULL for |prov| == NULL and NULL libctx has a special meaning
 2342|       |     * that does not apply here. Here |prov| == NULL can happen only in
 2343|       |     * case of a coding error.
 2344|       |     */
 2345|      1|    assert(prov != NULL);
 2346|      1|    return (OPENSSL_CORE_CTX *)prov->libctx;
 2347|      1|}
provider_core.c:provider_deactivate:
 1161|      1|{
 1162|      1|    int count;
 1163|      1|    struct provider_store_st *store;
 1164|      1|#ifndef FIPS_MODULE
 1165|      1|    int freeparent = 0;
 1166|      1|#endif
 1167|      1|    int lock = 1;
 1168|       |
 1169|      1|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|      1|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      1|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1169:9): [True: 0, False: 1]
  ------------------
 1170|      0|        return -1;
 1171|       |
 1172|      1|#ifndef FIPS_MODULE
 1173|      1|    if (prov->random_bytes != NULL
  ------------------
  |  Branch (1173:9): [True: 0, False: 1]
  ------------------
 1174|      1|            && !ossl_rand_check_random_provider_on_unload(prov->libctx, prov))
  ------------------
  |  Branch (1174:16): [True: 0, False: 0]
  ------------------
 1175|      0|        return -1;
 1176|      1|#endif
 1177|       |
 1178|       |    /*
 1179|       |     * No need to lock if we've got no store because we've not been shared with
 1180|       |     * other threads.
 1181|       |     */
 1182|      1|    store = get_provider_store(prov->libctx);
 1183|      1|    if (store == NULL)
  ------------------
  |  Branch (1183:9): [True: 0, False: 1]
  ------------------
 1184|      0|        lock = 0;
 1185|       |
 1186|      1|    if (lock && !CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1186:9): [True: 1, False: 0]
  |  Branch (1186:17): [True: 0, False: 1]
  ------------------
 1187|      0|        return -1;
 1188|      1|    if (lock && !CRYPTO_THREAD_write_lock(prov->flag_lock)) {
  ------------------
  |  Branch (1188:9): [True: 1, False: 0]
  |  Branch (1188:17): [True: 0, False: 1]
  ------------------
 1189|      0|        CRYPTO_THREAD_unlock(store->lock);
 1190|      0|        return -1;
 1191|      0|    }
 1192|       |
 1193|      1|    if (!CRYPTO_atomic_add(&prov->activatecnt, -1, &count, prov->activatecnt_lock)) {
  ------------------
  |  Branch (1193:9): [True: 0, False: 1]
  ------------------
 1194|      0|        if (lock) {
  ------------------
  |  Branch (1194:13): [True: 0, False: 0]
  ------------------
 1195|      0|            CRYPTO_THREAD_unlock(prov->flag_lock);
 1196|      0|            CRYPTO_THREAD_unlock(store->lock);
 1197|      0|        }
 1198|      0|        return -1;
 1199|      0|    }
 1200|       |
 1201|      1|#ifndef FIPS_MODULE
 1202|      1|    if (count >= 1 && prov->ischild && upcalls) {
  ------------------
  |  Branch (1202:9): [True: 0, False: 1]
  |  Branch (1202:23): [True: 0, False: 0]
  |  Branch (1202:40): [True: 0, False: 0]
  ------------------
 1203|       |        /*
 1204|       |         * We have had a direct activation in this child libctx so we need to
 1205|       |         * now down the ref count in the parent provider. We do the actual down
 1206|       |         * ref outside of the flag_lock, since it could involve getting other
 1207|       |         * locks.
 1208|       |         */
 1209|      0|        freeparent = 1;
 1210|      0|    }
 1211|      1|#endif
 1212|       |
 1213|      1|    if (count < 1)
  ------------------
  |  Branch (1213:9): [True: 1, False: 0]
  ------------------
 1214|      1|        prov->flag_activated = 0;
 1215|      0|#ifndef FIPS_MODULE
 1216|      0|    else
 1217|      0|        removechildren = 0;
 1218|      1|#endif
 1219|       |
 1220|      1|#ifndef FIPS_MODULE
 1221|      1|    if (removechildren && store != NULL) {
  ------------------
  |  Branch (1221:9): [True: 1, False: 0]
  |  Branch (1221:27): [True: 1, False: 0]
  ------------------
 1222|      1|        int i, max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs);
 1223|      1|        OSSL_PROVIDER_CHILD_CB *child_cb;
 1224|       |
 1225|      1|        for (i = 0; i < max; i++) {
  ------------------
  |  Branch (1225:21): [True: 0, False: 1]
  ------------------
 1226|      0|            child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i);
 1227|      0|            child_cb->remove_cb((OSSL_CORE_HANDLE *)prov, child_cb->cbdata);
 1228|      0|        }
 1229|      1|    }
 1230|      1|#endif
 1231|      1|    if (lock) {
  ------------------
  |  Branch (1231:9): [True: 1, False: 0]
  ------------------
 1232|      1|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1233|      1|        CRYPTO_THREAD_unlock(store->lock);
 1234|       |        /*
 1235|       |         * This can be done outside the lock. We tolerate other threads getting
 1236|       |         * the wrong result briefly when creating OSSL_DECODER_CTXs.
 1237|       |         */
 1238|      1|#ifndef FIPS_MODULE
 1239|      1|        if (count < 1)
  ------------------
  |  Branch (1239:13): [True: 1, False: 0]
  ------------------
 1240|      1|            ossl_decoder_cache_flush(prov->libctx);
 1241|      1|#endif
 1242|      1|    }
 1243|      1|#ifndef FIPS_MODULE
 1244|      1|    if (freeparent)
  ------------------
  |  Branch (1244:9): [True: 0, False: 1]
  ------------------
 1245|      0|        ossl_provider_free_parent(prov, 1);
 1246|      1|#endif
 1247|       |
 1248|       |    /* We don't deinit here, that's done in ossl_provider_free() */
 1249|      1|    return count;
 1250|      1|}
provider_core.c:provider_remove_store_methods:
 1357|      1|{
 1358|      1|    struct provider_store_st *store;
 1359|      1|    int freeing;
 1360|       |
 1361|      1|    if ((store = get_provider_store(prov->libctx)) == NULL)
  ------------------
  |  Branch (1361:9): [True: 0, False: 1]
  ------------------
 1362|      0|        return 0;
 1363|       |
 1364|      1|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1364:9): [True: 0, False: 1]
  ------------------
 1365|      0|        return 0;
 1366|      1|    freeing = store->freeing;
 1367|      1|    CRYPTO_THREAD_unlock(store->lock);
 1368|       |
 1369|      1|    if (!freeing) {
  ------------------
  |  Branch (1369:9): [True: 0, False: 1]
  ------------------
 1370|      0|        int acc;
 1371|       |
 1372|      0|        if (!CRYPTO_THREAD_write_lock(prov->opbits_lock))
  ------------------
  |  Branch (1372:13): [True: 0, False: 0]
  ------------------
 1373|      0|            return 0;
 1374|      0|        OPENSSL_free(prov->operation_bits);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1375|      0|        prov->operation_bits = NULL;
 1376|      0|        prov->operation_bits_sz = 0;
 1377|      0|        CRYPTO_THREAD_unlock(prov->opbits_lock);
 1378|       |
 1379|      0|        acc = evp_method_store_remove_all_provided(prov)
 1380|      0|#ifndef FIPS_MODULE
 1381|      0|            + ossl_encoder_store_remove_all_provided(prov)
 1382|      0|            + ossl_decoder_store_remove_all_provided(prov)
 1383|      0|            + ossl_store_loader_store_remove_all_provided(prov)
 1384|      0|#endif
 1385|      0|            ;
 1386|       |
 1387|      0|#ifndef FIPS_MODULE
 1388|      0|        return acc == 4;
 1389|       |#else
 1390|       |        return acc == 1;
 1391|       |#endif
 1392|      0|    }
 1393|      1|    return 1;
 1394|      1|}
provider_core.c:provider_activate_fallbacks:
 1437|     35|{
 1438|     35|    int use_fallbacks;
 1439|     35|    int activated_fallback_count = 0;
 1440|     35|    int ret = 0;
 1441|     35|    const OSSL_PROVIDER_INFO *p;
 1442|       |
 1443|     35|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1443:9): [True: 0, False: 35]
  ------------------
 1444|      0|        return 0;
 1445|     35|    use_fallbacks = store->use_fallbacks;
 1446|     35|    CRYPTO_THREAD_unlock(store->lock);
 1447|     35|    if (!use_fallbacks)
  ------------------
  |  Branch (1447:9): [True: 34, False: 1]
  ------------------
 1448|     34|        return 1;
 1449|       |
 1450|      1|    if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (1450:9): [True: 0, False: 1]
  ------------------
 1451|      0|        return 0;
 1452|       |    /* Check again, just in case another thread changed it */
 1453|      1|    use_fallbacks = store->use_fallbacks;
 1454|      1|    if (!use_fallbacks) {
  ------------------
  |  Branch (1454:9): [True: 0, False: 1]
  ------------------
 1455|      0|        CRYPTO_THREAD_unlock(store->lock);
 1456|      0|        return 1;
 1457|      0|    }
 1458|       |
 1459|      4|    for (p = ossl_predefined_providers; p->name != NULL; p++) {
  ------------------
  |  Branch (1459:41): [True: 3, False: 1]
  ------------------
 1460|      3|        OSSL_PROVIDER *prov = NULL;
 1461|      3|        OSSL_PROVIDER_INFO *info = store->provinfo;
 1462|      3|        STACK_OF(INFOPAIR) *params = NULL;
  ------------------
  |  |   31|      3|# define STACK_OF(type) struct stack_st_##type
  ------------------
 1463|      3|        size_t i;
 1464|       |
 1465|      3|        if (!p->is_fallback)
  ------------------
  |  Branch (1465:13): [True: 2, False: 1]
  ------------------
 1466|      2|            continue;
 1467|       |
 1468|      1|        for (i = 0; i < store->numprovinfo; info++, i++) {
  ------------------
  |  Branch (1468:21): [True: 0, False: 1]
  ------------------
 1469|      0|            if (strcmp(info->name, p->name) != 0)
  ------------------
  |  Branch (1469:17): [True: 0, False: 0]
  ------------------
 1470|      0|                continue;
 1471|      0|            params = info->parameters;
 1472|      0|            break;
 1473|      0|        }
 1474|       |
 1475|       |        /*
 1476|       |         * We use the internal constructor directly here,
 1477|       |         * otherwise we get a call loop
 1478|       |         */
 1479|      1|        prov = provider_new(p->name, p->init, params);
 1480|      1|        if (prov == NULL)
  ------------------
  |  Branch (1480:13): [True: 0, False: 1]
  ------------------
 1481|      0|            goto err;
 1482|      1|        prov->libctx = store->libctx;
 1483|      1|#ifndef FIPS_MODULE
 1484|      1|        prov->error_lib = ERR_get_next_error_library();
 1485|      1|#endif
 1486|       |
 1487|       |        /*
 1488|       |         * We are calling provider_activate while holding the store lock. This
 1489|       |         * means the init function will be called while holding a lock. Normally
 1490|       |         * we try to avoid calling a user callback while holding a lock.
 1491|       |         * However, fallbacks are never third party providers so we accept this.
 1492|       |         */
 1493|      1|        if (provider_activate(prov, 0, 0) < 0) {
  ------------------
  |  Branch (1493:13): [True: 0, False: 1]
  ------------------
 1494|      0|            ossl_provider_free(prov);
 1495|      0|            goto err;
 1496|      0|        }
 1497|      1|        prov->store = store;
 1498|      1|        if (sk_OSSL_PROVIDER_push(store->providers, prov) == 0) {
  ------------------
  |  Branch (1498:13): [True: 0, False: 1]
  ------------------
 1499|      0|            ossl_provider_free(prov);
 1500|      0|            goto err;
 1501|      0|        }
 1502|      1|        activated_fallback_count++;
 1503|      1|    }
 1504|       |
 1505|      1|    if (activated_fallback_count > 0) {
  ------------------
  |  Branch (1505:9): [True: 1, False: 0]
  ------------------
 1506|      1|        store->use_fallbacks = 0;
 1507|      1|        ret = 1;
 1508|      1|    }
 1509|      1| err:
 1510|      1|    CRYPTO_THREAD_unlock(store->lock);
 1511|      1|    return ret;
 1512|      1|}

ossl_err_load_RAND_strings:
  105|      1|{
  106|      1|#ifndef OPENSSL_NO_ERR
  107|      1|    if (ERR_reason_error_string(RAND_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (107:9): [True: 1, False: 0]
  ------------------
  108|      1|        ERR_load_strings_const(RAND_str_reasons);
  109|      1|#endif
  110|      1|    return 1;
  111|      1|}

ossl_rand_cleanup_int:
  180|      1|{
  181|      1|# ifndef OPENSSL_NO_DEPRECATED_3_0
  182|      1|    const RAND_METHOD *meth = default_RAND_meth;
  183|       |
  184|      1|    if (!rand_inited)
  ------------------
  |  Branch (184:9): [True: 0, False: 1]
  ------------------
  185|      0|        return;
  186|       |
  187|      1|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (187:9): [True: 1, False: 0]
  |  Branch (187:25): [True: 0, False: 1]
  ------------------
  188|      0|        meth->cleanup();
  189|      1|    RAND_set_rand_method(NULL);
  190|      1|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  191|      1|    ossl_rand_pool_cleanup();
  192|      1|# ifndef OPENSSL_NO_ENGINE
  193|      1|    CRYPTO_THREAD_lock_free(rand_engine_lock);
  194|      1|    rand_engine_lock = NULL;
  195|      1|# endif     /* !OPENSSL_NO_ENGINE */
  196|      1|# ifndef OPENSSL_NO_DEPRECATED_3_0
  197|      1|    CRYPTO_THREAD_lock_free(rand_meth_lock);
  198|      1|    rand_meth_lock = NULL;
  199|      1|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  200|      1|    ossl_release_default_drbg_ctx();
  201|      1|    rand_inited = 0;
  202|      1|}
RAND_set_rand_method:
  281|      1|{
  282|      1|    return rand_set_rand_method_internal(meth, NULL);
  283|      1|}
RAND_get_rand_method:
  286|    339|{
  287|    339|    const RAND_METHOD *tmp_meth = NULL;
  288|       |
  289|    339|    if (!RUN_ONCE(&rand_init, do_rand_init))
  ------------------
  |  |  130|    339|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 339, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (289:9): [True: 0, False: 339]
  ------------------
  290|      0|        return NULL;
  291|       |
  292|    339|    if (rand_meth_lock == NULL)
  ------------------
  |  Branch (292:9): [True: 0, False: 339]
  ------------------
  293|      0|        return NULL;
  294|       |
  295|    339|    if (!CRYPTO_THREAD_read_lock(rand_meth_lock))
  ------------------
  |  Branch (295:9): [True: 0, False: 339]
  ------------------
  296|      0|        return NULL;
  297|    339|    tmp_meth = default_RAND_meth;
  298|    339|    CRYPTO_THREAD_unlock(rand_meth_lock);
  299|    339|    if (tmp_meth != NULL)
  ------------------
  |  Branch (299:9): [True: 338, False: 1]
  ------------------
  300|    338|        return tmp_meth;
  301|       |
  302|      1|    if (!CRYPTO_THREAD_write_lock(rand_meth_lock))
  ------------------
  |  Branch (302:9): [True: 0, False: 1]
  ------------------
  303|      0|        return NULL;
  304|      1|    if (default_RAND_meth == NULL) {
  ------------------
  |  Branch (304:9): [True: 1, False: 0]
  ------------------
  305|      1|#  ifndef OPENSSL_NO_ENGINE
  306|      1|        ENGINE *e;
  307|       |
  308|       |        /* If we have an engine that can do RAND, use it. */
  309|      1|        if ((e = ENGINE_get_default_RAND()) != NULL
  ------------------
  |  Branch (309:13): [True: 0, False: 1]
  ------------------
  310|      1|                && (tmp_meth = ENGINE_get_RAND(e)) != NULL) {
  ------------------
  |  Branch (310:20): [True: 0, False: 0]
  ------------------
  311|      0|            funct_ref = e;
  312|      0|            default_RAND_meth = tmp_meth;
  313|      1|        } else {
  314|      1|            ENGINE_finish(e);
  315|      1|            default_RAND_meth = &ossl_rand_meth;
  316|      1|        }
  317|       |#  else
  318|       |        default_RAND_meth = &ossl_rand_meth;
  319|       |#  endif
  320|      1|    }
  321|      1|    tmp_meth = default_RAND_meth;
  322|      1|    CRYPTO_THREAD_unlock(rand_meth_lock);
  323|      1|    return tmp_meth;
  324|      1|}
RAND_priv_bytes_ex:
  438|    166|{
  439|    166|    RAND_GLOBAL *dgbl;
  440|    166|    EVP_RAND_CTX *rand;
  441|    166|#if !defined(OPENSSL_NO_DEPRECATED_3_0) && !defined(FIPS_MODULE)
  442|    166|    const RAND_METHOD *meth = RAND_get_rand_method();
  443|       |
  444|    166|    if (meth != NULL && meth != RAND_OpenSSL()) {
  ------------------
  |  Branch (444:9): [True: 166, False: 0]
  |  Branch (444:25): [True: 0, False: 166]
  ------------------
  445|      0|        if (meth->bytes != NULL)
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|            return meth->bytes(buf, num);
  447|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  448|      0|        return -1;
  449|      0|    }
  450|    166|#endif
  451|       |
  452|    166|    dgbl = rand_get_global(ctx);
  453|    166|    if (dgbl == NULL)
  ------------------
  |  Branch (453:9): [True: 0, False: 166]
  ------------------
  454|      0|        return 0;
  455|    166|#ifndef FIPS_MODULE
  456|    166|    if (dgbl->random_provider != NULL)
  ------------------
  |  Branch (456:9): [True: 0, False: 166]
  ------------------
  457|      0|        return ossl_provider_random_bytes(dgbl->random_provider,
  458|      0|                                          OSSL_PROV_RANDOM_PRIVATE,
  ------------------
  |  |  125|      0|# define OSSL_PROV_RANDOM_PRIVATE    1
  ------------------
  459|      0|                                          buf, num, strength);
  460|    166|#endif      /* !FIPS_MODULE */
  461|    166|    rand = rand_get0_private(ctx, dgbl);
  462|    166|    if (rand != NULL)
  ------------------
  |  Branch (462:9): [True: 166, False: 0]
  ------------------
  463|    166|        return EVP_RAND_generate(rand, buf, num, strength, 0, NULL, 0);
  464|       |
  465|      0|    return 0;
  466|    166|}
RAND_bytes_ex:
  477|    173|{
  478|    173|    RAND_GLOBAL *dgbl;
  479|    173|    EVP_RAND_CTX *rand;
  480|    173|#if !defined(OPENSSL_NO_DEPRECATED_3_0) && !defined(FIPS_MODULE)
  481|    173|    const RAND_METHOD *meth = RAND_get_rand_method();
  482|       |
  483|    173|    if (meth != NULL && meth != RAND_OpenSSL()) {
  ------------------
  |  Branch (483:9): [True: 173, False: 0]
  |  Branch (483:25): [True: 0, False: 173]
  ------------------
  484|      0|        if (meth->bytes != NULL)
  ------------------
  |  Branch (484:13): [True: 0, False: 0]
  ------------------
  485|      0|            return meth->bytes(buf, num);
  486|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  487|      0|        return -1;
  488|      0|    }
  489|    173|#endif
  490|       |
  491|    173|    dgbl = rand_get_global(ctx);
  492|    173|    if (dgbl == NULL)
  ------------------
  |  Branch (492:9): [True: 0, False: 173]
  ------------------
  493|      0|        return 0;
  494|    173|#ifndef FIPS_MODULE
  495|    173|    if (dgbl->random_provider != NULL)
  ------------------
  |  Branch (495:9): [True: 0, False: 173]
  ------------------
  496|      0|        return ossl_provider_random_bytes(dgbl->random_provider,
  497|      0|                                          OSSL_PROV_RANDOM_PUBLIC,
  ------------------
  |  |  124|      0|# define OSSL_PROV_RANDOM_PUBLIC     0
  ------------------
  498|      0|                                          buf, num, strength);
  499|    173|#endif      /* !FIPS_MODULE */
  500|       |
  501|    173|    rand = rand_get0_public(ctx, dgbl);
  502|    173|    if (rand != NULL)
  ------------------
  |  Branch (502:9): [True: 173, False: 0]
  ------------------
  503|    173|        return EVP_RAND_generate(rand, buf, num, strength, 0, NULL, 0);
  504|       |
  505|      0|    return 0;
  506|    173|}
RAND_bytes:
  509|    127|{
  510|    127|    if (num < 0)
  ------------------
  |  Branch (510:9): [True: 0, False: 127]
  ------------------
  511|      0|        return 0;
  512|    127|    return RAND_bytes_ex(NULL, buf, (size_t)num, 0);
  513|    127|}
ossl_rand_ctx_new:
  520|      1|{
  521|      1|    RAND_GLOBAL *dgbl = OPENSSL_zalloc(sizeof(*dgbl));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  522|       |
  523|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (523:9): [True: 0, False: 1]
  ------------------
  524|      0|        return NULL;
  525|       |
  526|      1|#ifndef FIPS_MODULE
  527|       |    /*
  528|       |     * We need to ensure that base libcrypto thread handling has been
  529|       |     * initialised.
  530|       |     */
  531|      1|    OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL);
  ------------------
  |  |   31|      1|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  532|       |
  533|       |    /* Prepopulate the random provider name */
  534|      1|    dgbl->random_provider_name = OPENSSL_strdup(random_provider_fips_name);
  ------------------
  |  |  119|      1|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  535|      1|    if (dgbl->random_provider_name == NULL)
  ------------------
  |  Branch (535:9): [True: 0, False: 1]
  ------------------
  536|      0|        goto err0;
  537|      1|#endif
  538|       |
  539|      1|    dgbl->lock = CRYPTO_THREAD_lock_new();
  540|      1|    if (dgbl->lock == NULL)
  ------------------
  |  Branch (540:9): [True: 0, False: 1]
  ------------------
  541|      0|        goto err1;
  542|       |
  543|      1|    if (!CRYPTO_THREAD_init_local(&dgbl->private, NULL))
  ------------------
  |  Branch (543:9): [True: 0, False: 1]
  ------------------
  544|      0|        goto err1;
  545|       |
  546|      1|    if (!CRYPTO_THREAD_init_local(&dgbl->public, NULL))
  ------------------
  |  Branch (546:9): [True: 0, False: 1]
  ------------------
  547|      0|        goto err2;
  548|       |
  549|      1|    return dgbl;
  550|       |
  551|      0| err2:
  552|      0|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  553|      0| err1:
  554|      0|    CRYPTO_THREAD_lock_free(dgbl->lock);
  555|      0|#ifndef FIPS_MODULE
  556|      0| err0:
  557|      0|    OPENSSL_free(dgbl->random_provider_name);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      0|#endif
  559|      0|    OPENSSL_free(dgbl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  560|      0|    return NULL;
  561|      0|}
ossl_rand_ctx_free:
  564|      1|{
  565|      1|    RAND_GLOBAL *dgbl = vdgbl;
  566|       |
  567|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (567:9): [True: 0, False: 1]
  ------------------
  568|      0|        return;
  569|       |
  570|      1|    CRYPTO_THREAD_lock_free(dgbl->lock);
  571|      1|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  572|      1|    CRYPTO_THREAD_cleanup_local(&dgbl->public);
  573|      1|    EVP_RAND_CTX_free(dgbl->primary);
  574|      1|    EVP_RAND_CTX_free(dgbl->seed);
  575|      1|#ifndef FIPS_MODULE
  576|      1|    OPENSSL_free(dgbl->random_provider_name);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  577|      1|#endif      /* !FIPS_MODULE */
  578|      1|    OPENSSL_free(dgbl->rng_name);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  579|      1|    OPENSSL_free(dgbl->rng_cipher);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  580|      1|    OPENSSL_free(dgbl->rng_digest);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  581|      1|    OPENSSL_free(dgbl->rng_propq);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  582|      1|    OPENSSL_free(dgbl->seed_name);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  583|      1|    OPENSSL_free(dgbl->seed_propq);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  584|       |
  585|      1|    OPENSSL_free(dgbl);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  586|      1|}
rand_lib.c:do_rand_init:
  148|      1|{
  149|      1|# ifndef OPENSSL_NO_ENGINE
  150|      1|    rand_engine_lock = CRYPTO_THREAD_lock_new();
  151|      1|    if (rand_engine_lock == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 1]
  ------------------
  152|      0|        return 0;
  153|      1|# endif     /* !OPENSSL_NO_ENGINE */
  154|       |
  155|      1|# ifndef OPENSSL_NO_DEPRECATED_3_0
  156|      1|    rand_meth_lock = CRYPTO_THREAD_lock_new();
  157|      1|    if (rand_meth_lock == NULL)
  ------------------
  |  Branch (157:9): [True: 0, False: 1]
  ------------------
  158|      0|        goto err;
  159|      1|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  160|       |
  161|      1|    if (!ossl_rand_pool_init())
  ------------------
  |  Branch (161:9): [True: 0, False: 1]
  ------------------
  162|      0|        goto err;
  163|       |
  164|      1|    rand_inited = 1;
  165|      1|    return 1;
  166|       |
  167|      0| err:
  168|      0|# ifndef OPENSSL_NO_DEPRECATED_3_0
  169|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
  170|      0|    rand_meth_lock = NULL;
  171|      0|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  172|      0|# ifndef OPENSSL_NO_ENGINE
  173|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
  174|      0|    rand_engine_lock = NULL;
  175|      0|# endif     /* !OPENSSL_NO_ENGINE */
  176|      0|    return 0;
  177|      1|}
rand_lib.c:rand_set_rand_method_internal:
  265|      1|{
  266|      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 (266:9): [True: 0, False: 1]
  ------------------
  267|      0|        return 0;
  268|       |
  269|      1|    if (!CRYPTO_THREAD_write_lock(rand_meth_lock))
  ------------------
  |  Branch (269:9): [True: 0, False: 1]
  ------------------
  270|      0|        return 0;
  271|      1|#  ifndef OPENSSL_NO_ENGINE
  272|      1|    ENGINE_finish(funct_ref);
  273|      1|    funct_ref = e;
  274|      1|#  endif
  275|      1|    default_RAND_meth = meth;
  276|      1|    CRYPTO_THREAD_unlock(rand_meth_lock);
  277|      1|    return 1;
  278|      1|}
rand_lib.c:rand_get_global:
  100|    344|{
  101|    344|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DRBG_INDEX);
  ------------------
  |  |  103|    344|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  102|    344|}
rand_lib.c:rand_get0_primary:
  760|      2|{
  761|      2|    EVP_RAND_CTX *ret, *seed, *newseed = NULL, *primary;
  762|       |
  763|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (763:9): [True: 0, False: 2]
  ------------------
  764|      0|        return NULL;
  765|       |
  766|      2|    if (!CRYPTO_THREAD_read_lock(dgbl->lock))
  ------------------
  |  Branch (766:9): [True: 0, False: 2]
  ------------------
  767|      0|        return NULL;
  768|       |
  769|      2|    ret = dgbl->primary;
  770|      2|    seed = dgbl->seed;
  771|      2|    CRYPTO_THREAD_unlock(dgbl->lock);
  772|       |
  773|      2|    if (ret != NULL)
  ------------------
  |  Branch (773:9): [True: 1, False: 1]
  ------------------
  774|      1|        return ret;
  775|       |
  776|      1|#if !defined(FIPS_MODULE) || !defined(OPENSSL_NO_FIPS_JITTER)
  777|       |    /* Create a seed source for libcrypto or jitter enabled FIPS provider */
  778|      1|    if (seed == NULL) {
  ------------------
  |  Branch (778:9): [True: 1, False: 0]
  ------------------
  779|      1|        ERR_set_mark();
  780|      1|        seed = newseed = rand_new_seed(ctx);
  781|      1|        ERR_pop_to_mark();
  782|      1|    }
  783|      1|#endif  /* !FIPS_MODULE || !OPENSSL_NO_FIPS_JITTER */
  784|       |
  785|       |#if defined(FIPS_MODULE)
  786|       |    /* The FIPS provider has entropy health tests instead of the primary */
  787|       |    ret = rand_new_crngt(ctx, seed);
  788|       |#else   /* FIPS_MODULE */
  789|      1|    ret = rand_new_drbg(ctx, seed, PRIMARY_RESEED_INTERVAL,
  ------------------
  |  |   23|      1|# define PRIMARY_RESEED_INTERVAL                 (1 << 8)
  ------------------
  790|      1|                        PRIMARY_RESEED_TIME_INTERVAL);
  ------------------
  |  |   25|      1|# define PRIMARY_RESEED_TIME_INTERVAL            (60 * 60) /* 1 hour */
  ------------------
  791|      1|#endif  /* FIPS_MODULE */
  792|       |
  793|       |    /*
  794|       |     * The primary DRBG may be shared between multiple threads so we must
  795|       |     * enable locking.
  796|       |     */
  797|      1|    if (ret == NULL || !EVP_RAND_enable_locking(ret)) {
  ------------------
  |  Branch (797:9): [True: 0, False: 1]
  |  Branch (797:24): [True: 0, False: 1]
  ------------------
  798|      0|        if (ret != NULL) {
  ------------------
  |  Branch (798:13): [True: 0, False: 0]
  ------------------
  799|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  800|      0|            EVP_RAND_CTX_free(ret);
  801|      0|        }
  802|      0|        if (newseed == NULL)
  ------------------
  |  Branch (802:13): [True: 0, False: 0]
  ------------------
  803|      0|            return NULL;
  804|       |        /* else carry on and store seed */
  805|      0|        ret = NULL;
  806|      0|    }
  807|       |
  808|      1|    if (!CRYPTO_THREAD_write_lock(dgbl->lock))
  ------------------
  |  Branch (808:9): [True: 0, False: 1]
  ------------------
  809|      0|        return NULL;
  810|       |
  811|      1|    primary = dgbl->primary;
  812|      1|    if (primary != NULL) {
  ------------------
  |  Branch (812:9): [True: 0, False: 1]
  ------------------
  813|      0|        CRYPTO_THREAD_unlock(dgbl->lock);
  814|      0|        EVP_RAND_CTX_free(ret);
  815|      0|        EVP_RAND_CTX_free(newseed);
  816|      0|        return primary;
  817|      0|    }
  818|      1|    if (newseed != NULL)
  ------------------
  |  Branch (818:9): [True: 1, False: 0]
  ------------------
  819|      1|        dgbl->seed = newseed;
  820|      1|    dgbl->primary = ret;
  821|      1|    CRYPTO_THREAD_unlock(dgbl->lock);
  822|       |
  823|      1|    return ret;
  824|      1|}
rand_lib.c:rand_new_seed:
  608|      1|{
  609|      1|    EVP_RAND *rand;
  610|      1|    const char *propq;
  611|      1|    char *name;
  612|      1|    EVP_RAND_CTX *ctx = NULL;
  613|      1|# ifdef OPENSSL_NO_FIPS_JITTER
  614|      1|    RAND_GLOBAL *dgbl = rand_get_global(libctx);
  615|       |
  616|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (616:9): [True: 0, False: 1]
  ------------------
  617|      0|        return NULL;
  618|      1|    propq = dgbl->seed_propq;
  619|      1|    name = dgbl->seed_name != NULL ? dgbl->seed_name
  ------------------
  |  Branch (619:12): [True: 0, False: 1]
  ------------------
  620|      1|                                   : OPENSSL_MSTR(OPENSSL_DEFAULT_SEED_SRC);
  ------------------
  |  |   20|      1|# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x)
  |  |  ------------------
  |  |  |  |   19|      1|# define OPENSSL_MSTR_HELPER(x) #x
  |  |  ------------------
  ------------------
  621|       |# else /* !OPENSSL_NO_FIPS_JITTER */
  622|       |    name = "JITTER";
  623|       |    propq = "";
  624|       |# endif /* OPENSSL_NO_FIPS_JITTER */
  625|       |
  626|      1|    rand = EVP_RAND_fetch(libctx, name, propq);
  627|      1|    if (rand == NULL) {
  ------------------
  |  Branch (627:9): [True: 0, False: 1]
  ------------------
  628|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  629|      0|        goto err;
  630|      0|    }
  631|      1|    ctx = EVP_RAND_CTX_new(rand, NULL);
  632|      1|    EVP_RAND_free(rand);
  633|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (633:9): [True: 0, False: 1]
  ------------------
  634|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  635|      0|        goto err;
  636|      0|    }
  637|      1|    if (!EVP_RAND_instantiate(ctx, 0, 0, NULL, 0, NULL)) {
  ------------------
  |  Branch (637:9): [True: 0, False: 1]
  ------------------
  638|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  639|      0|        goto err;
  640|      0|    }
  641|      1|    return ctx;
  642|      0| err:
  643|      0|    EVP_RAND_CTX_free(ctx);
  644|      0|    return NULL;
  645|      1|}
rand_lib.c:rand_new_drbg:
  668|      3|{
  669|      3|    EVP_RAND *rand;
  670|      3|    RAND_GLOBAL *dgbl = rand_get_global(libctx);
  671|      3|    EVP_RAND_CTX *ctx;
  672|      3|    OSSL_PARAM params[9], *p = params;
  673|      3|    const OSSL_PARAM *settables;
  674|      3|    const char *prov_name;
  675|      3|    char *name, *cipher;
  676|      3|    int use_df = 1;
  677|       |
  678|      3|    if (dgbl == NULL)
  ------------------
  |  Branch (678:9): [True: 0, False: 3]
  ------------------
  679|      0|        return NULL;
  680|      3|    name = dgbl->rng_name != NULL ? dgbl->rng_name : "CTR-DRBG";
  ------------------
  |  Branch (680:12): [True: 0, False: 3]
  ------------------
  681|      3|    rand = EVP_RAND_fetch(libctx, name, dgbl->rng_propq);
  682|      3|    if (rand == NULL) {
  ------------------
  |  Branch (682:9): [True: 0, False: 3]
  ------------------
  683|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  684|      0|        return NULL;
  685|      0|    }
  686|      3|    prov_name = ossl_provider_name(EVP_RAND_get0_provider(rand));
  687|      3|    ctx = EVP_RAND_CTX_new(rand, parent);
  688|      3|    EVP_RAND_free(rand);
  689|      3|    if (ctx == NULL) {
  ------------------
  |  Branch (689:9): [True: 0, False: 3]
  ------------------
  690|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  691|      0|        return NULL;
  692|      0|    }
  693|       |
  694|      3|    settables = EVP_RAND_CTX_settable_params(ctx);
  695|      3|    if (OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_CIPHER)) {
  ------------------
  |  |  227|      3|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  121|      3|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  |  Branch (695:9): [True: 3, False: 0]
  ------------------
  696|      3|        cipher = dgbl->rng_cipher != NULL ? dgbl->rng_cipher : "AES-256-CTR";
  ------------------
  |  Branch (696:18): [True: 0, False: 3]
  ------------------
  697|      3|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
  ------------------
  |  |  227|      3|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  121|      3|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  698|      3|                                                cipher, 0);
  699|      3|    }
  700|      3|    if (dgbl->rng_digest != NULL
  ------------------
  |  Branch (700:9): [True: 0, False: 3]
  ------------------
  701|      3|            && OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_DIGEST))
  ------------------
  |  |  228|      0|# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  122|      0|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  ------------------
  ------------------
  |  Branch (701:16): [True: 0, False: 0]
  ------------------
  702|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST,
  ------------------
  |  |  228|      0|# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  122|      0|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  ------------------
  ------------------
  703|      0|                                                dgbl->rng_digest, 0);
  704|      3|    if (prov_name != NULL)
  ------------------
  |  Branch (704:9): [True: 3, False: 0]
  ------------------
  705|      3|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_PROV_PARAM_CORE_PROV_NAME,
  ------------------
  |  |  494|      3|# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name"
  ------------------
  706|      3|                                                (char *)prov_name, 0);
  707|      3|    if (dgbl->rng_propq != NULL)
  ------------------
  |  Branch (707:9): [True: 0, False: 3]
  ------------------
  708|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_PROPERTIES,
  ------------------
  |  |  242|      0|# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  126|      0|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  709|      0|                                                dgbl->rng_propq, 0);
  710|      3|    if (OSSL_PARAM_locate_const(settables, OSSL_ALG_PARAM_MAC))
  ------------------
  |  |  125|      3|# define OSSL_ALG_PARAM_MAC "mac"
  ------------------
  |  Branch (710:9): [True: 0, False: 3]
  ------------------
  711|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_MAC, "HMAC", 0);
  ------------------
  |  |  125|      0|# define OSSL_ALG_PARAM_MAC "mac"
  ------------------
  712|      3|    if (OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_USE_DF))
  ------------------
  |  |  249|      3|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  |  Branch (712:9): [True: 3, False: 0]
  ------------------
  713|      3|        *p++ = OSSL_PARAM_construct_int(OSSL_DRBG_PARAM_USE_DF, &use_df);
  ------------------
  |  |  249|      3|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  714|      3|    *p++ = OSSL_PARAM_construct_uint(OSSL_DRBG_PARAM_RESEED_REQUESTS,
  ------------------
  |  |  245|      3|# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
  ------------------
  715|      3|                                     &reseed_interval);
  716|      3|    *p++ = OSSL_PARAM_construct_time_t(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL,
  ------------------
  |  |  247|      3|# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
  ------------------
  717|      3|                                       &reseed_time_interval);
  718|      3|    *p = OSSL_PARAM_construct_end();
  719|      3|    if (!EVP_RAND_instantiate(ctx, 0, 0, NULL, 0, params)) {
  ------------------
  |  Branch (719:9): [True: 0, False: 3]
  ------------------
  720|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  721|      0|        EVP_RAND_CTX_free(ctx);
  722|      0|        return NULL;
  723|      0|    }
  724|      3|    return ctx;
  725|      3|}
rand_lib.c:rand_get0_public:
  839|    173|{
  840|    173|    EVP_RAND_CTX *rand, *primary;
  841|       |
  842|    173|    if (dgbl == NULL)
  ------------------
  |  Branch (842:9): [True: 0, False: 173]
  ------------------
  843|      0|        return NULL;
  844|       |
  845|    173|    rand = CRYPTO_THREAD_get_local(&dgbl->public);
  846|    173|    if (rand == NULL) {
  ------------------
  |  Branch (846:9): [True: 1, False: 172]
  ------------------
  847|      1|        primary = rand_get0_primary(ctx, dgbl);
  848|      1|        if (primary == NULL)
  ------------------
  |  Branch (848:13): [True: 0, False: 1]
  ------------------
  849|      0|            return NULL;
  850|       |
  851|      1|        ctx = ossl_lib_ctx_get_concrete(ctx);
  852|       |
  853|      1|        if (ctx == NULL)
  ------------------
  |  Branch (853:13): [True: 0, False: 1]
  ------------------
  854|      0|            return NULL;
  855|       |        /*
  856|       |         * If the private is also NULL then this is the first time we've
  857|       |         * used this thread.
  858|       |         */
  859|      1|        if (CRYPTO_THREAD_get_local(&dgbl->private) == NULL
  ------------------
  |  Branch (859:13): [True: 0, False: 1]
  ------------------
  860|      1|                && !ossl_init_thread_start(NULL, ctx, rand_delete_thread_state))
  ------------------
  |  Branch (860:20): [True: 0, False: 0]
  ------------------
  861|      0|            return NULL;
  862|      1|        rand = rand_new_drbg(ctx, primary, SECONDARY_RESEED_INTERVAL,
  ------------------
  |  |   24|      1|# define SECONDARY_RESEED_INTERVAL               (1 << 16)
  ------------------
  863|      1|                             SECONDARY_RESEED_TIME_INTERVAL);
  ------------------
  |  |   26|      1|# define SECONDARY_RESEED_TIME_INTERVAL          (7 * 60)  /* 7 minutes */
  ------------------
  864|      1|        CRYPTO_THREAD_set_local(&dgbl->public, rand);
  865|      1|    }
  866|    173|    return rand;
  867|    173|}
rand_lib.c:rand_delete_thread_state:
  589|      1|{
  590|      1|    OSSL_LIB_CTX *ctx = arg;
  591|      1|    RAND_GLOBAL *dgbl = rand_get_global(ctx);
  592|      1|    EVP_RAND_CTX *rand;
  593|       |
  594|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (594:9): [True: 0, False: 1]
  ------------------
  595|      0|        return;
  596|       |
  597|      1|    rand = CRYPTO_THREAD_get_local(&dgbl->public);
  598|      1|    CRYPTO_THREAD_set_local(&dgbl->public, NULL);
  599|      1|    EVP_RAND_CTX_free(rand);
  600|       |
  601|      1|    rand = CRYPTO_THREAD_get_local(&dgbl->private);
  602|      1|    CRYPTO_THREAD_set_local(&dgbl->private, NULL);
  603|      1|    EVP_RAND_CTX_free(rand);
  604|      1|}
rand_lib.c:rand_get0_private:
  881|    166|{
  882|    166|    EVP_RAND_CTX *rand, *primary;
  883|       |
  884|    166|    rand = CRYPTO_THREAD_get_local(&dgbl->private);
  885|    166|    if (rand == NULL) {
  ------------------
  |  Branch (885:9): [True: 1, False: 165]
  ------------------
  886|      1|        primary = rand_get0_primary(ctx, dgbl);
  887|      1|        if (primary == NULL)
  ------------------
  |  Branch (887:13): [True: 0, False: 1]
  ------------------
  888|      0|            return NULL;
  889|       |
  890|      1|        ctx = ossl_lib_ctx_get_concrete(ctx);
  891|       |
  892|      1|        if (ctx == NULL)
  ------------------
  |  Branch (892:13): [True: 0, False: 1]
  ------------------
  893|      0|            return NULL;
  894|       |        /*
  895|       |         * If the public is also NULL then this is the first time we've
  896|       |         * used this thread.
  897|       |         */
  898|      1|        if (CRYPTO_THREAD_get_local(&dgbl->public) == NULL
  ------------------
  |  Branch (898:13): [True: 1, False: 0]
  ------------------
  899|      1|                && !ossl_init_thread_start(NULL, ctx, rand_delete_thread_state))
  ------------------
  |  Branch (899:20): [True: 0, False: 1]
  ------------------
  900|      0|            return NULL;
  901|      1|        rand = rand_new_drbg(ctx, primary, SECONDARY_RESEED_INTERVAL,
  ------------------
  |  |   24|      1|# define SECONDARY_RESEED_INTERVAL               (1 << 16)
  ------------------
  902|      1|                             SECONDARY_RESEED_TIME_INTERVAL);
  ------------------
  |  |   26|      1|# define SECONDARY_RESEED_TIME_INTERVAL          (7 * 60)  /* 7 minutes */
  ------------------
  903|      1|        CRYPTO_THREAD_set_local(&dgbl->private, rand);
  904|      1|    }
  905|    166|    return rand;
  906|    166|}

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

ossl_rand_pool_new:
   24|      1|{
   25|      1|    RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      1|    size_t min_alloc_size = RAND_POOL_MIN_ALLOCATION(secure);
  ------------------
  |  |   60|      1|# define RAND_POOL_MIN_ALLOCATION(secure) ((secure) ? 16 : 48)
  |  |  ------------------
  |  |  |  Branch (60:44): [True: 1, False: 0]
  |  |  ------------------
  ------------------
   27|       |
   28|      1|    if (pool == NULL)
  ------------------
  |  Branch (28:9): [True: 0, False: 1]
  ------------------
   29|      0|        return NULL;
   30|       |
   31|      1|    pool->min_len = min_len;
   32|      1|    pool->max_len = (max_len > RAND_POOL_MAX_LENGTH) ?
  ------------------
  |  |   36|      1|# define RAND_POOL_MAX_LENGTH    (RAND_POOL_FACTOR * \
  |  |  ------------------
  |  |  |  |   35|      1|# define RAND_POOL_FACTOR        256
  |  |  ------------------
  |  |   37|      1|                                  3 * (RAND_DRBG_STRENGTH / 16))
  |  |  ------------------
  |  |  |  |   37|      1|# define RAND_DRBG_STRENGTH             256
  |  |  ------------------
  ------------------
  |  Branch (32:21): [True: 1, False: 0]
  ------------------
   33|      1|        RAND_POOL_MAX_LENGTH : max_len;
  ------------------
  |  |   36|      1|# define RAND_POOL_MAX_LENGTH    (RAND_POOL_FACTOR * \
  |  |  ------------------
  |  |  |  |   35|      1|# define RAND_POOL_FACTOR        256
  |  |  ------------------
  |  |   37|      1|                                  3 * (RAND_DRBG_STRENGTH / 16))
  |  |  ------------------
  |  |  |  |   37|      1|# define RAND_DRBG_STRENGTH             256
  |  |  ------------------
  ------------------
   34|      1|    pool->alloc_len = min_len < min_alloc_size ? min_alloc_size : min_len;
  ------------------
  |  Branch (34:23): [True: 0, False: 1]
  ------------------
   35|      1|    if (pool->alloc_len > pool->max_len)
  ------------------
  |  Branch (35:9): [True: 0, False: 1]
  ------------------
   36|      0|        pool->alloc_len = pool->max_len;
   37|       |
   38|      1|    if (secure)
  ------------------
  |  Branch (38:9): [True: 1, False: 0]
  ------------------
   39|      1|        pool->buffer = OPENSSL_secure_zalloc(pool->alloc_len);
  ------------------
  |  |  125|      1|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      0|    else
   41|      0|        pool->buffer = OPENSSL_zalloc(pool->alloc_len);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   42|       |
   43|      1|    if (pool->buffer == NULL)
  ------------------
  |  Branch (43:9): [True: 0, False: 1]
  ------------------
   44|      0|        goto err;
   45|       |
   46|      1|    pool->entropy_requested = entropy_requested;
   47|      1|    pool->secure = secure;
   48|      1|    return pool;
   49|       |
   50|      0|err:
   51|      0|    OPENSSL_free(pool);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   52|      0|    return NULL;
   53|      1|}
ossl_rand_pool_free:
   89|      1|{
   90|      1|    if (pool == NULL)
  ------------------
  |  Branch (90:9): [True: 0, False: 1]
  ------------------
   91|      0|        return;
   92|       |
   93|       |    /*
   94|       |     * Although it would be advisable from a cryptographical viewpoint,
   95|       |     * we are not allowed to clear attached buffers, since they are passed
   96|       |     * to ossl_rand_pool_attach() as `const unsigned char*`.
   97|       |     * (see corresponding comment in ossl_rand_pool_attach()).
   98|       |     */
   99|      1|    if (!pool->attached) {
  ------------------
  |  Branch (99:9): [True: 1, False: 0]
  ------------------
  100|      1|        if (pool->secure)
  ------------------
  |  Branch (100:13): [True: 1, False: 0]
  ------------------
  101|      1|            OPENSSL_secure_clear_free(pool->buffer, pool->alloc_len);
  ------------------
  |  |  129|      1|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  102|      0|        else
  103|      0|            OPENSSL_clear_free(pool->buffer, pool->alloc_len);
  ------------------
  |  |  113|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  104|      1|    }
  105|       |
  106|      1|    OPENSSL_free(pool);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  107|      1|}
ossl_rand_pool_length:
  129|      1|{
  130|      1|    return pool->len;
  131|      1|}
ossl_rand_pool_detach:
  140|      1|{
  141|      1|    unsigned char *ret = pool->buffer;
  142|      1|    pool->buffer = NULL;
  143|      1|    pool->entropy = 0;
  144|      1|    return ret;
  145|      1|}
ossl_rand_pool_entropy_available:
  175|      1|{
  176|      1|    if (pool->entropy < pool->entropy_requested)
  ------------------
  |  Branch (176:9): [True: 0, False: 1]
  ------------------
  177|      0|        return 0;
  178|       |
  179|      1|    if (pool->len < pool->min_len)
  ------------------
  |  Branch (179:9): [True: 0, False: 1]
  ------------------
  180|      0|        return 0;
  181|       |
  182|      1|    return pool->entropy;
  183|      1|}
ossl_rand_pool_entropy_needed:
  191|      1|{
  192|      1|    if (pool->entropy < pool->entropy_requested)
  ------------------
  |  Branch (192:9): [True: 1, False: 0]
  ------------------
  193|      1|        return pool->entropy_requested - pool->entropy;
  194|       |
  195|      0|    return 0;
  196|      1|}
ossl_rand_pool_bytes_needed:
  239|      1|{
  240|      1|    size_t bytes_needed;
  241|      1|    size_t entropy_needed = ossl_rand_pool_entropy_needed(pool);
  242|       |
  243|      1|    if (entropy_factor < 1) {
  ------------------
  |  Branch (243:9): [True: 0, False: 1]
  ------------------
  244|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_ARGUMENT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  245|      0|        return 0;
  246|      0|    }
  247|       |
  248|      1|    bytes_needed = ENTROPY_TO_BYTES(entropy_needed, entropy_factor);
  ------------------
  |  |  163|      1|    (((bits) * (entropy_factor) + 7) / 8)
  ------------------
  249|       |
  250|      1|    if (bytes_needed > pool->max_len - pool->len) {
  ------------------
  |  Branch (250:9): [True: 0, False: 1]
  ------------------
  251|       |        /* not enough space left */
  252|      0|        ERR_raise_data(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW,
  ------------------
  |  |   97|      0|# define ERR_LIB_RAND            36
  ------------------
                      ERR_raise_data(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW,
  ------------------
  |  |   55|      0|# define RAND_R_RANDOM_POOL_OVERFLOW                      125
  ------------------
  253|      0|                       "entropy_factor=%u, entropy_needed=%zu, bytes_needed=%zu,"
  254|      0|                       "pool->max_len=%zu, pool->len=%zu",
  255|      0|                       entropy_factor, entropy_needed, bytes_needed,
  256|      0|                       pool->max_len, pool->len);
  257|      0|        return 0;
  258|      0|    }
  259|       |
  260|      1|    if (pool->len < pool->min_len &&
  ------------------
  |  Branch (260:9): [True: 1, False: 0]
  ------------------
  261|      1|        bytes_needed < pool->min_len - pool->len)
  ------------------
  |  Branch (261:9): [True: 0, False: 1]
  ------------------
  262|       |        /* to meet the min_len requirement */
  263|      0|        bytes_needed = pool->min_len - pool->len;
  264|       |
  265|       |    /*
  266|       |     * Make sure the buffer is large enough for the requested amount
  267|       |     * of data. This guarantees that existing code patterns where
  268|       |     * ossl_rand_pool_add_begin, ossl_rand_pool_add_end or ossl_rand_pool_add
  269|       |     * are used to collect entropy data without any error handling
  270|       |     * whatsoever, continue to be valid.
  271|       |     * Furthermore if the allocation here fails once, make sure that
  272|       |     * we don't fall back to a less secure or even blocking random source,
  273|       |     * as that could happen by the existing code patterns.
  274|       |     * This is not a concern for additional data, therefore that
  275|       |     * is not needed if rand_pool_grow fails in other places.
  276|       |     */
  277|      1|    if (!rand_pool_grow(pool, bytes_needed)) {
  ------------------
  |  Branch (277:9): [True: 0, False: 1]
  ------------------
  278|       |        /* persistent error for this pool */
  279|      0|        pool->max_len = pool->len = 0;
  280|      0|        return 0;
  281|      0|    }
  282|       |
  283|      1|    return bytes_needed;
  284|      1|}
ossl_rand_pool_add_begin:
  357|      1|{
  358|      1|    if (len == 0)
  ------------------
  |  Branch (358:9): [True: 0, False: 1]
  ------------------
  359|      0|        return NULL;
  360|       |
  361|      1|    if (len > pool->max_len - pool->len) {
  ------------------
  |  Branch (361:9): [True: 0, False: 1]
  ------------------
  362|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  363|      0|        return NULL;
  364|      0|    }
  365|       |
  366|      1|    if (pool->buffer == NULL) {
  ------------------
  |  Branch (366:9): [True: 0, False: 1]
  ------------------
  367|      0|        ERR_raise(ERR_LIB_RAND, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|      0|        return NULL;
  369|      0|    }
  370|       |
  371|       |    /*
  372|       |     * As long as the allocation request stays within the limits given
  373|       |     * by ossl_rand_pool_bytes_needed this rand_pool_grow below is guaranteed
  374|       |     * to succeed, thus no allocation happens.
  375|       |     * We have that only for cases when a pool is used to collect
  376|       |     * additional data. Then the buffer might need to grow here,
  377|       |     * and of course the caller is responsible to check the return
  378|       |     * value of this function.
  379|       |     */
  380|      1|    if (!rand_pool_grow(pool, len))
  ------------------
  |  Branch (380:9): [True: 0, False: 1]
  ------------------
  381|      0|        return NULL;
  382|       |
  383|      1|    return pool->buffer + pool->len;
  384|      1|}
ossl_rand_pool_add_end:
  396|      1|{
  397|      1|    if (len > pool->alloc_len - pool->len) {
  ------------------
  |  Branch (397:9): [True: 0, False: 1]
  ------------------
  398|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  399|      0|        return 0;
  400|      0|    }
  401|       |
  402|      1|    if (len > 0) {
  ------------------
  |  Branch (402:9): [True: 1, False: 0]
  ------------------
  403|      1|        pool->len += len;
  404|      1|        pool->entropy += entropy;
  405|      1|    }
  406|       |
  407|      1|    return 1;
  408|      1|}
ossl_rand_pool_adin_mix_in:
  423|      1|{
  424|      1|    if (adin == NULL || adin_len == 0)
  ------------------
  |  Branch (424:9): [True: 0, False: 1]
  |  Branch (424:25): [True: 0, False: 1]
  ------------------
  425|       |        /* Nothing to mix in -> success */
  426|      0|        return 1;
  427|       |
  428|      1|    if (pool->buffer == NULL) {
  ------------------
  |  Branch (428:9): [True: 0, False: 1]
  ------------------
  429|      0|        ERR_raise(ERR_LIB_RAND, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  430|      0|        return 0;
  431|      0|    }
  432|       |
  433|      1|    if (pool->len == 0) {
  ------------------
  |  Branch (433:9): [True: 0, False: 1]
  ------------------
  434|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_RANDOM_POOL_IS_EMPTY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  435|      0|        return 0;
  436|      0|    }
  437|       |
  438|      1|    if (adin != NULL && adin_len > 0) {
  ------------------
  |  Branch (438:9): [True: 1, False: 0]
  |  Branch (438:25): [True: 1, False: 0]
  ------------------
  439|      1|        size_t i;
  440|       |
  441|       |        /* xor the additional data into the pool */
  442|      9|        for (i = 0; i < adin_len; ++i)
  ------------------
  |  Branch (442:21): [True: 8, False: 1]
  ------------------
  443|      8|            pool->buffer[i % pool->len] ^= adin[i];
  444|      1|    }
  445|       |
  446|      1|    return 1;
  447|      1|}
rand_pool.c:rand_pool_grow:
  200|      2|{
  201|      2|    if (len > pool->alloc_len - pool->len) {
  ------------------
  |  Branch (201:9): [True: 0, False: 2]
  ------------------
  202|      0|        unsigned char *p;
  203|      0|        const size_t limit = pool->max_len / 2;
  204|      0|        size_t newlen = pool->alloc_len;
  205|       |
  206|      0|        if (pool->attached || len > pool->max_len - pool->len) {
  ------------------
  |  Branch (206:13): [True: 0, False: 0]
  |  Branch (206:31): [True: 0, False: 0]
  ------------------
  207|      0|            ERR_raise(ERR_LIB_RAND, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  208|      0|            return 0;
  209|      0|        }
  210|       |
  211|      0|        do
  212|      0|            newlen = newlen < limit ? newlen * 2 : pool->max_len;
  ------------------
  |  Branch (212:22): [True: 0, False: 0]
  ------------------
  213|      0|        while (len > newlen - pool->len);
  ------------------
  |  Branch (213:16): [True: 0, False: 0]
  ------------------
  214|       |
  215|      0|        if (pool->secure)
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|      0|            p = OPENSSL_secure_zalloc(newlen);
  ------------------
  |  |  125|      0|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  217|      0|        else
  218|      0|            p = OPENSSL_zalloc(newlen);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|      0|        if (p == NULL)
  ------------------
  |  Branch (219:13): [True: 0, False: 0]
  ------------------
  220|      0|            return 0;
  221|      0|        memcpy(p, pool->buffer, pool->len);
  222|      0|        if (pool->secure)
  ------------------
  |  Branch (222:13): [True: 0, False: 0]
  ------------------
  223|      0|            OPENSSL_secure_clear_free(pool->buffer, pool->alloc_len);
  ------------------
  |  |  129|      0|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  224|      0|        else
  225|      0|            OPENSSL_clear_free(pool->buffer, pool->alloc_len);
  ------------------
  |  |  113|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  226|      0|        pool->buffer = p;
  227|      0|        pool->alloc_len = newlen;
  228|      0|    }
  229|      2|    return 1;
  230|      2|}

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

ossl_self_test_set_callback_new:
   35|      1|{
   36|      1|    SELF_TEST_CB *stcb;
   37|       |
   38|      1|    stcb = OPENSSL_zalloc(sizeof(*stcb));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|      1|    return stcb;
   40|      1|}
ossl_self_test_set_callback_free:
   43|      1|{
   44|      1|    OPENSSL_free(stcb);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|      1|}

ossl_sha3_reset:
   19|  4.36k|{
   20|       |#if defined(__s390x__) && defined(OPENSSL_CPUID_OBJ)
   21|       |    if (!(OPENSSL_s390xcap_P.stfle[1] & S390X_CAPBIT(S390X_MSA12)))
   22|       |#endif
   23|  4.36k|        memset(ctx->A, 0, sizeof(ctx->A));
   24|  4.36k|    ctx->bufsz = 0;
   25|  4.36k|    ctx->xof_state = XOF_STATE_INIT;
  ------------------
  |  |   35|  4.36k|#define XOF_STATE_INIT    0
  ------------------
   26|  4.36k|}
ossl_sha3_init:
   29|    894|{
   30|    894|    size_t bsz = SHA3_BLOCKSIZE(bitlen);
  ------------------
  |  |   21|    894|# define SHA3_BLOCKSIZE(bitlen) (KECCAK1600_WIDTH - bitlen * 2) / 8
  |  |  ------------------
  |  |  |  |   18|    894|# define KECCAK1600_WIDTH 1600
  |  |  ------------------
  ------------------
   31|       |
   32|    894|    if (bsz <= sizeof(ctx->buf)) {
  ------------------
  |  Branch (32:9): [True: 894, False: 0]
  ------------------
   33|    894|        ossl_sha3_reset(ctx);
   34|    894|        ctx->block_size = bsz;
   35|    894|        ctx->md_size = bitlen / 8;
   36|    894|        ctx->pad = pad;
   37|    894|        return 1;
   38|    894|    }
   39|       |
   40|      0|    return 0;
   41|    894|}
ossl_keccak_init:
   44|    470|{
   45|    470|    int ret = ossl_sha3_init(ctx, pad, bitlen);
   46|       |
   47|    470|    if (ret)
  ------------------
  |  Branch (47:9): [True: 470, False: 0]
  ------------------
   48|    470|        ctx->md_size = mdlen / 8;
   49|    470|    return ret;
   50|    470|}
ossl_sha3_final:
  104|  1.99k|{
  105|  1.99k|    size_t bsz = ctx->block_size;
  106|  1.99k|    size_t num = ctx->bufsz;
  107|       |
  108|  1.99k|    if (outlen == 0)
  ------------------
  |  Branch (108:9): [True: 0, False: 1.99k]
  ------------------
  109|      0|        return 1;
  110|  1.99k|    if (ctx->xof_state == XOF_STATE_SQUEEZE
  ------------------
  |  |   38|  3.98k|#define XOF_STATE_SQUEEZE 3
  ------------------
  |  Branch (110:9): [True: 0, False: 1.99k]
  ------------------
  111|  1.99k|        || ctx->xof_state == XOF_STATE_FINAL)
  ------------------
  |  |   37|  1.99k|#define XOF_STATE_FINAL   2
  ------------------
  |  Branch (111:12): [True: 0, False: 1.99k]
  ------------------
  112|      0|        return 0;
  113|       |
  114|       |    /*
  115|       |     * Pad the data with 10*1. Note that |num| can be |bsz - 1|
  116|       |     * in which case both byte operations below are performed on
  117|       |     * same byte...
  118|       |     */
  119|  1.99k|    memset(ctx->buf + num, 0, bsz - num);
  120|  1.99k|    ctx->buf[num] = ctx->pad;
  121|  1.99k|    ctx->buf[bsz - 1] |= 0x80;
  122|       |
  123|  1.99k|    (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz);
  124|       |
  125|  1.99k|    ctx->xof_state = XOF_STATE_FINAL;
  ------------------
  |  |   37|  1.99k|#define XOF_STATE_FINAL   2
  ------------------
  126|  1.99k|    SHA3_squeeze(ctx->A, out, outlen, bsz, 0);
  127|  1.99k|    return 1;
  128|  1.99k|}
ossl_sha3_squeeze:
  141|  4.44k|{
  142|  4.44k|    size_t bsz = ctx->block_size;
  143|  4.44k|    size_t num = ctx->bufsz;
  144|  4.44k|    size_t len;
  145|  4.44k|    int next = 1;
  146|       |
  147|  4.44k|    if (outlen == 0)
  ------------------
  |  Branch (147:9): [True: 0, False: 4.44k]
  ------------------
  148|      0|        return 1;
  149|       |
  150|  4.44k|    if (ctx->xof_state == XOF_STATE_FINAL)
  ------------------
  |  |   37|  4.44k|#define XOF_STATE_FINAL   2
  ------------------
  |  Branch (150:9): [True: 0, False: 4.44k]
  ------------------
  151|      0|        return 0;
  152|       |
  153|       |    /*
  154|       |     * On the first squeeze call, finish the absorb process,
  155|       |     * by adding the trailing padding and then doing
  156|       |     * a final absorb.
  157|       |     */
  158|  4.44k|    if (ctx->xof_state != XOF_STATE_SQUEEZE) {
  ------------------
  |  |   38|  4.44k|#define XOF_STATE_SQUEEZE 3
  ------------------
  |  Branch (158:9): [True: 1.47k, False: 2.96k]
  ------------------
  159|       |        /*
  160|       |         * Pad the data with 10*1. Note that |num| can be |bsz - 1|
  161|       |         * in which case both byte operations below are performed on
  162|       |         * same byte...
  163|       |         */
  164|  1.47k|        memset(ctx->buf + num, 0, bsz - num);
  165|  1.47k|        ctx->buf[num] = ctx->pad;
  166|  1.47k|        ctx->buf[bsz - 1] |= 0x80;
  167|  1.47k|        (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz);
  168|  1.47k|        ctx->xof_state = XOF_STATE_SQUEEZE;
  ------------------
  |  |   38|  1.47k|#define XOF_STATE_SQUEEZE 3
  ------------------
  169|  1.47k|        num = ctx->bufsz = 0;
  170|  1.47k|        next = 0;
  171|  1.47k|    }
  172|       |
  173|       |    /*
  174|       |     * Step 1. Consume any bytes left over from a previous squeeze
  175|       |     * (See Step 4 below).
  176|       |     */
  177|  4.44k|    if (num != 0) {
  ------------------
  |  Branch (177:9): [True: 0, False: 4.44k]
  ------------------
  178|      0|        if (outlen > ctx->bufsz)
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  ------------------
  179|      0|            len = ctx->bufsz;
  180|      0|        else
  181|      0|            len = outlen;
  182|      0|        memcpy(out, ctx->buf + bsz - ctx->bufsz, len);
  183|      0|        out += len;
  184|      0|        outlen -= len;
  185|      0|        ctx->bufsz -= len;
  186|      0|    }
  187|  4.44k|    if (outlen == 0)
  ------------------
  |  Branch (187:9): [True: 0, False: 4.44k]
  ------------------
  188|      0|        return 1;
  189|       |
  190|       |    /* Step 2. Copy full sized squeezed blocks to the output buffer directly */
  191|  4.44k|    if (outlen >= bsz) {
  ------------------
  |  Branch (191:9): [True: 4.44k, False: 0]
  ------------------
  192|  4.44k|        len = bsz * (outlen / bsz);
  193|  4.44k|        SHA3_squeeze(ctx->A, out, len, bsz, next);
  194|  4.44k|        next = 1;
  195|  4.44k|        out += len;
  196|  4.44k|        outlen -= len;
  197|  4.44k|    }
  198|  4.44k|    if (outlen > 0) {
  ------------------
  |  Branch (198:9): [True: 0, False: 4.44k]
  ------------------
  199|       |        /* Step 3. Squeeze one more block into a buffer */
  200|      0|        SHA3_squeeze(ctx->A, ctx->buf, bsz, bsz, next);
  201|      0|        memcpy(out, ctx->buf, outlen);
  202|       |        /* Step 4. Remember the leftover part of the squeezed block */
  203|      0|        ctx->bufsz = bsz - outlen;
  204|      0|    }
  205|       |
  206|  4.44k|    return 1;
  207|  4.44k|}

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

ossl_sa_new:
   59|      4|{
   60|      4|    OPENSSL_SA *res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|       |
   62|      4|    return res;
   63|      4|}
ossl_sa_free:
  111|      4|{
  112|      4|    if (sa != NULL) {
  ------------------
  |  Branch (112:9): [True: 4, False: 0]
  ------------------
  113|      4|        sa_doall(sa, &sa_free_node, NULL, NULL);
  114|      4|        OPENSSL_free(sa);
  ------------------
  |  |  115|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  115|      4|    }
  116|      4|}
ossl_sa_doall_arg:
  146|      4|{
  147|      4|    if (sa != NULL)
  ------------------
  |  Branch (147:9): [True: 4, False: 0]
  ------------------
  148|      4|        sa_doall(sa, NULL, leaf, arg);
  149|      4|}
ossl_sa_get:
  157|  1.95k|{
  158|  1.95k|    int level;
  159|  1.95k|    void **p, *r = NULL;
  160|       |
  161|  1.95k|    if (sa == NULL || sa->nelem == 0)
  ------------------
  |  Branch (161:9): [True: 0, False: 1.95k]
  |  Branch (161:23): [True: 2, False: 1.95k]
  ------------------
  162|      2|        return NULL;
  163|       |
  164|  1.95k|    if (n <= sa->top) {
  ------------------
  |  Branch (164:9): [True: 1.74k, False: 214]
  ------------------
  165|  1.74k|        p = sa->nodes;
  166|  6.77k|        for (level = sa->levels - 1; p != NULL && level > 0; level--)
  ------------------
  |  Branch (166:38): [True: 6.58k, False: 189]
  |  Branch (166:51): [True: 5.03k, False: 1.55k]
  ------------------
  167|  5.03k|            p = (void **)p[(n >> (OPENSSL_SA_BLOCK_BITS * level))
  ------------------
  |  |   34|  5.03k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
  168|  5.03k|                           & SA_BLOCK_MASK];
  ------------------
  |  |   46|  5.03k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  5.03k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  5.03k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  169|  1.74k|        r = p == NULL ? NULL : p[n & SA_BLOCK_MASK];
  ------------------
  |  |   46|  1.55k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  1.55k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  1.55k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (169:13): [True: 189, False: 1.55k]
  ------------------
  170|  1.74k|    }
  171|  1.95k|    return r;
  172|  1.95k|}
ossl_sa_set:
  180|    440|{
  181|    440|    int i, level = 1;
  182|    440|    ossl_uintmax_t n = posn;
  183|    440|    void **p;
  184|       |
  185|    440|    if (sa == NULL)
  ------------------
  |  Branch (185:9): [True: 0, False: 440]
  ------------------
  186|      0|        return 0;
  187|       |
  188|  1.73k|    for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++)
  ------------------
  |  |   47|  1.73k|#define SA_BLOCK_MAX_LEVELS     (((int)sizeof(ossl_uintmax_t) * 8 \
  |  |   48|  1.73k|                                  + OPENSSL_SA_BLOCK_BITS - 1) \
  |  |  ------------------
  |  |  |  |   34|  1.73k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  |  |   49|  1.73k|                                 / OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|  1.73k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (188:21): [True: 1.73k, False: 0]
  ------------------
  189|  1.73k|        if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0)
  ------------------
  |  |   34|  1.73k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
  |  Branch (189:13): [True: 440, False: 1.29k]
  ------------------
  190|    440|            break;
  191|       |
  192|    444|    for (;sa->levels < level; sa->levels++) {
  ------------------
  |  Branch (192:11): [True: 4, False: 440]
  ------------------
  193|      4|        p = alloc_node();
  194|      4|        if (p == NULL)
  ------------------
  |  Branch (194:13): [True: 0, False: 4]
  ------------------
  195|      0|            return 0;
  196|      4|        p[0] = sa->nodes;
  197|      4|        sa->nodes = p;
  198|      4|    }
  199|    440|    if (sa->top < posn)
  ------------------
  |  Branch (199:9): [True: 108, False: 332]
  ------------------
  200|    108|        sa->top = posn;
  201|       |
  202|    440|    p = sa->nodes;
  203|  1.76k|    for (level = sa->levels - 1; level > 0; level--) {
  ------------------
  |  Branch (203:34): [True: 1.32k, False: 440]
  ------------------
  204|  1.32k|        i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;
  ------------------
  |  |   34|  1.32k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
                      i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;
  ------------------
  |  |   46|  1.32k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  1.32k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  1.32k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|  1.32k|        if (p[i] == NULL && (p[i] = alloc_node()) == NULL)
  ------------------
  |  Branch (205:13): [True: 417, False: 903]
  |  Branch (205:29): [True: 0, False: 417]
  ------------------
  206|      0|            return 0;
  207|  1.32k|        p = p[i];
  208|  1.32k|    }
  209|    440|    p += posn & SA_BLOCK_MASK;
  ------------------
  |  |   46|    440|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|    440|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|    440|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|    440|    if (val == NULL && *p != NULL)
  ------------------
  |  Branch (210:9): [True: 220, False: 220]
  |  Branch (210:24): [True: 220, False: 0]
  ------------------
  211|    220|        sa->nelem--;
  212|    220|    else if (val != NULL && *p == NULL)
  ------------------
  |  Branch (212:14): [True: 220, False: 0]
  |  Branch (212:29): [True: 220, False: 0]
  ------------------
  213|    220|        sa->nelem++;
  214|    440|    *p = val;
  215|    440|    return 1;
  216|    440|}
sparse_array.c:sa_doall:
   67|      8|{
   68|      8|    int i[SA_BLOCK_MAX_LEVELS];
   69|      8|    void *nodes[SA_BLOCK_MAX_LEVELS];
   70|      8|    ossl_uintmax_t idx = 0;
   71|      8|    int l = 0;
   72|       |
   73|      8|    i[0] = 0;
   74|      8|    nodes[0] = sa->nodes;
   75|  14.4k|    while (l >= 0) {
  ------------------
  |  Branch (75:12): [True: 14.4k, False: 8]
  ------------------
   76|  14.4k|        const int n = i[l];
   77|  14.4k|        void ** const p = nodes[l];
   78|       |
   79|  14.4k|        if (n >= SA_BLOCK_MAX) {
  ------------------
  |  |   45|  14.4k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|  14.4k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (79:13): [True: 848, False: 13.5k]
  ------------------
   80|    848|            if (p != NULL && node != NULL)
  ------------------
  |  Branch (80:17): [True: 842, False: 6]
  |  Branch (80:30): [True: 421, False: 421]
  ------------------
   81|    421|                (*node)(p);
   82|    848|            l--;
   83|    848|            idx >>= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|    848|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   84|  13.5k|        } else {
   85|  13.5k|            i[l] = n + 1;
   86|  13.5k|            if (p != NULL && p[n] != NULL) {
  ------------------
  |  Branch (86:17): [True: 13.4k, False: 96]
  |  Branch (86:30): [True: 1.06k, False: 12.4k]
  ------------------
   87|  1.06k|                idx = (idx & ~SA_BLOCK_MASK) | n;
  ------------------
  |  |   46|  1.06k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  1.06k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  1.06k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   88|  1.06k|                if (l < sa->levels - 1) {
  ------------------
  |  Branch (88:21): [True: 840, False: 220]
  ------------------
   89|    840|                    i[++l] = 0;
   90|    840|                    nodes[l] = p[n];
   91|    840|                    idx <<= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|    840|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   92|    840|                } else if (leaf != NULL) {
  ------------------
  |  Branch (92:28): [True: 220, False: 0]
  ------------------
   93|    220|                    (*leaf)(idx, p[n], arg);
   94|    220|                }
   95|  1.06k|            }
   96|  13.5k|        }
   97|  14.4k|    }
   98|      8|}
sparse_array.c:sa_free_node:
  101|    421|{
  102|    421|    OPENSSL_free(p);
  ------------------
  |  |  115|    421|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    421|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    421|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  103|    421|}
sparse_array.c:alloc_node:
  175|    421|{
  176|    421|    return OPENSSL_zalloc(SA_BLOCK_MAX * sizeof(void *));
  ------------------
  |  |  104|    421|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    421|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    421|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|    421|}

OPENSSL_sk_dup:
   49|    399|{
   50|    399|    OPENSSL_STACK *ret;
   51|       |
   52|    399|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  102|    399|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    399|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    399|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (52:9): [True: 0, False: 399]
  ------------------
   53|      0|        goto err;
   54|       |
   55|    399|    if (sk == NULL) {
  ------------------
  |  Branch (55:9): [True: 1, False: 398]
  ------------------
   56|      1|        ret->num = 0;
   57|      1|        ret->sorted = 0;
   58|      1|        ret->comp = NULL;
   59|    398|    } else {
   60|       |        /* direct structure assignment */
   61|    398|        *ret = *sk;
   62|    398|    }
   63|       |
   64|    399|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (64:9): [True: 1, False: 398]
  |  Branch (64:23): [True: 0, False: 398]
  ------------------
   65|       |        /* postpone |ret->data| allocation */
   66|      1|        ret->data = NULL;
   67|      1|        ret->num_alloc = 0;
   68|      1|        return ret;
   69|      1|    }
   70|       |
   71|       |    /* duplicate |sk->data| content */
   72|    398|    ret->data = OPENSSL_malloc(sizeof(*ret->data) * sk->num_alloc);
  ------------------
  |  |  102|    398|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    398|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    398|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|    398|    if (ret->data == NULL)
  ------------------
  |  Branch (73:9): [True: 0, False: 398]
  ------------------
   74|      0|        goto err;
   75|    398|    memcpy(ret->data, sk->data, sizeof(void *) * sk->num);
   76|    398|    return ret;
   77|       |
   78|      0| err:
   79|      0|    OPENSSL_sk_free(ret);
   80|      0|    return NULL;
   81|    398|}
OPENSSL_sk_deep_copy:
   86|      1|{
   87|      1|    OPENSSL_STACK *ret;
   88|      1|    int i;
   89|       |
   90|      1|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  102|      1|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (90:9): [True: 0, False: 1]
  ------------------
   91|      0|        goto err;
   92|       |
   93|      1|    if (sk == NULL) {
  ------------------
  |  Branch (93:9): [True: 1, False: 0]
  ------------------
   94|      1|        ret->num = 0;
   95|      1|        ret->sorted = 0;
   96|      1|        ret->comp = NULL;
   97|      1|    } else {
   98|       |        /* direct structure assignment */
   99|      0|        *ret = *sk;
  100|      0|    }
  101|       |
  102|      1|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (102:9): [True: 1, False: 0]
  |  Branch (102:23): [True: 0, False: 0]
  ------------------
  103|       |        /* postpone |ret| data allocation */
  104|      1|        ret->data = NULL;
  105|      1|        ret->num_alloc = 0;
  106|      1|        return ret;
  107|      1|    }
  108|       |
  109|      0|    ret->num_alloc = sk->num > min_nodes ? sk->num : min_nodes;
  ------------------
  |  Branch (109:22): [True: 0, False: 0]
  ------------------
  110|      0|    ret->data = OPENSSL_zalloc(sizeof(*ret->data) * ret->num_alloc);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  111|      0|    if (ret->data == NULL)
  ------------------
  |  Branch (111:9): [True: 0, False: 0]
  ------------------
  112|      0|        goto err;
  113|       |
  114|      0|    for (i = 0; i < ret->num; ++i) {
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|      0|        if (sk->data[i] == NULL)
  ------------------
  |  Branch (115:13): [True: 0, False: 0]
  ------------------
  116|      0|            continue;
  117|      0|        if ((ret->data[i] = copy_func(sk->data[i])) == NULL) {
  ------------------
  |  Branch (117:13): [True: 0, False: 0]
  ------------------
  118|      0|            while (--i >= 0)
  ------------------
  |  Branch (118:20): [True: 0, False: 0]
  ------------------
  119|      0|                if (ret->data[i] != NULL)
  ------------------
  |  Branch (119:21): [True: 0, False: 0]
  ------------------
  120|      0|                    free_func((void *)ret->data[i]);
  121|      0|            goto err;
  122|      0|        }
  123|      0|    }
  124|      0|    return ret;
  125|       |
  126|      0| err:
  127|      0|    OPENSSL_sk_free(ret);
  128|      0|    return NULL;
  129|      0|}
OPENSSL_sk_new_null:
  132|    449|{
  133|    449|    return OPENSSL_sk_new_reserve(NULL, 0);
  134|    449|}
OPENSSL_sk_new:
  137|     17|{
  138|     17|    return OPENSSL_sk_new_reserve(c, 0);
  139|     17|}
OPENSSL_sk_new_reserve:
  228|    466|{
  229|    466|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |  104|    466|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    466|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    466|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|       |
  231|    466|    if (st == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 466]
  ------------------
  232|      0|        return NULL;
  233|       |
  234|    466|    st->comp = c;
  235|       |
  236|    466|    if (n <= 0)
  ------------------
  |  Branch (236:9): [True: 466, False: 0]
  ------------------
  237|    466|        return st;
  238|       |
  239|      0|    if (!sk_reserve(st, n, 1)) {
  ------------------
  |  Branch (239:9): [True: 0, False: 0]
  ------------------
  240|      0|        OPENSSL_sk_free(st);
  241|      0|        return NULL;
  242|      0|    }
  243|       |
  244|      0|    return st;
  245|      0|}
OPENSSL_sk_set_thunks:
  260|    522|{
  261|    522|    if (st != NULL)
  ------------------
  |  Branch (261:9): [True: 256, False: 266]
  ------------------
  262|    256|        st->free_thunk = f_thunk;
  263|       |
  264|    522|    return st;
  265|    522|}
OPENSSL_sk_insert:
  268|    929|{
  269|    929|    if (st == NULL) {
  ------------------
  |  Branch (269:9): [True: 0, False: 929]
  ------------------
  270|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  271|      0|        return 0;
  272|      0|    }
  273|    929|    if (st->num == max_nodes) {
  ------------------
  |  Branch (273:9): [True: 0, False: 929]
  ------------------
  274|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  275|      0|        return 0;
  276|      0|    }
  277|       |
  278|    929|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (278:9): [True: 0, False: 929]
  ------------------
  279|      0|        return 0;
  280|       |
  281|    929|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (281:9): [True: 929, False: 0]
  |  Branch (281:29): [True: 0, False: 0]
  ------------------
  282|    929|        st->data[st->num] = data;
  283|    929|    } else {
  284|      0|        memmove(&st->data[loc + 1], &st->data[loc],
  285|      0|                sizeof(st->data[0]) * (st->num - loc));
  286|      0|        st->data[loc] = data;
  287|      0|    }
  288|    929|    st->num++;
  289|    929|    st->sorted = 0;
  290|    929|    return st->num;
  291|    929|}
OPENSSL_sk_delete:
  319|      1|{
  320|      1|    if (st == NULL || loc < 0 || loc >= st->num)
  ------------------
  |  Branch (320:9): [True: 0, False: 1]
  |  Branch (320:23): [True: 0, False: 1]
  |  Branch (320:34): [True: 0, False: 1]
  ------------------
  321|      0|        return NULL;
  322|       |
  323|      1|    return internal_delete(st, loc);
  324|      1|}
OPENSSL_sk_find:
  392|      3|{
  393|      3|    return internal_find(st, data, OSSL_BSEARCH_FIRST_VALUE_ON_MATCH, NULL);
  ------------------
  |  |  153|      3|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  394|      3|}
OPENSSL_sk_push:
  407|    929|{
  408|    929|    if (st == NULL)
  ------------------
  |  Branch (408:9): [True: 0, False: 929]
  ------------------
  409|      0|        return 0;
  410|    929|    return OPENSSL_sk_insert(st, data, st->num);
  411|    929|}
OPENSSL_sk_pop:
  426|      9|{
  427|      9|    if (st == NULL || st->num == 0)
  ------------------
  |  Branch (427:9): [True: 0, False: 9]
  |  Branch (427:23): [True: 0, False: 9]
  ------------------
  428|      0|        return NULL;
  429|      9|    return internal_delete(st, st->num - 1);
  430|      9|}
OPENSSL_sk_pop_free:
  441|    971|{
  442|    971|    int i;
  443|       |
  444|    971|    if (st == NULL)
  ------------------
  |  Branch (444:9): [True: 510, False: 461]
  ------------------
  445|    510|        return;
  446|       |
  447|  1.37k|    for (i = 0; i < st->num; i++) {
  ------------------
  |  Branch (447:17): [True: 910, False: 461]
  ------------------
  448|    910|        if (st->data[i] != NULL) {
  ------------------
  |  Branch (448:13): [True: 910, False: 0]
  ------------------
  449|    910|            if (st->free_thunk != NULL)
  ------------------
  |  Branch (449:17): [True: 442, False: 468]
  ------------------
  450|    442|                st->free_thunk(func, (void *)st->data[i]);
  451|    468|            else
  452|    468|                func((void *)st->data[i]);
  453|    910|        }
  454|    910|    }
  455|    461|    OPENSSL_sk_free(st);
  456|    461|}
OPENSSL_sk_free:
  459|  1.11k|{
  460|  1.11k|    if (st == NULL)
  ------------------
  |  Branch (460:9): [True: 249, False: 866]
  ------------------
  461|    249|        return;
  462|    866|    OPENSSL_free(st->data);
  ------------------
  |  |  115|    866|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    866|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    866|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  463|    866|    OPENSSL_free(st);
  ------------------
  |  |  115|    866|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    866|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    866|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  464|    866|}
OPENSSL_sk_num:
  467|  3.41k|{
  468|  3.41k|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (468:12): [True: 489, False: 2.92k]
  ------------------
  469|  3.41k|}
OPENSSL_sk_value:
  472|  1.82k|{
  473|  1.82k|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (473:9): [True: 0, False: 1.82k]
  |  Branch (473:23): [True: 0, False: 1.82k]
  |  Branch (473:32): [True: 0, False: 1.82k]
  ------------------
  474|      0|        return NULL;
  475|  1.82k|    return (void *)st->data[i];
  476|  1.82k|}
OPENSSL_sk_sort:
  495|     18|{
  496|     18|    if (st != NULL && !st->sorted && st->comp != NULL) {
  ------------------
  |  Branch (496:9): [True: 18, False: 0]
  |  Branch (496:23): [True: 16, False: 2]
  |  Branch (496:38): [True: 16, False: 0]
  ------------------
  497|     16|        if (st->num > 1)
  ------------------
  |  Branch (497:13): [True: 0, False: 16]
  ------------------
  498|      0|            qsort(st->data, st->num, sizeof(void *), st->comp);
  499|     16|        st->sorted = 1; /* empty or single-element stack is considered sorted */
  500|     16|    }
  501|     18|}
stack.c:sk_reserve:
  179|    929|{
  180|    929|    const void **tmpdata;
  181|    929|    int num_alloc;
  182|       |
  183|       |    /* Check to see the reservation isn't exceeding the hard limit */
  184|    929|    if (n > max_nodes - st->num) {
  ------------------
  |  Branch (184:9): [True: 0, False: 929]
  ------------------
  185|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  186|      0|        return 0;
  187|      0|    }
  188|       |
  189|       |    /* Figure out the new size */
  190|    929|    num_alloc = st->num + n;
  191|    929|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (191:9): [True: 677, False: 252]
  ------------------
  192|    677|        num_alloc = min_nodes;
  193|       |
  194|       |    /* If |st->data| allocation was postponed */
  195|    929|    if (st->data == NULL) {
  ------------------
  |  Branch (195:9): [True: 449, False: 480]
  ------------------
  196|       |        /*
  197|       |         * At this point, |st->num_alloc| and |st->num| are 0;
  198|       |         * so |num_alloc| value is |n| or |min_nodes| if greater than |n|.
  199|       |         */
  200|    449|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL)
  ------------------
  |  |  104|    449|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    449|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    449|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (200:13): [True: 0, False: 449]
  ------------------
  201|      0|            return 0;
  202|    449|        st->num_alloc = num_alloc;
  203|    449|        return 1;
  204|    449|    }
  205|       |
  206|    480|    if (!exact) {
  ------------------
  |  Branch (206:9): [True: 480, False: 0]
  ------------------
  207|    480|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (207:13): [True: 466, False: 14]
  ------------------
  208|    466|            return 1;
  209|     14|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  210|     14|        if (num_alloc == 0) {
  ------------------
  |  Branch (210:13): [True: 0, False: 14]
  ------------------
  211|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  212|      0|            return 0;
  213|      0|        }
  214|     14|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  ------------------
  215|      0|        return 1;
  216|      0|    }
  217|       |
  218|     14|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  109|     14|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     14|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     14|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|     14|    if (tmpdata == NULL)
  ------------------
  |  Branch (219:9): [True: 0, False: 14]
  ------------------
  220|      0|        return 0;
  221|       |
  222|     14|    st->data = tmpdata;
  223|     14|    st->num_alloc = num_alloc;
  224|     14|    return 1;
  225|     14|}
stack.c:compute_growth:
  161|     14|{
  162|     14|    int err = 0;
  163|       |
  164|     28|    while (current < target) {
  ------------------
  |  Branch (164:12): [True: 14, False: 14]
  ------------------
  165|     14|        if (current >= max_nodes)
  ------------------
  |  Branch (165:13): [True: 0, False: 14]
  ------------------
  166|      0|            return 0;
  167|       |
  168|     14|        current = safe_muldiv_int(current, 8, 5, &err);
  169|     14|        if (err != 0)
  ------------------
  |  Branch (169:13): [True: 0, False: 14]
  ------------------
  170|      0|            return 0;
  171|     14|        if (current >= max_nodes)
  ------------------
  |  Branch (171:13): [True: 0, False: 14]
  ------------------
  172|      0|            current = max_nodes;
  173|     14|    }
  174|     14|    return current;
  175|     14|}
stack.c:internal_delete:
  294|     10|{
  295|     10|    const void *ret = st->data[loc];
  296|       |
  297|     10|    if (loc != st->num - 1)
  ------------------
  |  Branch (297:9): [True: 0, False: 10]
  ------------------
  298|      0|        memmove(&st->data[loc], &st->data[loc + 1],
  299|      0|                sizeof(st->data[0]) * (st->num - loc - 1));
  300|     10|    st->num--;
  301|       |
  302|     10|    return (void *)ret;
  303|     10|}
stack.c:internal_find:
  328|      3|{
  329|      3|    const void *r;
  330|      3|    int i, count = 0;
  331|      3|    int *pnum = pnum_matched;
  332|       |
  333|      3|    if (st == NULL || st->num == 0)
  ------------------
  |  Branch (333:9): [True: 0, False: 3]
  |  Branch (333:23): [True: 0, False: 3]
  ------------------
  334|      0|        return -1;
  335|       |
  336|      3|    if (pnum == NULL)
  ------------------
  |  Branch (336:9): [True: 3, False: 0]
  ------------------
  337|      3|        pnum = &count;
  338|       |
  339|      3|    if (st->comp == NULL) {
  ------------------
  |  Branch (339:9): [True: 0, False: 3]
  ------------------
  340|      0|        for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (340:21): [True: 0, False: 0]
  ------------------
  341|      0|            if (st->data[i] == data) {
  ------------------
  |  Branch (341:17): [True: 0, False: 0]
  ------------------
  342|      0|                *pnum = 1;
  343|      0|                return i;
  344|      0|            }
  345|      0|        *pnum = 0;
  346|      0|        return -1;
  347|      0|    }
  348|       |
  349|      3|    if (data == NULL)
  ------------------
  |  Branch (349:9): [True: 0, False: 3]
  ------------------
  350|      0|        return -1;
  351|       |
  352|      3|    if (!st->sorted) {
  ------------------
  |  Branch (352:9): [True: 0, False: 3]
  ------------------
  353|      0|        int res = -1;
  354|       |
  355|      0|        for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (355:21): [True: 0, False: 0]
  ------------------
  356|      0|            if (st->comp(&data, st->data + i) == 0) {
  ------------------
  |  Branch (356:17): [True: 0, False: 0]
  ------------------
  357|      0|                if (res == -1)
  ------------------
  |  Branch (357:21): [True: 0, False: 0]
  ------------------
  358|      0|                    res = i;
  359|      0|                ++*pnum;
  360|       |                /* Check if only one result is wanted and exit if so */
  361|      0|                if (pnum_matched == NULL)
  ------------------
  |  Branch (361:21): [True: 0, False: 0]
  ------------------
  362|      0|                    return i;
  363|      0|            }
  364|      0|        if (res == -1)
  ------------------
  |  Branch (364:13): [True: 0, False: 0]
  ------------------
  365|      0|            *pnum = 0;
  366|      0|        return res;
  367|      0|    }
  368|       |
  369|      3|    if (pnum_matched != NULL)
  ------------------
  |  Branch (369:9): [True: 0, False: 3]
  ------------------
  370|      0|        ret_val_options |= OSSL_BSEARCH_FIRST_VALUE_ON_MATCH;
  ------------------
  |  |  153|      0|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  371|      3|    r = ossl_bsearch(&data, st->data, st->num, sizeof(void *), st->comp,
  372|      3|                     ret_val_options);
  373|       |
  374|      3|    if (pnum_matched != NULL) {
  ------------------
  |  Branch (374:9): [True: 0, False: 3]
  ------------------
  375|      0|        *pnum = 0;
  376|      0|        if (r != NULL) {
  ------------------
  |  Branch (376:13): [True: 0, False: 0]
  ------------------
  377|      0|            const void **p = (const void **)r;
  378|       |
  379|      0|            while (p < st->data + st->num) {
  ------------------
  |  Branch (379:20): [True: 0, False: 0]
  ------------------
  380|      0|                if (st->comp(&data, p) != 0)
  ------------------
  |  Branch (380:21): [True: 0, False: 0]
  ------------------
  381|      0|                    break;
  382|      0|                ++*pnum;
  383|      0|                ++p;
  384|      0|            }
  385|      0|        }
  386|      0|    }
  387|       |
  388|      3|    return r == NULL ? -1 : (int)((const void **)r - st->data);
  ------------------
  |  Branch (388:12): [True: 0, False: 3]
  ------------------
  389|      3|}

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

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

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

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

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

ossl_rcu_write_lock:
  441|      3|{
  442|      3|    pthread_mutex_lock(&lock->write_lock);
  443|      3|    TSAN_FAKE_UNLOCK(&lock->write_lock);
  444|      3|}
ossl_rcu_write_unlock:
  447|      3|{
  448|      3|    TSAN_FAKE_LOCK(&lock->write_lock);
  449|      3|    pthread_mutex_unlock(&lock->write_lock);
  450|      3|}
ossl_synchronize_rcu:
  453|      5|{
  454|      5|    struct rcu_qp *qp;
  455|      5|    uint64_t count;
  456|      5|    uint32_t curr_id;
  457|      5|    struct rcu_cb_item *cb_items, *tmpcb;
  458|       |
  459|      5|    pthread_mutex_lock(&lock->write_lock);
  460|      5|    cb_items = lock->cb_items;
  461|      5|    lock->cb_items = NULL;
  462|      5|    pthread_mutex_unlock(&lock->write_lock);
  463|       |
  464|      5|    qp = update_qp(lock, &curr_id);
  465|       |
  466|       |    /* retire in order */
  467|      5|    pthread_mutex_lock(&lock->prior_lock);
  468|      5|    while (lock->next_to_retire != curr_id)
  ------------------
  |  Branch (468:12): [True: 0, False: 5]
  ------------------
  469|      0|        pthread_cond_wait(&lock->prior_signal, &lock->prior_lock);
  470|       |
  471|       |    /*
  472|       |     * wait for the reader count to reach zero
  473|       |     * Note the use of __ATOMIC_ACQUIRE here to ensure that any
  474|       |     * prior __ATOMIC_RELEASE write operation in ossl_rcu_read_unlock
  475|       |     * is visible prior to our read
  476|       |     * however this is likely just necessary to silence a tsan warning
  477|       |     * because the read side should not do any write operation
  478|       |     * outside the atomic itself
  479|       |     */
  480|      5|    do {
  481|      5|        count = ATOMIC_LOAD_N(uint64_t, &qp->users, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|      5|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  482|      5|    } while (count != (uint64_t)0);
  ------------------
  |  Branch (482:14): [True: 0, False: 5]
  ------------------
  483|       |
  484|      5|    lock->next_to_retire++;
  485|      5|    pthread_cond_broadcast(&lock->prior_signal);
  486|      5|    pthread_mutex_unlock(&lock->prior_lock);
  487|       |
  488|      5|    retire_qp(lock, qp);
  489|       |
  490|       |    /* handle any callbacks that we have */
  491|      6|    while (cb_items != NULL) {
  ------------------
  |  Branch (491:12): [True: 1, False: 5]
  ------------------
  492|      1|        tmpcb = cb_items;
  493|      1|        cb_items = cb_items->next;
  494|      1|        tmpcb->fn(tmpcb->data);
  495|      1|        OPENSSL_free(tmpcb);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  496|      1|    }
  497|      5|}
ossl_rcu_call:
  504|      1|{
  505|      1|    struct rcu_cb_item *new =
  506|      1|        OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  507|       |
  508|      1|    if (new == NULL)
  ------------------
  |  Branch (508:9): [True: 0, False: 1]
  ------------------
  509|      0|        return 0;
  510|       |
  511|      1|    new->data = data;
  512|      1|    new->fn = cb;
  513|       |
  514|      1|    new->next = lock->cb_items;
  515|      1|    lock->cb_items = new;
  516|       |
  517|      1|    return 1;
  518|      1|}
ossl_rcu_uptr_deref:
  521|  7.39k|{
  522|  7.39k|    return ATOMIC_LOAD_N(pvoid, p, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|  7.39k|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  523|  7.39k|}
ossl_rcu_assign_uptr:
  526|    471|{
  527|    471|    ATOMIC_STORE(pvoid, p, v, __ATOMIC_RELEASE);
  ------------------
  |  |   98|    471|#  define ATOMIC_STORE(t, p, v, o) __atomic_store(p, v, o)
  ------------------
  528|    471|}
ossl_rcu_lock_new:
  531|      2|{
  532|      2|    struct rcu_lock_st *new;
  533|       |
  534|       |    /*
  535|       |     * We need a minimum of 2 qp's
  536|       |     */
  537|      2|    if (num_writers < 2)
  ------------------
  |  Branch (537:9): [True: 2, False: 0]
  ------------------
  538|      2|        num_writers = 2;
  539|       |
  540|      2|    ctx = ossl_lib_ctx_get_concrete(ctx);
  541|      2|    if (ctx == NULL)
  ------------------
  |  Branch (541:9): [True: 0, False: 2]
  ------------------
  542|      0|        return 0;
  543|       |
  544|      2|    new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  545|      2|    if (new == NULL)
  ------------------
  |  Branch (545:9): [True: 0, False: 2]
  ------------------
  546|      0|        return NULL;
  547|       |
  548|      2|    new->ctx = ctx;
  549|      2|    pthread_mutex_init(&new->write_lock, NULL);
  550|      2|    pthread_mutex_init(&new->prior_lock, NULL);
  551|      2|    pthread_mutex_init(&new->alloc_lock, NULL);
  552|      2|    pthread_cond_init(&new->prior_signal, NULL);
  553|      2|    pthread_cond_init(&new->alloc_signal, NULL);
  554|       |
  555|      2|    new->qp_group = allocate_new_qp_group(new, num_writers);
  556|      2|    if (new->qp_group == NULL) {
  ------------------
  |  Branch (556:9): [True: 0, False: 2]
  ------------------
  557|      0|        OPENSSL_free(new);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      0|        new = NULL;
  559|      0|    }
  560|       |
  561|      2|    return new;
  562|      2|}
ossl_rcu_lock_free:
  565|      2|{
  566|      2|    struct rcu_lock_st *rlock = (struct rcu_lock_st *)lock;
  567|       |
  568|      2|    if (lock == NULL)
  ------------------
  |  Branch (568:9): [True: 0, False: 2]
  ------------------
  569|      0|        return;
  570|       |
  571|       |    /* make sure we're synchronized */
  572|      2|    ossl_synchronize_rcu(rlock);
  573|       |
  574|      2|    OPENSSL_free(rlock->qp_group);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  575|       |    /* There should only be a single qp left now */
  576|      2|    OPENSSL_free(rlock);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  577|      2|}
CRYPTO_THREAD_lock_new:
  580|    276|{
  581|    276|# ifdef USE_RWLOCK
  582|    276|    CRYPTO_RWLOCK *lock;
  583|       |
  584|    276|    if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL)
  ------------------
  |  |  104|    276|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    276|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    276|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (584:9): [True: 0, False: 276]
  ------------------
  585|       |        /* Don't set error, to avoid recursion blowup. */
  586|      0|        return NULL;
  587|       |
  588|    276|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (588:9): [True: 0, False: 276]
  ------------------
  589|      0|        OPENSSL_free(lock);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  590|      0|        return NULL;
  591|      0|    }
  592|       |# else
  593|       |    pthread_mutexattr_t attr;
  594|       |    CRYPTO_RWLOCK *lock;
  595|       |
  596|       |    if ((lock = OPENSSL_zalloc(sizeof(pthread_mutex_t))) == NULL)
  597|       |        /* Don't set error, to avoid recursion blowup. */
  598|       |        return NULL;
  599|       |
  600|       |    /*
  601|       |     * We don't use recursive mutexes, but try to catch errors if we do.
  602|       |     */
  603|       |    pthread_mutexattr_init(&attr);
  604|       |#  if !defined (__TANDEM) && !defined (_SPT_MODEL_)
  605|       |#   if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
  606|       |    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
  607|       |#   endif
  608|       |#  else
  609|       |    /* The SPT Thread Library does not define MUTEX attributes. */
  610|       |#  endif
  611|       |
  612|       |    if (pthread_mutex_init(lock, &attr) != 0) {
  613|       |        pthread_mutexattr_destroy(&attr);
  614|       |        OPENSSL_free(lock);
  615|       |        return NULL;
  616|       |    }
  617|       |
  618|       |    pthread_mutexattr_destroy(&attr);
  619|       |# endif
  620|       |
  621|    276|    return lock;
  622|    276|}
CRYPTO_THREAD_read_lock:
  625|  4.93k|{
  626|  4.93k|# ifdef USE_RWLOCK
  627|  4.93k|    if (!ossl_assert(pthread_rwlock_rdlock(lock) == 0))
  ------------------
  |  |   52|  4.93k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  4.93k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (627:9): [True: 0, False: 4.93k]
  ------------------
  628|      0|        return 0;
  629|       |# else
  630|       |    if (pthread_mutex_lock(lock) != 0) {
  631|       |        assert(errno != EDEADLK && errno != EBUSY);
  632|       |        return 0;
  633|       |    }
  634|       |# endif
  635|       |
  636|  4.93k|    return 1;
  637|  4.93k|}
CRYPTO_THREAD_write_lock:
  640|  1.96k|{
  641|  1.96k|# ifdef USE_RWLOCK
  642|  1.96k|    if (!ossl_assert(pthread_rwlock_wrlock(lock) == 0))
  ------------------
  |  |   52|  1.96k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  1.96k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (642:9): [True: 0, False: 1.96k]
  ------------------
  643|      0|        return 0;
  644|       |# else
  645|       |    if (pthread_mutex_lock(lock) != 0) {
  646|       |        assert(errno != EDEADLK && errno != EBUSY);
  647|       |        return 0;
  648|       |    }
  649|       |# endif
  650|       |
  651|  1.96k|    return 1;
  652|  1.96k|}
CRYPTO_THREAD_unlock:
  655|  6.89k|{
  656|  6.89k|# ifdef USE_RWLOCK
  657|  6.89k|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (657:9): [True: 0, False: 6.89k]
  ------------------
  658|      0|        return 0;
  659|       |# else
  660|       |    if (pthread_mutex_unlock(lock) != 0) {
  661|       |        assert(errno != EPERM);
  662|       |        return 0;
  663|       |    }
  664|       |# endif
  665|       |
  666|  6.89k|    return 1;
  667|  6.89k|}
CRYPTO_THREAD_lock_free:
  670|    283|{
  671|    283|    if (lock == NULL)
  ------------------
  |  Branch (671:9): [True: 7, False: 276]
  ------------------
  672|      7|        return;
  673|       |
  674|    276|# ifdef USE_RWLOCK
  675|    276|    pthread_rwlock_destroy(lock);
  676|       |# else
  677|       |    pthread_mutex_destroy(lock);
  678|       |# endif
  679|    276|    OPENSSL_free(lock);
  ------------------
  |  |  115|    276|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    276|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    276|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  680|       |
  681|    276|    return;
  682|    283|}
CRYPTO_THREAD_run_once:
  685|  12.9k|{
  686|  12.9k|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (686:9): [True: 0, False: 12.9k]
  ------------------
  687|      0|        return 0;
  688|       |
  689|  12.9k|    return 1;
  690|  12.9k|}
CRYPTO_THREAD_init_local:
  693|      7|{
  694|      7|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (694:9): [True: 0, False: 7]
  ------------------
  695|      0|        return 0;
  696|       |
  697|      7|    return 1;
  698|      7|}
CRYPTO_THREAD_get_local:
  701|  6.21k|{
  702|  6.21k|    return pthread_getspecific(*key);
  703|  6.21k|}
CRYPTO_THREAD_set_local:
  706|     12|{
  707|     12|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (707:9): [True: 0, False: 12]
  ------------------
  708|      0|        return 0;
  709|       |
  710|     12|    return 1;
  711|     12|}
CRYPTO_THREAD_cleanup_local:
  714|      7|{
  715|      7|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (715:9): [True: 0, False: 7]
  ------------------
  716|      0|        return 0;
  717|       |
  718|      7|    return 1;
  719|      7|}
CRYPTO_atomic_add:
  732|     72|{
  733|     72|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  734|     72|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (734:9): [Folded - Ignored]
  ------------------
  735|     72|        *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
  736|     72|        return 1;
  737|     72|    }
  738|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  739|       |    /* This will work for all future Solaris versions. */
  740|       |    if (ret != NULL) {
  741|       |        *ret = atomic_add_int_nv((volatile unsigned int *)val, amount);
  742|       |        return 1;
  743|       |    }
  744|       |# endif
  745|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (745:9): [True: 0, False: 0]
  |  Branch (745:25): [True: 0, False: 0]
  ------------------
  746|      0|        return 0;
  747|       |
  748|      0|    *val += amount;
  749|      0|    *ret  = *val;
  750|       |
  751|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (751:9): [True: 0, False: 0]
  ------------------
  752|      0|        return 0;
  753|       |
  754|      0|    return 1;
  755|      0|}
CRYPTO_atomic_or:
  811|      3|{
  812|      3|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  813|      3|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (813:9): [Folded - Ignored]
  ------------------
  814|      3|        *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
  815|      3|        return 1;
  816|      3|    }
  817|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  818|       |    /* This will work for all future Solaris versions. */
  819|       |    if (ret != NULL) {
  820|       |        *ret = atomic_or_64_nv(val, op);
  821|       |        return 1;
  822|       |    }
  823|       |# endif
  824|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (824:9): [True: 0, False: 0]
  |  Branch (824:25): [True: 0, False: 0]
  ------------------
  825|      0|        return 0;
  826|      0|    *val |= op;
  827|      0|    *ret  = *val;
  828|       |
  829|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (829:9): [True: 0, False: 0]
  ------------------
  830|      0|        return 0;
  831|       |
  832|      0|    return 1;
  833|      0|}
CRYPTO_atomic_load:
  836|  12.1k|{
  837|  12.1k|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  838|  12.1k|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (838:9): [Folded - Ignored]
  ------------------
  839|  12.1k|        __atomic_load(val, ret, __ATOMIC_ACQUIRE);
  840|  12.1k|        return 1;
  841|  12.1k|    }
  842|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  843|       |    /* This will work for all future Solaris versions. */
  844|       |    if (ret != NULL) {
  845|       |        *ret = atomic_or_64_nv(val, 0);
  846|       |        return 1;
  847|       |    }
  848|       |# endif
  849|      0|    if (lock == NULL || !CRYPTO_THREAD_read_lock(lock))
  ------------------
  |  Branch (849:9): [True: 0, False: 0]
  |  Branch (849:25): [True: 0, False: 0]
  ------------------
  850|      0|        return 0;
  851|      0|    *ret  = *val;
  852|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (852:9): [True: 0, False: 0]
  ------------------
  853|      0|        return 0;
  854|       |
  855|      0|    return 1;
  856|      0|}
CRYPTO_atomic_store:
  859|    468|{
  860|    468|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  861|    468|    if (__atomic_is_lock_free(sizeof(*dst), dst)) {
  ------------------
  |  Branch (861:9): [Folded - Ignored]
  ------------------
  862|    468|        __atomic_store(dst, &val, __ATOMIC_RELEASE);
  863|    468|        return 1;
  864|    468|    }
  865|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  866|       |    /* This will work for all future Solaris versions. */
  867|       |    if (dst != NULL) {
  868|       |        atomic_swap_64(dst, val);
  869|       |        return 1;
  870|       |    }
  871|       |# endif
  872|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (872:9): [True: 0, False: 0]
  |  Branch (872:25): [True: 0, False: 0]
  ------------------
  873|      0|        return 0;
  874|      0|    *dst  = val;
  875|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (875:9): [True: 0, False: 0]
  ------------------
  876|      0|        return 0;
  877|       |
  878|      0|    return 1;
  879|      0|}
openssl_get_fork_id:
  912|    344|{
  913|    344|    return getpid();
  914|    344|}
threads_pthread.c:update_qp:
  380|      5|{
  381|      5|    uint32_t current_idx;
  382|       |
  383|      5|    pthread_mutex_lock(&lock->alloc_lock);
  384|       |
  385|       |    /*
  386|       |     * we need at least one qp to be available with one
  387|       |     * left over, so that readers can start working on
  388|       |     * one that isn't yet being waited on
  389|       |     */
  390|      5|    while (lock->group_count - lock->writers_alloced < 2)
  ------------------
  |  Branch (390:12): [True: 0, False: 5]
  ------------------
  391|       |        /* we have to wait for one to be free */
  392|      0|        pthread_cond_wait(&lock->alloc_signal, &lock->alloc_lock);
  393|       |
  394|      5|    current_idx = lock->current_alloc_idx;
  395|       |
  396|       |    /* Allocate the qp */
  397|      5|    lock->writers_alloced++;
  398|       |
  399|       |    /* increment the allocation index */
  400|      5|    lock->current_alloc_idx =
  401|      5|        (lock->current_alloc_idx + 1) % lock->group_count;
  402|       |
  403|      5|    *curr_id = lock->id_ctr;
  404|      5|    lock->id_ctr++;
  405|       |
  406|      5|    ATOMIC_STORE_N(uint32_t, &lock->reader_idx, lock->current_alloc_idx,
  ------------------
  |  |   97|      5|#  define ATOMIC_STORE_N(t, p, v, o) __atomic_store_n(p, v, o)
  ------------------
  407|      5|                   __ATOMIC_RELAXED);
  408|       |
  409|       |    /*
  410|       |     * this should make sure that the new value of reader_idx is visible in
  411|       |     * get_hold_current_qp, directly after incrementing the users count
  412|       |     */
  413|      5|    ATOMIC_ADD_FETCH(&lock->qp_group[current_idx].users, (uint64_t)0,
  ------------------
  |  |   99|      5|#  define ATOMIC_ADD_FETCH(p, v, o) __atomic_add_fetch(p, v, o)
  ------------------
  414|      5|                     __ATOMIC_RELEASE);
  415|       |
  416|       |    /* wake up any waiters */
  417|      5|    pthread_cond_signal(&lock->alloc_signal);
  418|      5|    pthread_mutex_unlock(&lock->alloc_lock);
  419|      5|    return &lock->qp_group[current_idx];
  420|      5|}
threads_pthread.c:retire_qp:
  423|      5|{
  424|      5|    pthread_mutex_lock(&lock->alloc_lock);
  425|      5|    lock->writers_alloced--;
  426|      5|    pthread_cond_signal(&lock->alloc_signal);
  427|      5|    pthread_mutex_unlock(&lock->alloc_lock);
  428|      5|}
threads_pthread.c:allocate_new_qp_group:
  432|      2|{
  433|      2|    struct rcu_qp *new =
  434|      2|        OPENSSL_zalloc(sizeof(*new) * count);
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  435|       |
  436|      2|    lock->group_count = count;
  437|      2|    return new;
  438|      2|}

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

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

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

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

X509_get_default_cert_area:
   79|      1|{
   80|       |#if defined (_WIN32)
   81|       |    RUN_ONCE(&openssldir_setup_init, do_openssldir_setup);
   82|       |    return x509_cert_areaptr;
   83|       |#else
   84|      1|    return X509_CERT_AREA;
  ------------------
  |  |   84|      1|#  define X509_CERT_AREA          OPENSSLDIR
  ------------------
   85|      1|#endif
   86|      1|}

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

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

FuzzerInitialize:
  612|      2|{
  613|      2|    return 0;
  614|      2|}
FuzzerTestOneInput:
  633|    172|{
  634|    172|    uint8_t operation;
  635|    172|    uint8_t *buffer_cursor;
  636|    172|    void *in1 = NULL, *in2 = NULL;
  637|    172|    void *out1 = NULL, *out2 = NULL;
  638|       |
  639|    172|    if (len < 32)
  ------------------
  |  Branch (639:9): [True: 8, False: 164]
  ------------------
  640|      8|        return -1;
  641|       |    /*
  642|       |     * Get the first byte of the buffer to tell us what operation
  643|       |     * to preform
  644|       |     */
  645|    164|    buffer_cursor = consume_uint8t(buf, &len, &operation);
  646|    164|    if (buffer_cursor == NULL)
  ------------------
  |  Branch (646:9): [True: 0, False: 164]
  ------------------
  647|      0|        return -1;
  648|       |
  649|       |    /*
  650|       |     * Adjust for operational array size
  651|       |     */
  652|    164|    operation %= OSSL_NELEM(ops);
  ------------------
  |  |   14|    164|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  653|       |
  654|       |    /*
  655|       |     * And run our setup/doit/cleanup sequence
  656|       |     */
  657|    164|    if (ops[operation].setup != NULL)
  ------------------
  |  Branch (657:9): [True: 164, False: 0]
  ------------------
  658|    164|        ops[operation].setup(&buffer_cursor, &len, &in1, &in2);
  659|    164|    if (ops[operation].doit != NULL)
  ------------------
  |  Branch (659:9): [True: 78, False: 86]
  ------------------
  660|     78|        ops[operation].doit(&buffer_cursor, &len, in1, in2, &out1, &out2);
  661|    164|    if (ops[operation].cleanup != NULL)
  ------------------
  |  Branch (661:9): [True: 164, False: 0]
  ------------------
  662|    164|        ops[operation].cleanup(in1, in2, out1, out2);
  663|       |
  664|    164|    return 0;
  665|    164|}
ml-kem.c:consume_uint8t:
   37|    164|{
   38|    164|    if (*len < sizeof(uint8_t))
  ------------------
  |  Branch (38:9): [True: 0, False: 164]
  ------------------
   39|      0|        return NULL;
   40|    164|    *val = *buf;
   41|    164|    *len -= sizeof(uint8_t);
   42|    164|    return (uint8_t *)buf + 1;
   43|    164|}
ml-kem.c:create_mlkem_raw_key:
  142|     81|{
  143|     81|    EVP_PKEY *pubkey;
  144|     81|    char *keytype = NULL;
  145|     81|    size_t keylen = 0;
  146|     81|    uint8_t key[4096];
  147|     81|    int pub = 0;
  148|       |
  149|     81|    if (!select_keytype_and_size(buf, len, &keytype, &keylen, 0))
  ------------------
  |  Branch (149:9): [True: 0, False: 81]
  ------------------
  150|      0|        return;
  151|       |
  152|       |    /*
  153|       |     * Select public or private key creation based on the low order
  154|       |     * bit of the next buffer value
  155|       |     * Note that keylen as returned from select_keytype_and_size is
  156|       |     * a public key length, private keys for ML-KEM are always double
  157|       |     * the size plus 32, so make that adjustment here
  158|       |     */
  159|     81|    if ((*buf)[0] & 0x1)
  ------------------
  |  Branch (159:9): [True: 46, False: 35]
  ------------------
  160|     46|        pub = 1;
  161|     35|    else
  162|     35|        keylen = (keylen * 2) + 32;
  163|       |
  164|       |    /*
  165|       |     * libfuzzer provides by default up to 4096 bit input
  166|       |     * buffers, but its typically much less (between 1 and 100 bytes)
  167|       |     * so use RAND_bytes here instead
  168|       |     */
  169|     81|    if (!RAND_bytes(key, keylen))
  ------------------
  |  Branch (169:9): [True: 0, False: 81]
  ------------------
  170|      0|        return;
  171|       |
  172|       |    /*
  173|       |     * Try to generate either a raw public or private key using random data
  174|       |     * Because the input is completely random, its effectively certain this
  175|       |     * operation will fail, but it will still exercise the code paths below,
  176|       |     * which is what we want the fuzzer to do
  177|       |     */
  178|     81|    if (pub == 1)
  ------------------
  |  Branch (178:9): [True: 46, False: 35]
  ------------------
  179|     46|        pubkey = EVP_PKEY_new_raw_public_key_ex(NULL, keytype, NULL, key, keylen);
  180|     35|    else
  181|     35|        pubkey = EVP_PKEY_new_raw_private_key_ex(NULL, keytype, NULL, key, keylen);
  182|       |
  183|     81|    *key1 = pubkey;
  184|     81|    return;
  185|     81|}
ml-kem.c:select_keytype_and_size:
   64|    247|{
   65|    247|    uint16_t keysize;
   66|    247|    uint16_t modulus = 6;
   67|       |
   68|       |    /*
   69|       |     * Note: We don't really care about endianess here, we just
   70|       |     * want a random 16 bit value
   71|       |     */
   72|    247|    *buf = (uint8_t *)OPENSSL_load_u16_le(&keysize, *buf);
   73|    247|    *len -= sizeof(uint16_t);
   74|       |
   75|    247|    if (*buf == NULL)
  ------------------
  |  Branch (75:9): [True: 0, False: 247]
  ------------------
   76|      0|        return 0;
   77|       |
   78|       |    /*
   79|       |     * select from sizes
   80|       |     * ML-KEM-512, ML-KEM-768, and ML-KEM-1024
   81|       |     * also select some invalid sizes to trigger
   82|       |     * error paths
   83|       |     */
   84|    247|    if (only_valid)
  ------------------
  |  Branch (84:9): [True: 166, False: 81]
  ------------------
   85|    166|        modulus = 3;
   86|       |
   87|       |    /*
   88|       |     * Note, keylens for valid values (cases 0-2)
   89|       |     * are taken based on input values from our unit tests
   90|       |     */
   91|    247|    switch (keysize % modulus) {
   92|    101|    case 0:
  ------------------
  |  Branch (92:5): [True: 101, False: 146]
  ------------------
   93|    101|        *keytype = "ML-KEM-512";
   94|    101|        *keylen = OSSL_ML_KEM_512_PUBLIC_KEY_BYTES;
  ------------------
  |  |   19|    101|# define OSSL_ML_KEM_512_PUBLIC_KEY_BYTES   800
  ------------------
   95|    101|        break;
   96|     49|    case 1:
  ------------------
  |  Branch (96:5): [True: 49, False: 198]
  ------------------
   97|     49|        *keytype = "ML-KEM-768";
   98|     49|        *keylen = OSSL_ML_KEM_768_PUBLIC_KEY_BYTES;
  ------------------
  |  |   24|     49|# define OSSL_ML_KEM_768_PUBLIC_KEY_BYTES   1184
  ------------------
   99|     49|        break;
  100|     56|    case 2:
  ------------------
  |  Branch (100:5): [True: 56, False: 191]
  ------------------
  101|     56|        *keytype = "ML-KEM-1024";
  102|     56|        *keylen = OSSL_ML_KEM_1024_PUBLIC_KEY_BYTES;
  ------------------
  |  |   29|     56|# define OSSL_ML_KEM_1024_PUBLIC_KEY_BYTES  1568
  ------------------
  103|     56|        break;
  104|      2|    case 3:
  ------------------
  |  Branch (104:5): [True: 2, False: 245]
  ------------------
  105|       |        /* select invalid alg */
  106|      2|        *keytype = "ML-KEM-13";
  107|      2|        *keylen = 13;
  108|      2|        break;
  109|     38|    case 4:
  ------------------
  |  Branch (109:5): [True: 38, False: 209]
  ------------------
  110|       |        /* Select valid alg, but bogus size */
  111|     38|        *keytype = "ML-KEM-1024";
  112|     38|        *buf = (uint8_t *)OPENSSL_load_u16_le(&keysize, *buf);
  113|     38|        *len -= sizeof(uint16_t);
  114|     38|        *keylen = (size_t)keysize;
  115|     38|        *keylen %= 1024; /* size to our key buffer */
  116|     38|        break;
  117|      1|    default:
  ------------------
  |  Branch (117:5): [True: 1, False: 246]
  ------------------
  118|      1|        *keytype = NULL;
  119|      1|        *keylen = 0;
  120|      1|        break;
  121|    247|    }
  122|    247|    return 1;
  123|    247|}
ml-kem.c:cleanup_mlkem_keys:
  513|    164|{
  514|    164|    EVP_PKEY_free((EVP_PKEY *)key1);
  515|    164|    EVP_PKEY_free((EVP_PKEY *)key2);
  516|    164|    EVP_PKEY_free((EVP_PKEY *)key3);
  517|    164|    EVP_PKEY_free((EVP_PKEY *)key4);
  518|    164|    return;
  519|    164|}
ml-kem.c:keygen_mlkem_real_key:
  204|     83|{
  205|     83|    char *keytype = NULL;
  206|     83|    size_t keylen = 0;
  207|     83|    EVP_PKEY_CTX *ctx = NULL;
  208|     83|    EVP_PKEY **key;
  209|       |
  210|     83|    *key1 = *key2 = NULL;
  211|       |
  212|     83|    key = (EVP_PKEY **)key1;
  213|       |
  214|    166|again:
  215|       |    /*
  216|       |     * Only generate valid key types and lengths
  217|       |     * Note, no adjustment is made to keylen here, as
  218|       |     * the provider is responsible for selecting the keys and sizes
  219|       |     * for us during the EVP_PKEY_keygen call
  220|       |     */
  221|    166|    if (!select_keytype_and_size(buf, len, &keytype, &keylen, 1))
  ------------------
  |  Branch (221:9): [True: 0, False: 166]
  ------------------
  222|      0|        return;
  223|       |
  224|    166|    ctx = EVP_PKEY_CTX_new_from_name(NULL, keytype, NULL);
  225|    166|    if (!ctx) {
  ------------------
  |  Branch (225:9): [True: 0, False: 166]
  ------------------
  226|      0|        fprintf(stderr, "Failed to generate ctx\n");
  227|      0|        return;
  228|      0|    }
  229|       |
  230|    166|    if (!EVP_PKEY_keygen_init(ctx)) {
  ------------------
  |  Branch (230:9): [True: 0, False: 166]
  ------------------
  231|      0|        fprintf(stderr, "Failed to init keygen ctx\n");
  232|      0|        goto err;
  233|      0|    }
  234|       |
  235|    166|    *key = EVP_PKEY_new();
  236|    166|    if (*key == NULL)
  ------------------
  |  Branch (236:9): [True: 0, False: 166]
  ------------------
  237|      0|        goto err;
  238|       |
  239|    166|    if (!EVP_PKEY_generate(ctx, key)) {
  ------------------
  |  Branch (239:9): [True: 0, False: 166]
  ------------------
  240|      0|        fprintf(stderr, "Failed to generate new real key\n");
  241|      0|        goto err;
  242|      0|    }
  243|       |
  244|    166|    if (key == (EVP_PKEY **)key1) {
  ------------------
  |  Branch (244:9): [True: 83, False: 83]
  ------------------
  245|     83|        EVP_PKEY_CTX_free(ctx);
  246|     83|        key = (EVP_PKEY **)key2;
  247|     83|        goto again;
  248|     83|    }
  249|       |
  250|     83|err:
  251|     83|    EVP_PKEY_CTX_free(ctx);
  252|     83|    return;
  253|    166|}
ml-kem.c:mlkem_encap_decap:
  271|     46|{
  272|     46|    EVP_PKEY *key = (EVP_PKEY *)key1;
  273|     46|    EVP_PKEY_CTX *ctx;
  274|     46|    unsigned char genkey[32];
  275|     46|    size_t genkey_len = 32;
  276|     46|    unsigned char unwrappedkey[32];
  277|     46|    size_t unwrappedkey_len = 32;
  278|     46|    unsigned char wrapkey[1568];
  279|     46|    size_t wrapkey_len = 1568;
  280|       |
  281|     46|    ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL);
  282|     46|    if (ctx == NULL) {
  ------------------
  |  Branch (282:9): [True: 0, False: 46]
  ------------------
  283|      0|        fprintf(stderr, "Failed to allocate ctx\n");
  284|      0|        goto err;
  285|      0|    }
  286|       |
  287|     46|    if (!EVP_PKEY_encapsulate_init(ctx, NULL)) {
  ------------------
  |  Branch (287:9): [True: 0, False: 46]
  ------------------
  288|      0|        fprintf(stderr, "Failed to init encap context\n");
  289|      0|        goto err;
  290|      0|    }
  291|       |
  292|     46|    if (!RAND_bytes(genkey, genkey_len))
  ------------------
  |  Branch (292:9): [True: 0, False: 46]
  ------------------
  293|      0|        goto err;
  294|       |
  295|     46|    if (EVP_PKEY_encapsulate(ctx, wrapkey, &wrapkey_len, genkey, &genkey_len) <= 0) {
  ------------------
  |  Branch (295:9): [True: 0, False: 46]
  ------------------
  296|      0|        fprintf(stderr, "Failed to encapsulate key\n");
  297|      0|        goto err;
  298|      0|    }
  299|       |
  300|     46|    EVP_PKEY_CTX_free(ctx);
  301|     46|    ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL);
  302|     46|    if (ctx == NULL) {
  ------------------
  |  Branch (302:9): [True: 0, False: 46]
  ------------------
  303|      0|        fprintf(stderr, "Failed to create context\n");
  304|      0|        goto err;
  305|      0|    }
  306|       |
  307|     46|    if (!EVP_PKEY_decapsulate_init(ctx, NULL)) {
  ------------------
  |  Branch (307:9): [True: 0, False: 46]
  ------------------
  308|      0|        fprintf(stderr, "Failed to init decap\n");
  309|      0|        goto err;
  310|      0|    }
  311|       |
  312|     46|    if (EVP_PKEY_decapsulate(ctx, unwrappedkey, &unwrappedkey_len,
  ------------------
  |  Branch (312:9): [True: 0, False: 46]
  ------------------
  313|     46|                             wrapkey, wrapkey_len) <= 0) {
  314|      0|        fprintf(stderr, "Failed to decap key\n");
  315|      0|        goto err;
  316|      0|    }
  317|       |
  318|     46|    if (memcmp(unwrappedkey, genkey, genkey_len))
  ------------------
  |  Branch (318:9): [True: 0, False: 46]
  ------------------
  319|      0|        fprintf(stderr, "mismatch on secret comparison\n");
  320|     46|err:
  321|     46|    EVP_PKEY_CTX_free(ctx);
  322|     46|    return;
  323|     46|}
ml-kem.c:mlkem_kex:
  407|     10|{
  408|     10|    EVP_PKEY *alice = (EVP_PKEY *)key1;
  409|     10|    EVP_PKEY *bob = (EVP_PKEY *)key2;
  410|     10|    size_t boblen, alicelen;
  411|     10|    uint8_t *bobshare = NULL;
  412|     10|    uint8_t *aliceshare = NULL;
  413|       |
  414|     10|    do_derive(alice, bob, &aliceshare, &alicelen);
  415|     10|    do_derive(bob, alice, &bobshare, &boblen);
  416|       |
  417|       |    /*
  418|       |     * TODO add check of shared secrets here when ML-KEM supports this
  419|       |     */
  420|     10|    OPENSSL_free(bobshare);
  ------------------
  |  |  115|     10|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  421|     10|    OPENSSL_free(aliceshare);
  ------------------
  |  |  115|     10|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  422|     10|}
ml-kem.c:do_derive:
  341|     20|{
  342|     20|    EVP_PKEY_CTX *ctx = NULL;
  343|       |
  344|     20|    *shared = NULL;
  345|     20|    *shared_len = 0;
  346|       |
  347|     20|    ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL);
  348|     20|    if (ctx == NULL) {
  ------------------
  |  Branch (348:9): [True: 0, False: 20]
  ------------------
  349|      0|        fprintf(stderr, "failed to create keygen context\n");
  350|      0|        goto err;
  351|      0|    }
  352|       |
  353|     20|    if (!EVP_PKEY_derive_init(ctx)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 20]
  ------------------
  354|      0|        fprintf(stderr, "failed to init derive context\n");
  355|      0|        goto err;
  356|      0|    }
  357|       |
  358|     20|    if (!EVP_PKEY_derive_set_peer(ctx, peer)) {
  ------------------
  |  Branch (358:9): [True: 0, False: 20]
  ------------------
  359|      0|        fprintf(stderr, "failed to set peer\n");
  360|      0|        goto err;
  361|      0|    }
  362|       |
  363|     20|    if (!EVP_PKEY_derive(ctx, NULL, shared_len)) {
  ------------------
  |  Branch (363:9): [True: 0, False: 20]
  ------------------
  364|      0|        fprintf(stderr, "Derive failed 1\n");
  365|      0|        goto err;
  366|      0|    }
  367|       |
  368|     20|    if (*shared_len == 0)
  ------------------
  |  Branch (368:9): [True: 20, False: 0]
  ------------------
  369|     20|        goto err;
  370|       |
  371|      0|    *shared = OPENSSL_zalloc(*shared_len);
  ------------------
  |  |  104|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  372|      0|    if (*shared == NULL) {
  ------------------
  |  Branch (372:9): [True: 0, False: 0]
  ------------------
  373|      0|        fprintf(stderr, "Failed to alloc\n");
  374|      0|        goto err;
  375|      0|    }
  376|      0|    if (!EVP_PKEY_derive(ctx, *shared, shared_len)) {
  ------------------
  |  Branch (376:9): [True: 0, False: 0]
  ------------------
  377|      0|        fprintf(stderr, "Derive failed 2\n");
  378|      0|        OPENSSL_free(*shared);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  379|      0|        *shared = NULL;
  380|      0|        *shared_len = 0;
  381|      0|        goto err;
  382|      0|    }
  383|     20|err:
  384|     20|    EVP_PKEY_CTX_free(ctx);
  385|     20|}
ml-kem.c:mlkem_export_import:
  444|      3|{
  445|      3|    EVP_PKEY *alice = (EVP_PKEY *)key1;
  446|      3|    EVP_PKEY *new = NULL;
  447|      3|    EVP_PKEY_CTX *ctx = NULL;
  448|      3|    OSSL_PARAM *params = NULL;
  449|       |
  450|      3|    if (!EVP_PKEY_todata(alice, EVP_PKEY_KEYPAIR, &params)) {
  ------------------
  |  |  113|      3|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  111|      3|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      3|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  647|      3|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  642|      3|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  648|      3|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  643|      3|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  641|      3|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  640|      3|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
  |  Branch (450:9): [True: 0, False: 3]
  ------------------
  451|      0|        fprintf(stderr, "Failed todata\n");
  452|      0|        goto err;
  453|      0|    }
  454|       |
  455|      3|    ctx = EVP_PKEY_CTX_new_from_pkey(NULL, alice, NULL);
  456|      3|    if (ctx == NULL) {
  ------------------
  |  Branch (456:9): [True: 0, False: 3]
  ------------------
  457|      0|        fprintf(stderr, "Failed new ctx\n");
  458|      0|        goto err;
  459|      0|    }
  460|       |
  461|      3|    if (!EVP_PKEY_fromdata(ctx, &new, EVP_PKEY_KEYPAIR, params)) {
  ------------------
  |  |  113|      3|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  111|      3|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      3|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  647|      3|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  642|      3|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  648|      3|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  643|      3|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  641|      3|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  640|      3|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
  |  Branch (461:9): [True: 0, False: 3]
  ------------------
  462|      0|        fprintf(stderr, "Failed fromdata\n");
  463|      0|        goto err;
  464|      0|    }
  465|       |
  466|      3|err:
  467|      3|    EVP_PKEY_CTX_free(ctx);
  468|      3|    EVP_PKEY_free(new);
  469|      3|    OSSL_PARAM_free(params);
  470|      3|}
ml-kem.c:mlkem_compare:
  489|     19|{
  490|     19|    EVP_PKEY *alice = (EVP_PKEY *)key1;
  491|     19|    EVP_PKEY *bob = (EVP_PKEY *)key2;
  492|       |
  493|     19|    EVP_PKEY_eq(alice, alice);
  494|     19|    EVP_PKEY_eq(alice, bob);
  495|     19|}

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

property.c:ossl_sa_ALGORITHM_new:
   27|      4|    { \
   28|      4|        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
   29|      4|    } \
property.c:ossl_sa_ALGORITHM_doall_arg:
   56|      4|    { \
   57|      4|        ossl_sa_doall_arg((OPENSSL_SA *)sa, \
   58|      4|                          (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
   59|      4|    } \
property.c:ossl_sa_ALGORITHM_set:
   68|    440|    { \
   69|    440|        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
   70|    440|    } \
property.c:ossl_sa_ALGORITHM_free:
   32|      4|    { \
   33|      4|        ossl_sa_free((OPENSSL_SA *)sa); \
   34|      4|    } \
property.c:ossl_sa_ALGORITHM_get:
   62|  1.95k|    { \
   63|  1.95k|        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
   64|  1.95k|    } \

exchange.c:ossl_assert_int:
   45|     20|{
   46|     20|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 20]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     20|    return expr;
   50|     20|}
kem.c:ossl_assert_int:
   45|     92|{
   46|     92|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 92]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     92|    return expr;
   50|     92|}
p_lib.c:ossl_assert_int:
   45|  1.67k|{
   46|  1.67k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.67k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  1.67k|    return expr;
   50|  1.67k|}
core_algorithm.c:ossl_assert_int:
   45|     22|{
   46|     22|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 22]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     22|    return expr;
   50|     22|}
core_namemap.c:ossl_assert_int:
   45|    936|{
   46|    936|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 936]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    936|    return expr;
   50|    936|}
provider_core.c:ossl_assert_int:
   45|     59|{
   46|     59|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 59]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     59|    return expr;
   50|     59|}
threads_pthread.c:ossl_assert_int:
   45|  6.89k|{
   46|  6.89k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 6.89k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  6.89k|    return expr;
   50|  6.89k|}
drbg_ctr.c:ossl_assert_int:
   45|     13|{
   46|     13|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 13]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     13|    return expr;
   50|     13|}
bio_print.c:ossl_assert_int:
   45|  17.7k|{
   46|  17.7k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 17.7k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  17.7k|    return expr;
   50|  17.7k|}
digest.c:ossl_assert_int:
   45|  3.21k|{
   46|  3.21k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 3.21k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  3.21k|    return expr;
   50|  3.21k|}
evp_enc.c:ossl_assert_int:
   45|  1.06k|{
   46|  1.06k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.06k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  1.06k|    return expr;
   50|  1.06k|}
evp_fetch.c:ossl_assert_int:
   45|  4.93k|{
   46|  4.93k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 4.93k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  4.93k|    return expr;
   50|  4.93k|}
core_fetch.c:ossl_assert_int:
   45|     63|{
   46|     63|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 63]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|     63|    return expr;
   50|     63|}
ml_kem.c:ossl_assert_int:
   45|    424|{
   46|    424|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 424]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    424|    return expr;
   50|    424|}
defn_cache.c:ossl_assert_int:
   45|    440|{
   46|    440|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 440]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    440|    return expr;
   50|    440|}
property.c:ossl_assert_int:
   45|    234|{
   46|    234|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 234]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    234|    return expr;
   50|    234|}

ml_kem.c:constant_time_lt_32:
  142|   193k|{
  143|   193k|    return constant_time_msb_32(a ^ ((a ^ b) | ((a - b) ^ b)));
  144|   193k|}
ml_kem.c:constant_time_msb_32:
  110|   193k|{
  111|   193k|    return 0 - (a >> 31);
  112|   193k|}
ml_kem.c:constant_time_eq_int_8:
  267|     46|{
  268|     46|    return constant_time_eq_8((unsigned)(a), (unsigned)(b));
  269|     46|}
ml_kem.c:constant_time_eq_8:
  252|     46|{
  253|     46|    return (unsigned char)constant_time_eq(a, b);
  254|     46|}
ml_kem.c:constant_time_eq:
  241|     46|{
  242|     46|    return constant_time_is_zero(a ^ b);
  243|     46|}
ml_kem.c:constant_time_is_zero:
  215|     46|{
  216|     46|    return constant_time_msb(~a & (a - 1));
  217|     46|}
ml_kem.c:constant_time_msb:
  104|     46|{
  105|     46|    return 0 - (a >> (sizeof(a) * 8 - 1));
  106|     46|}
ml_kem.c:constant_time_select_8:
  354|  1.47k|{
  355|  1.47k|    return (unsigned char)constant_time_select(mask, a, b);
  356|  1.47k|}
ml_kem.c:constant_time_select:
  340|  1.47k|{
  341|  1.47k|    return (value_barrier(mask) & a) | (value_barrier(~mask) & b);
  342|  1.47k|}
ml_kem.c:value_barrier:
  279|  2.94k|{
  280|  2.94k|#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__)
  281|  2.94k|    unsigned int r;
  282|  2.94k|    __asm__("" : "=r"(r) : "0"(a));
  283|       |#else
  284|       |    volatile unsigned int r = a;
  285|       |#endif
  286|  2.94k|    return r;
  287|  2.94k|}

core_namemap.c:ossl_ht_strcase:
  255|  3.72k|{
  256|  3.72k|    int i;
  257|       |#if defined(CHARSET_EBCDIC) && !defined(CHARSET_EBCDIC_TEST)
  258|       |    const long int case_adjust = ~0x40;
  259|       |#else
  260|  3.72k|    const long int case_adjust = ~0x20;
  261|  3.72k|#endif
  262|       |
  263|  3.72k|    if (src == NULL)
  ------------------
  |  Branch (263:9): [True: 0, False: 3.72k]
  ------------------
  264|      0|        return;
  265|       |
  266|  47.3k|    for (i = 0; src[i] != '\0' && i < len; i++)
  ------------------
  |  Branch (266:17): [True: 43.7k, False: 3.58k]
  |  Branch (266:35): [True: 43.6k, False: 142]
  ------------------
  267|  43.6k|        tgt[i] = case_adjust & src[i];
  268|  3.72k|}

exchange.c:CRYPTO_DOWN_REF:
   56|     14|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|     14|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|     14|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 7, False: 7]
  ------------------
   66|      7|        atomic_thread_fence(memory_order_acquire);
   67|     14|#   endif
   68|     14|    return 1;
   69|     14|}
exchange.c:CRYPTO_FREE_REF:
  285|      7|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      7|{
  287|      7|}
exchange.c:CRYPTO_UP_REF:
   40|      7|{
   41|      7|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|      7|    return 1;
   43|      7|}
exchange.c:CRYPTO_NEW_REF:
  280|      7|{
  281|      7|    refcnt->val = n;
  282|      7|    return 1;
  283|      7|}
kem.c:CRYPTO_DOWN_REF:
   56|    117|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|    117|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|    117|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 11, False: 106]
  ------------------
   66|     11|        atomic_thread_fence(memory_order_acquire);
   67|    117|#   endif
   68|    117|    return 1;
   69|    117|}
kem.c:CRYPTO_FREE_REF:
  285|     11|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|     11|{
  287|     11|}
kem.c:CRYPTO_UP_REF:
   40|    106|{
   41|    106|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|    106|    return 1;
   43|    106|}
kem.c:CRYPTO_NEW_REF:
  280|     11|{
  281|     11|    refcnt->val = n;
  282|     11|    return 1;
  283|     11|}
keymgmt_meth.c:CRYPTO_NEW_REF:
  280|     40|{
  281|     40|    refcnt->val = n;
  282|     40|    return 1;
  283|     40|}
keymgmt_meth.c:CRYPTO_UP_REF:
   40|    660|{
   41|    660|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|    660|    return 1;
   43|    660|}
keymgmt_meth.c:CRYPTO_DOWN_REF:
   56|    700|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|    700|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|    700|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 40, False: 660]
  ------------------
   66|     40|        atomic_thread_fence(memory_order_acquire);
   67|    700|#   endif
   68|    700|    return 1;
   69|    700|}
keymgmt_meth.c:CRYPTO_FREE_REF:
  285|     40|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|     40|{
  287|     40|}
p_lib.c:CRYPTO_NEW_REF:
  280|    244|{
  281|    244|    refcnt->val = n;
  282|    244|    return 1;
  283|    244|}
p_lib.c:CRYPTO_FREE_REF:
  285|    244|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|    244|{
  287|    244|}
p_lib.c:CRYPTO_UP_REF:
   40|    115|{
   41|    115|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|    115|    return 1;
   43|    115|}
p_lib.c:CRYPTO_DOWN_REF:
   56|    359|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|    359|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|    359|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 244, False: 115]
  ------------------
   66|    244|        atomic_thread_fence(memory_order_acquire);
   67|    359|#   endif
   68|    359|    return 1;
   69|    359|}
provider_core.c:CRYPTO_UP_REF:
   40|    258|{
   41|    258|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|    258|    return 1;
   43|    258|}
provider_core.c:CRYPTO_NEW_REF:
  280|      1|{
  281|      1|    refcnt->val = n;
  282|      1|    return 1;
  283|      1|}
provider_core.c:CRYPTO_DOWN_REF:
   56|    259|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|    259|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|    259|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 1, False: 258]
  ------------------
   66|      1|        atomic_thread_fence(memory_order_acquire);
   67|    259|#   endif
   68|    259|    return 1;
   69|    259|}
provider_core.c:CRYPTO_FREE_REF:
  285|      1|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      1|{
  287|      1|}
bio_lib.c:CRYPTO_FREE_REF:
  285|      1|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      1|{
  287|      1|}
digest.c:CRYPTO_NEW_REF:
  280|     27|{
  281|     27|    refcnt->val = n;
  282|     27|    return 1;
  283|     27|}
digest.c:CRYPTO_UP_REF:
   40|  1.90k|{
   41|  1.90k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|  1.90k|    return 1;
   43|  1.90k|}
digest.c:CRYPTO_DOWN_REF:
   56|  1.92k|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|  1.92k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|  1.92k|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 27, False: 1.90k]
  ------------------
   66|     27|        atomic_thread_fence(memory_order_acquire);
   67|  1.92k|#   endif
   68|  1.92k|    return 1;
   69|  1.92k|}
evp_enc.c:CRYPTO_NEW_REF:
  280|    130|{
  281|    130|    refcnt->val = n;
  282|    130|    return 1;
  283|    130|}
evp_enc.c:CRYPTO_UP_REF:
   40|    147|{
   41|    147|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|    147|    return 1;
   43|    147|}
evp_enc.c:CRYPTO_FREE_REF:
  285|    130|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|    130|{
  287|    130|}
evp_enc.c:CRYPTO_DOWN_REF:
   56|    277|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|    277|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|    277|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 130, False: 147]
  ------------------
   66|    130|        atomic_thread_fence(memory_order_acquire);
   67|    277|#   endif
   68|    277|    return 1;
   69|    277|}
evp_lib.c:CRYPTO_FREE_REF:
  285|     27|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|     27|{
  287|     27|}
evp_rand.c:CRYPTO_UP_REF:
   40|     18|{
   41|     18|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   42|     18|    return 1;
   43|     18|}
evp_rand.c:CRYPTO_NEW_REF:
  280|      9|{
  281|      9|    refcnt->val = n;
  282|      9|    return 1;
  283|      9|}
evp_rand.c:CRYPTO_FREE_REF:
  285|      9|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      9|{
  287|      9|}
evp_rand.c:CRYPTO_DOWN_REF:
   56|     27|{
   57|       |#   ifdef OSSL_TSAN_BUILD
   58|       |    /*
   59|       |     * TSAN requires acq_rel as it indicates a false positive error when
   60|       |     * the object that contains the refcount is freed otherwise.
   61|       |     */
   62|       |    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_acq_rel) - 1;
   63|       |#   else
   64|     27|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_release) - 1;
   65|     27|    if (*ret == 0)
  ------------------
  |  Branch (65:9): [True: 9, False: 18]
  ------------------
   66|      9|        atomic_thread_fence(memory_order_acquire);
   67|     27|#   endif
   68|     27|    return 1;
   69|     27|}

stack.c:safe_muldiv_int:
  324|     14|    {                                                                        \
  325|     14|        int e2 = 0;                                                          \
  326|     14|        type q, r, x, y;                                                     \
  327|     14|                                                                             \
  328|     14|        if (c == 0) {                                                        \
  ------------------
  |  Branch (328:13): [True: 0, False: 14]
  ------------------
  329|      0|            *err |= 1;                                                       \
  330|      0|            return a == 0 || b == 0 ? 0 : max;                               \
  ------------------
  |  Branch (330:20): [True: 0, False: 0]
  |  Branch (330:30): [True: 0, False: 0]
  ------------------
  331|      0|        }                                                                    \
  332|     14|        x = safe_mul_ ## type_name(a, b, &e2);                               \
  333|     14|        if (!e2)                                                             \
  ------------------
  |  Branch (333:13): [True: 14, False: 0]
  ------------------
  334|     14|            return safe_div_ ## type_name(x, c, err);                        \
  335|     14|        if (b > a) {                                                         \
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  ------------------
  336|      0|            x = b;                                                           \
  337|      0|            b = a;                                                           \
  338|      0|            a = x;                                                           \
  339|      0|        }                                                                    \
  340|      0|        q = safe_div_ ## type_name(a, c, err);                               \
  341|      0|        r = safe_mod_ ## type_name(a, c, err);                               \
  342|      0|        x = safe_mul_ ## type_name(r, b, err);                               \
  343|      0|        y = safe_mul_ ## type_name(q, b, err);                               \
  344|      0|        q = safe_div_ ## type_name(x, c, err);                               \
  345|      0|        return safe_add_ ## type_name(y, q, err);                            \
  346|     14|    }
stack.c:safe_mul_int:
  138|     14|    {                                                                        \
  139|     14|        type r;                                                              \
  140|     14|                                                                             \
  141|     14|        if (!__builtin_mul_overflow(a, b, &r))                               \
  ------------------
  |  Branch (141:13): [True: 14, False: 0]
  ------------------
  142|     14|            return r;                                                        \
  143|     14|        *err |= 1;                                                           \
  144|      0|        return (a < 0) ^ (b < 0) ? min : max;                                \
  ------------------
  |  Branch (144:16): [True: 0, False: 0]
  ------------------
  145|     14|    }
stack.c:safe_div_int:
  201|     14|    {                                                                        \
  202|     14|        if (b == 0) {                                                        \
  ------------------
  |  Branch (202:13): [True: 0, False: 14]
  ------------------
  203|      0|            *err |= 1;                                                       \
  204|      0|            return a < 0 ? min : max;                                        \
  ------------------
  |  Branch (204:20): [True: 0, False: 0]
  ------------------
  205|      0|        }                                                                    \
  206|     14|        if (b == -1 && a == min) {                                           \
  ------------------
  |  Branch (206:13): [True: 0, False: 14]
  |  Branch (206:24): [True: 0, False: 0]
  ------------------
  207|      0|            *err |= 1;                                                       \
  208|      0|            return max;                                                      \
  209|      0|        }                                                                    \
  210|     14|        return a / b;                                                        \
  211|     14|    }

init.c:ossl_init_base_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_register_atexit_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_load_crypto_nodelete_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_load_crypto_strings_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_add_all_ciphers_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_add_all_digests_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
init.c:ossl_init_config_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
initthread.c:create_global_tevent_register_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
o_names.c:o_names_init_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
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|    }                                           \
conf_mod.c:do_init_module_list_lock_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
do_engine_lock_init_ossl_:
   41|      1|    {                                           \
   42|      1|        init##_ossl_ret_ = init();              \
   43|      1|    }                                           \
err.c:do_err_strings_init_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
err.c:err_do_init_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
context.c:default_context_do_init_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \

ml-kem.c:OPENSSL_load_u16_le:
  202|    285|{
  203|    285|# ifdef OSSL_LE16TOH
  204|    285|    uint16_t t;
  205|       |
  206|    285|    memcpy((unsigned char *)&t, in, 2);
  207|    285|    *val = OSSL_LE16TOH(t);
  ------------------
  |  |   53|    285|#   define OSSL_LE16TOH(x) le16toh(x)
  ------------------
  208|    285|    return in + 2;
  209|       |# else
  210|       |    uint16_t b0 = *in++;
  211|       |    uint16_t b1 = *in++;
  212|       |
  213|       |    *val = b0 | (b1 << 8);
  214|       |    return in;
  215|       |#endif
  216|    285|}
ml_kem.c:OPENSSL_store_u64_le:
  160|  35.5k|{
  161|  35.5k|# ifdef OSSL_HTOLE64
  162|  35.5k|    uint64_t t = OSSL_HTOLE64(val);
  ------------------
  |  |   52|  35.5k|#   define OSSL_HTOLE64(x) htole64(x)
  ------------------
  163|       |
  164|  35.5k|    memcpy(out, (unsigned char *)&t, 8);
  165|  35.5k|    return out + 8;
  166|       |# else
  167|       |    *out++ = (val & 0xff);
  168|       |    *out++ = (val >> 8) & 0xff;
  169|       |    *out++ = (val >> 16) & 0xff;
  170|       |    *out++ = (val >> 24) & 0xff;
  171|       |    *out++ = (val >> 32) & 0xff;
  172|       |    *out++ = (val >> 40) & 0xff;
  173|       |    *out++ = (val >> 48) & 0xff;
  174|       |    *out++ = (val >> 56) & 0xff;
  175|       |    return out;
  176|       |# endif
  177|  35.5k|}
ml_kem.c:OPENSSL_load_u64_le:
  278|  5.71k|{
  279|  5.71k|# ifdef OSSL_LE64TOH
  280|  5.71k|    uint64_t t;
  281|       |
  282|  5.71k|    memcpy((unsigned char *)&t, in, 8);
  283|  5.71k|    *val = OSSL_LE64TOH(t);
  ------------------
  |  |   55|  5.71k|#   define OSSL_LE64TOH(x) le64toh(x)
  ------------------
  284|  5.71k|    return in + 8;
  285|       |# else
  286|       |    uint64_t b0 = *in++;
  287|       |    uint64_t b1 = *in++;
  288|       |    uint64_t b2 = *in++;
  289|       |    uint64_t b3 = *in++;
  290|       |    uint64_t b4 = *in++;
  291|       |    uint64_t b5 = *in++;
  292|       |    uint64_t b6 = *in++;
  293|       |    uint64_t b7 = *in++;
  294|       |
  295|       |    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
  296|       |        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
  297|       |    return in;
  298|       |#endif
  299|  5.71k|}

exchange.c:OSSL_FUNC_keyexch_newctx:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_init:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_set_peer:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
exchange.c:OSSL_FUNC_keyexch_derive:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_freectx:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_dupctx:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_get_ctx_params:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_gettable_ctx_params:
   59|      7|    {                                                                   \
   60|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      7|    }
exchange.c:OSSL_FUNC_keyexch_set_ctx_params:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
exchange.c:OSSL_FUNC_keyexch_settable_ctx_params:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
kem.c:OSSL_FUNC_kem_newctx:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_encapsulate_init:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_auth_encapsulate_init:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
kem.c:OSSL_FUNC_kem_encapsulate:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_decapsulate_init:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_auth_decapsulate_init:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
kem.c:OSSL_FUNC_kem_decapsulate:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_freectx:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_dupctx:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
kem.c:OSSL_FUNC_kem_get_ctx_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
kem.c:OSSL_FUNC_kem_gettable_ctx_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
kem.c:OSSL_FUNC_kem_set_ctx_params:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
kem.c:OSSL_FUNC_kem_settable_ctx_params:
   59|     11|    {                                                                   \
   60|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     11|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_new:
   59|     40|    {                                                                   \
   60|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     40|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_init:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_set_template:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_set_params:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_settable_params:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_get_params:
   59|      2|    {                                                                   \
   60|      2|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      2|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_gettable_params:
   59|      2|    {                                                                   \
   60|      2|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      2|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_cleanup:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_free:
   59|     40|    {                                                                   \
   60|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     40|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_load:
   59|     29|    {                                                                   \
   60|     29|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     29|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_get_params:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gettable_params:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_set_params:
   59|     19|    {                                                                   \
   60|     19|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     19|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_settable_params:
   59|     19|    {                                                                   \
   60|     19|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     19|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_query_operation_name:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_has:
   59|     40|    {                                                                   \
   60|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     40|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_dup:
   59|     33|    {                                                                   \
   60|     33|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     33|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_validate:
   59|     29|    {                                                                   \
   60|     29|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     29|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_match:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_import:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_import_types:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_export:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_export_types:
   59|     37|    {                                                                   \
   60|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     37|    }
provider_core.c:OSSL_FUNC_provider_teardown:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_core.c:OSSL_FUNC_provider_gettable_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_core.c:OSSL_FUNC_provider_get_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_core.c:OSSL_FUNC_provider_get_capabilities:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_core.c:OSSL_FUNC_provider_query_operation:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
defltprov.c:OSSL_FUNC_core_gettable_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
defltprov.c:OSSL_FUNC_core_get_params:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
defltprov.c:OSSL_FUNC_core_get_libctx:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_new_file:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_new_membuf:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_read_ex:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_write_ex:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_gets:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_puts:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_ctrl:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_up_ref:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_free:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
bio_prov.c:OSSL_FUNC_BIO_vprintf:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_get_entropy:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_get_user_entropy:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_entropy:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_user_entropy:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_get_nonce:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_get_user_nonce:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_nonce:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_user_nonce:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
digest.c:OSSL_FUNC_digest_newctx:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_init:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_update:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_final:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_squeeze:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
digest.c:OSSL_FUNC_digest_freectx:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_dupctx:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_get_params:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_set_ctx_params:
   59|      8|    {                                                                   \
   60|      8|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      8|    }
digest.c:OSSL_FUNC_digest_get_ctx_params:
   59|      6|    {                                                                   \
   60|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      6|    }
digest.c:OSSL_FUNC_digest_gettable_params:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
digest.c:OSSL_FUNC_digest_settable_ctx_params:
   59|      8|    {                                                                   \
   60|      8|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      8|    }
digest.c:OSSL_FUNC_digest_gettable_ctx_params:
   59|      6|    {                                                                   \
   60|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      6|    }
digest.c:OSSL_FUNC_digest_copyctx:
   59|     27|    {                                                                   \
   60|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     27|    }
evp_enc.c:OSSL_FUNC_cipher_newctx:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_encrypt_init:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_decrypt_init:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_encrypt_skey_init:
   59|     68|    {                                                                   \
   60|     68|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     68|    }
evp_enc.c:OSSL_FUNC_cipher_decrypt_skey_init:
   59|     68|    {                                                                   \
   60|     68|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|     68|    }
evp_enc.c:OSSL_FUNC_cipher_update:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_final:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_cipher:
   59|    118|    {                                                                   \
   60|    118|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    118|    }
evp_enc.c:OSSL_FUNC_cipher_freectx:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_dupctx:
   59|    129|    {                                                                   \
   60|    129|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    129|    }
evp_enc.c:OSSL_FUNC_cipher_get_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_get_ctx_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_set_ctx_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_gettable_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_gettable_ctx_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_enc.c:OSSL_FUNC_cipher_settable_ctx_params:
   59|    130|    {                                                                   \
   60|    130|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|    130|    }
evp_rand.c:OSSL_FUNC_rand_newctx:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_freectx:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_instantiate:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_uninstantiate:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_generate:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_reseed:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_nonce:
   59|      1|    {                                                                   \
   60|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      1|    }
evp_rand.c:OSSL_FUNC_rand_enable_locking:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_lock:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_unlock:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_gettable_ctx_params:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_settable_ctx_params:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
evp_rand.c:OSSL_FUNC_rand_get_ctx_params:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_set_ctx_params:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
evp_rand.c:OSSL_FUNC_rand_verify_zeroization:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_get_seed:
   59|      5|    {                                                                   \
   60|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      5|    }
evp_rand.c:OSSL_FUNC_rand_clear_seed:
   59|      4|    {                                                                   \
   60|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      4|    }
drbg.c:OSSL_FUNC_rand_enable_locking:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
drbg.c:OSSL_FUNC_rand_lock:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
drbg.c:OSSL_FUNC_rand_unlock:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
drbg.c:OSSL_FUNC_rand_get_ctx_params:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
drbg.c:OSSL_FUNC_rand_get_seed:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }
drbg.c:OSSL_FUNC_rand_clear_seed:
   59|      3|    {                                                                   \
   60|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   61|      3|    }

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

o_names.c:lh_OBJ_NAME_new:
  317|      1|    { \
  318|      1|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      1|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      1|                                lh_##type##_doall_thunk, \
  321|      1|                                lh_##type##_doall_arg_thunk); \
  322|      1|    } \
o_names.c:lh_OBJ_NAME_hfn_thunk:
  243|  1.31k|    { \
  244|  1.31k|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|  1.31k|        return hfn_conv((const type *)data); \
  246|  1.31k|    } \
o_names.c:lh_OBJ_NAME_cfn_thunk:
  248|    918|    { \
  249|    918|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  250|    918|        return cfn_conv((const type *)da, (const type *)db); \
  251|    918|    } \
o_names.c:lh_OBJ_NAME_doall_thunk:
  299|    543|    { \
  300|    543|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|    543|        doall_conv((type *)node); \
  302|    543|    } \
o_names.c:lh_OBJ_NAME_retrieve:
  274|    651|    { \
  275|    651|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|    651|    } \
o_names.c:lh_OBJ_NAME_insert:
  264|    424|    { \
  265|    424|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|    424|    } \
o_names.c:lh_OBJ_NAME_error:
  279|    242|    { \
  280|    242|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|    242|    } \
o_names.c:lh_OBJ_NAME_delete:
  269|    242|    { \
  270|    242|        return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \
  271|    242|    } \
o_names.c:lh_OBJ_NAME_doall_OBJ_DOALL:
  354|      2|    { \
  355|      2|        OPENSSL_LH_doall_arg_thunk((OPENSSL_LHASH *)lh, \
  356|      2|                             lh_##type##_doall_##argtype##_thunk, \
  357|      2|                             (OPENSSL_LH_DOALL_FUNCARG)fn, \
  358|      2|                             (void *)arg); \
  359|      2|    } \
o_names.c:lh_OBJ_NAME_doall_OBJ_DOALL_thunk:
  346|    484|    { \
  347|    484|        void (*fn_conv)(cbargtype *, argtype *) = (void (*)(cbargtype *, argtype *))fn; \
  348|    484|        fn_conv((cbargtype *)node, (argtype *)arg); \
  349|    484|    } \
o_names.c:lh_OBJ_NAME_get_down_load:
  289|      4|    { \
  290|      4|        return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \
  291|      4|    } \
o_names.c:lh_OBJ_NAME_set_down_load:
  294|      7|    { \
  295|      7|        OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \
  296|      7|    } \
o_names.c:lh_OBJ_NAME_doall:
  311|      4|    { \
  312|      4|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      4|    } \
o_names.c:lh_OBJ_NAME_free:
  254|      1|    { \
  255|      1|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      1|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  254|      1|    { \
  255|      1|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      1|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_new:
  317|      1|    { \
  318|      1|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      1|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      1|                                lh_##type##_doall_thunk, \
  321|      1|                                lh_##type##_doall_arg_thunk); \
  322|      1|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_doall:
  311|      1|    { \
  312|      1|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      1|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_free:
  254|      1|    { \
  255|      1|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      1|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_type:
  196|  4.38k|    { \
  197|  4.38k|        return (OPENSSL_LHASH *)lh; \
  198|  4.38k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_hashfunc_type:
  206|      1|    { \
  207|      1|        return (OPENSSL_LH_HASHFUNC)hfn; \
  208|      1|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_compfunc_type:
  201|      1|    { \
  202|      1|        return (OPENSSL_LH_COMPFUNC)cmp; \
  203|      1|    } \
err.c:lh_ERR_STRING_DATA_hash_thunk:
  160|  4.37k|    { \
  161|  4.37k|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  162|  4.37k|        return hfn_conv((const type *)data); \
  163|  4.37k|    } \
err.c:lh_ERR_STRING_DATA_comp_thunk:
  165|  2.94k|    { \
  166|  2.94k|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  167|  2.94k|        return cfn_conv((const type *)da, (const type *)db); \
  168|  2.94k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_plain_type:
  181|  4.31k|    { \
  182|  4.31k|        return ptr; \
  183|  4.31k|    } \
err.c:ossl_check_const_ERR_STRING_DATA_lh_plain_type:
  186|     68|    { \
  187|     68|        return ptr; \
  188|     68|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_doall:
  311|      1|    { \
  312|      1|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      1|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_free:
  254|      1|    { \
  255|      1|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      1|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_new:
  317|      1|    { \
  318|      1|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      1|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      1|                                lh_##type##_doall_thunk, \
  321|      1|                                lh_##type##_doall_arg_thunk); \
  322|      1|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_hfn_thunk:
  243|    222|    { \
  244|    222|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|    222|        return hfn_conv((const type *)data); \
  246|    222|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_cfn_thunk:
  248|    219|    { \
  249|    219|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  250|    219|        return cfn_conv((const type *)da, (const type *)db); \
  251|    219|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_doall_thunk:
  299|      1|    { \
  300|      1|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|      1|        doall_conv((type *)node); \
  302|      1|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_retrieve:
  274|    221|    { \
  275|    221|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|    221|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_insert:
  264|      1|    { \
  265|      1|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|      1|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_error:
  279|      1|    { \
  280|      1|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|      1|    } \
property.c:lh_QUERY_doall:
  311|    220|    { \
  312|    220|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|    220|    } \
property.c:lh_QUERY_free:
  254|    220|    { \
  255|    220|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|    220|    } \
property.c:lh_QUERY_new:
  317|    220|    { \
  318|    220|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|    220|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|    220|                                lh_##type##_doall_thunk, \
  321|    220|                                lh_##type##_doall_arg_thunk); \
  322|    220|    } \
property.c:lh_QUERY_hfn_thunk:
  243|  1.42k|    { \
  244|  1.42k|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|  1.42k|        return hfn_conv((const type *)data); \
  246|  1.42k|    } \
property.c:lh_QUERY_cfn_thunk:
  248|  1.40k|    { \
  249|  1.40k|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  250|  1.40k|        return cfn_conv((const type *)da, (const type *)db); \
  251|  1.40k|    } \
property.c:lh_QUERY_doall_thunk:
  299|     14|    { \
  300|     14|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|     14|        doall_conv((type *)node); \
  302|     14|    } \
property.c:lh_QUERY_retrieve:
  274|  1.40k|    { \
  275|  1.40k|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|  1.40k|    } \
property.c:lh_QUERY_insert:
  264|     14|    { \
  265|     14|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|     14|    } \
property.c:lh_QUERY_error:
  279|     14|    { \
  280|     14|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|     14|    } \
property_string.c:lh_PROPERTY_STRING_doall:
  311|      2|    { \
  312|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      2|    } \
property_string.c:lh_PROPERTY_STRING_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \
property_string.c:lh_PROPERTY_STRING_new:
  317|      2|    { \
  318|      2|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      2|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      2|                                lh_##type##_doall_thunk, \
  321|      2|                                lh_##type##_doall_arg_thunk); \
  322|      2|    } \
property_string.c:lh_PROPERTY_STRING_hfn_thunk:
  243|     28|    { \
  244|     28|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|     28|        return hfn_conv((const type *)data); \
  246|     28|    } \
property_string.c:lh_PROPERTY_STRING_cfn_thunk:
  248|      1|    { \
  249|      1|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  250|      1|        return cfn_conv((const type *)da, (const type *)db); \
  251|      1|    } \
property_string.c:lh_PROPERTY_STRING_doall_thunk:
  299|      9|    { \
  300|      9|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|      9|        doall_conv((type *)node); \
  302|      9|    } \
property_string.c:lh_PROPERTY_STRING_retrieve:
  274|     19|    { \
  275|     19|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|     19|    } \
property_string.c:lh_PROPERTY_STRING_insert:
  264|      9|    { \
  265|      9|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|      9|    } \
property_string.c:lh_PROPERTY_STRING_error:
  279|      9|    { \
  280|      9|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|      9|    } \

obj_dat.c:OBJ_bsearch_ln:
  129|    435|      { \
  130|    435|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|    435|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|    435|      } \
obj_dat.c:ln_cmp_BSEARCH_CMP_FN:
  123|  4.43k|      { \
  124|  4.43k|      type1 const *a = a_; \
  125|  4.43k|      type2 const *b = b_; \
  126|  4.43k|      return nm##_cmp(a,b); \
  127|  4.43k|      } \
obj_dat.c:OBJ_bsearch_sn:
  129|    440|      { \
  130|    440|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|    440|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|    440|      } \
obj_dat.c:sn_cmp_BSEARCH_CMP_FN:
  123|  4.79k|      { \
  124|  4.79k|      type1 const *a = a_; \
  125|  4.79k|      type2 const *b = b_; \
  126|  4.79k|      return nm##_cmp(a,b); \
  127|  4.79k|      } \
ameth_lib.c:OBJ_bsearch_ameth:
  129|    875|      { \
  130|    875|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|    875|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|    875|      } \
ameth_lib.c:ameth_cmp_BSEARCH_CMP_FN:
  123|  3.49k|      { \
  124|  3.49k|      type1 const *a = a_; \
  125|  3.49k|      type2 const *b = b_; \
  126|  3.49k|      return nm##_cmp(a,b); \
  127|  3.49k|      } \

keymgmt_lib.c:sk_OP_CACHE_ELEM_pop_free:
  145|    244|    { \
  146|    244|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|    244|        \
  148|    244|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|    244|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|    244|        \
  151|    244|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|    244|    } \
p_lib.c:ossl_check_X509_ATTRIBUTE_sk_type:
   53|    244|    { \
   54|    244|        return (OPENSSL_STACK *)sk; \
   55|    244|    } \
p_lib.c:ossl_check_X509_ATTRIBUTE_freefunc_type:
   65|    244|    { \
   66|    244|        return (OPENSSL_sk_freefunc)fr; \
   67|    244|    }
core_namemap.c:sk_NAMES_value:
   84|    611|    { \
   85|    611|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|    611|    } \
core_namemap.c:ossl_check_const_OPENSSL_STRING_sk_type:
   49|  2.89k|    { \
   50|  2.89k|        return (const OPENSSL_STACK *)sk; \
   51|  2.89k|    } \
core_namemap.c:ossl_check_OPENSSL_STRING_sk_type:
   53|  1.05k|    { \
   54|  1.05k|        return (OPENSSL_STACK *)sk; \
   55|  1.05k|    } \
core_namemap.c:ossl_check_OPENSSL_STRING_type:
   45|    468|    { \
   46|    468|        return ptr; \
   47|    468|    } \
core_namemap.c:sk_NAMES_push:
  129|    220|    { \
  130|    220|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|    220|    } \
core_namemap.c:sk_NAMES_num:
   80|    220|    { \
   81|    220|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|    220|    } \
core_namemap.c:ossl_check_OPENSSL_STRING_freefunc_type:
   65|    220|    { \
   66|    220|        return (OPENSSL_sk_freefunc)fr; \
   67|    220|    }
core_namemap.c:sk_NAMES_new_null:
   96|      1|    { \
   97|      1|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      1|    } \
core_namemap.c:sk_NAMES_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
core_namemap.c:sk_NAMES_freefunc_thunk:
   75|    220|    { \
   76|    220|        sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc) freefunc_arg;\
   77|    220|        freefunc((t3 *)ptr);\
   78|    220|    } \
ex_data.c:sk_EX_CALLBACK_pop_free:
  145|     18|    { \
  146|     18|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|     18|        \
  148|     18|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|     18|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|     18|        \
  151|     18|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|     18|    } \
ex_data.c:sk_EX_CALLBACK_num:
   80|    488|    { \
   81|    488|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|    488|    } \
ex_data.c:ossl_check_void_sk_type:
   53|    244|    { \
   54|    244|        return (OPENSSL_STACK *)sk; \
   55|    244|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_new_null:
   96|      1|    { \
   97|      1|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      1|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_free:
  112|      1|    { \
  113|      1|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      1|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_push:
  129|      1|    { \
  130|      1|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      1|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_num:
   80|      3|    { \
   81|      3|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      3|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_value:
   84|      1|    { \
   85|      1|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|      1|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_delete:
  120|      1|    { \
  121|      1|        return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
  122|      1|    } \
provider_core.c:sk_INFOPAIR_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_freefunc_thunk:
   75|      1|    { \
   76|      1|        sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc) freefunc_arg;\
   77|      1|        freefunc((t3 *)ptr);\
   78|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_new:
   88|      1|    { \
   89|      1|        OPENSSL_STACK *ret = OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   90|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
   91|      1|        \
   92|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
   93|      1|        return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \
   94|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_new_null:
   96|      1|    { \
   97|      1|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_sort:
  174|      3|    { \
  175|      3|        OPENSSL_sk_sort((OPENSSL_STACK *)sk); \
  176|      3|    } \
provider_core.c:sk_OSSL_PROVIDER_find:
  162|      3|    { \
  163|      3|        return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \
  164|      3|    } \
provider_core.c:sk_OSSL_PROVIDER_value:
   84|    108|    { \
   85|    108|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|    108|    } \
provider_core.c:sk_INFOPAIR_deep_copy:
  188|      1|    { \
  189|      1|        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
  190|      1|                                            (OPENSSL_sk_copyfunc)copyfunc, \
  191|      1|                                            (OPENSSL_sk_freefunc)freefunc); \
  192|      1|    } \
provider_core.c:sk_OSSL_PROVIDER_push:
  129|      1|    { \
  130|      1|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      1|    } \
provider_core.c:sk_INFOPAIR_num:
   80|    732|    { \
   81|    732|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|    732|    } \
provider_core.c:sk_OSSL_PROVIDER_dup:
  182|     35|    { \
  183|     35|        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
  184|     35|    } \
provider_core.c:sk_OSSL_PROVIDER_num:
   80|     35|    { \
   81|     35|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|     35|    } \
provider_core.c:sk_OSSL_PROVIDER_free:
  112|     35|    { \
  113|     35|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|     35|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_num:
   80|      1|    { \
   81|      1|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      1|    } \
o_names.c:sk_NAME_FUNCS_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
obj_xref.c:sk_nid_triple_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
obj_xref.c:sk_nid_triple_free:
  112|      1|    { \
  113|      1|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      1|    } \
conf_mod.c:sk_CONF_IMODULE_free:
  112|      2|    { \
  113|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      2|    } \
conf_mod.c:sk_CONF_MODULE_dup:
  182|      1|    { \
  183|      1|        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
  184|      1|    } \
conf_mod.c:sk_CONF_MODULE_new_null:
   96|      1|    { \
   97|      1|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      1|    } \
conf_mod.c:sk_CONF_MODULE_num:
   80|      2|    { \
   81|      2|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      2|    } \
conf_mod.c:sk_CONF_MODULE_free:
  112|      3|    { \
  113|      3|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      3|    } \
conf_mod.c:sk_CONF_MODULE_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   80|      1|    { \
   81|      1|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      1|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_new_null:
   96|      3|    { \
   97|      3|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      3|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_pop:
  137|      9|    { \
  138|      9|        return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \
  139|      9|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_free:
  112|      3|    { \
  113|      3|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      3|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_push:
  129|      9|    { \
  130|      9|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      9|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_num:
   80|     12|    { \
   81|     12|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|     12|    } \
param_build.c:sk_OSSL_PARAM_BLD_DEF_value:
   84|      9|    { \
   85|      9|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|      9|    } \
provider_conf.c:sk_OSSL_PROVIDER_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
property.c:sk_IMPLEMENTATION_pop_free:
  145|    220|    { \
  146|    220|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|    220|        \
  148|    220|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|    220|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|    220|        \
  151|    220|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|    220|    } \
property.c:sk_IMPLEMENTATION_freefunc_thunk:
   75|    220|    { \
   76|    220|        sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc) freefunc_arg;\
   77|    220|        freefunc((t3 *)ptr);\
   78|    220|    } \
property.c:sk_IMPLEMENTATION_new_null:
   96|    220|    { \
   97|    220|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|    220|    } \
property.c:sk_IMPLEMENTATION_num:
   80|    454|    { \
   81|    454|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|    454|    } \
property.c:sk_IMPLEMENTATION_value:
   84|     14|    { \
   85|     14|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|     14|    } \
property.c:sk_IMPLEMENTATION_push:
  129|    220|    { \
  130|    220|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|    220|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_new:
   88|     15|    { \
   89|     15|        OPENSSL_STACK *ret = OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   90|     15|        OPENSSL_sk_freefunc_thunk f_thunk; \
   91|     15|        \
   92|     15|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
   93|     15|        return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \
   94|     15|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_freefunc_thunk:
   75|      1|    { \
   76|      1|        sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc) freefunc_arg;\
   77|      1|        freefunc((t3 *)ptr);\
   78|      1|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_push:
  129|      1|    { \
  130|      1|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      1|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_num:
   80|     15|    { \
   81|     15|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|     15|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_sort:
  174|     15|    { \
  175|     15|        OPENSSL_sk_sort((OPENSSL_STACK *)sk); \
  176|     15|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_value:
   84|      1|    { \
   85|      1|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|      1|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_pop_free:
  145|     15|    { \
  146|     15|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|     15|        \
  148|     15|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|     15|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|     15|        \
  151|     15|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|     15|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_sk_type:
   53|     11|    { \
   54|     11|        return (OPENSSL_STACK *)sk; \
   55|     11|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_type:
   45|      9|    { \
   46|      9|        return ptr; \
   47|      9|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
  145|      1|    { \
  146|      1|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      1|        \
  148|      1|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      1|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      1|        \
  151|      1|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      1|    } \
comp_methods.c:ossl_check_SSL_COMP_compfunc_type:
   57|      1|    { \
   58|      1|        return (OPENSSL_sk_compfunc)cmp; \
   59|      1|    } \
comp_methods.c:ossl_check_SSL_COMP_sk_type:
   53|      1|    { \
   54|      1|        return (OPENSSL_STACK *)sk; \
   55|      1|    } \
comp_methods.c:ossl_check_SSL_COMP_freefunc_type:
   65|      1|    { \
   66|      1|        return (OPENSSL_sk_freefunc)fr; \
   67|      1|    }

ossl_prov_bio_from_dispatch:
   27|      1|{
   28|     53|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (28:12): [True: 52, False: 1]
  ------------------
   29|     52|        switch (fns->function_id) {
  ------------------
  |  Branch (29:17): [True: 42, False: 10]
  ------------------
   30|      1|        case OSSL_FUNC_BIO_NEW_FILE:
  ------------------
  |  |  156|      1|#define OSSL_FUNC_BIO_NEW_FILE                40
  ------------------
  |  Branch (30:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  157|      1|#define OSSL_FUNC_BIO_NEW_MEMBUF              41
  ------------------
  |  Branch (34:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  158|      1|#define OSSL_FUNC_BIO_READ_EX                 42
  ------------------
  |  Branch (38:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  159|      1|#define OSSL_FUNC_BIO_WRITE_EX                43
  ------------------
  |  Branch (42:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  165|      1|#define OSSL_FUNC_BIO_GETS                    49
  ------------------
  |  Branch (46:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  164|      1|#define OSSL_FUNC_BIO_PUTS                    48
  ------------------
  |  Branch (50:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  166|      1|#define OSSL_FUNC_BIO_CTRL                    50
  ------------------
  |  Branch (54:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  160|      1|#define OSSL_FUNC_BIO_UP_REF                  44
  ------------------
  |  Branch (58:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  161|      1|#define OSSL_FUNC_BIO_FREE                    45
  ------------------
  |  Branch (62:9): [True: 1, False: 51]
  ------------------
   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:
  ------------------
  |  |  162|      1|#define OSSL_FUNC_BIO_VPRINTF                 46
  ------------------
  |  Branch (66:9): [True: 1, False: 51]
  ------------------
   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|     52|        }
   71|     52|    }
   72|       |
   73|      1|    return 1;
   74|      1|}
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|}

sha3_prov.c:ossl_param_is_empty:
   30|  4.61k|{
   31|  4.61k|    return params == NULL || params->key == NULL;
  ------------------
  |  Branch (31:12): [True: 3.04k, False: 1.56k]
  |  Branch (31:30): [True: 0, False: 1.56k]
  ------------------
   32|  4.61k|}
ml_kem_kem.c:ossl_param_is_empty:
   30|     92|{
   31|     92|    return params == NULL || params->key == NULL;
  ------------------
  |  Branch (31:12): [True: 92, False: 0]
  |  Branch (31:30): [True: 0, False: 0]
  ------------------
   32|     92|}
ml_kem_kmgmt.c:ossl_param_is_empty:
   30|    166|{
   31|    166|    return params == NULL || params->key == NULL;
  ------------------
  |  Branch (31:12): [True: 166, False: 0]
  |  Branch (31:30): [True: 0, False: 0]
  ------------------
   32|    166|}
ciphercommon.c:ossl_param_is_empty:
   30|  1.06k|{
   31|  1.06k|    return params == NULL || params->key == NULL;
  ------------------
  |  Branch (31:12): [True: 1.06k, False: 0]
  |  Branch (31:30): [True: 0, False: 0]
  ------------------
   32|  1.06k|}
drbg.c:ossl_param_is_empty:
   30|      3|{
   31|      3|    return params == NULL || params->key == NULL;
  ------------------
  |  Branch (31:12): [True: 0, False: 3]
  |  Branch (31:30): [True: 0, False: 3]
  ------------------
   32|      3|}

ossl_prov_ctx_new:
   16|      1|{
   17|      1|    return OPENSSL_zalloc(sizeof(PROV_CTX));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   18|      1|}
ossl_prov_ctx_free:
   21|      1|{
   22|      1|    OPENSSL_free(ctx);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   23|      1|}
ossl_prov_ctx_set0_libctx:
   26|      1|{
   27|      1|    if (ctx != NULL)
  ------------------
  |  Branch (27:9): [True: 1, False: 0]
  ------------------
   28|      1|        ctx->libctx = libctx;
   29|      1|}
ossl_prov_ctx_set0_handle:
   32|      1|{
   33|      1|    if (ctx != NULL)
  ------------------
  |  Branch (33:9): [True: 1, False: 0]
  ------------------
   34|      1|        ctx->handle = handle;
   35|      1|}
ossl_prov_ctx_set0_core_bio_method:
   38|      1|{
   39|      1|    if (ctx != NULL)
  ------------------
  |  Branch (39:9): [True: 1, False: 0]
  ------------------
   40|      1|        ctx->corebiometh = corebiometh;
   41|      1|}
ossl_prov_ctx_set0_core_get_params:
   46|      1|{
   47|      1|    if (ctx != NULL)
  ------------------
  |  Branch (47:9): [True: 1, False: 0]
  ------------------
   48|      1|        ctx->core_get_params = c_get_params;
   49|      1|}
ossl_prov_ctx_get0_libctx:
   52|    256|{
   53|    256|    if (ctx == NULL)
  ------------------
  |  Branch (53:9): [True: 0, False: 256]
  ------------------
   54|      0|        return NULL;
   55|    256|    return ctx->libctx;
   56|    256|}
ossl_prov_ctx_get0_core_bio_method:
   66|      1|{
   67|      1|    if (ctx == NULL)
  ------------------
  |  Branch (67:9): [True: 0, False: 1]
  ------------------
   68|      0|        return NULL;
   69|      1|    return ctx->corebiometh;
   70|      1|}
ossl_prov_ctx_get_param:
   81|    732|{
   82|    732|    char *val = NULL;
   83|    732|    OSSL_PARAM param[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    732|    { NULL, 0, NULL, 0, 0 }
  ------------------
                  OSSL_PARAM param[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    732|    { NULL, 0, NULL, 0, 0 }
  ------------------
   84|       |
   85|    732|    if (ctx == NULL
  ------------------
  |  Branch (85:9): [True: 0, False: 732]
  ------------------
   86|    732|        || ctx->handle == NULL
  ------------------
  |  Branch (86:12): [True: 0, False: 732]
  ------------------
   87|    732|        || ctx->core_get_params == NULL)
  ------------------
  |  Branch (87:12): [True: 0, False: 732]
  ------------------
   88|      0|        return defval;
   89|       |
   90|    732|    param[0].key = (char *) name;
   91|    732|    param[0].data_type = OSSL_PARAM_UTF8_PTR;
  ------------------
  |  |  141|    732|# define OSSL_PARAM_UTF8_PTR             6
  ------------------
   92|    732|    param[0].data = (void *) &val;
   93|    732|    param[0].data_size = sizeof(val);
   94|    732|    param[0].return_size = OSSL_PARAM_UNMODIFIED;
  ------------------
  |  |   22|    732|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  ------------------
   95|       |
   96|       |    /* Errors are ignored, returning the default value */
   97|    732|    if (ctx->core_get_params(ctx->handle, param)
  ------------------
  |  Branch (97:9): [True: 732, False: 0]
  ------------------
   98|    732|        && OSSL_PARAM_modified(param)
  ------------------
  |  Branch (98:12): [True: 0, False: 732]
  ------------------
   99|    732|        && val != NULL)
  ------------------
  |  Branch (99:12): [True: 0, False: 0]
  ------------------
  100|      0|        return val;
  101|    732|    return defval;
  102|    732|}
ossl_prov_ctx_get_bool_param:
  105|    488|{
  106|    488|    const char *val = ossl_prov_ctx_get_param(ctx, name, NULL);
  107|       |
  108|    488|    if (val != NULL) {
  ------------------
  |  Branch (108:9): [True: 0, False: 488]
  ------------------
  109|      0|        if ((strcmp(val, "1") == 0)
  ------------------
  |  Branch (109:13): [True: 0, False: 0]
  ------------------
  110|      0|            || (OPENSSL_strcasecmp(val, "yes") == 0)
  ------------------
  |  Branch (110:16): [True: 0, False: 0]
  ------------------
  111|      0|            || (OPENSSL_strcasecmp(val, "true") == 0)
  ------------------
  |  Branch (111:16): [True: 0, False: 0]
  ------------------
  112|      0|            || (OPENSSL_strcasecmp(val, "on") == 0))
  ------------------
  |  Branch (112:16): [True: 0, False: 0]
  ------------------
  113|      0|            return 1;
  114|      0|        else if ((strcmp(val, "0") == 0)
  ------------------
  |  Branch (114:18): [True: 0, False: 0]
  ------------------
  115|      0|                 || (OPENSSL_strcasecmp(val, "no") == 0)
  ------------------
  |  Branch (115:21): [True: 0, False: 0]
  ------------------
  116|      0|                 || (OPENSSL_strcasecmp(val, "false") == 0)
  ------------------
  |  Branch (116:21): [True: 0, False: 0]
  ------------------
  117|      0|                 || (OPENSSL_strcasecmp(val, "off") == 0))
  ------------------
  |  Branch (117:21): [True: 0, False: 0]
  ------------------
  118|      0|            return 0;
  119|      0|    }
  120|    488|    return defval;
  121|    488|}

ossl_err_load_PROV_strings:
  259|      1|{
  260|      1|#ifndef OPENSSL_NO_ERR
  261|      1|    if (ERR_reason_error_string(PROV_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (261:9): [True: 1, False: 0]
  ------------------
  262|      1|        ERR_load_strings_const(PROV_str_reasons);
  263|      1|#endif
  264|      1|    return 1;
  265|      1|}

ossl_prov_seeding_from_dispatch:
   42|      1|{
   43|     53|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (43:12): [True: 52, False: 1]
  ------------------
   44|       |        /*
   45|       |         * We do not support the scenario of an application linked against
   46|       |         * multiple versions of libcrypto (e.g. one static and one dynamic), but
   47|       |         * sharing a single fips.so. We do a simple sanity check here.
   48|       |         */
   49|     52|#define set_func(c, f) \
   50|     52|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
   51|     52|        switch (fns->function_id) {
  ------------------
  |  Branch (51:17): [True: 44, False: 8]
  ------------------
   52|      1|        case OSSL_FUNC_GET_ENTROPY:
  ------------------
  |  |  201|      1|#define OSSL_FUNC_GET_ENTROPY                101
  ------------------
  |  Branch (52:9): [True: 1, False: 51]
  ------------------
   53|      1|            set_func(c_get_entropy, OSSL_FUNC_get_entropy(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   54|      1|            break;
   55|      1|        case OSSL_FUNC_GET_USER_ENTROPY:
  ------------------
  |  |  190|      1|#define OSSL_FUNC_GET_USER_ENTROPY            98
  ------------------
  |  Branch (55:9): [True: 1, False: 51]
  ------------------
   56|      1|            set_func(c_get_user_entropy, OSSL_FUNC_get_user_entropy(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   57|      1|            break;
   58|      1|        case OSSL_FUNC_CLEANUP_ENTROPY:
  ------------------
  |  |  202|      1|#define OSSL_FUNC_CLEANUP_ENTROPY            102
  ------------------
  |  Branch (58:9): [True: 1, False: 51]
  ------------------
   59|      1|            set_func(c_cleanup_entropy, OSSL_FUNC_cleanup_entropy(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   60|      1|            break;
   61|      1|        case OSSL_FUNC_CLEANUP_USER_ENTROPY:
  ------------------
  |  |  188|      1|#define OSSL_FUNC_CLEANUP_USER_ENTROPY        96
  ------------------
  |  Branch (61:9): [True: 1, False: 51]
  ------------------
   62|      1|            set_func(c_cleanup_user_entropy, OSSL_FUNC_cleanup_user_entropy(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   63|      1|            break;
   64|      1|        case OSSL_FUNC_GET_NONCE:
  ------------------
  |  |  203|      1|#define OSSL_FUNC_GET_NONCE                  103
  ------------------
  |  Branch (64:9): [True: 1, False: 51]
  ------------------
   65|      1|            set_func(c_get_nonce, OSSL_FUNC_get_nonce(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   66|      1|            break;
   67|      1|        case OSSL_FUNC_GET_USER_NONCE:
  ------------------
  |  |  191|      1|#define OSSL_FUNC_GET_USER_NONCE              99
  ------------------
  |  Branch (67:9): [True: 1, False: 51]
  ------------------
   68|      1|            set_func(c_get_user_nonce, OSSL_FUNC_get_user_nonce(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   69|      1|            break;
   70|      1|        case OSSL_FUNC_CLEANUP_NONCE:
  ------------------
  |  |  204|      1|#define OSSL_FUNC_CLEANUP_NONCE              104
  ------------------
  |  Branch (70:9): [True: 1, False: 51]
  ------------------
   71|      1|            set_func(c_cleanup_nonce, OSSL_FUNC_cleanup_nonce(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   72|      1|            break;
   73|      1|        case OSSL_FUNC_CLEANUP_USER_NONCE:
  ------------------
  |  |  189|      1|#define OSSL_FUNC_CLEANUP_USER_NONCE          97
  ------------------
  |  Branch (73:9): [True: 1, False: 51]
  ------------------
   74|      1|            set_func(c_cleanup_user_nonce, OSSL_FUNC_cleanup_user_nonce(fns));
  ------------------
  |  |   50|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (50:14): [True: 1, False: 0]
  |  |  |  Branch (50:41): [True: 0, False: 0]
  |  |  |  Branch (50:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   75|      1|            break;
   76|     52|        }
   77|     52|#undef set_func
   78|     52|    }
   79|      1|    return 1;
   80|      1|}

ossl_prov_cache_exported_algorithms:
  349|      1|{
  350|      1|    int i, j;
  351|       |
  352|      1|    if (out[0].algorithm_names == NULL) {
  ------------------
  |  Branch (352:9): [True: 1, False: 0]
  ------------------
  353|    140|        for (i = j = 0; in[i].alg.algorithm_names != NULL; ++i) {
  ------------------
  |  Branch (353:25): [True: 139, False: 1]
  ------------------
  354|    139|            if (in[i].capable == NULL || in[i].capable())
  ------------------
  |  Branch (354:17): [True: 126, False: 13]
  |  Branch (354:42): [True: 4, False: 9]
  ------------------
  355|    130|                out[j++] = in[i].alg;
  356|    139|        }
  357|      1|        out[j++] = in[i].alg;
  358|      1|    }
  359|      1|}

ossl_default_provider_init:
  745|      1|{
  746|      1|    OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
  747|      1|    BIO_METHOD *corebiometh;
  748|       |
  749|      1|    if (!ossl_prov_bio_from_dispatch(in)
  ------------------
  |  Branch (749:9): [True: 0, False: 1]
  ------------------
  750|      1|            || !ossl_prov_seeding_from_dispatch(in))
  ------------------
  |  Branch (750:16): [True: 0, False: 1]
  ------------------
  751|      0|        return 0;
  752|     53|    for (; in->function_id != 0; in++) {
  ------------------
  |  Branch (752:12): [True: 52, False: 1]
  ------------------
  753|     52|        switch (in->function_id) {
  754|      1|        case OSSL_FUNC_CORE_GETTABLE_PARAMS:
  ------------------
  |  |   71|      1|# define OSSL_FUNC_CORE_GETTABLE_PARAMS        1
  ------------------
  |  Branch (754:9): [True: 1, False: 51]
  ------------------
  755|      1|            c_gettable_params = OSSL_FUNC_core_gettable_params(in);
  756|      1|            break;
  757|      1|        case OSSL_FUNC_CORE_GET_PARAMS:
  ------------------
  |  |   74|      1|# define OSSL_FUNC_CORE_GET_PARAMS             2
  ------------------
  |  Branch (757:9): [True: 1, False: 51]
  ------------------
  758|      1|            c_get_params = OSSL_FUNC_core_get_params(in);
  759|      1|            break;
  760|      1|        case OSSL_FUNC_CORE_GET_LIBCTX:
  ------------------
  |  |   81|      1|# define OSSL_FUNC_CORE_GET_LIBCTX             4
  ------------------
  |  Branch (760:9): [True: 1, False: 51]
  ------------------
  761|      1|            c_get_libctx = OSSL_FUNC_core_get_libctx(in);
  762|      1|            break;
  763|     49|        default:
  ------------------
  |  Branch (763:9): [True: 49, False: 3]
  ------------------
  764|       |            /* Just ignore anything we don't understand */
  765|     49|            break;
  766|     52|        }
  767|     52|    }
  768|       |
  769|      1|    if (c_get_libctx == NULL)
  ------------------
  |  Branch (769:9): [True: 0, False: 1]
  ------------------
  770|      0|        return 0;
  771|       |
  772|       |    /*
  773|       |     * We want to make sure that all calls from this provider that requires
  774|       |     * a library context use the same context as the one used to call our
  775|       |     * functions.  We do that by passing it along in the provider context.
  776|       |     *
  777|       |     * This only works for built-in providers.  Most providers should
  778|       |     * create their own library context.
  779|       |     */
  780|      1|    if ((*provctx = ossl_prov_ctx_new()) == NULL
  ------------------
  |  Branch (780:9): [True: 0, False: 1]
  ------------------
  781|      1|            || (corebiometh = ossl_bio_prov_init_bio_method()) == NULL) {
  ------------------
  |  Branch (781:16): [True: 0, False: 1]
  ------------------
  782|      0|        ossl_prov_ctx_free(*provctx);
  783|      0|        *provctx = NULL;
  784|      0|        return 0;
  785|      0|    }
  786|      1|    ossl_prov_ctx_set0_libctx(*provctx,
  787|      1|                                       (OSSL_LIB_CTX *)c_get_libctx(handle));
  788|      1|    ossl_prov_ctx_set0_handle(*provctx, handle);
  789|      1|    ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);
  790|      1|    ossl_prov_ctx_set0_core_get_params(*provctx, c_get_params);
  791|       |
  792|      1|    *out = deflt_dispatch_table;
  793|      1|    ossl_prov_cache_exported_algorithms(deflt_ciphers, exported_ciphers);
  794|       |
  795|      1|    return 1;
  796|      1|}
defltprov.c:deflt_teardown:
  723|      1|{
  724|      1|    BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx));
  725|      1|    ossl_prov_ctx_free(provctx);
  726|      1|}
defltprov.c:deflt_query:
  686|     57|{
  687|     57|    *no_cache = 0;
  688|     57|    switch (operation_id) {
  ------------------
  |  Branch (688:13): [True: 0, False: 57]
  ------------------
  689|      4|    case OSSL_OP_DIGEST:
  ------------------
  |  |  310|      4|# define OSSL_OP_DIGEST                              1
  ------------------
  |  Branch (689:5): [True: 4, False: 53]
  ------------------
  690|      4|        return deflt_digests;
  691|      2|    case OSSL_OP_CIPHER:
  ------------------
  |  |  311|      2|# define OSSL_OP_CIPHER                              2   /* Symmetric Ciphers */
  ------------------
  |  Branch (691:5): [True: 2, False: 55]
  ------------------
  692|      2|        return exported_ciphers;
  693|      0|    case OSSL_OP_MAC:
  ------------------
  |  |  312|      0|# define OSSL_OP_MAC                                 3
  ------------------
  |  Branch (693:5): [True: 0, False: 57]
  ------------------
  694|      0|        return deflt_macs;
  695|      0|    case OSSL_OP_KDF:
  ------------------
  |  |  313|      0|# define OSSL_OP_KDF                                 4
  ------------------
  |  Branch (695:5): [True: 0, False: 57]
  ------------------
  696|      0|        return deflt_kdfs;
  697|      2|    case OSSL_OP_RAND:
  ------------------
  |  |  314|      2|# define OSSL_OP_RAND                                5
  ------------------
  |  Branch (697:5): [True: 2, False: 55]
  ------------------
  698|      2|        return deflt_rands;
  699|      6|    case OSSL_OP_KEYMGMT:
  ------------------
  |  |  315|      6|# define OSSL_OP_KEYMGMT                            10
  ------------------
  |  Branch (699:5): [True: 6, False: 51]
  ------------------
  700|      6|        return deflt_keymgmt;
  701|     40|    case OSSL_OP_KEYEXCH:
  ------------------
  |  |  316|     40|# define OSSL_OP_KEYEXCH                            11
  ------------------
  |  Branch (701:5): [True: 40, False: 17]
  ------------------
  702|     40|        return deflt_keyexch;
  703|      0|    case OSSL_OP_SIGNATURE:
  ------------------
  |  |  317|      0|# define OSSL_OP_SIGNATURE                          12
  ------------------
  |  Branch (703:5): [True: 0, False: 57]
  ------------------
  704|      0|        return deflt_signature;
  705|      0|    case OSSL_OP_ASYM_CIPHER:
  ------------------
  |  |  318|      0|# define OSSL_OP_ASYM_CIPHER                        13
  ------------------
  |  Branch (705:5): [True: 0, False: 57]
  ------------------
  706|      0|        return deflt_asym_cipher;
  707|      3|    case OSSL_OP_KEM:
  ------------------
  |  |  319|      3|# define OSSL_OP_KEM                                14
  ------------------
  |  Branch (707:5): [True: 3, False: 54]
  ------------------
  708|      3|        return deflt_asym_kem;
  709|      0|    case OSSL_OP_ENCODER:
  ------------------
  |  |  322|      0|# define OSSL_OP_ENCODER                            20
  ------------------
  |  Branch (709:5): [True: 0, False: 57]
  ------------------
  710|      0|        return deflt_encoder;
  711|      0|    case OSSL_OP_DECODER:
  ------------------
  |  |  323|      0|# define OSSL_OP_DECODER                            21
  ------------------
  |  Branch (711:5): [True: 0, False: 57]
  ------------------
  712|      0|        return deflt_decoder;
  713|      0|    case OSSL_OP_STORE:
  ------------------
  |  |  324|      0|# define OSSL_OP_STORE                              22
  ------------------
  |  Branch (713:5): [True: 0, False: 57]
  ------------------
  714|      0|        return deflt_store;
  715|      0|    case OSSL_OP_SKEYMGMT:
  ------------------
  |  |  320|      0|# define OSSL_OP_SKEYMGMT                           15
  ------------------
  |  Branch (715:5): [True: 0, False: 57]
  ------------------
  716|      0|        return deflt_skeymgmt;
  717|     57|    }
  718|      0|    return NULL;
  719|     57|}

cipher_aes.c:aes_freectx:
   27|      9|{
   28|      9|    PROV_AES_CTX *ctx = (PROV_AES_CTX *)vctx;
   29|       |
   30|      9|    ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
   31|      9|    OPENSSL_clear_free(ctx,  sizeof(*ctx));
  ------------------
  |  |  113|      9|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   32|      9|}

cipher_aes_cbc_hmac_sha.c:aes_128_cbc_hmac_sha1_get_params:
  402|      1|static int nm##_##kbits##_##sub##_get_params(OSSL_PARAM params[])              \
  403|      1|{                                                                              \
  404|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_CBC_MODE,           \
  ------------------
  |  |  323|      1|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  405|      1|                                          flags, kbits, blkbits, ivbits);      \
  406|      1|}                                                                              \
cipher_aes_cbc_hmac_sha.c:aes_gettable_ctx_params:
  303|      4|{
  304|      4|    return cipher_aes_known_gettable_ctx_params;
  305|      4|}
cipher_aes_cbc_hmac_sha.c:aes_256_cbc_hmac_sha1_get_params:
  402|      1|static int nm##_##kbits##_##sub##_get_params(OSSL_PARAM params[])              \
  403|      1|{                                                                              \
  404|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_CBC_MODE,           \
  ------------------
  |  |  323|      1|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  405|      1|                                          flags, kbits, blkbits, ivbits);      \
  406|      1|}                                                                              \
cipher_aes_cbc_hmac_sha.c:aes_128_cbc_hmac_sha256_get_params:
  402|      1|static int nm##_##kbits##_##sub##_get_params(OSSL_PARAM params[])              \
  403|      1|{                                                                              \
  404|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_CBC_MODE,           \
  ------------------
  |  |  323|      1|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  405|      1|                                          flags, kbits, blkbits, ivbits);      \
  406|      1|}                                                                              \
cipher_aes_cbc_hmac_sha.c:aes_256_cbc_hmac_sha256_get_params:
  402|      1|static int nm##_##kbits##_##sub##_get_params(OSSL_PARAM params[])              \
  403|      1|{                                                                              \
  404|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_CBC_MODE,           \
  ------------------
  |  |  323|      1|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  405|      1|                                          flags, kbits, blkbits, ivbits);      \
  406|      1|}                                                                              \

ossl_cipher_capable_aes_cbc_hmac_sha1_etm:
   14|      3|{
   15|      3|    return 0;
   16|      3|}

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

ossl_cipher_capable_aes_cbc_hmac_sha256_etm:
   14|      3|{
   15|      3|    return 0;
   16|      3|}

ossl_cipher_capable_aes_cbc_hmac_sha256:
   41|      2|{
   42|      2|    return AESNI_CBC_HMAC_SHA_CAPABLE
  ------------------
  |  |  177|      4|#  define AESNI_CBC_HMAC_SHA_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (177: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|}

ossl_cipher_capable_aes_cbc_hmac_sha512_etm:
   20|      3|{
   21|      3|    return 0;
   22|      3|}

cipher_aes_gcm_siv.c:ossl_aes_128_gcm_siv_get_params:
  287|      1|static int ossl_##alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])                                \
  288|      1|{                                                                                                       \
  289|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,                             \
  290|      1|                                          flags, kbits, blkbits, ivbits);                               \
  291|      1|}                                                                                                       \
cipher_aes_gcm_siv.c:ossl_aes_gcm_siv_gettable_ctx_params:
  211|      3|{
  212|      3|    return aes_gcm_siv_known_gettable_ctx_params;
  213|      3|}
cipher_aes_gcm_siv.c:ossl_aes_192_gcm_siv_get_params:
  287|      1|static int ossl_##alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])                                \
  288|      1|{                                                                                                       \
  289|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,                             \
  290|      1|                                          flags, kbits, blkbits, ivbits);                               \
  291|      1|}                                                                                                       \
cipher_aes_gcm_siv.c:ossl_aes_256_gcm_siv_get_params:
  287|      1|static int ossl_##alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])                                \
  288|      1|{                                                                                                       \
  289|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,                             \
  290|      1|                                          flags, kbits, blkbits, ivbits);                               \
  291|      1|}                                                                                                       \

ossl_prov_cipher_hw_aes_ecb:
  133|      6|const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_##mode(size_t keybits)           \
  134|      6|{                                                                              \
  135|      6|    PROV_CIPHER_HW_select(mode)                                                \
  ------------------
  |  |   82|      6|#define PROV_CIPHER_HW_select(mode)                                            \
  |  |   83|      6|if (AESNI_CAPABLE)                                                             \
  |  |  ------------------
  |  |  |  |  195|      6|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:27): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   84|      6|    return &aesni_##mode;
  ------------------
  136|      6|    return &aes_##mode;                                                        \
  137|      6|}
ossl_prov_cipher_hw_aes_ctr:
  133|      3|const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_##mode(size_t keybits)           \
  134|      3|{                                                                              \
  135|      3|    PROV_CIPHER_HW_select(mode)                                                \
  ------------------
  |  |   82|      3|#define PROV_CIPHER_HW_select(mode)                                            \
  |  |   83|      3|if (AESNI_CAPABLE)                                                             \
  |  |  ------------------
  |  |  |  |  195|      3|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:27): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   84|      3|    return &aesni_##mode;
  ------------------
  136|      3|    return &aes_##mode;                                                        \
  137|      3|}

cipher_aes_hw.c:cipher_hw_aesni_initkey:
   23|    715|{
   24|    715|    int ret;
   25|    715|    PROV_AES_CTX *adat = (PROV_AES_CTX *)dat;
   26|    715|    AES_KEY *ks = &adat->ks.ks;
   27|       |
   28|    715|    dat->ks = ks;
   29|       |
   30|    715|    if ((dat->mode == EVP_CIPH_ECB_MODE || dat->mode == EVP_CIPH_CBC_MODE)
  ------------------
  |  |  322|  1.43k|# define         EVP_CIPH_ECB_MODE               0x1
  ------------------
                  if ((dat->mode == EVP_CIPH_ECB_MODE || dat->mode == EVP_CIPH_CBC_MODE)
  ------------------
  |  |  323|    350|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  |  Branch (30:10): [True: 365, False: 350]
  |  Branch (30:44): [True: 0, False: 350]
  ------------------
   31|    715|        && !dat->enc) {
  ------------------
  |  Branch (31:12): [True: 0, False: 365]
  ------------------
   32|      0|        ret = aesni_set_decrypt_key(key, keylen * 8, ks);
   33|      0|        dat->block = (block128_f) aesni_decrypt;
   34|      0|        dat->stream.cbc = dat->mode == EVP_CIPH_CBC_MODE ?
  ------------------
  |  |  323|      0|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  |  Branch (34:27): [True: 0, False: 0]
  ------------------
   35|      0|            (cbc128_f) aesni_cbc_encrypt : NULL;
   36|    715|    } else {
   37|    715|        ret = aesni_set_encrypt_key(key, keylen * 8, ks);
   38|    715|        dat->block = (block128_f) aesni_encrypt;
   39|    715|        if (dat->mode == EVP_CIPH_CBC_MODE)
  ------------------
  |  |  323|    715|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  |  Branch (39:13): [True: 0, False: 715]
  ------------------
   40|      0|            dat->stream.cbc = (cbc128_f) aesni_cbc_encrypt;
   41|    715|        else if (dat->mode == EVP_CIPH_CTR_MODE)
  ------------------
  |  |  326|    715|# define         EVP_CIPH_CTR_MODE               0x5
  ------------------
  |  Branch (41:18): [True: 350, False: 365]
  ------------------
   42|    350|            dat->stream.ctr = (ctr128_f) aesni_ctr32_encrypt_blocks;
   43|    365|        else
   44|    365|            dat->stream.cbc = NULL;
   45|    715|    }
   46|       |
   47|    715|    if (ret < 0) {
  ------------------
  |  Branch (47:9): [True: 0, False: 715]
  ------------------
   48|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_KEY_SETUP_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   49|      0|        return 0;
   50|      0|    }
   51|       |
   52|    715|    return 1;
   53|    715|}
cipher_aes_hw.c:cipher_hw_aesni_ecb:
   67|    418|{
   68|    418|    if (len < ctx->blocksize)
  ------------------
  |  Branch (68:9): [True: 0, False: 418]
  ------------------
   69|      0|        return 1;
   70|       |
   71|    418|    aesni_ecb_encrypt(in, out, len, ctx->ks, ctx->enc);
   72|       |
   73|    418|    return 1;
   74|    418|}

cipher_aes_ocb.c:aes_256_ocb_get_params:
  528|      1|static int aes_##kbits##_##mode##_get_params(OSSL_PARAM params[])              \
  529|      1|{                                                                              \
  530|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  531|      1|                                          flags, kbits, blkbits, ivbits);      \
  532|      1|}                                                                              \
cipher_aes_ocb.c:cipher_ocb_gettable_ctx_params:
  488|      3|{
  489|      3|    return cipher_ocb_known_gettable_ctx_params;
  490|      3|}
cipher_aes_ocb.c:aes_192_ocb_get_params:
  528|      1|static int aes_##kbits##_##mode##_get_params(OSSL_PARAM params[])              \
  529|      1|{                                                                              \
  530|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  531|      1|                                          flags, kbits, blkbits, ivbits);      \
  532|      1|}                                                                              \
cipher_aes_ocb.c:aes_128_ocb_get_params:
  528|      1|static int aes_##kbits##_##mode##_get_params(OSSL_PARAM params[])              \
  529|      1|{                                                                              \
  530|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  531|      1|                                          flags, kbits, blkbits, ivbits);      \
  532|      1|}                                                                              \

cipher_aes_siv.c:aes_128_siv_get_params:
  260|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
  261|      1|{                                                                              \
  262|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  263|      1|                                          flags, 2*kbits, blkbits, ivbits);    \
  264|      1|}                                                                              \
cipher_aes_siv.c:aes_siv_gettable_ctx_params:
  186|      3|{
  187|      3|    return aes_siv_known_gettable_ctx_params;
  188|      3|}
cipher_aes_siv.c:aes_192_siv_get_params:
  260|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
  261|      1|{                                                                              \
  262|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  263|      1|                                          flags, 2*kbits, blkbits, ivbits);    \
  264|      1|}                                                                              \
cipher_aes_siv.c:aes_256_siv_get_params:
  260|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
  261|      1|{                                                                              \
  262|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  263|      1|                                          flags, 2*kbits, blkbits, ivbits);    \
  264|      1|}                                                                              \

cipher_aes_wrp.c:aes_256_wrap_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_192_wrap_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_128_wrap_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_256_wrappad_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_192_wrappad_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_128_wrappad_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_256_wrapinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_192_wrapinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_128_wrapinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_256_wrappadinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_192_wrappadinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \
cipher_aes_wrp.c:aes_128_wrappadinv_get_params:
  289|      1|    {                                                                          \
  290|      1|        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\
  291|      1|                                              flags, kbits, blkbits, ivbits);  \
  292|      1|    }                                                                          \

cipher_aes_xts.c:aes_256_xts_get_params:
  281|      1|static int aes_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])            \
  282|      1|{                                                                              \
  283|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  284|      1|                                     flags, 2 * kbits, AES_XTS_BLOCK_BITS,     \
  ------------------
  |  |   25|      1|#define AES_XTS_BLOCK_BITS 8
  ------------------
  285|      1|                                     AES_XTS_IV_BITS);                         \
  ------------------
  |  |   24|      1|#define AES_XTS_IV_BITS 128
  ------------------
  286|      1|}                                                                              \
cipher_aes_xts.c:aes_128_xts_get_params:
  281|      1|static int aes_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])            \
  282|      1|{                                                                              \
  283|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  284|      1|                                     flags, 2 * kbits, AES_XTS_BLOCK_BITS,     \
  ------------------
  |  |   25|      1|#define AES_XTS_BLOCK_BITS 8
  ------------------
  285|      1|                                     AES_XTS_IV_BITS);                         \
  ------------------
  |  |   24|      1|#define AES_XTS_IV_BITS 128
  ------------------
  286|      1|}                                                                              \

cipher_chacha20.c:chacha20_get_params:
   96|      1|{
   97|      1|    return ossl_cipher_generic_get_params(params, 0, CHACHA20_FLAGS,
  ------------------
  |  |   21|      1|#define CHACHA20_FLAGS (PROV_CIPHER_FLAG_CUSTOM_IV)
  |  |  ------------------
  |  |  |  |   40|      1|# define PROV_CIPHER_FLAG_CUSTOM_IV        0x0002
  |  |  ------------------
  ------------------
   98|      1|                                          CHACHA20_KEYLEN * 8,
  ------------------
  |  |   18|      1|#define CHACHA20_KEYLEN (CHACHA_KEY_SIZE)
  |  |  ------------------
  |  |  |  |   45|      1|#define CHACHA_KEY_SIZE         32
  |  |  ------------------
  ------------------
   99|      1|                                          CHACHA20_BLKLEN * 8,
  ------------------
  |  |   19|      1|#define CHACHA20_BLKLEN (1)
  ------------------
  100|      1|                                          CHACHA20_IVLEN * 8);
  ------------------
  |  |   20|      1|#define CHACHA20_IVLEN (CHACHA_CTR_SIZE)
  |  |  ------------------
  |  |  |  |   46|      1|#define CHACHA_CTR_SIZE         16
  |  |  ------------------
  ------------------
  101|      1|}
cipher_chacha20.c:chacha20_gettable_ctx_params:
  141|      1|{
  142|      1|    return chacha20_known_gettable_ctx_params;
  143|      1|}

cipher_chacha20_poly1305.c:chacha20_poly1305_get_params:
   97|      1|{
   98|      1|    return ossl_cipher_generic_get_params(params, 0, CHACHA20_POLY1305_FLAGS,
  ------------------
  |  |   24|      1|#define CHACHA20_POLY1305_FLAGS (PROV_CIPHER_FLAG_AEAD                         \
  |  |  ------------------
  |  |  |  |   39|      1|# define PROV_CIPHER_FLAG_AEAD             0x0001
  |  |  ------------------
  |  |   25|      1|                                 | PROV_CIPHER_FLAG_CUSTOM_IV)
  |  |  ------------------
  |  |  |  |   40|      1|# define PROV_CIPHER_FLAG_CUSTOM_IV        0x0002
  |  |  ------------------
  ------------------
   99|      1|                                          CHACHA20_POLY1305_KEYLEN * 8,
  ------------------
  |  |   20|      1|#define CHACHA20_POLY1305_KEYLEN CHACHA_KEY_SIZE
  |  |  ------------------
  |  |  |  |   45|      1|#define CHACHA_KEY_SIZE         32
  |  |  ------------------
  ------------------
  100|      1|                                          CHACHA20_POLY1305_BLKLEN * 8,
  ------------------
  |  |   21|      1|#define CHACHA20_POLY1305_BLKLEN 1
  ------------------
  101|      1|                                          CHACHA20_POLY1305_IVLEN * 8);
  ------------------
  |  |   16|      1|#define CHACHA20_POLY1305_IVLEN 12
  ------------------
  102|      1|}
cipher_chacha20_poly1305.c:chacha20_poly1305_gettable_ctx_params:
  218|      1|{
  219|      1|    return chacha20_poly1305_known_gettable_ctx_params;
  220|      1|}

cipher_aes.c:aes_cts_256_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \
cipher_aes.c:aes_cts_192_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \
cipher_aes.c:aes_cts_128_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \
cipher_camellia.c:camellia_cts_256_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \
cipher_camellia.c:camellia_cts_192_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \
cipher_camellia.c:camellia_cts_128_cbc_get_params:
   16|      1|static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])      \
   17|      1|{                                                                              \
   18|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   19|      1|                                          flags, kbits, blkbits, ivbits);      \
   20|      1|}                                                                              \

cipher_null.c:null_get_params:
  104|      1|{
  105|      1|    return ossl_cipher_generic_get_params(params, 0, 0, 0, 8, 0);
  106|      1|}
cipher_null.c:null_gettable_ctx_params:
  118|      1|{
  119|      1|    return null_known_gettable_ctx_params;
  120|      1|}

cipher_sm4_xts.c:sm4_128_xts_get_params:
  245|      1|static int sm4_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])            \
  246|      1|{                                                                              \
  247|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  248|      1|                                          flags, 2 * kbits, SM4_XTS_BLOCK_BITS,\
  ------------------
  |  |   20|      1|#define SM4_XTS_BLOCK_BITS 8
  ------------------
  249|      1|                                          SM4_XTS_IV_BITS);                    \
  ------------------
  |  |   19|      1|#define SM4_XTS_IV_BITS 128
  ------------------
  250|      1|}                                                                              \

cipher_tdes.c:tdes_ede3_ecb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes.c:tdes_ede3_cbc_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede3_ofb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede3_cfb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede3_cfb1_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede3_cfb8_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede2_ecb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede2_cbc_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede2_ofb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \
cipher_tdes_default.c:tdes_ede2_cfb_get_params:
   43|      1|static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[])            \
   44|      1|{                                                                              \
   45|      1|    return ossl_tdes_get_params(params, EVP_CIPH_##UCMODE##_MODE,              \
   46|      1|                                flags, kbits, blkbits, ivbits);                \
   47|      1|}                                                                              \

ossl_tdes_get_params:
  190|     10|{
  191|       |#ifdef FIPS_MODULE
  192|       |    const int decrypt_only = 1;
  193|       |#else
  194|     10|    const int decrypt_only = 0;
  195|     10|#endif
  196|     10|    OSSL_PARAM *p;
  197|       |
  198|     10|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_DECRYPT_ONLY);
  ------------------
  |  |  187|     10|# define OSSL_CIPHER_PARAM_DECRYPT_ONLY "decrypt-only"
  ------------------
  199|     10|    if (p != NULL && !OSSL_PARAM_set_int(p, decrypt_only)) {
  ------------------
  |  Branch (199:9): [True: 0, False: 10]
  |  Branch (199:22): [True: 0, False: 0]
  ------------------
  200|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  201|      0|        return 0;
  202|      0|    }
  203|       |
  204|     10|    return ossl_cipher_generic_get_params(params, md, flags,
  205|     10|                                          kbits, blkbits, ivbits);
  206|     10|}

cipher_tdes_wrap.c:tdes_wrap_get_params:
  179|      1|static int tdes_wrap_get_params(OSSL_PARAM params[])                           \
  180|      1|{                                                                              \
  181|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_WRAP_MODE, flags,   \
  ------------------
  |  |  330|      1|# define         EVP_CIPH_WRAP_MODE              0x10002
  ------------------
  182|      1|                                          kbits, blkbits, ivbits);             \
  183|      1|}                                                                              \

ossl_cipher_generic_get_params:
   50|    130|{
   51|    130|    OSSL_PARAM *p;
   52|       |
   53|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_MODE);
  ------------------
  |  |  195|    130|# define OSSL_CIPHER_PARAM_MODE "mode"
  ------------------
   54|    130|    if (p != NULL && !OSSL_PARAM_set_uint(p, md)) {
  ------------------
  |  Branch (54:9): [True: 130, False: 0]
  |  Branch (54:22): [True: 0, False: 130]
  ------------------
   55|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   56|      0|        return 0;
   57|      0|    }
   58|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD);
  ------------------
  |  |  169|    130|# define OSSL_CIPHER_PARAM_AEAD "aead"
  ------------------
   59|    130|    if (p != NULL
  ------------------
  |  Branch (59:9): [True: 130, False: 0]
  ------------------
   60|    130|        && !OSSL_PARAM_set_int(p, (flags & PROV_CIPHER_FLAG_AEAD) != 0)) {
  ------------------
  |  |   39|    130|# define PROV_CIPHER_FLAG_AEAD             0x0001
  ------------------
  |  Branch (60:12): [True: 0, False: 130]
  ------------------
   61|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   62|      0|        return 0;
   63|      0|    }
   64|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_CUSTOM_IV);
  ------------------
  |  |  186|    130|# define OSSL_CIPHER_PARAM_CUSTOM_IV "custom-iv"
  ------------------
   65|    130|    if (p != NULL
  ------------------
  |  Branch (65:9): [True: 130, False: 0]
  ------------------
   66|    130|        && !OSSL_PARAM_set_int(p, (flags & PROV_CIPHER_FLAG_CUSTOM_IV) != 0)) {
  ------------------
  |  |   40|    130|# define PROV_CIPHER_FLAG_CUSTOM_IV        0x0002
  ------------------
  |  Branch (66:12): [True: 0, False: 130]
  ------------------
   67|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   68|      0|        return 0;
   69|      0|    }
   70|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_CTS);
  ------------------
  |  |  184|    130|# define OSSL_CIPHER_PARAM_CTS "cts"
  ------------------
   71|    130|    if (p != NULL
  ------------------
  |  Branch (71:9): [True: 130, False: 0]
  ------------------
   72|    130|        && !OSSL_PARAM_set_int(p, (flags & PROV_CIPHER_FLAG_CTS) != 0)) {
  ------------------
  |  |   41|    130|# define PROV_CIPHER_FLAG_CTS              0x0004
  ------------------
  |  Branch (72:12): [True: 0, False: 130]
  ------------------
   73|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   74|      0|        return 0;
   75|      0|    }
   76|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK);
  ------------------
  |  |  203|    130|# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK "tls-multi"
  ------------------
   77|    130|    if (p != NULL
  ------------------
  |  Branch (77:9): [True: 130, False: 0]
  ------------------
   78|    130|        && !OSSL_PARAM_set_int(p, (flags & PROV_CIPHER_FLAG_TLS1_MULTIBLOCK) != 0)) {
  ------------------
  |  |   42|    130|# define PROV_CIPHER_FLAG_TLS1_MULTIBLOCK  0x0008
  ------------------
  |  Branch (78:12): [True: 0, False: 130]
  ------------------
   79|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   80|      0|        return 0;
   81|      0|    }
   82|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_HAS_RAND_KEY);
  ------------------
  |  |  191|    130|# define OSSL_CIPHER_PARAM_HAS_RAND_KEY "has-randkey"
  ------------------
   83|    130|    if (p != NULL
  ------------------
  |  Branch (83:9): [True: 130, False: 0]
  ------------------
   84|    130|        && !OSSL_PARAM_set_int(p, (flags & PROV_CIPHER_FLAG_RAND_KEY) != 0)) {
  ------------------
  |  |   43|    130|# define PROV_CIPHER_FLAG_RAND_KEY         0x0010
  ------------------
  |  Branch (84:12): [True: 0, False: 130]
  ------------------
   85|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   86|      0|        return 0;
   87|      0|    }
   88|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC);
  ------------------
  |  |  188|    130|# define OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC "encrypt-then-mac"
  ------------------
   89|    130|    if (p != NULL
  ------------------
  |  Branch (89:9): [True: 130, False: 0]
  ------------------
   90|    130|        && !OSSL_PARAM_set_int(p, (flags & EVP_CIPH_FLAG_ENC_THEN_MAC) != 0)) {
  ------------------
  |  |  379|    130|# define         EVP_CIPH_FLAG_ENC_THEN_MAC      0x10000000
  ------------------
  |  Branch (90:12): [True: 0, False: 130]
  ------------------
   91|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   92|      0|        return 0;
   93|      0|    }
   94|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_KEYLEN);
  ------------------
  |  |  194|    130|# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
  ------------------
   95|    130|    if (p != NULL && !OSSL_PARAM_set_size_t(p, kbits / 8)) {
  ------------------
  |  Branch (95:9): [True: 130, False: 0]
  |  Branch (95:22): [True: 0, False: 130]
  ------------------
   96|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   97|      0|        return 0;
   98|      0|    }
   99|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_BLOCK_SIZE);
  ------------------
  |  |  183|    130|# define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize"
  ------------------
  100|    130|    if (p != NULL && !OSSL_PARAM_set_size_t(p, blkbits / 8)) {
  ------------------
  |  Branch (100:9): [True: 130, False: 0]
  |  Branch (100:22): [True: 0, False: 130]
  ------------------
  101|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  102|      0|        return 0;
  103|      0|    }
  104|    130|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_IVLEN);
  ------------------
  |  |  193|    130|# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
  ------------------
  105|    130|    if (p != NULL && !OSSL_PARAM_set_size_t(p, ivbits / 8)) {
  ------------------
  |  Branch (105:9): [True: 130, False: 0]
  |  Branch (105:22): [True: 0, False: 130]
  ------------------
  106|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  107|      0|        return 0;
  108|      0|    }
  109|    130|    return 1;
  110|    130|}
ossl_cipher_aead_gettable_ctx_params:
  255|     14|{
  256|     14|    return cipher_aead_known_gettable_ctx_params;
  257|     14|}
ossl_cipher_generic_reset_ctx:
  332|      9|{
  333|      9|    if (ctx != NULL && ctx->alloced) {
  ------------------
  |  Branch (333:9): [True: 9, False: 0]
  |  Branch (333:24): [True: 0, False: 9]
  ------------------
  334|      0|        OPENSSL_free(ctx->tlsmac);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  335|      0|        ctx->alloced = 0;
  336|      0|        ctx->tlsmac = NULL;
  337|      0|    }
  338|      9|}
ossl_cipher_generic_einit:
  383|  1.06k|{
  384|  1.06k|    return cipher_generic_init_internal((PROV_CIPHER_CTX *)vctx, key, keylen,
  385|  1.06k|                                        iv, ivlen, params, 1);
  386|  1.06k|}
ossl_cipher_generic_block_update:
  424|    418|{
  425|    418|    size_t outlint = 0;
  426|    418|    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
  427|    418|    size_t blksz = ctx->blocksize;
  428|    418|    size_t nextblocks;
  429|       |
  430|    418|    if (!ctx->key_set) {
  ------------------
  |  Branch (430:9): [True: 0, False: 418]
  ------------------
  431|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  432|      0|        return 0;
  433|      0|    }
  434|       |
  435|    418|    if (ctx->tlsversion > 0) {
  ------------------
  |  Branch (435:9): [True: 0, False: 418]
  ------------------
  436|       |        /*
  437|       |         * Each update call corresponds to a TLS record and is individually
  438|       |         * padded
  439|       |         */
  440|       |
  441|       |        /* Sanity check inputs */
  442|      0|        if (in == NULL
  ------------------
  |  Branch (442:13): [True: 0, False: 0]
  ------------------
  443|      0|                || in != out
  ------------------
  |  Branch (443:20): [True: 0, False: 0]
  ------------------
  444|      0|                || outsize < inl
  ------------------
  |  Branch (444:20): [True: 0, False: 0]
  ------------------
  445|      0|                || !ctx->pad) {
  ------------------
  |  Branch (445:20): [True: 0, False: 0]
  ------------------
  446|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  447|      0|            return 0;
  448|      0|        }
  449|       |
  450|      0|        if (ctx->enc) {
  ------------------
  |  Branch (450:13): [True: 0, False: 0]
  ------------------
  451|      0|            unsigned char padval;
  452|      0|            size_t padnum, loop;
  453|       |
  454|       |            /* Add padding */
  455|       |
  456|      0|            padnum = blksz - (inl % blksz);
  457|       |
  458|      0|            if (outsize < inl + padnum) {
  ------------------
  |  Branch (458:17): [True: 0, False: 0]
  ------------------
  459|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  460|      0|                return 0;
  461|      0|            }
  462|       |
  463|      0|            if (padnum > MAX_PADDING) {
  ------------------
  |  |  419|      0|#define MAX_PADDING 256
  ------------------
  |  Branch (463:17): [True: 0, False: 0]
  ------------------
  464|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  465|      0|                return 0;
  466|      0|            }
  467|      0|            padval = (unsigned char)(padnum - 1);
  468|      0|            if (ctx->tlsversion == SSL3_VERSION) {
  ------------------
  |  |   23|      0|# define SSL3_VERSION                    0x0300
  ------------------
  |  Branch (468:17): [True: 0, False: 0]
  ------------------
  469|      0|                if (padnum > 1)
  ------------------
  |  Branch (469:21): [True: 0, False: 0]
  ------------------
  470|      0|                    memset(out + inl, 0, padnum - 1);
  471|      0|                *(out + inl + padnum - 1) = padval;
  472|      0|            } else {
  473|       |                /* we need to add 'padnum' padding bytes of value padval */
  474|      0|                for (loop = inl; loop < inl + padnum; loop++)
  ------------------
  |  Branch (474:34): [True: 0, False: 0]
  ------------------
  475|      0|                    out[loop] = padval;
  476|      0|            }
  477|      0|            inl += padnum;
  478|      0|        }
  479|       |
  480|      0|        if ((inl % blksz) != 0) {
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  482|      0|            return 0;
  483|      0|        }
  484|       |
  485|       |
  486|       |        /* Shouldn't normally fail */
  487|      0|        if (!ctx->hw->cipher(ctx, out, in, inl)) {
  ------------------
  |  Branch (487:13): [True: 0, False: 0]
  ------------------
  488|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  489|      0|            return 0;
  490|      0|        }
  491|       |
  492|      0|        if (ctx->alloced) {
  ------------------
  |  Branch (492:13): [True: 0, False: 0]
  ------------------
  493|      0|            OPENSSL_free(ctx->tlsmac);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  494|      0|            ctx->alloced = 0;
  495|      0|            ctx->tlsmac = NULL;
  496|      0|        }
  497|       |
  498|       |        /* This only fails if padding is publicly invalid */
  499|      0|        *outl = inl;
  500|      0|        if (!ctx->enc
  ------------------
  |  Branch (500:13): [True: 0, False: 0]
  ------------------
  501|      0|            && !ossl_cipher_tlsunpadblock(ctx->libctx, ctx->tlsversion,
  ------------------
  |  Branch (501:16): [True: 0, False: 0]
  ------------------
  502|      0|                                          out, outl,
  503|      0|                                          blksz, &ctx->tlsmac, &ctx->alloced,
  504|      0|                                          ctx->tlsmacsize, 0)) {
  505|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  506|      0|            return 0;
  507|      0|        }
  508|      0|        return 1;
  509|      0|    }
  510|       |
  511|    418|    if (ctx->bufsz != 0)
  ------------------
  |  Branch (511:9): [True: 0, False: 418]
  ------------------
  512|      0|        nextblocks = ossl_cipher_fillblock(ctx->buf, &ctx->bufsz, blksz,
  513|      0|                                           &in, &inl);
  514|    418|    else
  515|    418|        nextblocks = inl & ~(blksz-1);
  516|       |
  517|       |    /*
  518|       |     * If we're decrypting and we end an update on a block boundary we hold
  519|       |     * the last block back in case this is the last update call and the last
  520|       |     * block is padded.
  521|       |     */
  522|    418|    if (ctx->bufsz == blksz && (ctx->enc || inl > 0 || !ctx->pad)) {
  ------------------
  |  Branch (522:9): [True: 0, False: 418]
  |  Branch (522:33): [True: 0, False: 0]
  |  Branch (522:45): [True: 0, False: 0]
  |  Branch (522:56): [True: 0, False: 0]
  ------------------
  523|      0|        if (outsize < blksz) {
  ------------------
  |  Branch (523:13): [True: 0, False: 0]
  ------------------
  524|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  525|      0|            return 0;
  526|      0|        }
  527|      0|        if (!ctx->hw->cipher(ctx, out, ctx->buf, blksz)) {
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  529|      0|            return 0;
  530|      0|        }
  531|      0|        ctx->bufsz = 0;
  532|      0|        outlint = blksz;
  533|      0|        out += blksz;
  534|      0|    }
  535|    418|    if (nextblocks > 0) {
  ------------------
  |  Branch (535:9): [True: 418, False: 0]
  ------------------
  536|    418|        if (!ctx->enc && ctx->pad && nextblocks == inl) {
  ------------------
  |  Branch (536:13): [True: 0, False: 418]
  |  Branch (536:26): [True: 0, False: 0]
  |  Branch (536:38): [True: 0, False: 0]
  ------------------
  537|      0|            if (!ossl_assert(inl >= blksz)) {
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (537:17): [True: 0, False: 0]
  ------------------
  538|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  539|      0|                return 0;
  540|      0|            }
  541|      0|            nextblocks -= blksz;
  542|      0|        }
  543|    418|        outlint += nextblocks;
  544|    418|        if (outsize < outlint) {
  ------------------
  |  Branch (544:13): [True: 0, False: 418]
  ------------------
  545|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  546|      0|            return 0;
  547|      0|        }
  548|    418|    }
  549|    418|    if (nextblocks > 0) {
  ------------------
  |  Branch (549:9): [True: 418, False: 0]
  ------------------
  550|    418|        if (!ctx->hw->cipher(ctx, out, in, nextblocks)) {
  ------------------
  |  Branch (550:13): [True: 0, False: 418]
  ------------------
  551|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  552|      0|            return 0;
  553|      0|        }
  554|    418|        in += nextblocks;
  555|    418|        inl -= nextblocks;
  556|    418|    }
  557|    418|    if (inl != 0
  ------------------
  |  Branch (557:9): [True: 0, False: 418]
  ------------------
  558|    418|        && !ossl_cipher_trailingdata(ctx->buf, &ctx->bufsz, blksz, &in, &inl)) {
  ------------------
  |  Branch (558:12): [True: 0, False: 0]
  ------------------
  559|       |        /* ERR_raise already called */
  560|      0|        return 0;
  561|      0|    }
  562|       |
  563|    418|    *outl = outlint;
  564|    418|    return inl == 0;
  565|    418|}
ossl_cipher_generic_stream_update:
  644|    341|{
  645|    341|    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
  646|       |
  647|    341|    if (!ctx->key_set) {
  ------------------
  |  Branch (647:9): [True: 0, False: 341]
  ------------------
  648|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  649|      0|        return 0;
  650|      0|    }
  651|       |
  652|    341|    if (inl == 0) {
  ------------------
  |  Branch (652:9): [True: 0, False: 341]
  ------------------
  653|      0|        *outl = 0;
  654|      0|        return 1;
  655|      0|    }
  656|       |
  657|    341|    if (outsize < inl) {
  ------------------
  |  Branch (657:9): [True: 0, False: 341]
  ------------------
  658|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  659|      0|        return 0;
  660|      0|    }
  661|       |
  662|    341|    if (!ctx->hw->cipher(ctx, out, in, inl)) {
  ------------------
  |  Branch (662:9): [True: 0, False: 341]
  ------------------
  663|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  664|      0|        return 0;
  665|      0|    }
  666|       |
  667|    341|    *outl = inl;
  668|    341|    if (!ctx->enc && ctx->tlsversion > 0) {
  ------------------
  |  Branch (668:9): [True: 0, False: 341]
  |  Branch (668:22): [True: 0, False: 0]
  ------------------
  669|       |        /*
  670|       |        * Remove any TLS padding. Only used by cipher_aes_cbc_hmac_sha1_hw.c and
  671|       |        * cipher_aes_cbc_hmac_sha256_hw.c
  672|       |        */
  673|      0|        if (ctx->removetlspad) {
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  ------------------
  674|       |            /*
  675|       |             * We should have already failed in the cipher() call above if this
  676|       |             * isn't true.
  677|       |             */
  678|      0|            if (!ossl_assert(*outl >= (size_t)(out[inl - 1] + 1)))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (678:17): [True: 0, False: 0]
  ------------------
  679|      0|                return 0;
  680|       |            /* The actual padding length */
  681|      0|            *outl -= out[inl - 1] + 1;
  682|      0|        }
  683|       |
  684|       |        /* TLS MAC and explicit IV if relevant. We should have already failed
  685|       |         * in the cipher() call above if *outl is too short.
  686|       |         */
  687|      0|        if (!ossl_assert(*outl >= ctx->removetlsfixed))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (687:13): [True: 0, False: 0]
  ------------------
  688|      0|            return 0;
  689|      0|        *outl -= ctx->removetlsfixed;
  690|       |
  691|       |        /* Extract the MAC if there is one */
  692|      0|        if (ctx->tlsmacsize > 0) {
  ------------------
  |  Branch (692:13): [True: 0, False: 0]
  ------------------
  693|      0|            if (*outl < ctx->tlsmacsize)
  ------------------
  |  Branch (693:17): [True: 0, False: 0]
  ------------------
  694|      0|                return 0;
  695|       |
  696|      0|            ctx->tlsmac = out + *outl - ctx->tlsmacsize;
  697|      0|            *outl -= ctx->tlsmacsize;
  698|      0|        }
  699|      0|    }
  700|       |
  701|    341|    return 1;
  702|    341|}
ossl_cipher_generic_get_ctx_params:
  749|     12|{
  750|     12|    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
  751|     12|    OSSL_PARAM *p;
  752|       |
  753|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_IVLEN);
  ------------------
  |  |  193|     12|# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
  ------------------
  754|     12|    if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->ivlen)) {
  ------------------
  |  Branch (754:9): [True: 3, False: 9]
  |  Branch (754:22): [True: 0, False: 3]
  ------------------
  755|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  756|      0|        return 0;
  757|      0|    }
  758|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_PADDING);
  ------------------
  |  |  197|     12|# define OSSL_CIPHER_PARAM_PADDING "padding"
  ------------------
  759|     12|    if (p != NULL && !OSSL_PARAM_set_uint(p, ctx->pad)) {
  ------------------
  |  Branch (759:9): [True: 0, False: 12]
  |  Branch (759:22): [True: 0, False: 0]
  ------------------
  760|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  761|      0|        return 0;
  762|      0|    }
  763|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_IV);
  ------------------
  |  |  192|     12|# define OSSL_CIPHER_PARAM_IV "iv"
  ------------------
  764|     12|    if (p != NULL
  ------------------
  |  Branch (764:9): [True: 0, False: 12]
  ------------------
  765|     12|        && !OSSL_PARAM_set_octet_string_or_ptr(p, ctx->oiv, ctx->ivlen)) {
  ------------------
  |  Branch (765:12): [True: 0, False: 0]
  ------------------
  766|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  767|      0|        return 0;
  768|      0|    }
  769|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_UPDATED_IV);
  ------------------
  |  |  215|     12|# define OSSL_CIPHER_PARAM_UPDATED_IV "updated-iv"
  ------------------
  770|     12|    if (p != NULL
  ------------------
  |  Branch (770:9): [True: 0, False: 12]
  ------------------
  771|     12|        && !OSSL_PARAM_set_octet_string_or_ptr(p, ctx->iv, ctx->ivlen)) {
  ------------------
  |  Branch (771:12): [True: 0, False: 0]
  ------------------
  772|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  773|      0|        return 0;
  774|      0|    }
  775|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_NUM);
  ------------------
  |  |  196|     12|# define OSSL_CIPHER_PARAM_NUM "num"
  ------------------
  776|     12|    if (p != NULL && !OSSL_PARAM_set_uint(p, ctx->num)) {
  ------------------
  |  Branch (776:9): [True: 0, False: 12]
  |  Branch (776:22): [True: 0, False: 0]
  ------------------
  777|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  778|      0|        return 0;
  779|      0|    }
  780|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_KEYLEN);
  ------------------
  |  |  194|     12|# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
  ------------------
  781|     12|    if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->keylen)) {
  ------------------
  |  Branch (781:9): [True: 9, False: 3]
  |  Branch (781:22): [True: 0, False: 9]
  ------------------
  782|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  783|      0|        return 0;
  784|      0|    }
  785|     12|    p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_TLS_MAC);
  ------------------
  |  |  212|     12|# define OSSL_CIPHER_PARAM_TLS_MAC "tls-mac"
  ------------------
  786|     12|    if (p != NULL
  ------------------
  |  Branch (786:9): [True: 0, False: 12]
  ------------------
  787|     12|        && !OSSL_PARAM_set_octet_ptr(p, ctx->tlsmac, ctx->tlsmacsize)) {
  ------------------
  |  Branch (787:12): [True: 0, False: 0]
  ------------------
  788|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  789|      0|        return 0;
  790|      0|    }
  791|     12|    return 1;
  792|     12|}
ossl_cipher_generic_set_ctx_params:
  795|  1.06k|{
  796|  1.06k|    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
  797|  1.06k|    const OSSL_PARAM *p;
  798|       |
  799|  1.06k|    if (ossl_param_is_empty(params))
  ------------------
  |  Branch (799:9): [True: 1.06k, False: 0]
  ------------------
  800|  1.06k|        return 1;
  801|       |
  802|      0|    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_PADDING);
  ------------------
  |  |  197|      0|# define OSSL_CIPHER_PARAM_PADDING "padding"
  ------------------
  803|      0|    if (p != NULL) {
  ------------------
  |  Branch (803:9): [True: 0, False: 0]
  ------------------
  804|      0|        unsigned int pad;
  805|       |
  806|      0|        if (!OSSL_PARAM_get_uint(p, &pad)) {
  ------------------
  |  Branch (806:13): [True: 0, False: 0]
  ------------------
  807|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  808|      0|            return 0;
  809|      0|        }
  810|      0|        ctx->pad = pad ? 1 : 0;
  ------------------
  |  Branch (810:20): [True: 0, False: 0]
  ------------------
  811|      0|    }
  812|      0|    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_USE_BITS);
  ------------------
  |  |  216|      0|# define OSSL_CIPHER_PARAM_USE_BITS "use-bits"
  ------------------
  813|      0|    if (p != NULL) {
  ------------------
  |  Branch (813:9): [True: 0, False: 0]
  ------------------
  814|      0|        unsigned int bits;
  815|       |
  816|      0|        if (!OSSL_PARAM_get_uint(p, &bits)) {
  ------------------
  |  Branch (816:13): [True: 0, False: 0]
  ------------------
  817|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  818|      0|            return 0;
  819|      0|        }
  820|      0|        ctx->use_bits = bits ? 1 : 0;
  ------------------
  |  Branch (820:25): [True: 0, False: 0]
  ------------------
  821|      0|    }
  822|      0|    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_TLS_VERSION);
  ------------------
  |  |  214|      0|# define OSSL_CIPHER_PARAM_TLS_VERSION "tls-version"
  ------------------
  823|      0|    if (p != NULL) {
  ------------------
  |  Branch (823:9): [True: 0, False: 0]
  ------------------
  824|      0|        if (!OSSL_PARAM_get_uint(p, &ctx->tlsversion)) {
  ------------------
  |  Branch (824:13): [True: 0, False: 0]
  ------------------
  825|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  826|      0|            return 0;
  827|      0|        }
  828|      0|    }
  829|      0|    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_TLS_MAC_SIZE);
  ------------------
  |  |  213|      0|# define OSSL_CIPHER_PARAM_TLS_MAC_SIZE "tls-mac-size"
  ------------------
  830|      0|    if (p != NULL) {
  ------------------
  |  Branch (830:9): [True: 0, False: 0]
  ------------------
  831|      0|        if (!OSSL_PARAM_get_size_t(p, &ctx->tlsmacsize)) {
  ------------------
  |  Branch (831:13): [True: 0, False: 0]
  ------------------
  832|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  833|      0|            return 0;
  834|      0|        }
  835|      0|    }
  836|      0|    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_NUM);
  ------------------
  |  |  196|      0|# define OSSL_CIPHER_PARAM_NUM "num"
  ------------------
  837|      0|    if (p != NULL) {
  ------------------
  |  Branch (837:9): [True: 0, False: 0]
  ------------------
  838|      0|        unsigned int num;
  839|       |
  840|      0|        if (!OSSL_PARAM_get_uint(p, &num)) {
  ------------------
  |  Branch (840:13): [True: 0, False: 0]
  ------------------
  841|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  842|      0|            return 0;
  843|      0|        }
  844|      0|        ctx->num = num;
  845|      0|    }
  846|      0|    return 1;
  847|      0|}
ossl_cipher_generic_initiv:
  851|    341|{
  852|    341|    if (ivlen != ctx->ivlen
  ------------------
  |  Branch (852:9): [True: 0, False: 341]
  ------------------
  853|    341|        || ivlen > sizeof(ctx->iv)) {
  ------------------
  |  Branch (853:12): [True: 0, False: 341]
  ------------------
  854|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  855|      0|        return 0;
  856|      0|    }
  857|    341|    ctx->iv_set = 1;
  858|    341|    memcpy(ctx->iv, iv, ivlen);
  859|    341|    memcpy(ctx->oiv, iv, ivlen);
  860|    341|    return 1;
  861|    341|}
ossl_cipher_generic_initkey:
  867|      9|{
  868|      9|    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
  869|       |
  870|      9|    if ((flags & PROV_CIPHER_FLAG_INVERSE_CIPHER) != 0)
  ------------------
  |  |   46|      9|# define PROV_CIPHER_FLAG_INVERSE_CIPHER   0x0200
  ------------------
  |  Branch (870:9): [True: 0, False: 9]
  ------------------
  871|      0|        ctx->inverse_cipher = 1;
  872|      9|    if ((flags & PROV_CIPHER_FLAG_VARIABLE_LENGTH) != 0)
  ------------------
  |  |   45|      9|# define PROV_CIPHER_FLAG_VARIABLE_LENGTH  0x0100
  ------------------
  |  Branch (872:9): [True: 0, False: 9]
  ------------------
  873|      0|        ctx->variable_keylength = 1;
  874|       |
  875|      9|    ctx->pad = 1;
  876|      9|    ctx->keylen = ((kbits) / 8);
  877|      9|    ctx->ivlen = ((ivbits) / 8);
  878|      9|    ctx->hw = hw;
  879|      9|    ctx->mode = mode;
  880|      9|    ctx->blocksize = blkbits / 8;
  881|      9|    if (provctx != NULL)
  ------------------
  |  Branch (881:9): [True: 9, False: 0]
  ------------------
  882|      9|        ctx->libctx = PROV_LIBCTX_OF(provctx); /* used for rand */
  ------------------
  |  |   31|      9|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  883|      9|}
ciphercommon.c:cipher_generic_init_internal:
  344|  1.06k|{
  345|  1.06k|    ctx->num = 0;
  346|  1.06k|    ctx->bufsz = 0;
  347|  1.06k|    ctx->updated = 0;
  348|  1.06k|    ctx->enc = enc ? 1 : 0;
  ------------------
  |  Branch (348:16): [True: 1.06k, False: 0]
  ------------------
  349|       |
  350|  1.06k|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (350:9): [True: 0, False: 1.06k]
  ------------------
  351|      0|        return 0;
  352|       |
  353|  1.06k|    if (iv != NULL && ctx->mode != EVP_CIPH_ECB_MODE) {
  ------------------
  |  |  322|    341|# define         EVP_CIPH_ECB_MODE               0x1
  ------------------
  |  Branch (353:9): [True: 341, False: 721]
  |  Branch (353:23): [True: 341, False: 0]
  ------------------
  354|    341|        if (!ossl_cipher_generic_initiv(ctx, iv, ivlen))
  ------------------
  |  Branch (354:13): [True: 0, False: 341]
  ------------------
  355|      0|            return 0;
  356|    341|    }
  357|  1.06k|    if (iv == NULL && ctx->iv_set
  ------------------
  |  Branch (357:9): [True: 721, False: 341]
  |  Branch (357:23): [True: 344, False: 377]
  ------------------
  358|  1.06k|        && (ctx->mode == EVP_CIPH_CBC_MODE
  ------------------
  |  |  323|    688|# define         EVP_CIPH_CBC_MODE               0x2
  ------------------
  |  Branch (358:13): [True: 0, False: 344]
  ------------------
  359|    344|            || ctx->mode == EVP_CIPH_CFB_MODE
  ------------------
  |  |  324|    688|# define         EVP_CIPH_CFB_MODE               0x3
  ------------------
  |  Branch (359:16): [True: 0, False: 344]
  ------------------
  360|    344|            || ctx->mode == EVP_CIPH_OFB_MODE))
  ------------------
  |  |  325|    344|# define         EVP_CIPH_OFB_MODE               0x4
  ------------------
  |  Branch (360:16): [True: 0, False: 344]
  ------------------
  361|       |        /* reset IV for these modes to keep compatibility with 1.1.1 */
  362|      0|        memcpy(ctx->iv, ctx->oiv, ctx->ivlen);
  363|       |
  364|  1.06k|    if (key != NULL) {
  ------------------
  |  Branch (364:9): [True: 715, False: 347]
  ------------------
  365|    715|        if (ctx->variable_keylength == 0) {
  ------------------
  |  Branch (365:13): [True: 715, False: 0]
  ------------------
  366|    715|            if (keylen != ctx->keylen) {
  ------------------
  |  Branch (366:17): [True: 0, False: 715]
  ------------------
  367|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|      0|                return 0;
  369|      0|            }
  370|    715|        } else {
  371|      0|            ctx->keylen = keylen;
  372|      0|        }
  373|    715|        if (!ctx->hw->init(ctx, key, ctx->keylen))
  ------------------
  |  Branch (373:13): [True: 0, False: 715]
  ------------------
  374|      0|            return 0;
  375|    715|        ctx->key_set = 1;
  376|    715|    }
  377|  1.06k|    return ossl_cipher_generic_set_ctx_params(ctx, params);
  378|  1.06k|}

ossl_cipher_hw_generic_ctr:
  113|    341|{
  114|    341|    unsigned int num = dat->num;
  115|       |
  116|    341|    if (dat->stream.ctr)
  ------------------
  |  Branch (116:9): [True: 341, False: 0]
  ------------------
  117|    341|        CRYPTO_ctr128_encrypt_ctr32(in, out, len, dat->ks, dat->iv, dat->buf,
  118|    341|                                    &num, dat->stream.ctr);
  119|      0|    else
  120|      0|        CRYPTO_ctr128_encrypt(in, out, len, dat->ks, dat->iv, dat->buf,
  121|      0|                              &num, dat->block);
  122|    341|    dat->num = num;
  123|       |
  124|    341|    return 1;
  125|    341|}

blake2_prov.c:blake2s256_get_params:
  170|      1|static int blake##variantsize##_get_params(OSSL_PARAM params[]) \
  171|      1|{ \
  172|      1|    return ossl_digest_default_get_params(params, BLAKE##VARIANT##_BLOCKBYTES, BLAKE##VARIANT##_OUTBYTES, 0); \
  173|      1|} \
blake2_prov.c:blake2b512_get_params:
  170|      1|static int blake##variantsize##_get_params(OSSL_PARAM params[]) \
  171|      1|{ \
  172|      1|    return ossl_digest_default_get_params(params, BLAKE##VARIANT##_BLOCKBYTES, BLAKE##VARIANT##_OUTBYTES, 0); \
  173|      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);
  ------------------
  |  |  220|     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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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);
  ------------------
  |  |  223|     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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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);
  ------------------
  |  |  225|     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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      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);
  ------------------
  |  |  219|     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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   39|      0|        return 0;
   40|      0|    }
   41|     27|    return 1;
   42|     27|}

sha3_prov.c:generic_sha3_absorb:
  151|  4.17k|{
  152|  4.17k|    KECCAK1600_CTX *ctx = vctx;
  153|       |
  154|  4.17k|    if (!(ctx->xof_state == XOF_STATE_INIT ||
  ------------------
  |  |   35|  8.35k|#define XOF_STATE_INIT    0
  ------------------
  |  Branch (154:11): [True: 3.46k, False: 710]
  ------------------
  155|  4.17k|          ctx->xof_state == XOF_STATE_ABSORB))
  ------------------
  |  |   36|    710|#define XOF_STATE_ABSORB  1
  ------------------
  |  Branch (155:11): [True: 710, False: 0]
  ------------------
  156|      0|        return 0;
  157|  4.17k|    ctx->xof_state = XOF_STATE_ABSORB;
  ------------------
  |  |   36|  4.17k|#define XOF_STATE_ABSORB  1
  ------------------
  158|  4.17k|    return SHA3_absorb(ctx->A, inp, len, ctx->block_size);
  159|  4.17k|}
sha3_prov.c:generic_sha3_final:
  162|  1.99k|{
  163|  1.99k|    return ossl_sha3_final((KECCAK1600_CTX *)vctx, out, outlen);
  164|  1.99k|}
sha3_prov.c:keccak_update:
   75|  3.99k|{
   76|  3.99k|    KECCAK1600_CTX *ctx = vctx;
   77|  3.99k|    const size_t bsz = ctx->block_size;
   78|  3.99k|    size_t num, rem;
   79|       |
   80|  3.99k|    if (len == 0)
  ------------------
  |  Branch (80:9): [True: 0, False: 3.99k]
  ------------------
   81|      0|        return 1;
   82|       |
   83|       |    /* Is there anything in the buffer already ? */
   84|  3.99k|    if ((num = ctx->bufsz) != 0) {
  ------------------
  |  Branch (84:9): [True: 521, False: 3.46k]
  ------------------
   85|       |        /* Calculate how much space is left in the buffer */
   86|    521|        rem = bsz - num;
   87|       |        /* If the new input does not fill the buffer then just add it */
   88|    521|        if (len < rem) {
  ------------------
  |  Branch (88:13): [True: 166, False: 355]
  ------------------
   89|    166|            memcpy(ctx->buf + num, inp, len);
   90|    166|            ctx->bufsz += len;
   91|    166|            return 1;
   92|    166|        }
   93|       |        /* otherwise fill up the buffer and absorb the buffer */
   94|    355|        memcpy(ctx->buf + num, inp, rem);
   95|       |        /* Update the input pointer */
   96|    355|        inp += rem;
   97|    355|        len -= rem;
   98|    355|        ctx->meth.absorb(ctx, ctx->buf, bsz);
   99|    355|        ctx->bufsz = 0;
  100|    355|    }
  101|       |    /* Absorb the input - rem = leftover part of the input < blocksize) */
  102|  3.82k|    rem = ctx->meth.absorb(ctx, inp, len);
  103|       |    /* Copy the leftover bit of the input into the buffer */
  104|  3.82k|    if (rem) {
  ------------------
  |  Branch (104:9): [True: 3.82k, False: 0]
  ------------------
  105|  3.82k|        memcpy(ctx->buf, inp + len - rem, rem);
  106|  3.82k|        ctx->bufsz = rem;
  107|  3.82k|    }
  108|  3.82k|    return 1;
  109|  3.99k|}
sha3_prov.c:keccak_final:
  113|  1.99k|{
  114|  1.99k|    int ret = 1;
  115|  1.99k|    KECCAK1600_CTX *ctx = vctx;
  116|       |
  117|  1.99k|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (117:9): [True: 0, False: 1.99k]
  ------------------
  118|      0|        return 0;
  119|  1.99k|    if (ctx->md_size == SIZE_MAX) {
  ------------------
  |  Branch (119:9): [True: 0, False: 1.99k]
  ------------------
  120|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  121|      0|        return 0;
  122|      0|    }
  123|  1.99k|    if (outlen > 0)
  ------------------
  |  Branch (123:9): [True: 1.99k, False: 0]
  ------------------
  124|  1.99k|        ret = ctx->meth.final(ctx, out, ctx->md_size);
  125|       |
  126|  1.99k|    *outl = ctx->md_size;
  127|  1.99k|    return ret;
  128|  1.99k|}
sha3_prov.c:keccak_freectx:
  559|    894|{
  560|    894|    KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx;
  561|       |
  562|    894|    OPENSSL_clear_free(ctx,  sizeof(*ctx));
  ------------------
  |  |  113|    894|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    894|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    894|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  563|    894|}
sha3_prov.c:keccak_init:
   60|  3.46k|{
   61|  3.46k|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (61:9): [True: 0, False: 3.46k]
  ------------------
   62|      0|        return 0;
   63|       |    /* The newctx() handles most of the ctx fixed setup. */
   64|  3.46k|    ossl_sha3_reset((KECCAK1600_CTX *)vctx);
   65|  3.46k|    return 1;
   66|  3.46k|}
sha3_prov.c:sha3_256_newctx:
  488|    166|static void *name##_newctx(void *provctx)                                      \
  489|    166|{                                                                              \
  490|    166|    KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \
  ------------------
  |  |  104|    166|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (490:27): [True: 166, False: 0]
  ------------------
  491|    166|                                                : NULL;                        \
  492|    166|                                                                               \
  493|    166|    if (ctx == NULL)                                                           \
  ------------------
  |  Branch (493:9): [True: 0, False: 166]
  ------------------
  494|    166|        return NULL;                                                           \
  495|    166|    ossl_sha3_init(ctx, pad, bitlen);                                          \
  496|    166|    SHA3_SET_MD(uname, typ)                                                    \
  ------------------
  |  |  481|    166|# define SHA3_SET_MD(uname, typ) ctx->meth = sha3_generic_md;
  ------------------
  497|    166|    return ctx;                                                                \
  498|    166|}
sha3_prov.c:sha3_512_newctx:
  488|    258|static void *name##_newctx(void *provctx)                                      \
  489|    258|{                                                                              \
  490|    258|    KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \
  ------------------
  |  |  104|    258|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    258|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    258|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (490:27): [True: 258, False: 0]
  ------------------
  491|    258|                                                : NULL;                        \
  492|    258|                                                                               \
  493|    258|    if (ctx == NULL)                                                           \
  ------------------
  |  Branch (493:9): [True: 0, False: 258]
  ------------------
  494|    258|        return NULL;                                                           \
  495|    258|    ossl_sha3_init(ctx, pad, bitlen);                                          \
  496|    258|    SHA3_SET_MD(uname, typ)                                                    \
  ------------------
  |  |  481|    258|# define SHA3_SET_MD(uname, typ) ctx->meth = sha3_generic_md;
  ------------------
  497|    258|    return ctx;                                                                \
  498|    258|}
sha3_prov.c:shake_128_newctx:
  502|    166|static void *name##_newctx(void *provctx)                                      \
  503|    166|{                                                                              \
  504|    166|    KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
  ------------------
  |  |  104|    166|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (504:27): [True: 166, False: 0]
  ------------------
  505|    166|                                                : NULL;                        \
  506|    166|                                                                               \
  507|    166|    if (ctx == NULL)                                                           \
  ------------------
  |  Branch (507:9): [True: 0, False: 166]
  ------------------
  508|    166|        return NULL;                                                           \
  509|    166|    ossl_keccak_init(ctx, pad, bitlen, mdlen);                                 \
  510|    166|    if (mdlen == 0)                                                            \
  ------------------
  |  Branch (510:9): [Folded - Ignored]
  ------------------
  511|    166|        ctx->md_size = SIZE_MAX;                                               \
  512|    166|    SHAKE_SET_MD(uname, typ)                                                   \
  ------------------
  |  |  483|    166|# define SHAKE_SET_MD(uname, typ) ctx->meth = shake_generic_md;
  ------------------
  513|    166|    return ctx;                                                                \
  514|    166|}
sha3_prov.c:generic_sha3_squeeze:
  167|  4.44k|{
  168|  4.44k|    return ossl_sha3_squeeze((KECCAK1600_CTX *)vctx, out, outlen);
  169|  4.44k|}
sha3_prov.c:shake_squeeze:
  132|  4.44k|{
  133|  4.44k|    int ret = 1;
  134|  4.44k|    KECCAK1600_CTX *ctx = vctx;
  135|       |
  136|  4.44k|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (136:9): [True: 0, False: 4.44k]
  ------------------
  137|      0|        return 0;
  138|  4.44k|    if (ctx->meth.squeeze == NULL)
  ------------------
  |  Branch (138:9): [True: 0, False: 4.44k]
  ------------------
  139|      0|        return 0;
  140|  4.44k|    if (outlen > 0)
  ------------------
  |  Branch (140:9): [True: 4.44k, False: 0]
  ------------------
  141|  4.44k|        ret = ctx->meth.squeeze(ctx, out, outlen);
  142|       |
  143|  4.44k|    *outl = outlen;
  144|  4.44k|    return ret;
  145|  4.44k|}
sha3_prov.c:keccak_init_params:
   69|  3.04k|{
   70|  3.04k|    return keccak_init(vctx, NULL)
  ------------------
  |  Branch (70:12): [True: 3.04k, False: 0]
  ------------------
   71|  3.04k|            && shake_set_ctx_params(vctx, params);
  ------------------
  |  Branch (71:16): [True: 3.04k, False: 0]
  ------------------
   72|  3.04k|}
sha3_prov.c:shake_set_ctx_params:
  632|  4.61k|{
  633|  4.61k|    const OSSL_PARAM *p;
  634|  4.61k|    KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx;
  635|       |
  636|  4.61k|    if (ctx == NULL)
  ------------------
  |  Branch (636:9): [True: 0, False: 4.61k]
  ------------------
  637|      0|        return 0;
  638|  4.61k|    if (ossl_param_is_empty(params))
  ------------------
  |  Branch (638:9): [True: 3.04k, False: 1.56k]
  ------------------
  639|  3.04k|        return 1;
  640|       |
  641|  1.56k|    p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_XOFLEN);
  ------------------
  |  |  226|  1.56k|# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
  ------------------
  642|  1.56k|    if (p == NULL)
  ------------------
  |  Branch (642:9): [True: 0, False: 1.56k]
  ------------------
  643|      0|        p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SIZE);
  ------------------
  |  |  223|      0|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
  644|       |
  645|  1.56k|    if (p != NULL && !OSSL_PARAM_get_size_t(p, &ctx->md_size)) {
  ------------------
  |  Branch (645:9): [True: 1.56k, False: 0]
  |  Branch (645:22): [True: 0, False: 1.56k]
  ------------------
  646|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  647|      0|        return 0;
  648|      0|    }
  649|  1.56k|    return 1;
  650|  1.56k|}
sha3_prov.c:shake_256_newctx:
  502|    304|static void *name##_newctx(void *provctx)                                      \
  503|    304|{                                                                              \
  504|    304|    KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
  ------------------
  |  |  104|    304|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    304|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    304|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (504:27): [True: 304, False: 0]
  ------------------
  505|    304|                                                : NULL;                        \
  506|    304|                                                                               \
  507|    304|    if (ctx == NULL)                                                           \
  ------------------
  |  Branch (507:9): [True: 0, False: 304]
  ------------------
  508|    304|        return NULL;                                                           \
  509|    304|    ossl_keccak_init(ctx, pad, bitlen, mdlen);                                 \
  510|    304|    if (mdlen == 0)                                                            \
  ------------------
  |  Branch (510:9): [Folded - Ignored]
  ------------------
  511|    304|        ctx->md_size = SIZE_MAX;                                               \
  512|    304|    SHAKE_SET_MD(uname, typ)                                                   \
  ------------------
  |  |  483|    304|# define SHAKE_SET_MD(uname, typ) ctx->meth = shake_generic_md;
  ------------------
  513|    304|    return ctx;                                                                \
  514|    304|}

cipher_aes.c:aes_256_ecb_newctx:
  204|      6|static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
  205|      6|{                                                                              \
  206|      6|     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
  ------------------
  |  |  104|      6|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (206:32): [True: 6, False: 0]
  ------------------
  207|      6|                                                     : NULL;                   \
  208|      6|     if (ctx != NULL) {                                                        \
  ------------------
  |  Branch (208:10): [True: 6, False: 0]
  ------------------
  209|      6|         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
  210|      6|                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
  211|      6|                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
  212|      6|                                     provctx);                                 \
  213|      6|     }                                                                         \
  214|      6|     return ctx;                                                               \
  215|      6|}                                                                              \
cipher_aes.c:aes_256_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_256_ctr_newctx:
  204|      3|static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
  205|      3|{                                                                              \
  206|      3|     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
  ------------------
  |  |  104|      3|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (206:32): [True: 3, False: 0]
  ------------------
  207|      3|                                                     : NULL;                   \
  208|      3|     if (ctx != NULL) {                                                        \
  ------------------
  |  Branch (208:10): [True: 3, False: 0]
  ------------------
  209|      3|         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
  210|      3|                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
  211|      3|                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
  212|      3|                                     provctx);                                 \
  213|      3|     }                                                                         \
  214|      3|     return ctx;                                                               \
  215|      3|}                                                                              \
cipher_aes.c:aes_256_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_192_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_128_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aes.c:aes_cbc_cts_gettable_ctx_params:
  347|      3|                                              ossl_unused void *provctx)       \
  348|      3|{                                                                              \
  349|      3|    return name##_known_gettable_ctx_params;                                   \
  350|      3|}
cipher_aria.c:aria_256_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_256_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_192_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_aria.c:aria_128_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_ofb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_cfb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_cfb1_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_cfb8_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_256_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_192_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_128_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_camellia.c:camellia_cbc_cts_gettable_ctx_params:
  347|      3|                                              ossl_unused void *provctx)       \
  348|      3|{                                                                              \
  349|      3|    return name##_known_gettable_ctx_params;                                   \
  350|      3|}
cipher_sm4.c:sm4_128_ecb_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_sm4.c:sm4_128_cbc_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_sm4.c:sm4_128_ctr_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_sm4.c:sm4_128_ofb128_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
cipher_sm4.c:sm4_128_cfb128_get_params:
  198|      1|static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
  199|      1|{                                                                              \
  200|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
  201|      1|                                          flags, kbits, blkbits, ivbits);      \
  202|      1|}                                                                              \
ossl_tdes_gettable_ctx_params:
  347|     11|                                              ossl_unused void *provctx)       \
  348|     11|{                                                                              \
  349|     11|    return name##_known_gettable_ctx_params;                                   \
  350|     11|}
ossl_cipher_generic_gettable_ctx_params:
  347|     83|                                              ossl_unused void *provctx)       \
  348|     83|{                                                                              \
  349|     83|    return name##_known_gettable_ctx_params;                                   \
  350|     83|}

cipher_aes_ccm.c:aes_128_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aes_ccm.c:aes_192_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aes_ccm.c:aes_256_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aes_gcm.c:aes_128_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aes_gcm.c:aes_192_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aes_gcm.c:aes_256_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_ccm.c:aria_128_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_ccm.c:aria_192_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_ccm.c:aria_256_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_gcm.c:aria_128_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_gcm.c:aria_192_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_aria_gcm.c:aria_256_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_sm4_ccm.c:sm4_128_ccm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      1|}                                                                              \
cipher_sm4_gcm.c:sm4_128_gcm_get_params:
   20|      1|static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
   21|      1|{                                                                              \
   22|      1|    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
   23|      1|                                          flags, kbits, blkbits, ivbits);      \
   24|      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_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: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_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_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|}

ml_kem_kem.c:ml_kem_newctx:
   41|     92|{
   42|     92|    PROV_ML_KEM_CTX *ctx;
   43|       |
   44|     92|    if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL)
  ------------------
  |  |  102|     92|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     92|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     92|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (44:9): [True: 0, False: 92]
  ------------------
   45|      0|        return NULL;
   46|       |
   47|     92|    ctx->key = NULL;
   48|     92|    ctx->entropy = NULL;
   49|     92|    ctx->op = 0;
   50|     92|    return ctx;
   51|     92|}
ml_kem_kem.c:ml_kem_encapsulate_init:
   76|     46|{
   77|     46|    ML_KEM_KEY *key = vkey;
   78|       |
   79|     46|    if (!ossl_ml_kem_have_pubkey(key)) {
  ------------------
  |  |  203|     46|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  |  Branch (79:9): [True: 0, False: 46]
  ------------------
   80|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   81|      0|        return 0;
   82|      0|    }
   83|     46|    return ml_kem_init(vctx, EVP_PKEY_OP_ENCAPSULATE, key, params);
  ------------------
  |  | 1756|     46|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  ------------------
   84|     46|}
ml_kem_kem.c:ml_kem_init:
   64|     92|{
   65|     92|    PROV_ML_KEM_CTX *ctx = vctx;
   66|       |
   67|     92|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (67:9): [True: 0, False: 92]
  ------------------
   68|      0|        return 0;
   69|     92|    ctx->key = key;
   70|     92|    ctx->op = op;
   71|     92|    return ml_kem_set_ctx_params(vctx, params);
   72|     92|}
ml_kem_kem.c:ml_kem_encapsulate:
  148|     46|{
  149|     46|    PROV_ML_KEM_CTX *ctx = vctx;
  150|     46|    ML_KEM_KEY *key = ctx->key;
  151|     46|    const ML_KEM_VINFO *v;
  152|     46|    size_t encap_clen;
  153|     46|    size_t encap_slen;
  154|     46|    int ret = 0;
  155|       |
  156|     46|    if (!ossl_ml_kem_have_pubkey(key)) {
  ------------------
  |  |  203|     46|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  |  Branch (156:9): [True: 0, False: 46]
  ------------------
  157|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  158|      0|        goto end;
  159|      0|    }
  160|     46|    v = ossl_ml_kem_key_vinfo(key);
  ------------------
  |  |  202|     46|# define ossl_ml_kem_key_vinfo(key)     ((key)->vinfo)
  ------------------
  161|     46|    encap_clen = v->ctext_bytes;
  162|     46|    encap_slen = ML_KEM_SHARED_SECRET_BYTES;
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  163|       |
  164|     46|    if (ctext == NULL) {
  ------------------
  |  Branch (164:9): [True: 0, False: 46]
  ------------------
  165|      0|        if (clen == NULL && slen == NULL)
  ------------------
  |  Branch (165:13): [True: 0, False: 0]
  |  Branch (165:29): [True: 0, False: 0]
  ------------------
  166|      0|            return 0;
  167|      0|        if (clen != NULL)
  ------------------
  |  Branch (167:13): [True: 0, False: 0]
  ------------------
  168|      0|            *clen = encap_clen;
  169|      0|        if (slen != NULL)
  ------------------
  |  Branch (169:13): [True: 0, False: 0]
  ------------------
  170|      0|            *slen = encap_slen;
  171|      0|        return 1;
  172|      0|    }
  173|     46|    if (shsec == NULL) {
  ------------------
  |  Branch (173:9): [True: 0, False: 46]
  ------------------
  174|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  128|      0|# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
  ------------------
  175|      0|                       "NULL shared-secret buffer");
  176|      0|        goto end;
  177|      0|    }
  178|       |
  179|     46|    if (clen == NULL) {
  ------------------
  |  Branch (179:9): [True: 0, False: 46]
  ------------------
  180|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  124|      0|# define PROV_R_NULL_LENGTH_POINTER                       247
  ------------------
  181|      0|                       "null ciphertext input/output length pointer");
  182|      0|        goto end;
  183|     46|    } else if (*clen < encap_clen) {
  ------------------
  |  Branch (183:16): [True: 0, False: 46]
  ------------------
  184|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  128|      0|# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
  ------------------
  185|      0|                       "ciphertext buffer too small");
  186|      0|        goto end;
  187|     46|    } else {
  188|     46|        *clen = encap_clen;
  189|     46|    }
  190|       |
  191|     46|    if (slen == NULL) {
  ------------------
  |  Branch (191:9): [True: 0, False: 46]
  ------------------
  192|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_NULL_LENGTH_POINTER,
  ------------------
  |  |  124|      0|# define PROV_R_NULL_LENGTH_POINTER                       247
  ------------------
  193|      0|                       "null shared secret input/output length pointer");
  194|      0|        goto end;
  195|     46|    } else if (*slen < encap_slen) {
  ------------------
  |  Branch (195:16): [True: 0, False: 46]
  ------------------
  196|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  128|      0|# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
  ------------------
  197|      0|                       "shared-secret buffer too small");
  198|      0|        goto end;
  199|     46|    } else {
  200|     46|        *slen = encap_slen;
  201|     46|    }
  202|       |
  203|     46|    if (ctx->entropy != NULL)
  ------------------
  |  Branch (203:9): [True: 0, False: 46]
  ------------------
  204|      0|        ret = ossl_ml_kem_encap_seed(ctext, encap_clen, shsec, encap_slen,
  205|      0|                                     ctx->entropy, ML_KEM_RANDOM_BYTES, key);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  206|     46|    else
  207|     46|        ret = ossl_ml_kem_encap_rand(ctext, encap_clen, shsec, encap_slen, key);
  208|       |
  209|     46| end:
  210|       |    /*
  211|       |     * One shot entropy, each encapsulate call must either provide a new
  212|       |     * "ikmE", or else will use a random value.  If a caller sets an explicit
  213|       |     * ikmE once for testing, and later performs multiple encapsulations
  214|       |     * without again calling encapsulate_init(), these should not share the
  215|       |     * original entropy.
  216|       |     */
  217|     46|    if (ctx->entropy != NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 46]
  ------------------
  218|      0|        OPENSSL_cleanse(ctx->entropy, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  219|      0|        ctx->entropy = NULL;
  220|      0|    }
  221|     46|    return ret;
  222|     46|}
ml_kem_kem.c:ml_kem_decapsulate_init:
   88|     46|{
   89|     46|    ML_KEM_KEY *key = vkey;
   90|       |
   91|     46|    if (!ossl_ml_kem_have_prvkey(key)) {
  ------------------
  |  |  204|     46|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  ------------------
  |  Branch (91:9): [True: 0, False: 46]
  ------------------
   92|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   93|      0|        return 0;
   94|      0|    }
   95|     46|    return ml_kem_init(vctx, EVP_PKEY_OP_DECAPSULATE, key, params);
  ------------------
  |  | 1757|     46|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  ------------------
   96|     46|}
ml_kem_kem.c:ml_kem_decapsulate:
  226|     46|{
  227|     46|    PROV_ML_KEM_CTX *ctx = vctx;
  228|     46|    ML_KEM_KEY *key = ctx->key;
  229|     46|    size_t decap_slen = ML_KEM_SHARED_SECRET_BYTES;
  ------------------
  |  |   51|     46|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  230|       |
  231|     46|    if (!ossl_ml_kem_have_prvkey(key)) {
  ------------------
  |  |  204|     46|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 46]
  ------------------
  232|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  233|      0|        return 0;
  234|      0|    }
  235|       |
  236|     46|    if (shsec == NULL) {
  ------------------
  |  Branch (236:9): [True: 0, False: 46]
  ------------------
  237|      0|        if (slen == NULL)
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            return 0;
  239|      0|        *slen = ML_KEM_SHARED_SECRET_BYTES;
  ------------------
  |  |   51|      0|# define ML_KEM_SHARED_SECRET_BYTES 32
  ------------------
  240|      0|        return 1;
  241|      0|    }
  242|       |
  243|       |    /* For now tolerate newly-deprecated NULL length pointers. */
  244|     46|    if (slen == NULL) {
  ------------------
  |  Branch (244:9): [True: 0, False: 46]
  ------------------
  245|      0|        slen = &decap_slen;
  246|     46|    } else if (*slen < decap_slen) {
  ------------------
  |  Branch (246:16): [True: 0, False: 46]
  ------------------
  247|      0|        ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                      ERR_raise_data(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL,
  ------------------
  |  |  128|      0|# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
  ------------------
  248|      0|                       "shared-secret buffer too small");
  249|      0|        return 0;
  250|     46|    } else {
  251|     46|        *slen = decap_slen;
  252|     46|    }
  253|       |
  254|       |    /* ML-KEM decap handles incorrect ciphertext lengths internally */
  255|     46|    return ossl_ml_kem_decap(shsec, decap_slen, ctext, clen, key);
  256|     46|}
ml_kem_kem.c:ml_kem_freectx:
   54|     92|{
   55|     92|    PROV_ML_KEM_CTX *ctx = vctx;
   56|       |
   57|     92|    if (ctx->entropy != NULL)
  ------------------
  |  Branch (57:9): [True: 0, False: 92]
  ------------------
   58|      0|        OPENSSL_cleanse(ctx->entropy, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
   59|     92|    OPENSSL_free(ctx);
  ------------------
  |  |  115|     92|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     92|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     92|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   60|     92|}
ml_kem_kem.c:ml_kem_set_ctx_params:
   99|     92|{
  100|     92|    PROV_ML_KEM_CTX *ctx = vctx;
  101|     92|    const OSSL_PARAM *p;
  102|       |
  103|     92|    if (ctx == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 92]
  ------------------
  104|      0|        return 0;
  105|       |
  106|     92|    if (ctx->op == EVP_PKEY_OP_DECAPSULATE && ctx->entropy != NULL) {
  ------------------
  |  | 1757|    184|# define EVP_PKEY_OP_DECAPSULATE         (1 << 13)
  ------------------
  |  Branch (106:9): [True: 46, False: 46]
  |  Branch (106:47): [True: 0, False: 46]
  ------------------
  107|       |        /* Decapsulation is deterministic */
  108|      0|        OPENSSL_cleanse(ctx->entropy, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  109|      0|        ctx->entropy = NULL;
  110|      0|    }
  111|       |
  112|     92|    if (ossl_param_is_empty(params))
  ------------------
  |  Branch (112:9): [True: 92, False: 0]
  ------------------
  113|     92|        return 1;
  114|       |
  115|       |    /* Encapsulation ephemeral input key material "ikmE" */
  116|      0|    if (ctx->op == EVP_PKEY_OP_ENCAPSULATE
  ------------------
  |  | 1756|      0|# define EVP_PKEY_OP_ENCAPSULATE         (1 << 12)
  ------------------
  |  Branch (116:9): [True: 0, False: 0]
  ------------------
  117|      0|        && (p = OSSL_PARAM_locate_const(params, OSSL_KEM_PARAM_IKME)) != NULL) {
  ------------------
  |  |  319|      0|# define OSSL_KEM_PARAM_IKME "ikme"
  ------------------
  |  Branch (117:12): [True: 0, False: 0]
  ------------------
  118|      0|        size_t len = ML_KEM_RANDOM_BYTES;
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  119|       |
  120|      0|        ctx->entropy = ctx->entropy_buf;
  121|      0|        if (OSSL_PARAM_get_octet_string(p, (void **)&ctx->entropy,
  ------------------
  |  Branch (121:13): [True: 0, False: 0]
  ------------------
  122|      0|                                        len, &len)
  123|      0|            && len == ML_KEM_RANDOM_BYTES)
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  |  Branch (123:16): [True: 0, False: 0]
  ------------------
  124|      0|            return 1;
  125|       |
  126|       |        /* Possibly, but much less likely wrong type */
  127|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SEED_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  128|      0|        ctx->entropy = NULL;
  129|      0|        return 0;
  130|      0|    }
  131|       |
  132|      0|    return 1;
  133|      0|}

ossl_prov_ml_kem_new:
  156|    244|{
  157|    244|    ML_KEM_KEY *key;
  158|       |
  159|    244|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (159:9): [True: 0, False: 244]
  ------------------
  160|      0|        return NULL;
  161|       |    /*
  162|       |     * When decoding, if the key ends up "loaded" into the same provider, these
  163|       |     * are the correct config settings, otherwise, new values will be assigned
  164|       |     * on import into a different provider.  The "load" API does not pass along
  165|       |     * the provider context.
  166|       |     */
  167|    244|    if ((key = ossl_ml_kem_key_new(PROV_LIBCTX_OF(ctx), propq, evp_type)) != NULL) {
  ------------------
  |  |   31|    244|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  |  Branch (167:9): [True: 244, False: 0]
  ------------------
  168|    244|        const char *pct_type = ossl_prov_ctx_get_param(
  169|    244|            ctx, OSSL_PKEY_PARAM_ML_KEM_IMPORT_PCT_TYPE, "random");
  ------------------
  |  |  424|    244|# define OSSL_PKEY_PARAM_ML_KEM_IMPORT_PCT_TYPE "ml-kem.import_pct_type"
  ------------------
  170|       |
  171|    244|        if (ossl_prov_ctx_get_bool_param(
  ------------------
  |  Branch (171:13): [True: 244, False: 0]
  ------------------
  172|    244|            ctx, OSSL_PKEY_PARAM_ML_KEM_RETAIN_SEED, 1))
  ------------------
  |  |  428|    244|# define OSSL_PKEY_PARAM_ML_KEM_RETAIN_SEED "ml-kem.retain_seed"
  ------------------
  173|    244|            key->prov_flags |= ML_KEM_KEY_RETAIN_SEED;
  ------------------
  |  |  126|    244|# define ML_KEM_KEY_RETAIN_SEED (1 << 3)
  ------------------
  174|      0|        else
  175|      0|            key->prov_flags &= ~ML_KEM_KEY_RETAIN_SEED;
  ------------------
  |  |  126|      0|# define ML_KEM_KEY_RETAIN_SEED (1 << 3)
  ------------------
  176|    244|        if (ossl_prov_ctx_get_bool_param(
  ------------------
  |  Branch (176:13): [True: 244, False: 0]
  ------------------
  177|    244|            ctx, OSSL_PKEY_PARAM_ML_KEM_PREFER_SEED, 1))
  ------------------
  |  |  427|    244|# define OSSL_PKEY_PARAM_ML_KEM_PREFER_SEED "ml-kem.prefer_seed"
  ------------------
  178|    244|            key->prov_flags |= ML_KEM_KEY_PREFER_SEED;
  ------------------
  |  |  125|    244|# define ML_KEM_KEY_PREFER_SEED (1 << 2)
  ------------------
  179|      0|        else
  180|      0|            key->prov_flags &= ~ML_KEM_KEY_PREFER_SEED;
  ------------------
  |  |  125|      0|# define ML_KEM_KEY_PREFER_SEED (1 << 2)
  ------------------
  181|    244|        if (OPENSSL_strcasecmp(pct_type, "random") == 0)
  ------------------
  |  Branch (181:13): [True: 244, False: 0]
  ------------------
  182|    244|            key->prov_flags |= ML_KEM_KEY_RANDOM_PCT;
  ------------------
  |  |  123|    244|# define ML_KEM_KEY_RANDOM_PCT  (1 << 0)
  ------------------
  183|      0|        else if (OPENSSL_strcasecmp(pct_type, "fixed") == 0)
  ------------------
  |  Branch (183:18): [True: 0, False: 0]
  ------------------
  184|      0|            key->prov_flags |= ML_KEM_KEY_FIXED_PCT;
  ------------------
  |  |  124|      0|# define ML_KEM_KEY_FIXED_PCT   (1 << 1)
  ------------------
  185|      0|        else
  186|      0|            key->prov_flags &= ~ML_KEM_KEY_PCT_TYPE;
  ------------------
  |  |  129|      0|    (ML_KEM_KEY_RANDOM_PCT | ML_KEM_KEY_FIXED_PCT)
  |  |  ------------------
  |  |  |  |  123|      0|# define ML_KEM_KEY_RANDOM_PCT  (1 << 0)
  |  |  ------------------
  |  |                   (ML_KEM_KEY_RANDOM_PCT | ML_KEM_KEY_FIXED_PCT)
  |  |  ------------------
  |  |  |  |  124|      0|# define ML_KEM_KEY_FIXED_PCT   (1 << 1)
  |  |  ------------------
  ------------------
  187|    244|    }
  188|    244|    return key;
  189|    244|}
ml_kem_kmgmt.c:ml_kem_512_new:
  964|     29|    { \
  965|     29|        return ossl_prov_ml_kem_new(provctx, NULL, EVP_PKEY_ML_KEM_##bits); \
  966|     29|    } \
ml_kem_kmgmt.c:ml_kem_get_params:
  686|    166|{
  687|    166|    ML_KEM_KEY *key = vkey;
  688|    166|    const ML_KEM_VINFO *v = ossl_ml_kem_key_vinfo(key);
  ------------------
  |  |  202|    166|# define ossl_ml_kem_key_vinfo(key)     ((key)->vinfo)
  ------------------
  689|    166|    OSSL_PARAM *p;
  690|    166|    uint8_t *pubenc = NULL;
  691|       |
  692|    830|    for (p = params; p->key != NULL; p++)
  ------------------
  |  Branch (692:22): [True: 664, False: 166]
  ------------------
  693|    664|        switch (ml_kem_get_params_find_pidx(p->key)) {
  694|      0|        default:
  ------------------
  |  Branch (694:9): [True: 0, False: 664]
  ------------------
  695|      0|            break;
  696|       |
  697|    166|        case PIDX_PKEY_PARAM_BITS:
  ------------------
  |  |  256|    166|#define PIDX_PKEY_PARAM_BITS 178
  ------------------
  |  Branch (697:9): [True: 166, False: 498]
  ------------------
  698|    166|            if (!OSSL_PARAM_set_int(p, v->bits))
  ------------------
  |  Branch (698:17): [True: 0, False: 166]
  ------------------
  699|      0|                return 0;
  700|    166|            break;
  701|       |
  702|    166|        case PIDX_PKEY_PARAM_SECURITY_BITS:
  ------------------
  |  |  383|    166|#define PIDX_PKEY_PARAM_SECURITY_BITS 284
  ------------------
  |  Branch (702:9): [True: 166, False: 498]
  ------------------
  703|    166|            if (!OSSL_PARAM_set_int(p, v->secbits))
  ------------------
  |  Branch (703:17): [True: 0, False: 166]
  ------------------
  704|      0|                return 0;
  705|    166|            break;
  706|       |
  707|    166|        case PIDX_PKEY_PARAM_MAX_SIZE:
  ------------------
  |  |  312|    166|#define PIDX_PKEY_PARAM_MAX_SIZE 222
  ------------------
  |  Branch (707:9): [True: 166, False: 498]
  ------------------
  708|    166|            if (!OSSL_PARAM_set_int(p, v->ctext_bytes))
  ------------------
  |  Branch (708:17): [True: 0, False: 166]
  ------------------
  709|      0|                return 0;
  710|    166|            break;
  711|       |
  712|    166|        case PIDX_PKEY_PARAM_SECURITY_CATEGORY:
  ------------------
  |  |  384|    166|#define PIDX_PKEY_PARAM_SECURITY_CATEGORY PIDX_ALG_PARAM_SECURITY_CATEGORY
  |  |  ------------------
  |  |  |  |   23|    166|#define PIDX_ALG_PARAM_SECURITY_CATEGORY 8
  |  |  ------------------
  ------------------
  |  Branch (712:9): [True: 166, False: 498]
  ------------------
  713|    166|            if (!OSSL_PARAM_set_int(p, v->security_category))
  ------------------
  |  Branch (713:17): [True: 0, False: 166]
  ------------------
  714|      0|                return 0;
  715|    166|            break;
  716|       |
  717|       |        /* Exported to EVP_PKEY_get_raw_public_key() */
  718|    166|        case PIDX_PKEY_PARAM_PUB_KEY:
  ------------------
  |  |  329|      0|#define PIDX_PKEY_PARAM_PUB_KEY 236
  ------------------
  |  Branch (718:9): [True: 0, False: 664]
  ------------------
  719|       |        /* Needed by EVP_PKEY_get1_encoded_public_key() */
  720|      0|        case PIDX_PKEY_PARAM_ENCODED_PUBLIC_KEY:
  ------------------
  |  |  286|      0|#define PIDX_PKEY_PARAM_ENCODED_PUBLIC_KEY 204
  ------------------
  |  Branch (720:9): [True: 0, False: 664]
  ------------------
  721|      0|            if (ossl_ml_kem_have_pubkey(key)) {
  ------------------
  |  |  203|      0|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  722|      0|                if (p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|      0|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (722:21): [True: 0, False: 0]
  ------------------
  723|      0|                    return 0;
  724|      0|                p->return_size = v->pubkey_bytes;
  725|      0|                if (p->data == NULL)
  ------------------
  |  Branch (725:21): [True: 0, False: 0]
  ------------------
  726|      0|                    break;
  727|      0|                if (p->data_size < p->return_size)
  ------------------
  |  Branch (727:21): [True: 0, False: 0]
  ------------------
  728|      0|                    return 0;
  729|      0|                if (pubenc != NULL) {
  ------------------
  |  Branch (729:21): [True: 0, False: 0]
  ------------------
  730|      0|                    memcpy(p->data, pubenc, p->return_size);
  731|      0|                    break;
  732|      0|                }
  733|      0|                if (!ossl_ml_kem_encode_public_key(p->data, p->return_size, key))
  ------------------
  |  Branch (733:21): [True: 0, False: 0]
  ------------------
  734|      0|                    return 0;
  735|      0|                pubenc = p->data;
  736|      0|            }
  737|      0|            break;
  738|       |
  739|       |        /* Exported to EVP_PKEY_get_raw_private_key() */
  740|      0|        case PIDX_PKEY_PARAM_PRIV_KEY:
  ------------------
  |  |  327|      0|#define PIDX_PKEY_PARAM_PRIV_KEY 235
  ------------------
  |  Branch (740:9): [True: 0, False: 664]
  ------------------
  741|      0|            if (ossl_ml_kem_have_prvkey(key)) {
  ------------------
  |  |  204|      0|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  |  |  ------------------
  |  |  |  Branch (204:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  742|      0|                if (p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|      0|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (742:21): [True: 0, False: 0]
  ------------------
  743|      0|                    return 0;
  744|      0|                p->return_size = v->prvkey_bytes;
  745|      0|                if (p->data != NULL) {
  ------------------
  |  Branch (745:21): [True: 0, False: 0]
  ------------------
  746|      0|                    if (p->data_size < p->return_size)
  ------------------
  |  Branch (746:25): [True: 0, False: 0]
  ------------------
  747|      0|                        return 0;
  748|      0|                    if (!ossl_ml_kem_encode_private_key(p->data, p->return_size, key))
  ------------------
  |  Branch (748:25): [True: 0, False: 0]
  ------------------
  749|      0|                        return 0;
  750|      0|                }
  751|      0|            }
  752|      0|            break;
  753|       |
  754|       |        /* Exported for import */
  755|      0|        case PIDX_PKEY_PARAM_ML_KEM_SEED:
  ------------------
  |  |  325|      0|#define PIDX_PKEY_PARAM_ML_KEM_SEED 142
  ------------------
  |  Branch (755:9): [True: 0, False: 664]
  ------------------
  756|      0|            if (ossl_ml_kem_have_seed(key)) {
  ------------------
  |  |  205|      0|# define ossl_ml_kem_have_seed(key)     ((key)->d != NULL)
  |  |  ------------------
  |  |  |  Branch (205:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  757|      0|                if (p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|      0|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (757:21): [True: 0, False: 0]
  ------------------
  758|      0|                    return 0;
  759|      0|                p->return_size = ML_KEM_SEED_BYTES;
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  760|      0|                if (p->data != NULL) {
  ------------------
  |  Branch (760:21): [True: 0, False: 0]
  ------------------
  761|      0|                    if (p->data_size < p->return_size)
  ------------------
  |  Branch (761:25): [True: 0, False: 0]
  ------------------
  762|      0|                        return 0;
  763|      0|                    if (!ossl_ml_kem_encode_seed(p->data, p->return_size, key))
  ------------------
  |  Branch (763:25): [True: 0, False: 0]
  ------------------
  764|      0|                        return 0;
  765|      0|                }
  766|      0|            }
  767|      0|            break;
  768|    664|        }
  769|    166|    return 1;
  770|    166|}
ml_kem_kmgmt.c:ml_kem_get_params_find_pidx:
  539|    664|{
  540|    664|    switch(s[0]) {
  541|      0|    default:
  ------------------
  |  Branch (541:5): [True: 0, False: 664]
  ------------------
  542|      0|        break;
  543|    166|    case 'b':
  ------------------
  |  Branch (543:5): [True: 166, False: 498]
  ------------------
  544|    166|        if (strcmp("its", s + 1) == 0)
  ------------------
  |  Branch (544:13): [True: 166, False: 0]
  ------------------
  545|    166|            return PIDX_PKEY_PARAM_BITS;
  ------------------
  |  |  256|    166|#define PIDX_PKEY_PARAM_BITS 178
  ------------------
  546|      0|        break;
  547|      0|    case 'e':
  ------------------
  |  Branch (547:5): [True: 0, False: 664]
  ------------------
  548|      0|        if (strcmp("ncoded-pub-key", s + 1) == 0)
  ------------------
  |  Branch (548:13): [True: 0, False: 0]
  ------------------
  549|      0|            return PIDX_PKEY_PARAM_ENCODED_PUBLIC_KEY;
  ------------------
  |  |  286|      0|#define PIDX_PKEY_PARAM_ENCODED_PUBLIC_KEY 204
  ------------------
  550|      0|        break;
  551|    166|    case 'm':
  ------------------
  |  Branch (551:5): [True: 166, False: 498]
  ------------------
  552|    166|        if (strcmp("ax-size", s + 1) == 0)
  ------------------
  |  Branch (552:13): [True: 166, False: 0]
  ------------------
  553|    166|            return PIDX_PKEY_PARAM_MAX_SIZE;
  ------------------
  |  |  312|    166|#define PIDX_PKEY_PARAM_MAX_SIZE 222
  ------------------
  554|      0|        break;
  555|      0|    case 'p':
  ------------------
  |  Branch (555:5): [True: 0, False: 664]
  ------------------
  556|      0|        switch(s[1]) {
  557|      0|        default:
  ------------------
  |  Branch (557:9): [True: 0, False: 0]
  ------------------
  558|      0|            break;
  559|      0|        case 'r':
  ------------------
  |  Branch (559:9): [True: 0, False: 0]
  ------------------
  560|      0|            if (strcmp("iv", s + 2) == 0)
  ------------------
  |  Branch (560:17): [True: 0, False: 0]
  ------------------
  561|      0|                return PIDX_PKEY_PARAM_PRIV_KEY;
  ------------------
  |  |  327|      0|#define PIDX_PKEY_PARAM_PRIV_KEY 235
  ------------------
  562|      0|            break;
  563|      0|        case 'u':
  ------------------
  |  Branch (563:9): [True: 0, False: 0]
  ------------------
  564|      0|            if (strcmp("b", s + 2) == 0)
  ------------------
  |  Branch (564:17): [True: 0, False: 0]
  ------------------
  565|      0|                return PIDX_PKEY_PARAM_PUB_KEY;
  ------------------
  |  |  329|      0|#define PIDX_PKEY_PARAM_PUB_KEY 236
  ------------------
  566|      0|        }
  567|      0|        break;
  568|    332|    case 's':
  ------------------
  |  Branch (568:5): [True: 332, False: 332]
  ------------------
  569|    332|        switch(s[1]) {
  570|      0|        default:
  ------------------
  |  Branch (570:9): [True: 0, False: 332]
  ------------------
  571|      0|            break;
  572|    332|        case 'e':
  ------------------
  |  Branch (572:9): [True: 332, False: 0]
  ------------------
  573|    332|            switch(s[2]) {
  574|      0|            default:
  ------------------
  |  Branch (574:13): [True: 0, False: 332]
  ------------------
  575|      0|                break;
  576|    332|            case 'c':
  ------------------
  |  Branch (576:13): [True: 332, False: 0]
  ------------------
  577|    332|                switch(s[3]) {
  578|      0|                default:
  ------------------
  |  Branch (578:17): [True: 0, False: 332]
  ------------------
  579|      0|                    break;
  580|    332|                case 'u':
  ------------------
  |  Branch (580:17): [True: 332, False: 0]
  ------------------
  581|    332|                    switch(s[4]) {
  582|      0|                    default:
  ------------------
  |  Branch (582:21): [True: 0, False: 332]
  ------------------
  583|      0|                        break;
  584|    332|                    case 'r':
  ------------------
  |  Branch (584:21): [True: 332, False: 0]
  ------------------
  585|    332|                        switch(s[5]) {
  586|      0|                        default:
  ------------------
  |  Branch (586:25): [True: 0, False: 332]
  ------------------
  587|      0|                            break;
  588|    332|                        case 'i':
  ------------------
  |  Branch (588:25): [True: 332, False: 0]
  ------------------
  589|    332|                            switch(s[6]) {
  590|      0|                            default:
  ------------------
  |  Branch (590:29): [True: 0, False: 332]
  ------------------
  591|      0|                                break;
  592|    332|                            case 't':
  ------------------
  |  Branch (592:29): [True: 332, False: 0]
  ------------------
  593|    332|                                switch(s[7]) {
  594|      0|                                default:
  ------------------
  |  Branch (594:33): [True: 0, False: 332]
  ------------------
  595|      0|                                    break;
  596|    332|                                case 'y':
  ------------------
  |  Branch (596:33): [True: 332, False: 0]
  ------------------
  597|    332|                                    switch(s[8]) {
  598|      0|                                    default:
  ------------------
  |  Branch (598:37): [True: 0, False: 332]
  ------------------
  599|      0|                                        break;
  600|    332|                                    case '-':
  ------------------
  |  Branch (600:37): [True: 332, False: 0]
  ------------------
  601|    332|                                        switch(s[9]) {
  602|      0|                                        default:
  ------------------
  |  Branch (602:41): [True: 0, False: 332]
  ------------------
  603|      0|                                            break;
  604|    166|                                        case 'b':
  ------------------
  |  Branch (604:41): [True: 166, False: 166]
  ------------------
  605|    166|                                            if (strcmp("its", s + 10) == 0)
  ------------------
  |  Branch (605:49): [True: 166, False: 0]
  ------------------
  606|    166|                                                return PIDX_PKEY_PARAM_SECURITY_BITS;
  ------------------
  |  |  383|    166|#define PIDX_PKEY_PARAM_SECURITY_BITS 284
  ------------------
  607|      0|                                            break;
  608|    166|                                        case 'c':
  ------------------
  |  Branch (608:41): [True: 166, False: 166]
  ------------------
  609|    166|                                            if (strcmp("ategory", s + 10) == 0)
  ------------------
  |  Branch (609:49): [True: 166, False: 0]
  ------------------
  610|    166|                                                return PIDX_PKEY_PARAM_SECURITY_CATEGORY;
  ------------------
  |  |  384|    166|#define PIDX_PKEY_PARAM_SECURITY_CATEGORY PIDX_ALG_PARAM_SECURITY_CATEGORY
  |  |  ------------------
  |  |  |  |   23|    166|#define PIDX_ALG_PARAM_SECURITY_CATEGORY 8
  |  |  ------------------
  ------------------
  611|    332|                                        }
  612|    332|                                    }
  613|    332|                                }
  614|    332|                            }
  615|    332|                        }
  616|    332|                    }
  617|    332|                }
  618|      0|                break;
  619|      0|            case 'e':
  ------------------
  |  Branch (619:13): [True: 0, False: 332]
  ------------------
  620|      0|                if (strcmp("d", s + 3) == 0)
  ------------------
  |  Branch (620:21): [True: 0, False: 0]
  ------------------
  621|      0|                    return PIDX_PKEY_PARAM_ML_KEM_SEED;
  ------------------
  |  |  325|      0|#define PIDX_PKEY_PARAM_ML_KEM_SEED 142
  ------------------
  622|    332|            }
  623|    332|        }
  624|    664|    }
  625|      0|    return -1;
  626|    664|}
ml_kem_kmgmt.c:ml_kem_has:
  192|     38|{
  193|     38|    const ML_KEM_KEY *key = vkey;
  194|       |
  195|       |    /* A NULL key MUST fail to have anything */
  196|     38|    if (!ossl_prov_is_running() || key == NULL)
  ------------------
  |  Branch (196:9): [True: 0, False: 38]
  |  Branch (196:36): [True: 0, False: 38]
  ------------------
  197|      0|        return 0;
  198|       |
  199|     38|    switch (selection & OSSL_KEYMGMT_SELECT_KEYPAIR) {
  ------------------
  |  |  650|     38|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|     38|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|     38|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  200|      0|    case 0:
  ------------------
  |  Branch (200:5): [True: 0, False: 38]
  ------------------
  201|      0|        return 1;
  202|     38|    case OSSL_KEYMGMT_SELECT_PUBLIC_KEY:
  ------------------
  |  |  641|     38|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (202:5): [True: 38, False: 0]
  ------------------
  203|     38|        return ossl_ml_kem_have_pubkey(key);
  ------------------
  |  |  203|     38|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  204|      0|    default:
  ------------------
  |  Branch (204:5): [True: 0, False: 38]
  ------------------
  205|      0|        return ossl_ml_kem_have_prvkey(key);
  ------------------
  |  |  204|      0|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  ------------------
  206|     38|    }
  207|     38|}
ml_kem_kmgmt.c:ml_kem_match:
  210|     16|{
  211|     16|    const ML_KEM_KEY *key1 = vkey1;
  212|     16|    const ML_KEM_KEY *key2 = vkey2;
  213|       |
  214|     16|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (214:9): [True: 0, False: 16]
  ------------------
  215|      0|        return 0;
  216|       |
  217|       |    /* All we have that can be compared is key material */
  218|     16|    if (!(selection & OSSL_KEYMGMT_SELECT_KEYPAIR))
  ------------------
  |  |  650|     16|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|     16|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|     16|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (218:9): [True: 0, False: 16]
  ------------------
  219|      0|        return 1;
  220|       |
  221|     16|    return ossl_ml_kem_pubkey_cmp(key1, key2);
  222|     16|}
ml_kem_kmgmt.c:ml_kem_512_gen_init:
  969|     72|    { \
  970|     72|        return ml_kem_gen_init(provctx, selection, params, \
  971|     72|                               EVP_PKEY_ML_KEM_##bits); \
  972|     72|    } \
ml_kem_kmgmt.c:ml_kem_gen_init:
  854|    166|{
  855|    166|    PROV_ML_KEM_GEN_CTX *gctx = NULL;
  856|       |
  857|       |    /*
  858|       |     * We can only generate private keys, check that the selection is
  859|       |     * appropriate.
  860|       |     */
  861|    166|    if (!ossl_prov_is_running()
  ------------------
  |  Branch (861:9): [True: 0, False: 166]
  ------------------
  862|    166|        || (selection & minimal_selection) == 0
  ------------------
  |  Branch (862:12): [True: 0, False: 166]
  ------------------
  863|    166|        || (gctx = OPENSSL_zalloc(sizeof(*gctx))) == NULL)
  ------------------
  |  |  104|    166|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (863:12): [True: 0, False: 166]
  ------------------
  864|      0|        return NULL;
  865|       |
  866|    166|    gctx->selection = selection;
  867|    166|    gctx->evp_type = evp_type;
  868|    166|    gctx->provctx = provctx;
  869|    166|    if (ml_kem_gen_set_params(gctx, params))
  ------------------
  |  Branch (869:9): [True: 166, False: 0]
  ------------------
  870|    166|        return gctx;
  871|       |
  872|      0|    ml_kem_gen_cleanup(gctx);
  873|      0|    return NULL;
  874|    166|}
ml_kem_kmgmt.c:ml_kem_gen_set_params:
  816|    166|{
  817|    166|    PROV_ML_KEM_GEN_CTX *gctx = vgctx;
  818|    166|    const OSSL_PARAM *p;
  819|       |
  820|    166|    if (gctx == NULL)
  ------------------
  |  Branch (820:9): [True: 0, False: 166]
  ------------------
  821|      0|        return 0;
  822|    166|    if (ossl_param_is_empty(params))
  ------------------
  |  Branch (822:9): [True: 166, False: 0]
  ------------------
  823|    166|        return 1;
  824|       |
  825|      0|    p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_PROPERTIES);
  ------------------
  |  |  432|      0|# define OSSL_PKEY_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  126|      0|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  826|      0|    if (p != NULL) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|        if (p->data_type != OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|      0|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (827:13): [True: 0, False: 0]
  ------------------
  828|      0|            return 0;
  829|      0|        OPENSSL_free(gctx->propq);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  830|      0|        if ((gctx->propq = OPENSSL_strdup(p->data)) == NULL)
  ------------------
  |  |  119|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (830:13): [True: 0, False: 0]
  ------------------
  831|      0|            return 0;
  832|      0|    }
  833|       |
  834|      0|    p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_ML_KEM_SEED);
  ------------------
  |  |  429|      0|# define OSSL_PKEY_PARAM_ML_KEM_SEED "seed"
  ------------------
  835|      0|    if (p != NULL) {
  ------------------
  |  Branch (835:9): [True: 0, False: 0]
  ------------------
  836|      0|        size_t len = ML_KEM_SEED_BYTES;
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  837|       |
  838|      0|        gctx->seed = gctx->seedbuf;
  839|      0|        if (OSSL_PARAM_get_octet_string(p, (void **)&gctx->seed, len, &len)
  ------------------
  |  Branch (839:13): [True: 0, False: 0]
  ------------------
  840|      0|            && len == ML_KEM_SEED_BYTES)
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  |  Branch (840:16): [True: 0, False: 0]
  ------------------
  841|      0|            return 1;
  842|       |
  843|       |        /* Possibly, but less likely wrong data type */
  844|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SEED_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  845|      0|        gctx->seed = NULL;
  846|      0|        return 0;
  847|      0|    }
  848|       |
  849|      0|    return 1;
  850|      0|}
ml_kem_kmgmt.c:ml_kem_gen:
  887|    166|{
  888|    166|    PROV_ML_KEM_GEN_CTX *gctx = vgctx;
  889|    166|    ML_KEM_KEY *key;
  890|    166|    uint8_t *nopub = NULL;
  891|    166|    uint8_t *seed;
  892|    166|    int genok = 0;
  893|       |
  894|    166|    if (gctx == NULL
  ------------------
  |  Branch (894:9): [True: 0, False: 166]
  ------------------
  895|    166|        || (gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) ==
  ------------------
  |  |  650|    166|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|    166|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|    166|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (895:12): [True: 0, False: 166]
  ------------------
  896|    166|            OSSL_KEYMGMT_SELECT_PUBLIC_KEY)
  ------------------
  |  |  641|    166|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  897|      0|        return NULL;
  898|    166|    seed = gctx->seed;
  899|    166|    key = ossl_prov_ml_kem_new(gctx->provctx, gctx->propq, gctx->evp_type);
  900|    166|    if (key == NULL)
  ------------------
  |  Branch (900:9): [True: 0, False: 166]
  ------------------
  901|      0|        return NULL;
  902|       |
  903|    166|    if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
  ------------------
  |  |  650|    166|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|    166|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|    166|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (903:9): [True: 0, False: 166]
  ------------------
  904|      0|        return key;
  905|       |
  906|    166|    if (seed != NULL && !ossl_ml_kem_set_seed(seed, ML_KEM_SEED_BYTES, key))
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  |  Branch (906:9): [True: 0, False: 166]
  |  Branch (906:25): [True: 0, False: 0]
  ------------------
  907|      0|        return NULL;
  908|    166|    genok = ossl_ml_kem_genkey(nopub, 0, key);
  909|       |
  910|       |    /* Erase the single-use seed */
  911|    166|    if (seed != NULL)
  ------------------
  |  Branch (911:9): [True: 0, False: 166]
  ------------------
  912|      0|        OPENSSL_cleanse(seed, ML_KEM_SEED_BYTES);
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  913|    166|    gctx->seed = NULL;
  914|       |
  915|    166|    if (genok) {
  ------------------
  |  Branch (915:9): [True: 166, False: 0]
  ------------------
  916|       |#ifdef FIPS_MODULE
  917|       |        if (!ml_kem_pairwise_test(key, ML_KEM_KEY_FIXED_PCT)) {
  918|       |            ossl_set_error_state(OSSL_SELF_TEST_TYPE_PCT);
  919|       |            ossl_ml_kem_key_free(key);
  920|       |            return NULL;
  921|       |        }
  922|       |#endif  /* FIPS_MODULE */
  923|    166|        return key;
  924|    166|    }
  925|       |
  926|      0|    ossl_ml_kem_key_free(key);
  927|      0|    return NULL;
  928|    166|}
ml_kem_kmgmt.c:ml_kem_gen_cleanup:
  931|    166|{
  932|    166|    PROV_ML_KEM_GEN_CTX *gctx = vgctx;
  933|       |
  934|    166|    if (gctx == NULL)
  ------------------
  |  Branch (934:9): [True: 0, False: 166]
  ------------------
  935|      0|        return;
  936|       |
  937|    166|    if (gctx->seed != NULL)
  ------------------
  |  Branch (937:9): [True: 0, False: 166]
  ------------------
  938|      0|        OPENSSL_cleanse(gctx->seed, ML_KEM_RANDOM_BYTES);
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
  939|    166|    OPENSSL_free(gctx->propq);
  ------------------
  |  |  115|    166|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  940|    166|    OPENSSL_free(gctx);
  ------------------
  |  |  115|    166|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|    166|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|    166|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  941|    166|}
ml_kem_kmgmt.c:ml_kem_import:
  501|     78|{
  502|     78|    ML_KEM_KEY *key = vkey;
  503|     78|    int include_private;
  504|     78|    int res;
  505|       |
  506|     78|    if (!ossl_prov_is_running() || key == NULL)
  ------------------
  |  Branch (506:9): [True: 0, False: 78]
  |  Branch (506:36): [True: 0, False: 78]
  ------------------
  507|      0|        return 0;
  508|       |
  509|     78|    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
  ------------------
  |  |  650|     78|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|     78|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|     78|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (509:9): [True: 0, False: 78]
  ------------------
  510|      0|        return 0;
  511|       |
  512|     78|    include_private = selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY ? 1 : 0;
  ------------------
  |  |  640|     78|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (512:23): [True: 78, False: 0]
  ------------------
  513|     78|    res = ml_kem_key_fromdata(key, params, include_private);
  514|     78|    if (res > 0 && include_private
  ------------------
  |  Branch (514:9): [True: 0, False: 78]
  |  Branch (514:20): [True: 0, False: 0]
  ------------------
  515|     78|        && !ml_kem_pairwise_test(key, key->prov_flags)) {
  ------------------
  |  Branch (515:12): [True: 0, False: 0]
  ------------------
  516|       |#ifdef FIPS_MODULE
  517|       |        ossl_set_error_state(OSSL_SELF_TEST_TYPE_PCT);
  518|       |#endif
  519|      0|        ossl_ml_kem_key_reset(key);
  520|      0|        res = 0;
  521|      0|    }
  522|     78|    return res;
  523|     78|}
ml_kem_kmgmt.c:ml_kem_key_fromdata:
  410|     78|{
  411|     78|    const OSSL_PARAM *p = NULL;
  412|     78|    const void *pubenc = NULL, *prvenc = NULL, *seedenc = NULL;
  413|     78|    size_t publen = 0, prvlen = 0, seedlen = 0, puboff;
  414|     78|    const ML_KEM_VINFO *v;
  415|       |
  416|       |    /* Invalid attempt to mutate a key, what is the right error to report? */
  417|     78|    if (key == NULL || ossl_ml_kem_have_pubkey(key))
  ------------------
  |  |  203|     78|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  |  |  ------------------
  |  |  |  Branch (203:41): [True: 0, False: 78]
  |  |  ------------------
  ------------------
  |  Branch (417:9): [True: 0, False: 78]
  ------------------
  418|      0|        return 0;
  419|     78|    v = ossl_ml_kem_key_vinfo(key);
  ------------------
  |  |  202|     78|# define ossl_ml_kem_key_vinfo(key)     ((key)->vinfo)
  ------------------
  420|       |
  421|       |    /*
  422|       |     * When a private key is provided, without a seed, any public key also
  423|       |     * provided will be ignored (apart from length), just as with the seed.
  424|       |     */
  425|    119|    for (p = params; p->key != NULL; p++)
  ------------------
  |  Branch (425:22): [True: 78, False: 41]
  ------------------
  426|     78|        switch (ml_kem_key_types_find_pidx(p->key)) {
  427|      0|        default:
  ------------------
  |  Branch (427:9): [True: 0, False: 78]
  ------------------
  428|      0|            break;
  429|       |
  430|      0|        case PIDX_PKEY_PARAM_ML_KEM_SEED:
  ------------------
  |  |  325|      0|#define PIDX_PKEY_PARAM_ML_KEM_SEED 142
  ------------------
  |  Branch (430:9): [True: 0, False: 78]
  ------------------
  431|      0|            if (include_private) {
  ------------------
  |  Branch (431:17): [True: 0, False: 0]
  ------------------
  432|       |                /*
  433|       |                 * When a seed is provided, the private and public keys may be ignored,
  434|       |                 * after validating just their lengths.  Comparing encodings or hashes
  435|       |                 * when applicable is possible, but not currently implemented.
  436|       |                 */
  437|      0|                if (OSSL_PARAM_get_octet_string_ptr(p, &seedenc, &seedlen) != 1)
  ------------------
  |  Branch (437:21): [True: 0, False: 0]
  ------------------
  438|      0|                    return 0;
  439|      0|                if (seedlen != 0 && seedlen != ML_KEM_SEED_BYTES) {
  ------------------
  |  |   48|      0|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  |  Branch (439:21): [True: 0, False: 0]
  |  Branch (439:37): [True: 0, False: 0]
  ------------------
  440|      0|                    ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SEED_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  441|      0|                    return 0;
  442|      0|                }
  443|      0|            }
  444|      0|            break;
  445|       |
  446|     35|        case PIDX_PKEY_PARAM_PRIV_KEY:
  ------------------
  |  |  327|     35|#define PIDX_PKEY_PARAM_PRIV_KEY 235
  ------------------
  |  Branch (446:9): [True: 35, False: 43]
  ------------------
  447|     35|            if (include_private) {
  ------------------
  |  Branch (447:17): [True: 35, False: 0]
  ------------------
  448|     35|                if (OSSL_PARAM_get_octet_string_ptr(p, &prvenc, &prvlen) != 1)
  ------------------
  |  Branch (448:21): [True: 0, False: 35]
  ------------------
  449|      0|                    return 0;
  450|     35|                if (prvlen != 0 && prvlen != v->prvkey_bytes) {
  ------------------
  |  Branch (450:21): [True: 35, False: 0]
  |  Branch (450:36): [True: 16, False: 19]
  ------------------
  451|     16|                    ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
  ------------------
  |  |  401|     16|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     16|    (ERR_new(),                                                 \
  |  |  |  |  404|     16|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     16|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     16|     ERR_set_error)
  |  |  ------------------
  ------------------
  452|     16|                    return 0;
  453|     16|                }
  454|     35|            }
  455|     19|            break;
  456|       |
  457|       |        /* Used only when no seed or private key is provided. */
  458|     43|        case PIDX_PKEY_PARAM_PUB_KEY:
  ------------------
  |  |  329|     43|#define PIDX_PKEY_PARAM_PUB_KEY 236
  ------------------
  |  Branch (458:9): [True: 43, False: 35]
  ------------------
  459|     43|            if (OSSL_PARAM_get_octet_string_ptr(p, &pubenc, &publen) != 1)
  ------------------
  |  Branch (459:17): [True: 0, False: 43]
  ------------------
  460|      0|                return 0;
  461|     43|            if (publen != 0 && publen != v->pubkey_bytes) {
  ------------------
  |  Branch (461:17): [True: 42, False: 1]
  |  Branch (461:32): [True: 21, False: 21]
  ------------------
  462|     21|                ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
  ------------------
  |  |  401|     21|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     21|    (ERR_new(),                                                 \
  |  |  |  |  404|     21|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|     21|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|     21|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|     21|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     21|     ERR_set_error)
  |  |  ------------------
  ------------------
  463|     21|                return 0;
  464|     21|            }
  465|     22|            break;
  466|     78|        }
  467|       |
  468|       |    /* The caller MUST specify at least one of seed, private or public keys. */
  469|     41|    if (seedlen == 0 && publen == 0 && prvlen == 0) {
  ------------------
  |  Branch (469:9): [True: 41, False: 0]
  |  Branch (469:25): [True: 20, False: 21]
  |  Branch (469:40): [True: 1, False: 19]
  ------------------
  470|      1|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_KEY);
  ------------------
  |  |  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  471|      1|        return 0;
  472|      1|    }
  473|       |
  474|       |    /* Check any explicit public key against embedded value in private key */
  475|     40|    if (publen > 0 && prvlen > 0) {
  ------------------
  |  Branch (475:9): [True: 21, False: 19]
  |  Branch (475:23): [True: 0, False: 21]
  ------------------
  476|       |        /* point to the ek offset in dk = DKpke||ek||H(ek)||z */
  477|      0|        puboff = prvlen - ML_KEM_RANDOM_BYTES - ML_KEM_PKHASH_BYTES - publen;
  ------------------
  |  |   47|      0|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  ------------------
                      puboff = prvlen - ML_KEM_RANDOM_BYTES - ML_KEM_PKHASH_BYTES - publen;
  ------------------
  |  |   50|      0|# define ML_KEM_PKHASH_BYTES        32 /* Salts the shared-secret */
  ------------------
  478|      0|        if (memcmp(pubenc, (unsigned char *)prvenc + puboff, publen) != 0) {
  ------------------
  |  Branch (478:13): [True: 0, False: 0]
  ------------------
  479|      0|            ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_KEY,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_KEY,
  ------------------
  |  |  118|      0|# define ERR_LIB_PROV            57
  ------------------
                          ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_KEY,
  ------------------
  |  |   73|      0|# define PROV_R_INVALID_KEY                               158
  ------------------
  480|      0|                           "explicit %s public key does not match private",
  481|      0|                           v->algorithm_name);
  482|      0|            return 0;
  483|      0|        }
  484|      0|    }
  485|       |
  486|     40|    if (seedlen != 0
  ------------------
  |  Branch (486:9): [True: 0, False: 40]
  ------------------
  487|     40|        && (prvlen == 0 || (key->prov_flags & ML_KEM_KEY_PREFER_SEED))) {
  ------------------
  |  |  125|      0|# define ML_KEM_KEY_PREFER_SEED (1 << 2)
  ------------------
  |  Branch (487:13): [True: 0, False: 0]
  |  Branch (487:28): [True: 0, False: 0]
  ------------------
  488|      0|        if (prvlen != 0 && !check_seed(seedenc, prvenc, key))
  ------------------
  |  Branch (488:13): [True: 0, False: 0]
  |  Branch (488:28): [True: 0, False: 0]
  ------------------
  489|      0|            return 0;
  490|      0|        if (!ossl_ml_kem_set_seed(seedenc, seedlen, key)
  ------------------
  |  Branch (490:13): [True: 0, False: 0]
  ------------------
  491|      0|            || !ossl_ml_kem_genkey(NULL, 0, key))
  ------------------
  |  Branch (491:16): [True: 0, False: 0]
  ------------------
  492|      0|            return 0;
  493|      0|        return prvlen == 0 || check_prvenc(prvenc, key);
  ------------------
  |  Branch (493:16): [True: 0, False: 0]
  |  Branch (493:31): [True: 0, False: 0]
  ------------------
  494|     40|    } else if (prvlen != 0) {
  ------------------
  |  Branch (494:16): [True: 19, False: 21]
  ------------------
  495|     19|        return ossl_ml_kem_parse_private_key(prvenc, prvlen, key);
  496|     19|    }
  497|     21|    return ossl_ml_kem_parse_public_key(pubenc, publen, key);
  498|     40|}
ml_kem_kmgmt.c:ml_kem_key_types_find_pidx:
  339|     78|{
  340|     78|    switch(s[0]) {
  341|      0|    default:
  ------------------
  |  Branch (341:5): [True: 0, False: 78]
  ------------------
  342|      0|        break;
  343|     78|    case 'p':
  ------------------
  |  Branch (343:5): [True: 78, False: 0]
  ------------------
  344|     78|        switch(s[1]) {
  345|      0|        default:
  ------------------
  |  Branch (345:9): [True: 0, False: 78]
  ------------------
  346|      0|            break;
  347|     35|        case 'r':
  ------------------
  |  Branch (347:9): [True: 35, False: 43]
  ------------------
  348|     35|            if (strcmp("iv", s + 2) == 0)
  ------------------
  |  Branch (348:17): [True: 35, False: 0]
  ------------------
  349|     35|                return PIDX_PKEY_PARAM_PRIV_KEY;
  ------------------
  |  |  327|     35|#define PIDX_PKEY_PARAM_PRIV_KEY 235
  ------------------
  350|      0|            break;
  351|     43|        case 'u':
  ------------------
  |  Branch (351:9): [True: 43, False: 35]
  ------------------
  352|     43|            if (strcmp("b", s + 2) == 0)
  ------------------
  |  Branch (352:17): [True: 43, False: 0]
  ------------------
  353|     43|                return PIDX_PKEY_PARAM_PUB_KEY;
  ------------------
  |  |  329|     43|#define PIDX_PKEY_PARAM_PUB_KEY 236
  ------------------
  354|     78|        }
  355|      0|        break;
  356|      0|    case 's':
  ------------------
  |  Branch (356:5): [True: 0, False: 78]
  ------------------
  357|      0|        if (strcmp("eed", s + 1) == 0)
  ------------------
  |  Branch (357:13): [True: 0, False: 0]
  ------------------
  358|      0|            return PIDX_PKEY_PARAM_ML_KEM_SEED;
  ------------------
  |  |  325|      0|#define PIDX_PKEY_PARAM_ML_KEM_SEED 142
  ------------------
  359|     78|    }
  360|      0|    return -1;
  361|     78|}
ml_kem_kmgmt.c:ml_kem_export:
  238|      3|{
  239|      3|    ML_KEM_KEY *key = vkey;
  240|      3|    OSSL_PARAM_BLD *tmpl = NULL;
  241|      3|    OSSL_PARAM *params = NULL;
  242|      3|    const ML_KEM_VINFO *v;
  243|      3|    uint8_t *pubenc = NULL, *prvenc = NULL, *seedenc = NULL;
  244|      3|    size_t prvlen = 0, seedlen = 0;
  245|      3|    int ret = 0;
  246|       |
  247|      3|    if (!ossl_prov_is_running() || key == NULL)
  ------------------
  |  Branch (247:9): [True: 0, False: 3]
  |  Branch (247:36): [True: 0, False: 3]
  ------------------
  248|      0|        return 0;
  249|       |
  250|      3|    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
  ------------------
  |  |  650|      3|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  640|      3|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  641|      3|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (250:9): [True: 0, False: 3]
  ------------------
  251|      0|        return 0;
  252|       |
  253|      3|    v = ossl_ml_kem_key_vinfo(key);
  ------------------
  |  |  202|      3|# define ossl_ml_kem_key_vinfo(key)     ((key)->vinfo)
  ------------------
  254|      3|    if (!ossl_ml_kem_have_pubkey(key)) {
  ------------------
  |  |  203|      3|# define ossl_ml_kem_have_pubkey(key)   ((key)->t != NULL)
  ------------------
  |  Branch (254:9): [True: 0, False: 3]
  ------------------
  255|       |        /* Fail when no key material can be returned */
  256|      0|        if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) == 0
  ------------------
  |  |  640|      0|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (256:13): [True: 0, False: 0]
  ------------------
  257|      0|            || !ossl_ml_kem_decoded_key(key)) {
  ------------------
  |  |  207|      0|# define ossl_ml_kem_decoded_key(key)   ((key)->encoded_dk != NULL \
  |  |  ------------------
  |  |  |  Branch (207:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  208|      0|                                         || ((key)->s == NULL && (key)->d != NULL))
  |  |  ------------------
  |  |  |  Branch (208:46): [True: 0, False: 0]
  |  |  |  Branch (208:66): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  258|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  259|      0|            return 0;
  260|      0|        }
  261|      3|    } else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  641|      3|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (261:16): [True: 3, False: 0]
  ------------------
  262|      3|        pubenc = OPENSSL_malloc(v->pubkey_bytes);
  ------------------
  |  |  102|      3|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  263|      3|        if (pubenc == NULL
  ------------------
  |  Branch (263:13): [True: 0, False: 3]
  ------------------
  264|      3|            || !ossl_ml_kem_encode_public_key(pubenc, v->pubkey_bytes, key))
  ------------------
  |  Branch (264:16): [True: 0, False: 3]
  ------------------
  265|      0|            goto err;
  266|      3|    }
  267|       |
  268|      3|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  640|      3|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (268:9): [True: 3, False: 0]
  ------------------
  269|       |        /*
  270|       |         * The seed and/or private key material are allocated on the secure
  271|       |         * heap if configured, ossl_param_build_set_octet_string(), will then
  272|       |         * also use the secure heap.
  273|       |         */
  274|      3|        if (ossl_ml_kem_have_seed(key)) {
  ------------------
  |  |  205|      3|# define ossl_ml_kem_have_seed(key)     ((key)->d != NULL)
  |  |  ------------------
  |  |  |  Branch (205:41): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  275|      3|            seedlen = ML_KEM_SEED_BYTES;
  ------------------
  |  |   48|      3|# define ML_KEM_SEED_BYTES      (ML_KEM_RANDOM_BYTES * 2) /* Keygen (d, z) */
  |  |  ------------------
  |  |  |  |   47|      3|# define ML_KEM_RANDOM_BYTES    32 /* rho, sigma, ... */
  |  |  ------------------
  ------------------
  276|      3|            if ((seedenc = OPENSSL_secure_zalloc(seedlen)) == NULL
  ------------------
  |  |  125|      3|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (276:17): [True: 0, False: 3]
  ------------------
  277|      3|                || !ossl_ml_kem_encode_seed(seedenc, seedlen, key))
  ------------------
  |  Branch (277:20): [True: 0, False: 3]
  ------------------
  278|      0|                goto err;
  279|      3|        }
  280|      3|        if (ossl_ml_kem_have_prvkey(key)) {
  ------------------
  |  |  204|      3|# define ossl_ml_kem_have_prvkey(key)   ((key)->s != NULL)
  |  |  ------------------
  |  |  |  Branch (204:41): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  281|      3|            prvlen = v->prvkey_bytes;
  282|      3|            if ((prvenc = OPENSSL_secure_zalloc(prvlen)) == NULL
  ------------------
  |  |  125|      3|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (282:17): [True: 0, False: 3]
  ------------------
  283|      3|                || !ossl_ml_kem_encode_private_key(prvenc, prvlen, key))
  ------------------
  |  Branch (283:20): [True: 0, False: 3]
  ------------------
  284|      0|                goto err;
  285|      3|        } else if (ossl_ml_kem_have_dkenc(key)) {
  ------------------
  |  |  206|      0|# define ossl_ml_kem_have_dkenc(key)    ((key)->encoded_dk != NULL)
  |  |  ------------------
  |  |  |  Branch (206:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  286|      0|            prvlen = v->prvkey_bytes;
  287|      0|            if ((prvenc = OPENSSL_secure_zalloc(prvlen)) == NULL)
  ------------------
  |  |  125|      0|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (287:17): [True: 0, False: 0]
  ------------------
  288|      0|                goto err;
  289|      0|            memcpy(prvenc, key->encoded_dk, prvlen);
  290|      0|        }
  291|      3|    }
  292|       |
  293|      3|    tmpl = OSSL_PARAM_BLD_new();
  294|      3|    if (tmpl == NULL)
  ------------------
  |  Branch (294:9): [True: 0, False: 3]
  ------------------
  295|      0|        goto err;
  296|       |
  297|       |    /* The (d, z) seed, when available and private keys are requested. */
  298|      3|    if (seedenc != NULL
  ------------------
  |  Branch (298:9): [True: 3, False: 0]
  ------------------
  299|      3|        && !ossl_param_build_set_octet_string(
  ------------------
  |  Branch (299:12): [True: 0, False: 3]
  ------------------
  300|      3|                tmpl, params, OSSL_PKEY_PARAM_ML_KEM_SEED, seedenc, seedlen))
  ------------------
  |  |  429|      3|# define OSSL_PKEY_PARAM_ML_KEM_SEED "seed"
  ------------------
  301|      0|        goto err;
  302|       |
  303|       |    /* The private key in the FIPS 203 |dk| format, when requested. */
  304|      3|    if (prvenc != NULL
  ------------------
  |  Branch (304:9): [True: 3, False: 0]
  ------------------
  305|      3|        && !ossl_param_build_set_octet_string(
  ------------------
  |  Branch (305:12): [True: 0, False: 3]
  ------------------
  306|      3|                tmpl, params, OSSL_PKEY_PARAM_PRIV_KEY, prvenc, prvlen))
  ------------------
  |  |  431|      3|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  307|      0|            goto err;
  308|       |
  309|       |    /* The public key on request; it is always available when either is */
  310|      3|    if (pubenc != NULL
  ------------------
  |  Branch (310:9): [True: 3, False: 0]
  ------------------
  311|      3|        && !ossl_param_build_set_octet_string(
  ------------------
  |  Branch (311:12): [True: 0, False: 3]
  ------------------
  312|      3|               tmpl, params, OSSL_PKEY_PARAM_PUB_KEY, pubenc, v->pubkey_bytes))
  ------------------
  |  |  433|      3|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  313|      0|            goto err;
  314|       |
  315|      3|    params = OSSL_PARAM_BLD_to_param(tmpl);
  316|      3|    if (params == NULL)
  ------------------
  |  Branch (316:9): [True: 0, False: 3]
  ------------------
  317|      0|        goto err;
  318|       |
  319|      3|    ret = param_cb(params, cbarg);
  320|      3|    OSSL_PARAM_free(params);
  321|       |
  322|      3|err:
  323|      3|    OSSL_PARAM_BLD_free(tmpl);
  324|      3|    OPENSSL_secure_clear_free(seedenc, seedlen);
  ------------------
  |  |  129|      3|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  325|      3|    OPENSSL_secure_clear_free(prvenc, prvlen);
  ------------------
  |  |  129|      3|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  326|      3|    OPENSSL_free(pubenc);
  ------------------
  |  |  115|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  327|      3|    return ret;
  328|      3|}
ml_kem_kmgmt.c:ml_kem_768_new:
  964|      4|    { \
  965|      4|        return ossl_prov_ml_kem_new(provctx, NULL, EVP_PKEY_ML_KEM_##bits); \
  966|      4|    } \
ml_kem_kmgmt.c:ml_kem_768_gen_init:
  969|     45|    { \
  970|     45|        return ml_kem_gen_init(provctx, selection, params, \
  971|     45|                               EVP_PKEY_ML_KEM_##bits); \
  972|     45|    } \
ml_kem_kmgmt.c:ml_kem_1024_new:
  964|     45|    { \
  965|     45|        return ossl_prov_ml_kem_new(provctx, NULL, EVP_PKEY_ML_KEM_##bits); \
  966|     45|    } \
ml_kem_kmgmt.c:ml_kem_1024_gen_init:
  969|     49|    { \
  970|     49|        return ml_kem_gen_init(provctx, selection, params, \
  971|     49|                               EVP_PKEY_ML_KEM_##bits); \
  972|     49|    } \

ossl_drbg_lock:
   54|    695|{
   55|    695|    return 1;
   56|    695|}
ossl_drbg_unlock:
   60|    695|{
   61|    695|}
ossl_drbg_get_seed:
  148|      4|{
  149|      4|    PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
  150|      4|    size_t bytes_needed;
  151|      4|    unsigned char *buffer;
  152|       |
  153|       |    /* Figure out how many bytes we need */
  154|      4|    bytes_needed = entropy >= 0 ? (entropy + 7) / 8 : 0;
  ------------------
  |  Branch (154:20): [True: 4, False: 0]
  ------------------
  155|      4|    if (bytes_needed < min_len)
  ------------------
  |  Branch (155:9): [True: 0, False: 4]
  ------------------
  156|      0|        bytes_needed = min_len;
  157|      4|    if (bytes_needed > max_len)
  ------------------
  |  Branch (157:9): [True: 0, False: 4]
  ------------------
  158|      0|        bytes_needed = max_len;
  159|       |
  160|       |    /* Allocate storage */
  161|      4|    buffer = OPENSSL_secure_malloc(bytes_needed);
  ------------------
  |  |  123|      4|        CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  162|      4|    if (buffer == NULL)
  ------------------
  |  Branch (162:9): [True: 0, False: 4]
  ------------------
  163|      0|        return 0;
  164|       |
  165|       |    /*
  166|       |     * Get random data.  Include our DRBG address as
  167|       |     * additional input, in order to provide a distinction between
  168|       |     * different DRBG child instances.
  169|       |     *
  170|       |     * Note: using the sizeof() operator on a pointer triggers
  171|       |     *       a warning in some static code analyzers, but it's
  172|       |     *       intentional and correct here.
  173|       |     */
  174|      4|    if (!ossl_prov_drbg_generate(drbg, buffer, bytes_needed,
  ------------------
  |  Branch (174:9): [True: 0, False: 4]
  ------------------
  175|      4|                                 drbg->strength, prediction_resistance,
  176|      4|                                 (unsigned char *)&drbg, sizeof(drbg))) {
  177|      0|        OPENSSL_secure_clear_free(buffer, bytes_needed);
  ------------------
  |  |  129|      0|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  178|      0|        ERR_raise(ERR_LIB_PROV, PROV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  179|      0|        return 0;
  180|      0|    }
  181|      4|    *pout = buffer;
  182|      4|    return bytes_needed;
  183|      4|}
ossl_drbg_clear_seed:
  188|      4|{
  189|      4|    OPENSSL_secure_clear_free(out, outlen);
  ------------------
  |  |  129|      4|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  190|      4|}
ossl_prov_drbg_nonce_ctx_new:
  272|      1|{
  273|      1|    PROV_DRBG_NONCE_GLOBAL *dngbl = OPENSSL_zalloc(sizeof(*dngbl));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|       |
  275|      1|    if (dngbl == NULL)
  ------------------
  |  Branch (275:9): [True: 0, False: 1]
  ------------------
  276|      0|        return NULL;
  277|       |
  278|      1|    dngbl->rand_nonce_lock = CRYPTO_THREAD_lock_new();
  279|      1|    if (dngbl->rand_nonce_lock == NULL) {
  ------------------
  |  Branch (279:9): [True: 0, False: 1]
  ------------------
  280|      0|        OPENSSL_free(dngbl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|      0|        return NULL;
  282|      0|    }
  283|       |
  284|      1|    return dngbl;
  285|      1|}
ossl_prov_drbg_nonce_ctx_free:
  288|      1|{
  289|      1|    PROV_DRBG_NONCE_GLOBAL *dngbl = vdngbl;
  290|       |
  291|      1|    if (dngbl == NULL)
  ------------------
  |  Branch (291:9): [True: 0, False: 1]
  ------------------
  292|      0|        return;
  293|       |
  294|      1|    CRYPTO_THREAD_lock_free(dngbl->rand_nonce_lock);
  295|       |
  296|      1|    OPENSSL_free(dngbl);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  297|      1|}
ossl_prov_drbg_instantiate:
  352|      3|{
  353|      3|    unsigned char *nonce = NULL, *entropy = NULL;
  354|      3|    size_t noncelen = 0, entropylen = 0;
  355|      3|    size_t min_entropy, min_entropylen, max_entropylen;
  356|       |
  357|      3|    if (strength > drbg->strength) {
  ------------------
  |  Branch (357:9): [True: 0, False: 3]
  ------------------
  358|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INSUFFICIENT_DRBG_STRENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  359|      0|        goto end;
  360|      0|    }
  361|      3|    min_entropy = drbg->strength;
  362|      3|    min_entropylen = drbg->min_entropylen;
  363|      3|    max_entropylen = drbg->max_entropylen;
  364|       |
  365|      3|    if (pers == NULL) {
  ------------------
  |  Branch (365:9): [True: 3, False: 0]
  ------------------
  366|      3|        pers = (const unsigned char *)ossl_pers_string;
  367|      3|        perslen = sizeof(ossl_pers_string);
  368|      3|    }
  369|      3|    if (perslen > drbg->max_perslen) {
  ------------------
  |  Branch (369:9): [True: 0, False: 3]
  ------------------
  370|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_PERSONALISATION_STRING_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  371|      0|        goto end;
  372|      0|    }
  373|       |
  374|      3|    if (drbg->state != EVP_RAND_STATE_UNINITIALISED) {
  ------------------
  |  | 1347|      3|# define EVP_RAND_STATE_UNINITIALISED    0
  ------------------
  |  Branch (374:9): [True: 0, False: 3]
  ------------------
  375|      0|        if (drbg->state == EVP_RAND_STATE_ERROR)
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  |  Branch (375:13): [True: 0, False: 0]
  ------------------
  376|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_IN_ERROR_STATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  377|      0|        else
  378|      0|            ERR_raise(ERR_LIB_PROV, PROV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  379|      0|        goto end;
  380|      0|    }
  381|       |
  382|      3|    drbg->state = EVP_RAND_STATE_ERROR;
  ------------------
  |  | 1349|      3|# define EVP_RAND_STATE_ERROR            2
  ------------------
  383|       |
  384|      3|    if (drbg->min_noncelen > 0) {
  ------------------
  |  Branch (384:9): [True: 3, False: 0]
  ------------------
  385|      3|        if (drbg->parent_nonce != NULL) {
  ------------------
  |  Branch (385:13): [True: 0, False: 3]
  ------------------
  386|      0|            noncelen = drbg->parent_nonce(drbg->parent, NULL, drbg->strength,
  387|      0|                                          drbg->min_noncelen,
  388|      0|                                          drbg->max_noncelen);
  389|      0|            if (noncelen == 0) {
  ------------------
  |  Branch (389:17): [True: 0, False: 0]
  ------------------
  390|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_NONCE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  391|      0|                goto end;
  392|      0|            }
  393|      0|            nonce = OPENSSL_malloc(noncelen);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  394|      0|            if (nonce == NULL) {
  ------------------
  |  Branch (394:17): [True: 0, False: 0]
  ------------------
  395|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_NONCE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  396|      0|                goto end;
  397|      0|            }
  398|      0|            if (noncelen != drbg->parent_nonce(drbg->parent, nonce,
  ------------------
  |  Branch (398:17): [True: 0, False: 0]
  ------------------
  399|      0|                                               drbg->strength,
  400|      0|                                               drbg->min_noncelen,
  401|      0|                                               drbg->max_noncelen)) {
  402|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_NONCE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  403|      0|                goto end;
  404|      0|            }
  405|      0|#ifndef PROV_RAND_GET_RANDOM_NONCE
  406|      3|        } else if (drbg->parent != NULL) {
  ------------------
  |  Branch (406:20): [True: 3, False: 0]
  ------------------
  407|      3|#endif
  408|       |            /*
  409|       |             * NIST SP800-90Ar1 section 9.1 says you can combine getting
  410|       |             * the entropy and nonce in 1 call by increasing the entropy
  411|       |             * with 50% and increasing the minimum length to accommodate
  412|       |             * the length of the nonce. We do this in case a nonce is
  413|       |             * required and there is no parental nonce capability.
  414|       |             */
  415|      3|            min_entropy += drbg->strength / 2;
  416|      3|            min_entropylen += drbg->min_noncelen;
  417|      3|            max_entropylen += drbg->max_noncelen;
  418|      3|        }
  419|      0|#ifndef PROV_RAND_GET_RANDOM_NONCE
  420|      0|        else { /* parent == NULL */
  421|      0|            noncelen = prov_drbg_get_nonce(drbg, &nonce, drbg->min_noncelen,
  422|      0|                                           drbg->max_noncelen);
  423|      0|            if (noncelen < drbg->min_noncelen
  ------------------
  |  Branch (423:17): [True: 0, False: 0]
  ------------------
  424|      0|                    || noncelen > drbg->max_noncelen) {
  ------------------
  |  Branch (424:24): [True: 0, False: 0]
  ------------------
  425|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_NONCE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  426|      0|                goto end;
  427|      0|            }
  428|      0|        }
  429|      3|#endif
  430|      3|    }
  431|       |
  432|      3|    drbg->reseed_next_counter = tsan_load(&drbg->reseed_counter);
  ------------------
  |  |   61|      3|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  433|      3|    if (drbg->reseed_next_counter) {
  ------------------
  |  Branch (433:9): [True: 3, False: 0]
  ------------------
  434|      3|        drbg->reseed_next_counter++;
  435|      3|        if (!drbg->reseed_next_counter)
  ------------------
  |  Branch (435:13): [True: 0, False: 3]
  ------------------
  436|      0|            drbg->reseed_next_counter = 1;
  437|      3|    }
  438|       |
  439|      3|    entropylen = get_entropy(drbg, &entropy, min_entropy,
  440|      3|                             min_entropylen, max_entropylen,
  441|      3|                             prediction_resistance);
  442|      3|    if (entropylen < min_entropylen
  ------------------
  |  Branch (442:9): [True: 0, False: 3]
  ------------------
  443|      3|            || entropylen > max_entropylen) {
  ------------------
  |  Branch (443:16): [True: 0, False: 3]
  ------------------
  444|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_ENTROPY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  445|      0|        goto end;
  446|      0|    }
  447|       |
  448|      3|    if (!drbg->instantiate(drbg, entropy, entropylen, nonce, noncelen,
  ------------------
  |  Branch (448:9): [True: 0, False: 3]
  ------------------
  449|      3|                           pers, perslen)) {
  450|      0|        cleanup_entropy(drbg, entropy, entropylen);
  451|      0|        ERR_raise(ERR_LIB_PROV, PROV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  452|      0|        goto end;
  453|      0|    }
  454|      3|    cleanup_entropy(drbg, entropy, entropylen);
  455|       |
  456|      3|    drbg->state = EVP_RAND_STATE_READY;
  ------------------
  |  | 1348|      3|# define EVP_RAND_STATE_READY            1
  ------------------
  457|      3|    drbg->generate_counter = 1;
  458|      3|    drbg->reseed_time = time(NULL);
  459|      3|    tsan_store(&drbg->reseed_counter, drbg->reseed_next_counter);
  ------------------
  |  |   62|      3|#   define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed)
  ------------------
  460|       |
  461|      3| end:
  462|      3|    if (nonce != NULL)
  ------------------
  |  Branch (462:9): [True: 0, False: 3]
  ------------------
  463|      0|        ossl_prov_cleanup_nonce(drbg->provctx, nonce, noncelen);
  464|      3|    if (drbg->state == EVP_RAND_STATE_READY)
  ------------------
  |  | 1348|      3|# define EVP_RAND_STATE_READY            1
  ------------------
  |  Branch (464:9): [True: 3, False: 0]
  ------------------
  465|      3|        return 1;
  466|      0|    return 0;
  467|      3|}
ossl_prov_drbg_generate:
  627|    341|{
  628|    341|    int fork_id;
  629|    341|    int reseed_required = 0;
  630|    341|    int ret = 0;
  631|       |
  632|    341|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (632:9): [True: 0, False: 341]
  ------------------
  633|      0|        return 0;
  634|       |
  635|    341|    if (drbg->lock != NULL && !CRYPTO_THREAD_write_lock(drbg->lock))
  ------------------
  |  Branch (635:9): [True: 4, False: 337]
  |  Branch (635:31): [True: 0, False: 4]
  ------------------
  636|      0|        return 0;
  637|       |
  638|    341|    if (drbg->state != EVP_RAND_STATE_READY) {
  ------------------
  |  | 1348|    341|# define EVP_RAND_STATE_READY            1
  ------------------
  |  Branch (638:9): [True: 0, False: 341]
  ------------------
  639|       |        /* try to recover from previous errors */
  640|      0|        rand_drbg_restart(drbg);
  641|       |
  642|      0|        if (drbg->state == EVP_RAND_STATE_ERROR) {
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_IN_ERROR_STATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  644|      0|            goto err;
  645|      0|        }
  646|      0|        if (drbg->state == EVP_RAND_STATE_UNINITIALISED) {
  ------------------
  |  | 1347|      0|# define EVP_RAND_STATE_UNINITIALISED    0
  ------------------
  |  Branch (646:13): [True: 0, False: 0]
  ------------------
  647|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  648|      0|            goto err;
  649|      0|        }
  650|      0|    }
  651|    341|    if (strength > drbg->strength) {
  ------------------
  |  Branch (651:9): [True: 0, False: 341]
  ------------------
  652|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INSUFFICIENT_DRBG_STRENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  653|      0|        goto err;
  654|      0|    }
  655|       |
  656|    341|    if (outlen > drbg->max_request) {
  ------------------
  |  Branch (656:9): [True: 0, False: 341]
  ------------------
  657|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_REQUEST_TOO_LARGE_FOR_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  658|      0|        goto err;
  659|      0|    }
  660|    341|    if (adinlen > drbg->max_adinlen) {
  ------------------
  |  Branch (660:9): [True: 0, False: 341]
  ------------------
  661|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_ADDITIONAL_INPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  662|      0|        goto err;
  663|      0|    }
  664|       |
  665|    341|    fork_id = openssl_get_fork_id();
  666|       |
  667|    341|    if (drbg->fork_id != fork_id) {
  ------------------
  |  Branch (667:9): [True: 0, False: 341]
  ------------------
  668|      0|        drbg->fork_id = fork_id;
  669|      0|        reseed_required = 1;
  670|      0|    }
  671|       |
  672|    341|    if (drbg->reseed_interval > 0) {
  ------------------
  |  Branch (672:9): [True: 341, False: 0]
  ------------------
  673|    341|        if (drbg->generate_counter >= drbg->reseed_interval)
  ------------------
  |  Branch (673:13): [True: 0, False: 341]
  ------------------
  674|      0|            reseed_required = 1;
  675|    341|    }
  676|    341|    if (drbg->reseed_time_interval > 0) {
  ------------------
  |  Branch (676:9): [True: 341, False: 0]
  ------------------
  677|    341|        time_t now = time(NULL);
  678|    341|        if (now < drbg->reseed_time
  ------------------
  |  Branch (678:13): [True: 0, False: 341]
  ------------------
  679|    341|            || now - drbg->reseed_time >= drbg->reseed_time_interval)
  ------------------
  |  Branch (679:16): [True: 0, False: 341]
  ------------------
  680|      0|            reseed_required = 1;
  681|    341|    }
  682|    341|    if (drbg->parent != NULL
  ------------------
  |  Branch (682:9): [True: 341, False: 0]
  ------------------
  683|    341|            && get_parent_reseed_count(drbg) != drbg->parent_reseed_counter)
  ------------------
  |  Branch (683:16): [True: 2, False: 339]
  ------------------
  684|      2|        reseed_required = 1;
  685|       |
  686|    341|    if (reseed_required || prediction_resistance) {
  ------------------
  |  Branch (686:9): [True: 2, False: 339]
  |  Branch (686:28): [True: 0, False: 339]
  ------------------
  687|      2|        if (!ossl_prov_drbg_reseed_unlocked(drbg, prediction_resistance, NULL,
  ------------------
  |  Branch (687:13): [True: 0, False: 2]
  ------------------
  688|      2|                                            0, adin, adinlen)) {
  689|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_RESEED_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  690|      0|            goto err;
  691|      0|        }
  692|      2|        adin = NULL;
  693|      2|        adinlen = 0;
  694|      2|    }
  695|       |
  696|    341|    if (!drbg->generate(drbg, out, outlen, adin, adinlen)) {
  ------------------
  |  Branch (696:9): [True: 0, False: 341]
  ------------------
  697|      0|        drbg->state = EVP_RAND_STATE_ERROR;
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  698|      0|        ERR_raise(ERR_LIB_PROV, PROV_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  699|      0|        goto err;
  700|      0|    }
  701|       |
  702|    341|    drbg->generate_counter++;
  703|       |
  704|    341|    ret = 1;
  705|    341| err:
  706|    341|    if (drbg->lock != NULL)
  ------------------
  |  Branch (706:9): [True: 4, False: 337]
  ------------------
  707|      4|        CRYPTO_THREAD_unlock(drbg->lock);
  708|       |
  709|    341|    return ret;
  710|    341|}
ossl_drbg_enable_locking:
  757|      1|{
  758|      1|    PROV_DRBG *drbg = vctx;
  759|       |
  760|      1|    if (drbg != NULL && drbg->lock == NULL) {
  ------------------
  |  Branch (760:9): [True: 1, False: 0]
  |  Branch (760:25): [True: 1, False: 0]
  ------------------
  761|      1|        if (drbg->parent_enable_locking != NULL)
  ------------------
  |  Branch (761:13): [True: 1, False: 0]
  ------------------
  762|      1|            if (!drbg->parent_enable_locking(drbg->parent)) {
  ------------------
  |  Branch (762:17): [True: 0, False: 1]
  ------------------
  763|      0|                ERR_raise(ERR_LIB_PROV, PROV_R_PARENT_LOCKING_NOT_ENABLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  764|      0|                return 0;
  765|      0|            }
  766|      1|        drbg->lock = CRYPTO_THREAD_lock_new();
  767|      1|        if (drbg->lock == NULL) {
  ------------------
  |  Branch (767:13): [True: 0, False: 1]
  ------------------
  768|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_CREATE_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  769|      0|            return 0;
  770|      0|        }
  771|      1|    }
  772|      1|    return 1;
  773|      1|}
ossl_rand_drbg_new:
  796|      3|{
  797|      3|    PROV_DRBG *drbg;
  798|      3|    unsigned int p_str;
  799|      3|    const OSSL_DISPATCH *pfunc;
  800|       |
  801|      3|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (801:9): [True: 0, False: 3]
  ------------------
  802|      0|        return NULL;
  803|       |
  804|      3|    drbg = OPENSSL_zalloc(sizeof(*drbg));
  ------------------
  |  |  104|      3|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  805|      3|    if (drbg == NULL)
  ------------------
  |  Branch (805:9): [True: 0, False: 3]
  ------------------
  806|      0|        return NULL;
  807|       |
  808|      3|    drbg->provctx = provctx;
  809|      3|    drbg->instantiate = instantiate;
  810|      3|    drbg->uninstantiate = uninstantiate;
  811|      3|    drbg->reseed = reseed;
  812|      3|    drbg->generate = generate;
  813|      3|    drbg->fork_id = openssl_get_fork_id();
  814|       |
  815|       |    /* Extract parent's functions */
  816|      3|    drbg->parent = parent;
  817|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_ENABLE_LOCKING)) != NULL)
  ------------------
  |  |  542|      3|# define OSSL_FUNC_RAND_ENABLE_LOCKING                8
  ------------------
  |  Branch (817:9): [True: 3, False: 0]
  ------------------
  818|      3|        drbg->parent_enable_locking = OSSL_FUNC_rand_enable_locking(pfunc);
  819|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_LOCK)) != NULL)
  ------------------
  |  |  543|      3|# define OSSL_FUNC_RAND_LOCK                          9
  ------------------
  |  Branch (819:9): [True: 3, False: 0]
  ------------------
  820|      3|        drbg->parent_lock = OSSL_FUNC_rand_lock(pfunc);
  821|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_UNLOCK)) != NULL)
  ------------------
  |  |  544|      3|# define OSSL_FUNC_RAND_UNLOCK                       10
  ------------------
  |  Branch (821:9): [True: 3, False: 0]
  ------------------
  822|      3|        drbg->parent_unlock = OSSL_FUNC_rand_unlock(pfunc);
  823|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_GET_CTX_PARAMS)) != NULL)
  ------------------
  |  |  549|      3|# define OSSL_FUNC_RAND_GET_CTX_PARAMS               15
  ------------------
  |  Branch (823:9): [True: 3, False: 0]
  ------------------
  824|      3|        drbg->parent_get_ctx_params = OSSL_FUNC_rand_get_ctx_params(pfunc);
  825|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_NONCE)) != NULL)
  ------------------
  |  |  541|      3|# define OSSL_FUNC_RAND_NONCE                         7
  ------------------
  |  Branch (825:9): [True: 0, False: 3]
  ------------------
  826|      0|        drbg->parent_nonce = OSSL_FUNC_rand_nonce(pfunc);
  827|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_GET_SEED)) != NULL)
  ------------------
  |  |  552|      3|# define OSSL_FUNC_RAND_GET_SEED                     18
  ------------------
  |  Branch (827:9): [True: 3, False: 0]
  ------------------
  828|      3|        drbg->parent_get_seed = OSSL_FUNC_rand_get_seed(pfunc);
  829|      3|    if ((pfunc = find_call(p_dispatch, OSSL_FUNC_RAND_CLEAR_SEED)) != NULL)
  ------------------
  |  |  553|      3|# define OSSL_FUNC_RAND_CLEAR_SEED                   19
  ------------------
  |  Branch (829:9): [True: 3, False: 0]
  ------------------
  830|      3|        drbg->parent_clear_seed = OSSL_FUNC_rand_clear_seed(pfunc);
  831|       |
  832|       |    /* Set some default maximums up */
  833|      3|    drbg->max_entropylen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      3|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  834|      3|    drbg->max_noncelen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      3|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  835|      3|    drbg->max_perslen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      3|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  836|      3|    drbg->max_adinlen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      3|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  837|      3|    drbg->generate_counter = 1;
  838|      3|    drbg->reseed_counter = 1;
  839|      3|    drbg->reseed_interval = RESEED_INTERVAL;
  ------------------
  |  |   31|      3|# define RESEED_INTERVAL                         (1 << 8)
  ------------------
  840|      3|    drbg->reseed_time_interval = TIME_INTERVAL;
  ------------------
  |  |   32|      3|# define TIME_INTERVAL                           (60*60)   /* 1 hour */
  ------------------
  841|       |
  842|      3|    if (!dnew(drbg))
  ------------------
  |  Branch (842:9): [True: 0, False: 3]
  ------------------
  843|      0|        goto err;
  844|       |
  845|      3|    if (parent != NULL) {
  ------------------
  |  Branch (845:9): [True: 3, False: 0]
  ------------------
  846|      3|        if (!get_parent_strength(drbg, &p_str))
  ------------------
  |  Branch (846:13): [True: 0, False: 3]
  ------------------
  847|      0|            goto err;
  848|      3|        if (drbg->strength > p_str) {
  ------------------
  |  Branch (848:13): [True: 0, False: 3]
  ------------------
  849|       |            /*
  850|       |             * We currently don't support the algorithm from NIST SP 800-90C
  851|       |             * 10.1.2 to use a weaker DRBG as source
  852|       |             */
  853|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_PARENT_STRENGTH_TOO_WEAK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            goto err;
  855|      0|        }
  856|      3|    }
  857|       |#ifdef TSAN_REQUIRES_LOCKING
  858|       |    if (!ossl_drbg_enable_locking(drbg))
  859|       |        goto err;
  860|       |#endif
  861|      3|    return drbg;
  862|       |
  863|      0| err:
  864|      0|    dfree(drbg);
  865|      0|    return NULL;
  866|      3|}
ossl_rand_drbg_free:
  869|      3|{
  870|      3|    if (drbg == NULL)
  ------------------
  |  Branch (870:9): [True: 0, False: 3]
  ------------------
  871|      0|        return;
  872|       |
  873|      3|    CRYPTO_THREAD_lock_free(drbg->lock);
  874|      3|    OPENSSL_free(drbg);
  ------------------
  |  |  115|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  875|      3|}
ossl_drbg_get_ctx_params:
  882|      6|{
  883|      6|    OSSL_PARAM *p;
  884|       |
  885|      6|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STATE);
  ------------------
  |  |  533|      6|# define OSSL_RAND_PARAM_STATE "state"
  ------------------
  886|      6|    if (p != NULL && !OSSL_PARAM_set_int(p, drbg->state))
  ------------------
  |  Branch (886:9): [True: 0, False: 6]
  |  Branch (886:22): [True: 0, False: 0]
  ------------------
  887|      0|        return 0;
  888|       |
  889|      6|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STRENGTH);
  ------------------
  |  |  534|      6|# define OSSL_RAND_PARAM_STRENGTH "strength"
  ------------------
  890|      6|    if (p != NULL && !OSSL_PARAM_set_int(p, drbg->strength))
  ------------------
  |  Branch (890:9): [True: 6, False: 0]
  |  Branch (890:22): [True: 0, False: 6]
  ------------------
  891|      0|        return 0;
  892|       |
  893|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MIN_ENTROPYLEN);
  ------------------
  |  |  238|      6|# define OSSL_DRBG_PARAM_MIN_ENTROPYLEN "min_entropylen"
  ------------------
  894|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->min_entropylen))
  ------------------
  |  Branch (894:9): [True: 0, False: 6]
  |  Branch (894:22): [True: 0, False: 0]
  ------------------
  895|      0|        return 0;
  896|       |
  897|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MAX_ENTROPYLEN);
  ------------------
  |  |  234|      6|# define OSSL_DRBG_PARAM_MAX_ENTROPYLEN "max_entropylen"
  ------------------
  898|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->max_entropylen))
  ------------------
  |  Branch (898:9): [True: 0, False: 6]
  |  Branch (898:22): [True: 0, False: 0]
  ------------------
  899|      0|        return 0;
  900|       |
  901|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MIN_NONCELEN);
  ------------------
  |  |  240|      6|# define OSSL_DRBG_PARAM_MIN_NONCELEN "min_noncelen"
  ------------------
  902|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->min_noncelen))
  ------------------
  |  Branch (902:9): [True: 0, False: 6]
  |  Branch (902:22): [True: 0, False: 0]
  ------------------
  903|      0|        return 0;
  904|       |
  905|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MAX_NONCELEN);
  ------------------
  |  |  236|      6|# define OSSL_DRBG_PARAM_MAX_NONCELEN "max_noncelen"
  ------------------
  906|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->max_noncelen))
  ------------------
  |  Branch (906:9): [True: 0, False: 6]
  |  Branch (906:22): [True: 0, False: 0]
  ------------------
  907|      0|        return 0;
  908|       |
  909|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MAX_PERSLEN);
  ------------------
  |  |  237|      6|# define OSSL_DRBG_PARAM_MAX_PERSLEN "max_perslen"
  ------------------
  910|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->max_perslen))
  ------------------
  |  Branch (910:9): [True: 0, False: 6]
  |  Branch (910:22): [True: 0, False: 0]
  ------------------
  911|      0|        return 0;
  912|       |
  913|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_MAX_ADINLEN);
  ------------------
  |  |  233|      6|# define OSSL_DRBG_PARAM_MAX_ADINLEN "max_adinlen"
  ------------------
  914|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, drbg->max_adinlen))
  ------------------
  |  Branch (914:9): [True: 0, False: 6]
  |  Branch (914:22): [True: 0, False: 0]
  ------------------
  915|      0|        return 0;
  916|       |
  917|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_RESEED_REQUESTS);
  ------------------
  |  |  245|      6|# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
  ------------------
  918|      6|    if (p != NULL && !OSSL_PARAM_set_uint(p, drbg->reseed_interval))
  ------------------
  |  Branch (918:9): [True: 0, False: 6]
  |  Branch (918:22): [True: 0, False: 0]
  ------------------
  919|      0|        return 0;
  920|       |
  921|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_RESEED_TIME);
  ------------------
  |  |  246|      6|# define OSSL_DRBG_PARAM_RESEED_TIME "reseed_time"
  ------------------
  922|      6|    if (p != NULL && !OSSL_PARAM_set_time_t(p, drbg->reseed_time))
  ------------------
  |  Branch (922:9): [True: 0, False: 6]
  |  Branch (922:22): [True: 0, False: 0]
  ------------------
  923|      0|        return 0;
  924|       |
  925|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL);
  ------------------
  |  |  247|      6|# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
  ------------------
  926|      6|    if (p != NULL && !OSSL_PARAM_set_time_t(p, drbg->reseed_time_interval))
  ------------------
  |  Branch (926:9): [True: 0, False: 6]
  |  Branch (926:22): [True: 0, False: 0]
  ------------------
  927|      0|        return 0;
  928|      6|    if (!OSSL_FIPS_IND_GET_CTX_PARAM(drbg, params))
  ------------------
  |  |  148|      6|# define OSSL_FIPS_IND_GET_CTX_PARAM(ctx, params) 1
  ------------------
  |  Branch (928:9): [Folded - Ignored]
  ------------------
  929|      0|        return 0;
  930|      6|    return 1;
  931|      6|}
ossl_drbg_get_ctx_params_no_lock:
  939|    684|{
  940|    684|    size_t cnt = 0;
  941|    684|    OSSL_PARAM *p;
  942|       |
  943|       |    /* This value never changes once set */
  944|    684|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_MAX_REQUEST);
  ------------------
  |  |  532|    684|# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
  ------------------
  945|    684|    if (p != NULL) {
  ------------------
  |  Branch (945:9): [True: 339, False: 345]
  ------------------
  946|    339|        if (!OSSL_PARAM_set_size_t(p, drbg->max_request))
  ------------------
  |  Branch (946:13): [True: 0, False: 339]
  ------------------
  947|      0|            return 0;
  948|    339|        cnt++;
  949|    339|    }
  950|       |
  951|       |    /*
  952|       |     * Can be changed by multiple threads, but we tolerate inaccuracies in this
  953|       |     * value.
  954|       |     */
  955|    684|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_RESEED_COUNTER);
  ------------------
  |  |  244|    684|# define OSSL_DRBG_PARAM_RESEED_COUNTER "reseed_counter"
  ------------------
  956|    684|    if (p != NULL) {
  ------------------
  |  Branch (956:9): [True: 339, False: 345]
  ------------------
  957|    339|        if (!OSSL_PARAM_set_uint(p, tsan_load(&drbg->reseed_counter)))
  ------------------
  |  |   61|    339|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  |  Branch (957:13): [True: 0, False: 339]
  ------------------
  958|      0|            return 0;
  959|    339|        cnt++;
  960|    339|    }
  961|       |
  962|    684|    if (params[cnt].key == NULL)
  ------------------
  |  Branch (962:9): [True: 678, False: 6]
  ------------------
  963|    678|        *complete = 1;
  964|      6|    else
  965|      6|        *complete = 0;
  966|       |
  967|    684|    return 1;
  968|    684|}
ossl_drbg_set_ctx_params:
  971|      3|{
  972|      3|    const OSSL_PARAM *p;
  973|       |
  974|      3|    if (ossl_param_is_empty(params))
  ------------------
  |  Branch (974:9): [True: 0, False: 3]
  ------------------
  975|      0|        return 1;
  976|       |
  977|      3|    p = OSSL_PARAM_locate_const(params, OSSL_DRBG_PARAM_RESEED_REQUESTS);
  ------------------
  |  |  245|      3|# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
  ------------------
  978|      3|    if (p != NULL && !OSSL_PARAM_get_uint(p, &drbg->reseed_interval))
  ------------------
  |  Branch (978:9): [True: 3, False: 0]
  |  Branch (978:22): [True: 0, False: 3]
  ------------------
  979|      0|        return 0;
  980|       |
  981|      3|    p = OSSL_PARAM_locate_const(params, OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL);
  ------------------
  |  |  247|      3|# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
  ------------------
  982|      3|    if (p != NULL && !OSSL_PARAM_get_time_t(p, &drbg->reseed_time_interval))
  ------------------
  |  Branch (982:9): [True: 3, False: 0]
  |  Branch (982:22): [True: 0, False: 3]
  ------------------
  983|      0|        return 0;
  984|       |
  985|      3|    return 1;
  986|      3|}
drbg.c:get_entropy:
  195|      5|{
  196|      5|    size_t bytes;
  197|      5|    unsigned int p_str;
  198|       |
  199|      5|    if (drbg->parent == NULL)
  ------------------
  |  Branch (199:9): [True: 0, False: 5]
  ------------------
  200|       |        /*
  201|       |         * In normal use (i.e. OpenSSL's own uses), this is never called.
  202|       |         * This remains purely for legacy reasons.
  203|       |         */
  204|      0|        return ossl_prov_get_entropy(drbg->provctx, pout, entropy, min_len,
  205|      0|                                     max_len);
  206|       |
  207|      5|    if (drbg->parent_get_seed == NULL) {
  ------------------
  |  Branch (207:9): [True: 0, False: 5]
  ------------------
  208|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  209|      0|        return 0;
  210|      0|    }
  211|      5|    if (!get_parent_strength(drbg, &p_str))
  ------------------
  |  Branch (211:9): [True: 0, False: 5]
  ------------------
  212|      0|        return 0;
  213|      5|    if (drbg->strength > p_str) {
  ------------------
  |  Branch (213:9): [True: 0, False: 5]
  ------------------
  214|       |        /*
  215|       |         * We currently don't support the algorithm from NIST SP 800-90C
  216|       |         * 10.1.2 to use a weaker DRBG as source
  217|       |         */
  218|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_PARENT_STRENGTH_TOO_WEAK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  219|      0|        return 0;
  220|      0|    }
  221|       |
  222|       |    /*
  223|       |     * Our lock is already held, but we need to lock our parent before
  224|       |     * generating bits from it.  Note: taking the lock will be a no-op
  225|       |     * if locking is not required (while drbg->parent->lock == NULL).
  226|       |     */
  227|      5|    if (!ossl_drbg_lock_parent(drbg))
  ------------------
  |  Branch (227:9): [True: 0, False: 5]
  ------------------
  228|      0|        return 0;
  229|       |    /*
  230|       |     * Get random data from parent.  Include our DRBG address as
  231|       |     * additional input, in order to provide a distinction between
  232|       |     * different DRBG child instances.
  233|       |     *
  234|       |     * Note: using the sizeof() operator on a pointer triggers
  235|       |     *       a warning in some static code analyzers, but it's
  236|       |     *       intentional and correct here.
  237|       |     */
  238|      5|    bytes = drbg->parent_get_seed(drbg->parent, pout,
  239|      5|                                  entropy > 0 ? entropy : (int) drbg->strength,
  ------------------
  |  Branch (239:35): [True: 5, False: 0]
  ------------------
  240|      5|                                  min_len, max_len, prediction_resistance,
  241|      5|                                  (unsigned char *)&drbg, sizeof(drbg));
  242|      5|    ossl_drbg_unlock_parent(drbg);
  243|      5|    return bytes;
  244|      5|}
drbg.c:ossl_drbg_lock_parent:
   64|    361|{
   65|    361|    void *parent = drbg->parent;
   66|       |
   67|    361|    if (parent != NULL
  ------------------
  |  Branch (67:9): [True: 361, False: 0]
  ------------------
   68|    361|            && drbg->parent_lock != NULL
  ------------------
  |  Branch (68:16): [True: 361, False: 0]
  ------------------
   69|    361|            && !drbg->parent_lock(parent)) {
  ------------------
  |  Branch (69:16): [True: 0, False: 361]
  ------------------
   70|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_PARENT_LOCKING_NOT_ENABLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   71|      0|        return 0;
   72|      0|    }
   73|    361|    return 1;
   74|    361|}
drbg.c:ossl_drbg_unlock_parent:
   77|    361|{
   78|    361|    void *parent = drbg->parent;
   79|       |
   80|    361|    if (parent != NULL && drbg->parent_unlock != NULL)
  ------------------
  |  Branch (80:9): [True: 361, False: 0]
  |  Branch (80:27): [True: 361, False: 0]
  ------------------
   81|    361|        drbg->parent_unlock(parent);
   82|    361|}
drbg.c:cleanup_entropy:
  247|      5|{
  248|      5|    if (drbg->parent == NULL) {
  ------------------
  |  Branch (248:9): [True: 0, False: 5]
  ------------------
  249|      0|        ossl_prov_cleanup_entropy(drbg->provctx, out, outlen);
  250|      5|    } else if (drbg->parent_clear_seed != NULL) {
  ------------------
  |  Branch (250:16): [True: 5, False: 0]
  ------------------
  251|      5|        if (!ossl_drbg_lock_parent(drbg))
  ------------------
  |  Branch (251:13): [True: 0, False: 5]
  ------------------
  252|      0|            return;
  253|      5|        drbg->parent_clear_seed(drbg->parent, out, outlen);
  254|      5|        ossl_drbg_unlock_parent(drbg);
  255|      5|    }
  256|      5|}
drbg.c:ossl_prov_drbg_reseed_unlocked:
  488|      2|{
  489|      2|    unsigned char *entropy = NULL;
  490|      2|    size_t entropylen = 0;
  491|       |
  492|      2|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (492:9): [True: 0, False: 2]
  ------------------
  493|      0|        return 0;
  494|       |
  495|      2|    if (drbg->state != EVP_RAND_STATE_READY) {
  ------------------
  |  | 1348|      2|# define EVP_RAND_STATE_READY            1
  ------------------
  |  Branch (495:9): [True: 0, False: 2]
  ------------------
  496|       |        /* try to recover from previous errors */
  497|      0|        rand_drbg_restart(drbg);
  498|       |
  499|      0|        if (drbg->state == EVP_RAND_STATE_ERROR) {
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  |  Branch (499:13): [True: 0, False: 0]
  ------------------
  500|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_IN_ERROR_STATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  501|      0|            return 0;
  502|      0|        }
  503|      0|        if (drbg->state == EVP_RAND_STATE_UNINITIALISED) {
  ------------------
  |  | 1347|      0|# define EVP_RAND_STATE_UNINITIALISED    0
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  ------------------
  504|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  505|      0|            return 0;
  506|      0|        }
  507|      0|    }
  508|       |
  509|      2|    if (ent != NULL) {
  ------------------
  |  Branch (509:9): [True: 0, False: 2]
  ------------------
  510|      0|        if (ent_len < drbg->min_entropylen) {
  ------------------
  |  Branch (510:13): [True: 0, False: 0]
  ------------------
  511|      0|            ERR_raise(ERR_LIB_RAND, RAND_R_ENTROPY_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  512|      0|            drbg->state = EVP_RAND_STATE_ERROR;
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  513|      0|            return 0;
  514|      0|        }
  515|      0|        if (ent_len > drbg->max_entropylen) {
  ------------------
  |  Branch (515:13): [True: 0, False: 0]
  ------------------
  516|      0|            ERR_raise(ERR_LIB_RAND, RAND_R_ENTROPY_INPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  517|      0|            drbg->state = EVP_RAND_STATE_ERROR;
  ------------------
  |  | 1349|      0|# define EVP_RAND_STATE_ERROR            2
  ------------------
  518|      0|            return 0;
  519|      0|        }
  520|      0|    }
  521|       |
  522|      2|    if (adin == NULL) {
  ------------------
  |  Branch (522:9): [True: 2, False: 0]
  ------------------
  523|      2|        adinlen = 0;
  524|      2|    } else if (adinlen > drbg->max_adinlen) {
  ------------------
  |  Branch (524:16): [True: 0, False: 0]
  ------------------
  525|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_ADDITIONAL_INPUT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  526|      0|        return 0;
  527|      0|    }
  528|       |
  529|      2|    drbg->state = EVP_RAND_STATE_ERROR;
  ------------------
  |  | 1349|      2|# define EVP_RAND_STATE_ERROR            2
  ------------------
  530|       |
  531|      2|    drbg->reseed_next_counter = tsan_load(&drbg->reseed_counter);
  ------------------
  |  |   61|      2|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  532|      2|    if (drbg->reseed_next_counter) {
  ------------------
  |  Branch (532:9): [True: 2, False: 0]
  ------------------
  533|      2|        drbg->reseed_next_counter++;
  534|      2|        if (!drbg->reseed_next_counter)
  ------------------
  |  Branch (534:13): [True: 0, False: 2]
  ------------------
  535|      0|            drbg->reseed_next_counter = 1;
  536|      2|    }
  537|       |
  538|      2|    if (ent != NULL) {
  ------------------
  |  Branch (538:9): [True: 0, False: 2]
  ------------------
  539|       |#ifdef FIPS_MODULE
  540|       |        /*
  541|       |         * NIST SP-800-90A mandates that entropy *shall not* be provided
  542|       |         * by the consuming application. Instead the data is added as additional
  543|       |         * input.
  544|       |         *
  545|       |         * (NIST SP-800-90Ar1, Sections 9.1 and 9.2)
  546|       |         */
  547|       |        if (!drbg->reseed(drbg, NULL, 0, ent, ent_len)) {
  548|       |            ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_RESEED);
  549|       |            return 0;
  550|       |        }
  551|       |#else
  552|      0|        if (!drbg->reseed(drbg, ent, ent_len, adin, adinlen)) {
  ------------------
  |  Branch (552:13): [True: 0, False: 0]
  ------------------
  553|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_RESEED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  554|      0|            return 0;
  555|      0|        }
  556|       |        /* There isn't much point adding the same additional input twice */
  557|      0|        adin = NULL;
  558|      0|        adinlen = 0;
  559|      0|#endif
  560|      0|    }
  561|       |
  562|       |    /* Reseed using our sources in addition */
  563|      2|    entropylen = get_entropy(drbg, &entropy, drbg->strength,
  564|      2|                             drbg->min_entropylen, drbg->max_entropylen,
  565|      2|                             prediction_resistance);
  566|      2|    if (entropylen < drbg->min_entropylen
  ------------------
  |  Branch (566:9): [True: 0, False: 2]
  ------------------
  567|      2|            || entropylen > drbg->max_entropylen) {
  ------------------
  |  Branch (567:16): [True: 0, False: 2]
  ------------------
  568|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_ENTROPY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  569|      0|        goto end;
  570|      0|    }
  571|       |
  572|      2|    if (!drbg->reseed(drbg, entropy, entropylen, adin, adinlen))
  ------------------
  |  Branch (572:9): [True: 0, False: 2]
  ------------------
  573|      0|        goto end;
  574|       |
  575|      2|    drbg->state = EVP_RAND_STATE_READY;
  ------------------
  |  | 1348|      2|# define EVP_RAND_STATE_READY            1
  ------------------
  576|      2|    drbg->generate_counter = 1;
  577|      2|    drbg->reseed_time = time(NULL);
  578|      2|    tsan_store(&drbg->reseed_counter, drbg->reseed_next_counter);
  ------------------
  |  |   62|      2|#   define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed)
  ------------------
  579|      2|    if (drbg->parent != NULL)
  ------------------
  |  Branch (579:9): [True: 2, False: 0]
  ------------------
  580|      2|        drbg->parent_reseed_counter = get_parent_reseed_count(drbg);
  581|       |
  582|      2| end:
  583|      2|    cleanup_entropy(drbg, entropy, entropylen);
  584|      2|    if (drbg->state == EVP_RAND_STATE_READY)
  ------------------
  |  | 1348|      2|# define EVP_RAND_STATE_READY            1
  ------------------
  |  Branch (584:9): [True: 2, False: 0]
  ------------------
  585|      2|        return 1;
  586|      0|    return 0;
  587|      2|}
drbg.c:get_parent_reseed_count:
  110|    343|{
  111|    343|    OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    343|    { NULL, 0, NULL, 0, 0 }
  ------------------
                  OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|    343|    { NULL, 0, NULL, 0, 0 }
  ------------------
  112|    343|    void *parent = drbg->parent;
  113|    343|    unsigned int r = 0;
  114|       |
  115|    343|    *params = OSSL_PARAM_construct_uint(OSSL_DRBG_PARAM_RESEED_COUNTER, &r);
  ------------------
  |  |  244|    343|# define OSSL_DRBG_PARAM_RESEED_COUNTER "reseed_counter"
  ------------------
  116|    343|    if (!ossl_drbg_lock_parent(drbg)) {
  ------------------
  |  Branch (116:9): [True: 0, False: 343]
  ------------------
  117|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_LOCK_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  118|      0|        goto err;
  119|      0|    }
  120|    343|    if (!drbg->parent_get_ctx_params(parent, params))
  ------------------
  |  Branch (120:9): [True: 0, False: 343]
  ------------------
  121|      0|        r = 0;
  122|    343|    ossl_drbg_unlock_parent(drbg);
  123|    343|    return r;
  124|       |
  125|      0| err:
  126|      0|    r = tsan_load(&drbg->reseed_counter) - 2;
  ------------------
  |  |   61|      0|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  127|      0|    if (r == 0)
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|        r = UINT_MAX;
  129|      0|    return r;
  130|    343|}
drbg.c:find_call:
  746|     21|{
  747|     21|    if (dispatch != NULL)
  ------------------
  |  Branch (747:9): [True: 21, False: 0]
  ------------------
  748|    247|        while (dispatch->function_id != 0) {
  ------------------
  |  Branch (748:16): [True: 244, False: 3]
  ------------------
  749|    244|            if (dispatch->function_id == function)
  ------------------
  |  Branch (749:17): [True: 18, False: 226]
  ------------------
  750|     18|                return dispatch;
  751|    226|            dispatch++;
  752|    226|        }
  753|      3|    return NULL;
  754|     21|}
drbg.c:get_parent_strength:
   85|      8|{
   86|      8|    OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      8|    { NULL, 0, NULL, 0, 0 }
  ------------------
                  OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|      8|    { NULL, 0, NULL, 0, 0 }
  ------------------
   87|      8|    void *parent = drbg->parent;
   88|      8|    int res;
   89|       |
   90|      8|    if (drbg->parent_get_ctx_params == NULL) {
  ------------------
  |  Branch (90:9): [True: 0, False: 8]
  ------------------
   91|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PARENT_STRENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   92|      0|        return 0;
   93|      0|    }
   94|       |
   95|      8|    *params = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, str);
  ------------------
  |  |  534|      8|# define OSSL_RAND_PARAM_STRENGTH "strength"
  ------------------
   96|      8|    if (!ossl_drbg_lock_parent(drbg)) {
  ------------------
  |  Branch (96:9): [True: 0, False: 8]
  ------------------
   97|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_LOCK_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   98|      0|        return 0;
   99|      0|    }
  100|      8|    res = drbg->parent_get_ctx_params(parent, params);
  101|      8|    ossl_drbg_unlock_parent(drbg);
  102|      8|    if (!res) {
  ------------------
  |  Branch (102:9): [True: 0, False: 8]
  ------------------
  103|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PARENT_STRENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  104|      0|        return 0;
  105|      0|    }
  106|      8|    return 1;
  107|      8|}

drbg_ctr.c:drbg_ctr_new_wrapper:
  640|      3|{
  641|      3|    return ossl_rand_drbg_new(provctx, parent, parent_dispatch,
  642|      3|                              &drbg_ctr_new, &drbg_ctr_free,
  643|      3|                              &drbg_ctr_instantiate, &drbg_ctr_uninstantiate,
  644|      3|                              &drbg_ctr_reseed, &drbg_ctr_generate);
  645|      3|}
drbg_ctr.c:drbg_ctr_new:
  625|      3|{
  626|      3|    PROV_DRBG_CTR *ctr;
  627|       |
  628|      3|    ctr = OPENSSL_secure_zalloc(sizeof(*ctr));
  ------------------
  |  |  125|      3|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  629|      3|    if (ctr == NULL)
  ------------------
  |  Branch (629:9): [True: 0, False: 3]
  ------------------
  630|      0|        return 0;
  631|       |
  632|      3|    ctr->use_df = 1;
  633|      3|    drbg->data = ctr;
  634|      3|    OSSL_FIPS_IND_INIT(drbg)
  635|      3|    return drbg_ctr_init_lengths(drbg);
  636|      3|}
drbg_ctr.c:drbg_ctr_init_lengths:
  531|      6|{
  532|      6|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  533|      6|    int res = 1;
  534|       |
  535|       |    /* Maximum number of bits per request = 2^19  = 2^16 bytes */
  536|      6|    drbg->max_request = 1 << 16;
  537|      6|    if (ctr->use_df) {
  ------------------
  |  Branch (537:9): [True: 6, False: 0]
  ------------------
  538|      6|        drbg->min_entropylen = 0;
  539|      6|        drbg->max_entropylen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      6|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  540|      6|        drbg->min_noncelen = 0;
  541|      6|        drbg->max_noncelen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      6|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  542|      6|        drbg->max_perslen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      6|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  543|      6|        drbg->max_adinlen = DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      6|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  544|       |
  545|      6|        if (ctr->keylen > 0) {
  ------------------
  |  Branch (545:13): [True: 3, False: 3]
  ------------------
  546|      3|            drbg->min_entropylen = ctr->keylen;
  547|      3|            drbg->min_noncelen = drbg->min_entropylen / 2;
  548|      3|        }
  549|      6|    } else {
  550|      0|        const size_t len = ctr->keylen > 0 ? drbg->seedlen : DRBG_MAX_LENGTH;
  ------------------
  |  |   41|      0|# define DRBG_MAX_LENGTH                         INT32_MAX
  ------------------
  |  Branch (550:28): [True: 0, False: 0]
  ------------------
  551|       |
  552|      0|        drbg->min_entropylen = len;
  553|      0|        drbg->max_entropylen = len;
  554|       |        /* Nonce not used */
  555|      0|        drbg->min_noncelen = 0;
  556|      0|        drbg->max_noncelen = 0;
  557|      0|        drbg->max_perslen = len;
  558|      0|        drbg->max_adinlen = len;
  559|      0|    }
  560|      6|    return res;
  561|      6|}
drbg_ctr.c:drbg_ctr_instantiate:
  317|      3|{
  318|      3|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  319|       |
  320|      3|    if (entropy == NULL)
  ------------------
  |  Branch (320:9): [True: 0, False: 3]
  ------------------
  321|      0|        return 0;
  322|       |
  323|      3|    memset(ctr->K, 0, sizeof(ctr->K));
  324|      3|    memset(ctr->V, 0, sizeof(ctr->V));
  325|      3|    if (!EVP_CipherInit_ex(ctr->ctx_ecb, NULL, NULL, ctr->K, NULL, -1))
  ------------------
  |  Branch (325:9): [True: 0, False: 3]
  ------------------
  326|      0|        return 0;
  327|       |
  328|      3|    inc_128(ctr);
  329|      3|    if (!ctr_update(drbg, entropy, entropylen, pers, perslen, nonce, noncelen))
  ------------------
  |  Branch (329:9): [True: 0, False: 3]
  ------------------
  330|      0|        return 0;
  331|      3|    return 1;
  332|      3|}
drbg_ctr.c:inc_128:
   65|  1.05k|{
   66|  1.05k|    unsigned char *p = &ctr->V[0];
   67|  1.05k|    u32 n = 16, c = 1;
   68|       |
   69|  16.8k|    do {
   70|  16.8k|        --n;
   71|  16.8k|        c += p[n];
   72|  16.8k|        p[n] = (u8)c;
   73|  16.8k|        c >>= 8;
   74|  16.8k|    } while (n);
  ------------------
  |  Branch (74:14): [True: 15.7k, False: 1.05k]
  ------------------
   75|  1.05k|}
drbg_ctr.c:ctr_update:
  271|    350|{
  272|    350|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  273|    350|    int outlen = AES_BLOCK_SIZE;
  ------------------
  |  |   26|    350|# define AES_BLOCK_SIZE 16
  ------------------
  274|    350|    unsigned char V_tmp[48], out[48];
  275|    350|    unsigned char len;
  276|       |
  277|       |    /* correct key is already set up. */
  278|    350|    memcpy(V_tmp, ctr->V, 16);
  279|    350|    inc_128(ctr);
  280|    350|    memcpy(V_tmp + 16, ctr->V, 16);
  281|    350|    if (ctr->keylen == 16) {
  ------------------
  |  Branch (281:9): [True: 0, False: 350]
  ------------------
  282|      0|        len = 32;
  283|    350|    } else {
  284|    350|        inc_128(ctr);
  285|    350|        memcpy(V_tmp + 32, ctr->V, 16);
  286|    350|        len = 48;
  287|    350|    }
  288|    350|    if (!EVP_CipherUpdate(ctr->ctx_ecb, out, &outlen, V_tmp, len)
  ------------------
  |  Branch (288:9): [True: 0, False: 350]
  ------------------
  289|    350|            || outlen != len)
  ------------------
  |  Branch (289:16): [True: 0, False: 350]
  ------------------
  290|      0|        return 0;
  291|    350|    memcpy(ctr->K, out, ctr->keylen);
  292|    350|    memcpy(ctr->V, out + ctr->keylen, 16);
  293|       |
  294|    350|    if (ctr->use_df) {
  ------------------
  |  Branch (294:9): [True: 350, False: 0]
  ------------------
  295|       |        /* If no input reuse existing derived value */
  296|    350|        if (in1 != NULL || nonce != NULL || in2 != NULL)
  ------------------
  |  Branch (296:13): [True: 9, False: 341]
  |  Branch (296:28): [True: 0, False: 341]
  |  Branch (296:45): [True: 0, False: 341]
  ------------------
  297|      9|            if (!ctr_df(ctr, in1, in1len, nonce, noncelen, in2, in2len))
  ------------------
  |  Branch (297:17): [True: 0, False: 9]
  ------------------
  298|      0|                return 0;
  299|       |        /* If this a reuse input in1len != 0 */
  300|    350|        if (in1len)
  ------------------
  |  Branch (300:13): [True: 13, False: 337]
  ------------------
  301|     13|            ctr_XOR(ctr, ctr->KX, drbg->seedlen);
  302|    350|    } else {
  303|      0|        ctr_XOR(ctr, in1, in1len);
  304|      0|        ctr_XOR(ctr, in2, in2len);
  305|      0|    }
  306|       |
  307|    350|    if (!EVP_CipherInit_ex(ctr->ctx_ecb, NULL, NULL, ctr->K, NULL, -1)
  ------------------
  |  Branch (307:9): [True: 0, False: 350]
  ------------------
  308|    350|        || !EVP_CipherInit_ex(ctr->ctx_ctr, NULL, NULL, ctr->K, NULL, -1))
  ------------------
  |  Branch (308:12): [True: 0, False: 350]
  ------------------
  309|      0|        return 0;
  310|    350|    return 1;
  311|    350|}
drbg_ctr.c:ctr_df:
  208|      9|{
  209|      9|    static unsigned char c80 = 0x80;
  210|      9|    size_t inlen;
  211|      9|    unsigned char *p = ctr->bltmp;
  212|      9|    int outlen = AES_BLOCK_SIZE;
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  213|       |
  214|      9|    if (!ctr_BCC_init(ctr))
  ------------------
  |  Branch (214:9): [True: 0, False: 9]
  ------------------
  215|      0|        return 0;
  216|      9|    if (in1 == NULL)
  ------------------
  |  Branch (216:9): [True: 0, False: 9]
  ------------------
  217|      0|        in1len = 0;
  218|      9|    if (in2 == NULL)
  ------------------
  |  Branch (218:9): [True: 9, False: 0]
  ------------------
  219|      9|        in2len = 0;
  220|      9|    if (in3 == NULL)
  ------------------
  |  Branch (220:9): [True: 6, False: 3]
  ------------------
  221|      6|        in3len = 0;
  222|      9|    inlen = in1len + in2len + in3len;
  223|       |    /* Initialise L||N in temporary block */
  224|      9|    *p++ = (inlen >> 24) & 0xff;
  225|      9|    *p++ = (inlen >> 16) & 0xff;
  226|      9|    *p++ = (inlen >> 8) & 0xff;
  227|      9|    *p++ = inlen & 0xff;
  228|       |
  229|       |    /* NB keylen is at most 32 bytes */
  230|      9|    *p++ = 0;
  231|      9|    *p++ = 0;
  232|      9|    *p++ = 0;
  233|      9|    *p = (unsigned char)((ctr->keylen + 16) & 0xff);
  234|      9|    ctr->bltmp_pos = 8;
  235|      9|    if (!ctr_BCC_update(ctr, in1, in1len)
  ------------------
  |  Branch (235:9): [True: 0, False: 9]
  ------------------
  236|      9|        || !ctr_BCC_update(ctr, in2, in2len)
  ------------------
  |  Branch (236:12): [True: 0, False: 9]
  ------------------
  237|      9|        || !ctr_BCC_update(ctr, in3, in3len)
  ------------------
  |  Branch (237:12): [True: 0, False: 9]
  ------------------
  238|      9|        || !ctr_BCC_update(ctr, &c80, 1)
  ------------------
  |  Branch (238:12): [True: 0, False: 9]
  ------------------
  239|      9|        || !ctr_BCC_final(ctr))
  ------------------
  |  Branch (239:12): [True: 0, False: 9]
  ------------------
  240|      0|        return 0;
  241|       |    /* Set up key K */
  242|      9|    if (!EVP_CipherInit_ex(ctr->ctx_ecb, NULL, NULL, ctr->KX, NULL, -1))
  ------------------
  |  Branch (242:9): [True: 0, False: 9]
  ------------------
  243|      0|        return 0;
  244|       |    /* X follows key K */
  245|      9|    if (!EVP_CipherUpdate(ctr->ctx_ecb, ctr->KX, &outlen, ctr->KX + ctr->keylen,
  ------------------
  |  Branch (245:9): [True: 0, False: 9]
  ------------------
  246|      9|                          AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  247|      9|        || outlen != AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  |  Branch (247:12): [True: 0, False: 9]
  ------------------
  248|      0|        return 0;
  249|      9|    if (!EVP_CipherUpdate(ctr->ctx_ecb, ctr->KX + 16, &outlen, ctr->KX,
  ------------------
  |  Branch (249:9): [True: 0, False: 9]
  ------------------
  250|      9|                          AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  251|      9|        || outlen != AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  |  Branch (251:12): [True: 0, False: 9]
  ------------------
  252|      0|        return 0;
  253|      9|    if (ctr->keylen != 16)
  ------------------
  |  Branch (253:9): [True: 9, False: 0]
  ------------------
  254|      9|        if (!EVP_CipherUpdate(ctr->ctx_ecb, ctr->KX + 32, &outlen,
  ------------------
  |  Branch (254:13): [True: 0, False: 9]
  ------------------
  255|      9|                              ctr->KX + 16, AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  256|      9|            || outlen != AES_BLOCK_SIZE)
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  |  Branch (256:16): [True: 0, False: 9]
  ------------------
  257|      0|            return 0;
  258|      9|    return 1;
  259|      9|}
drbg_ctr.c:ctr_BCC_init:
  145|      9|{
  146|      9|    unsigned char bltmp[48] = {0};
  147|      9|    unsigned char num_of_blk;
  148|       |
  149|      9|    memset(ctr->KX, 0, 48);
  150|      9|    num_of_blk = ctr->keylen == 16 ? 2 : 3;
  ------------------
  |  Branch (150:18): [True: 0, False: 9]
  ------------------
  151|      9|    bltmp[(AES_BLOCK_SIZE * 1) + 3] = 1;
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  152|      9|    bltmp[(AES_BLOCK_SIZE * 2) + 3] = 2;
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  153|      9|    return ctr_BCC_block(ctr, ctr->KX, bltmp, num_of_blk * AES_BLOCK_SIZE);
  ------------------
  |  |   26|      9|# define AES_BLOCK_SIZE 16
  ------------------
  154|      9|}
drbg_ctr.c:ctr_BCC_block:
  110|     41|{
  111|     41|    int i, outlen = AES_BLOCK_SIZE;
  ------------------
  |  |   26|     41|# define AES_BLOCK_SIZE 16
  ------------------
  112|       |
  113|  2.00k|    for (i = 0; i < len; i++)
  ------------------
  |  Branch (113:17): [True: 1.96k, False: 41]
  ------------------
  114|  1.96k|        out[i] ^= in[i];
  115|       |
  116|     41|    if (!EVP_CipherUpdate(ctr->ctx_df, out, &outlen, out, len)
  ------------------
  |  Branch (116:9): [True: 0, False: 41]
  ------------------
  117|     41|        || outlen != len)
  ------------------
  |  Branch (117:12): [True: 0, False: 41]
  ------------------
  118|      0|        return 0;
  119|     41|    return 1;
  120|     41|}
drbg_ctr.c:ctr_BCC_update:
  161|     36|{
  162|     36|    if (in == NULL || inlen == 0)
  ------------------
  |  Branch (162:9): [True: 15, False: 21]
  |  Branch (162:23): [True: 0, False: 21]
  ------------------
  163|     15|        return 1;
  164|       |
  165|       |    /* If we have partial block handle it first */
  166|     21|    if (ctr->bltmp_pos) {
  ------------------
  |  Branch (166:9): [True: 17, False: 4]
  ------------------
  167|     17|        size_t left = 16 - ctr->bltmp_pos;
  168|       |
  169|       |        /* If we now have a complete block process it */
  170|     17|        if (inlen >= left) {
  ------------------
  |  Branch (170:13): [True: 12, False: 5]
  ------------------
  171|     12|            memcpy(ctr->bltmp + ctr->bltmp_pos, in, left);
  172|     12|            if (!ctr_BCC_blocks(ctr, ctr->bltmp))
  ------------------
  |  Branch (172:17): [True: 0, False: 12]
  ------------------
  173|      0|                return 0;
  174|     12|            ctr->bltmp_pos = 0;
  175|     12|            inlen -= left;
  176|     12|            in += left;
  177|     12|        }
  178|     17|    }
  179|       |
  180|       |    /* Process zero or more complete blocks */
  181|     32|    for (; inlen >= 16; in += 16, inlen -= 16) {
  ------------------
  |  Branch (181:12): [True: 11, False: 21]
  ------------------
  182|     11|        if (!ctr_BCC_blocks(ctr, in))
  ------------------
  |  Branch (182:13): [True: 0, False: 11]
  ------------------
  183|      0|            return 0;
  184|     11|    }
  185|       |
  186|       |    /* Copy any remaining partial block to the temporary buffer */
  187|     21|    if (inlen > 0) {
  ------------------
  |  Branch (187:9): [True: 17, False: 4]
  ------------------
  188|     17|        memcpy(ctr->bltmp + ctr->bltmp_pos, in, inlen);
  189|     17|        ctr->bltmp_pos += inlen;
  190|     17|    }
  191|     21|    return 1;
  192|     21|}
drbg_ctr.c:ctr_BCC_blocks:
  127|     32|{
  128|     32|    unsigned char in_tmp[48];
  129|     32|    unsigned char num_of_blk = 2;
  130|       |
  131|     32|    memcpy(in_tmp, in, 16);
  132|     32|    memcpy(in_tmp + 16, in, 16);
  133|     32|    if (ctr->keylen != 16) {
  ------------------
  |  Branch (133:9): [True: 32, False: 0]
  ------------------
  134|     32|        memcpy(in_tmp + 32, in, 16);
  135|     32|        num_of_blk = 3;
  136|     32|    }
  137|     32|    return ctr_BCC_block(ctr, ctr->KX, in_tmp, AES_BLOCK_SIZE * num_of_blk);
  ------------------
  |  |   26|     32|# define AES_BLOCK_SIZE 16
  ------------------
  138|     32|}
drbg_ctr.c:ctr_BCC_final:
  195|      9|{
  196|      9|    if (ctr->bltmp_pos) {
  ------------------
  |  Branch (196:9): [True: 9, False: 0]
  ------------------
  197|      9|        memset(ctr->bltmp + ctr->bltmp_pos, 0, 16 - ctr->bltmp_pos);
  198|      9|        if (!ctr_BCC_blocks(ctr, ctr->bltmp))
  ------------------
  |  Branch (198:13): [True: 0, False: 9]
  ------------------
  199|      0|            return 0;
  200|      9|    }
  201|      9|    return 1;
  202|      9|}
drbg_ctr.c:ctr_XOR:
   78|     13|{
   79|     13|    size_t i, n;
   80|       |
   81|     13|    if (in == NULL || inlen == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 13]
  |  Branch (81:23): [True: 0, False: 13]
  ------------------
   82|      0|        return;
   83|       |
   84|       |    /*
   85|       |     * Any zero padding will have no effect on the result as we
   86|       |     * are XORing. So just process however much input we have.
   87|       |     */
   88|     13|    n = inlen < ctr->keylen ? inlen : ctr->keylen;
  ------------------
  |  Branch (88:9): [True: 0, False: 13]
  ------------------
   89|     13|    if (!ossl_assert(n <= sizeof(ctr->K)))
  ------------------
  |  |   52|     13|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     13|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (89:9): [True: 0, False: 13]
  ------------------
   90|      0|        return;
   91|    429|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (91:17): [True: 416, False: 13]
  ------------------
   92|    416|        ctr->K[i] ^= in[i];
   93|     13|    if (inlen <= ctr->keylen)
  ------------------
  |  Branch (93:9): [True: 0, False: 13]
  ------------------
   94|      0|        return;
   95|       |
   96|     13|    n = inlen - ctr->keylen;
   97|     13|    if (n > 16) {
  ------------------
  |  Branch (97:9): [True: 0, False: 13]
  ------------------
   98|       |        /* Should never happen */
   99|      0|        n = 16;
  100|      0|    }
  101|    221|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (101:17): [True: 208, False: 13]
  ------------------
  102|    208|        ctr->V[i] ^= in[i + ctr->keylen];
  103|     13|}
drbg_ctr.c:drbg_ctr_reseed:
  360|      2|{
  361|      2|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  362|       |
  363|      2|    if (entropy == NULL)
  ------------------
  |  Branch (363:9): [True: 0, False: 2]
  ------------------
  364|      0|        return 0;
  365|       |
  366|      2|    inc_128(ctr);
  367|      2|    if (!ctr_update(drbg, entropy, entropylen, adin, adinlen, NULL, 0))
  ------------------
  |  Branch (367:9): [True: 0, False: 2]
  ------------------
  368|      0|        return 0;
  369|      2|    return 1;
  370|      2|}
drbg_ctr.c:drbg_ctr_generate:
  397|    341|{
  398|    341|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  399|    341|    unsigned int ctr32, blocks;
  400|    341|    int outl, buflen;
  401|       |
  402|    341|    if (adin != NULL && adinlen != 0) {
  ------------------
  |  Branch (402:9): [True: 4, False: 337]
  |  Branch (402:25): [True: 4, False: 0]
  ------------------
  403|      4|        inc_128(ctr);
  404|       |
  405|      4|        if (!ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0))
  ------------------
  |  Branch (405:13): [True: 0, False: 4]
  ------------------
  406|      0|            return 0;
  407|       |        /* This means we reuse derived value */
  408|      4|        if (ctr->use_df) {
  ------------------
  |  Branch (408:13): [True: 4, False: 0]
  ------------------
  409|      4|            adin = NULL;
  410|      4|            adinlen = 1;
  411|      4|        }
  412|    337|    } else {
  413|    337|        adinlen = 0;
  414|    337|    }
  415|       |
  416|    341|    inc_128(ctr);
  417|       |
  418|    341|    if (outlen == 0) {
  ------------------
  |  Branch (418:9): [True: 0, False: 341]
  ------------------
  419|      0|        inc_128(ctr);
  420|       |
  421|      0|        if (!ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0))
  ------------------
  |  Branch (421:13): [True: 0, False: 0]
  ------------------
  422|      0|            return 0;
  423|      0|        return 1;
  424|      0|    }
  425|       |
  426|    341|    memset(out, 0, outlen);
  427|       |
  428|    341|    do {
  429|    341|        if (!EVP_CipherInit_ex(ctr->ctx_ctr,
  ------------------
  |  Branch (429:13): [True: 0, False: 341]
  ------------------
  430|    341|                               NULL, NULL, NULL, ctr->V, -1))
  431|      0|            return 0;
  432|       |
  433|       |        /*-
  434|       |         * outlen has type size_t while EVP_CipherUpdate takes an
  435|       |         * int argument and thus cannot be guaranteed to process more
  436|       |         * than 2^31-1 bytes at a time. We process such huge generate
  437|       |         * requests in 2^30 byte chunks, which is the greatest multiple
  438|       |         * of AES block size lower than or equal to 2^31-1.
  439|       |         */
  440|    341|        buflen = outlen > (1U << 30) ? (1U << 30) : outlen;
  ------------------
  |  Branch (440:18): [True: 0, False: 341]
  ------------------
  441|    341|        blocks = (buflen + 15) / 16;
  442|       |
  443|    341|        ctr32 = GETU32(ctr->V + 12) + blocks;
  ------------------
  |  |  103|    341|# define GETU32(p)       ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
  ------------------
  444|    341|        if (ctr32 < blocks) {
  ------------------
  |  Branch (444:13): [True: 0, False: 341]
  ------------------
  445|       |            /* 32-bit counter overflow into V. */
  446|      0|            if (ctr32 != 0) {
  ------------------
  |  Branch (446:17): [True: 0, False: 0]
  ------------------
  447|      0|                blocks -= ctr32;
  448|      0|                buflen = blocks * 16;
  449|      0|                ctr32 = 0;
  450|      0|            }
  451|      0|            ctr96_inc(ctr->V);
  452|      0|        }
  453|    341|        PUTU32(ctr->V + 12, ctr32);
  ------------------
  |  |  104|    341|# define PUTU32(p,v)     ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
  ------------------
  454|       |
  455|    341|        if (!EVP_CipherUpdate(ctr->ctx_ctr, out, &outl, out, buflen)
  ------------------
  |  Branch (455:13): [True: 0, False: 341]
  ------------------
  456|    341|            || outl != buflen)
  ------------------
  |  Branch (456:16): [True: 0, False: 341]
  ------------------
  457|      0|            return 0;
  458|       |
  459|    341|        out += buflen;
  460|    341|        outlen -= buflen;
  461|    341|    } while (outlen);
  ------------------
  |  Branch (461:14): [True: 0, False: 341]
  ------------------
  462|       |
  463|    341|    if (!ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0))
  ------------------
  |  Branch (463:9): [True: 0, False: 341]
  ------------------
  464|      0|        return 0;
  465|    341|    return 1;
  466|    341|}
drbg_ctr.c:drbg_ctr_free:
  648|      3|{
  649|      3|    PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
  650|      3|    PROV_DRBG_CTR *ctr;
  651|       |
  652|      3|    if (drbg != NULL && (ctr = (PROV_DRBG_CTR *)drbg->data) != NULL) {
  ------------------
  |  Branch (652:9): [True: 3, False: 0]
  |  Branch (652:25): [True: 3, False: 0]
  ------------------
  653|      3|        EVP_CIPHER_CTX_free(ctr->ctx_ecb);
  654|      3|        EVP_CIPHER_CTX_free(ctr->ctx_ctr);
  655|      3|        EVP_CIPHER_CTX_free(ctr->ctx_df);
  656|      3|        EVP_CIPHER_free(ctr->cipher_ecb);
  657|      3|        EVP_CIPHER_free(ctr->cipher_ctr);
  658|       |
  659|      3|        OPENSSL_secure_clear_free(ctr, sizeof(*ctr));
  ------------------
  |  |  129|      3|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  660|      3|    }
  661|      3|    ossl_rand_drbg_free(drbg);
  662|      3|}
drbg_ctr.c:drbg_ctr_instantiate_wrapper:
  339|      3|{
  340|      3|    PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
  341|      3|    int ret = 0;
  342|       |
  343|      3|    if (drbg->lock != NULL && !CRYPTO_THREAD_write_lock(drbg->lock))
  ------------------
  |  Branch (343:9): [True: 0, False: 3]
  |  Branch (343:31): [True: 0, False: 0]
  ------------------
  344|      0|        return 0;
  345|       |
  346|      3|    if (!ossl_prov_is_running()
  ------------------
  |  Branch (346:9): [True: 0, False: 3]
  ------------------
  347|      3|            || !drbg_ctr_set_ctx_params_locked(drbg, params))
  ------------------
  |  Branch (347:16): [True: 0, False: 3]
  ------------------
  348|      0|        goto err;
  349|      3|    ret = ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
  350|      3|                                     pstr, pstr_len);
  351|      3| err:
  352|      3|    if (drbg->lock != NULL)
  ------------------
  |  Branch (352:9): [True: 0, False: 3]
  ------------------
  353|      0|        CRYPTO_THREAD_unlock(drbg->lock);
  354|      3|    return ret;
  355|      3|}
drbg_ctr.c:drbg_ctr_set_ctx_params_locked:
  714|      3|{
  715|      3|    PROV_DRBG *ctx = (PROV_DRBG *)vctx;
  716|      3|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)ctx->data;
  717|      3|    OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
  ------------------
  |  |   31|      3|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  718|      3|    OSSL_PROVIDER *prov = NULL;
  719|      3|    const OSSL_PARAM *p;
  720|      3|    char *ecb;
  721|      3|    const char *propquery = NULL;
  722|      3|    int i, cipher_init = 0;
  723|       |
  724|      3|    if ((p = OSSL_PARAM_locate_const(params, OSSL_DRBG_PARAM_USE_DF)) != NULL
  ------------------
  |  |  249|      3|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  |  Branch (724:9): [True: 3, False: 0]
  ------------------
  725|      3|            && OSSL_PARAM_get_int(p, &i)) {
  ------------------
  |  Branch (725:16): [True: 3, False: 0]
  ------------------
  726|       |        /* FIPS errors out in the drbg_ctr_init() call later */
  727|      3|        ctr->use_df = i != 0;
  728|      3|        cipher_init = 1;
  729|      3|    }
  730|       |
  731|      3|    if ((p = OSSL_PARAM_locate_const(params,
  ------------------
  |  Branch (731:9): [True: 0, False: 3]
  ------------------
  732|      3|                                     OSSL_DRBG_PARAM_PROPERTIES)) != NULL) {
  ------------------
  |  |  242|      3|# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  126|      3|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  733|      0|        if (p->data_type != OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|      0|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (733:13): [True: 0, False: 0]
  ------------------
  734|      0|            return 0;
  735|      0|        propquery = (const char *)p->data;
  736|      0|    }
  737|       |
  738|      3|    if ((p = OSSL_PARAM_locate_const(params,
  ------------------
  |  Branch (738:9): [True: 3, False: 0]
  ------------------
  739|      3|                                     OSSL_PROV_PARAM_CORE_PROV_NAME)) != NULL) {
  ------------------
  |  |  494|      3|# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name"
  ------------------
  740|      3|        if (p->data_type != OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|      3|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (740:13): [True: 0, False: 3]
  ------------------
  741|      0|            return 0;
  742|      3|        if ((prov = ossl_provider_find(libctx,
  ------------------
  |  Branch (742:13): [True: 0, False: 3]
  ------------------
  743|      3|                                       (const char *)p->data, 1)) == NULL)
  744|      0|            return 0;
  745|      3|    }
  746|       |
  747|      3|    if ((p = OSSL_PARAM_locate_const(params, OSSL_DRBG_PARAM_CIPHER)) != NULL) {
  ------------------
  |  |  227|      3|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  121|      3|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  |  Branch (747:9): [True: 3, False: 0]
  ------------------
  748|      3|        const char *base = (const char *)p->data;
  749|      3|        size_t ctr_str_len = sizeof("CTR") - 1;
  750|      3|        size_t ecb_str_len = sizeof("ECB") - 1;
  751|       |
  752|      3|        if (p->data_type != OSSL_PARAM_UTF8_STRING
  ------------------
  |  |  117|      6|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (752:13): [True: 0, False: 3]
  ------------------
  753|      3|                || p->data_size < ctr_str_len) {
  ------------------
  |  Branch (753:20): [True: 0, False: 3]
  ------------------
  754|      0|            ossl_provider_free(prov);
  755|      0|            return 0;
  756|      0|        }
  757|      3|        if (OPENSSL_strcasecmp("CTR", base + p->data_size - ctr_str_len) != 0) {
  ------------------
  |  Branch (757:13): [True: 0, False: 3]
  ------------------
  758|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_REQUIRE_CTR_MODE_CIPHER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  759|      0|            ossl_provider_free(prov);
  760|      0|            return 0;
  761|      0|        }
  762|      3|        if ((ecb = OPENSSL_strndup(base, p->data_size)) == NULL) {
  ------------------
  |  |  121|      3|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (762:13): [True: 0, False: 3]
  ------------------
  763|      0|            ossl_provider_free(prov);
  764|      0|            return 0;
  765|      0|        }
  766|      3|        strcpy(ecb + p->data_size - ecb_str_len, "ECB");
  767|      3|        EVP_CIPHER_free(ctr->cipher_ecb);
  768|      3|        EVP_CIPHER_free(ctr->cipher_ctr);
  769|       |        /*
  770|       |         * Try to fetch algorithms from our own provider code, fallback
  771|       |         * to generic fetch only if that fails
  772|       |         */
  773|      3|        (void)ERR_set_mark();
  774|      3|        ctr->cipher_ctr = evp_cipher_fetch_from_prov(prov, base, NULL);
  775|      3|        if (ctr->cipher_ctr == NULL) {
  ------------------
  |  Branch (775:13): [True: 0, False: 3]
  ------------------
  776|      0|            (void)ERR_pop_to_mark();
  777|      0|            ctr->cipher_ctr = EVP_CIPHER_fetch(libctx, base, propquery);
  778|      3|        } else {
  779|      3|            (void)ERR_clear_last_mark();
  780|      3|        }
  781|      3|        (void)ERR_set_mark();
  782|      3|        ctr->cipher_ecb = evp_cipher_fetch_from_prov(prov, ecb, NULL);
  783|      3|        if (ctr->cipher_ecb == NULL) {
  ------------------
  |  Branch (783:13): [True: 0, False: 3]
  ------------------
  784|      0|            (void)ERR_pop_to_mark();
  785|      0|            ctr->cipher_ecb = EVP_CIPHER_fetch(libctx, ecb, propquery);
  786|      3|        } else {
  787|      3|            (void)ERR_clear_last_mark();
  788|      3|        }
  789|      3|        OPENSSL_free(ecb);
  ------------------
  |  |  115|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  790|      3|        if (ctr->cipher_ctr == NULL || ctr->cipher_ecb == NULL) {
  ------------------
  |  Branch (790:13): [True: 0, False: 3]
  |  Branch (790:40): [True: 0, False: 3]
  ------------------
  791|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_FIND_CIPHERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  792|      0|            ossl_provider_free(prov);
  793|      0|            return 0;
  794|      0|        }
  795|      3|        cipher_init = 1;
  796|      3|    }
  797|      3|    ossl_provider_free(prov);
  798|       |
  799|      3|    if (cipher_init && !drbg_ctr_init(ctx))
  ------------------
  |  Branch (799:9): [True: 3, False: 0]
  |  Branch (799:24): [True: 0, False: 3]
  ------------------
  800|      0|        return 0;
  801|       |
  802|      3|    return ossl_drbg_set_ctx_params(ctx, params);
  803|      3|}
drbg_ctr.c:drbg_ctr_init:
  564|      3|{
  565|      3|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  566|      3|    size_t keylen;
  567|       |
  568|      3|    if (ctr->cipher_ctr == NULL) {
  ------------------
  |  Branch (568:9): [True: 0, False: 3]
  ------------------
  569|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_CIPHER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  570|      0|        return 0;
  571|      0|    }
  572|      3|    ctr->keylen = keylen = EVP_CIPHER_get_key_length(ctr->cipher_ctr);
  573|      3|    if (ctr->ctx_ecb == NULL)
  ------------------
  |  Branch (573:9): [True: 3, False: 0]
  ------------------
  574|      3|        ctr->ctx_ecb = EVP_CIPHER_CTX_new();
  575|      3|    if (ctr->ctx_ctr == NULL)
  ------------------
  |  Branch (575:9): [True: 3, False: 0]
  ------------------
  576|      3|        ctr->ctx_ctr = EVP_CIPHER_CTX_new();
  577|      3|    if (ctr->ctx_ecb == NULL || ctr->ctx_ctr == NULL) {
  ------------------
  |  Branch (577:9): [True: 0, False: 3]
  |  Branch (577:33): [True: 0, False: 3]
  ------------------
  578|      0|        ERR_raise(ERR_LIB_PROV, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  579|      0|        goto err;
  580|      0|    }
  581|       |
  582|      3|    if (!EVP_CipherInit_ex(ctr->ctx_ecb,
  ------------------
  |  Branch (582:9): [True: 0, False: 3]
  ------------------
  583|      3|                           ctr->cipher_ecb, NULL, NULL, NULL, 1)
  584|      3|        || !EVP_CipherInit_ex(ctr->ctx_ctr,
  ------------------
  |  Branch (584:12): [True: 0, False: 3]
  ------------------
  585|      3|                              ctr->cipher_ctr, NULL, NULL, NULL, 1)) {
  586|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_INITIALISE_CIPHERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  587|      0|        goto err;
  588|      0|    }
  589|       |
  590|      3|    drbg->strength = keylen * 8;
  591|      3|    drbg->seedlen = keylen + 16;
  592|       |
  593|      3|    if (ctr->use_df) {
  ------------------
  |  Branch (593:9): [True: 3, False: 0]
  ------------------
  594|       |        /* df initialisation */
  595|      3|        static const unsigned char df_key[32] = {
  596|      3|            0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  597|      3|            0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  598|      3|            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  599|      3|            0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
  600|      3|        };
  601|       |
  602|      3|        if (ctr->ctx_df == NULL)
  ------------------
  |  Branch (602:13): [True: 3, False: 0]
  ------------------
  603|      3|            ctr->ctx_df = EVP_CIPHER_CTX_new();
  604|      3|        if (ctr->ctx_df == NULL) {
  ------------------
  |  Branch (604:13): [True: 0, False: 3]
  ------------------
  605|      0|            ERR_raise(ERR_LIB_PROV, 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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  606|      0|            goto err;
  607|      0|        }
  608|       |        /* Set key schedule for df_key */
  609|      3|        if (!EVP_CipherInit_ex(ctr->ctx_df,
  ------------------
  |  Branch (609:13): [True: 0, False: 3]
  ------------------
  610|      3|                               ctr->cipher_ecb, NULL, df_key, NULL, 1)) {
  611|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_DERIVATION_FUNCTION_INIT_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  612|      0|            goto err;
  613|      0|        }
  614|      3|    }
  615|      3|    return drbg_ctr_init_lengths(drbg);
  616|       |
  617|      0|err:
  618|      0|    EVP_CIPHER_CTX_free(ctr->ctx_ecb);
  619|      0|    EVP_CIPHER_CTX_free(ctr->ctx_ctr);
  620|      0|    ctr->ctx_ecb = ctr->ctx_ctr = NULL;
  621|      0|    return 0;
  622|      3|}
drbg_ctr.c:drbg_ctr_generate_wrapper:
  472|    337|{
  473|    337|    PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
  474|       |
  475|    337|    return ossl_prov_drbg_generate(drbg, out, outlen, strength,
  476|    337|                                   prediction_resistance, adin, adin_len);
  477|    337|}
drbg_ctr.c:drbg_ctr_settable_ctx_params:
  823|      3|{
  824|      3|    static const OSSL_PARAM known_settable_ctx_params[] = {
  825|      3|        OSSL_PARAM_utf8_string(OSSL_DRBG_PARAM_PROPERTIES, NULL, 0),
  ------------------
  |  |   61|      3|    OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_STRING, (addr), sz)
  |  |  ------------------
  |  |  |  |   28|      3|    { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      3|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  826|      3|        OSSL_PARAM_utf8_string(OSSL_DRBG_PARAM_CIPHER, NULL, 0),
  ------------------
  |  |   61|      3|    OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_STRING, (addr), sz)
  |  |  ------------------
  |  |  |  |   28|      3|    { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      3|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  827|      3|        OSSL_PARAM_int(OSSL_DRBG_PARAM_USE_DF, NULL),
  ------------------
  |  |   32|      3|    OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int))
  |  |  ------------------
  |  |  |  |   28|      3|    { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      3|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  828|      3|        OSSL_PARAM_DRBG_SETTABLE_CTX_COMMON,
  ------------------
  |  |  222|      3|    OSSL_PARAM_uint(OSSL_DRBG_PARAM_RESEED_REQUESTS, NULL),             \
  |  |  ------------------
  |  |  |  |   34|      3|    OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|      3|    { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   22|      3|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   35|      3|                    sizeof(unsigned int))
  |  |  ------------------
  |  |  223|      3|    OSSL_PARAM_uint64(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL, NULL)
  |  |  ------------------
  |  |  |  |   49|      3|    OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|      3|    { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   22|      3|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|      3|                    sizeof(uint64_t))
  |  |  ------------------
  ------------------
  829|      3|        OSSL_PARAM_END
  ------------------
  |  |   25|      3|    { NULL, 0, NULL, 0, 0 }
  ------------------
  830|      3|    };
  831|      3|    return known_settable_ctx_params;
  832|      3|}
drbg_ctr.c:drbg_ctr_get_ctx_params:
  665|    684|{
  666|    684|    PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
  667|    684|    PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)drbg->data;
  668|    684|    OSSL_PARAM *p;
  669|    684|    int ret = 0, complete = 0;
  670|       |
  671|    684|    if (!ossl_drbg_get_ctx_params_no_lock(drbg, params, &complete))
  ------------------
  |  Branch (671:9): [True: 0, False: 684]
  ------------------
  672|      0|        return 0;
  673|       |
  674|    684|    if (complete)
  ------------------
  |  Branch (674:9): [True: 678, False: 6]
  ------------------
  675|    678|        return 1;
  676|       |
  677|      6|    if (drbg->lock != NULL && !CRYPTO_THREAD_read_lock(drbg->lock))
  ------------------
  |  Branch (677:9): [True: 6, False: 0]
  |  Branch (677:31): [True: 0, False: 6]
  ------------------
  678|      0|        return 0;
  679|       |
  680|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_USE_DF);
  ------------------
  |  |  249|      6|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  681|      6|    if (p != NULL && !OSSL_PARAM_set_int(p, ctr->use_df))
  ------------------
  |  Branch (681:9): [True: 0, False: 6]
  |  Branch (681:22): [True: 0, False: 0]
  ------------------
  682|      0|        goto err;
  683|       |
  684|      6|    p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_CIPHER);
  ------------------
  |  |  227|      6|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  121|      6|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  685|      6|    if (p != NULL) {
  ------------------
  |  Branch (685:9): [True: 0, False: 6]
  ------------------
  686|      0|        if (ctr->cipher_ctr == NULL
  ------------------
  |  Branch (686:13): [True: 0, False: 0]
  ------------------
  687|      0|            || !OSSL_PARAM_set_utf8_string(p,
  ------------------
  |  Branch (687:16): [True: 0, False: 0]
  ------------------
  688|      0|                                           EVP_CIPHER_get0_name(ctr->cipher_ctr)))
  689|      0|            goto err;
  690|      0|    }
  691|       |
  692|      6|    ret = ossl_drbg_get_ctx_params(drbg, params);
  693|      6| err:
  694|      6|    if (drbg->lock != NULL)
  ------------------
  |  Branch (694:9): [True: 6, False: 0]
  ------------------
  695|      6|        CRYPTO_THREAD_unlock(drbg->lock);
  696|       |
  697|      6|    return ret;
  698|      6|}

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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   52|      0|        return NULL;
   53|      0|    }
   54|       |
   55|      1|    s = OPENSSL_zalloc(sizeof(*s));
  ------------------
  |  |  104|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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;
  ------------------
  |  | 1347|      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);
  ------------------
  |  |  115|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      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;
  ------------------
  |  | 1348|      1|# define EVP_RAND_STATE_READY            1
  ------------------
   77|      1|    return 1;
   78|      1|}
seed_src.c:seed_src_enable_locking:
  216|      1|{
  217|      1|    return 1;
  218|      1|}
seed_src.c:seed_src_lock:
  221|      9|{
  222|      9|    return 1;
  223|      9|}
seed_src.c:seed_src_unlock:
  226|      9|{
  227|      9|}
seed_src.c:seed_src_get_ctx_params:
  145|      6|{
  146|      6|    PROV_SEED_SRC *s = (PROV_SEED_SRC *)vseed;
  147|      6|    OSSL_PARAM *p;
  148|       |
  149|      6|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STATE);
  ------------------
  |  |  533|      6|# define OSSL_RAND_PARAM_STATE "state"
  ------------------
  150|      6|    if (p != NULL && !OSSL_PARAM_set_int(p, s->state))
  ------------------
  |  Branch (150:9): [True: 0, False: 6]
  |  Branch (150:22): [True: 0, False: 0]
  ------------------
  151|      0|        return 0;
  152|       |
  153|      6|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STRENGTH);
  ------------------
  |  |  534|      6|# define OSSL_RAND_PARAM_STRENGTH "strength"
  ------------------
  154|      6|    if (p != NULL && !OSSL_PARAM_set_int(p, 1024))
  ------------------
  |  Branch (154:9): [True: 2, False: 4]
  |  Branch (154:22): [True: 0, False: 2]
  ------------------
  155|      0|        return 0;
  156|       |
  157|      6|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_MAX_REQUEST);
  ------------------
  |  |  532|      6|# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
  ------------------
  158|      6|    if (p != NULL && !OSSL_PARAM_set_size_t(p, 128))
  ------------------
  |  Branch (158:9): [True: 0, False: 6]
  |  Branch (158:22): [True: 0, False: 0]
  ------------------
  159|      0|        return 0;
  160|      6|    return 1;
  161|      6|}
seed_src.c:seed_get_seed:
  184|      1|{
  185|      1|    size_t ret = 0;
  186|      1|    size_t entropy_available = 0;
  187|      1|    RAND_POOL *pool;
  188|       |
  189|      1|    pool = ossl_rand_pool_new(entropy, 1, min_len, max_len);
  190|      1|    if (pool == NULL) {
  ------------------
  |  Branch (190:9): [True: 0, False: 1]
  ------------------
  191|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_RAND_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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  192|      0|        return 0;
  193|      0|    }
  194|       |
  195|       |    /* Get entropy by polling system entropy sources. */
  196|      1|    entropy_available = ossl_pool_acquire_entropy(pool);
  197|       |
  198|      1|    if (entropy_available > 0
  ------------------
  |  Branch (198:9): [True: 1, False: 0]
  ------------------
  199|      1|        && ossl_rand_pool_adin_mix_in(pool, adin, adin_len)) {
  ------------------
  |  Branch (199:12): [True: 1, False: 0]
  ------------------
  200|      1|        ret = ossl_rand_pool_length(pool);
  201|      1|        *pout = ossl_rand_pool_detach(pool);
  202|      1|    } else {
  203|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  204|      0|    }
  205|      1|    ossl_rand_pool_free(pool);
  206|      1|    return ret;
  207|      1|}
seed_src.c:seed_clear_seed:
  211|      1|{
  212|      1|    OPENSSL_secure_clear_free(out, outlen);
  ------------------
  |  |  129|      1|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  213|      1|}

ossl_rand_pool_init:
  570|      1|{
  571|      1|    size_t i;
  572|       |
  573|      5|    for (i = 0; i < OSSL_NELEM(random_devices); i++)
  ------------------
  |  |   14|      5|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (573:17): [True: 4, False: 1]
  ------------------
  574|      4|        random_devices[i].fd = -1;
  575|       |
  576|      1|    return 1;
  577|      1|}
ossl_rand_pool_cleanup:
  580|      1|{
  581|      1|    size_t i;
  582|       |
  583|      5|    for (i = 0; i < OSSL_NELEM(random_devices); i++)
  ------------------
  |  |   14|      5|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (583:17): [True: 4, False: 1]
  ------------------
  584|      4|        close_random_device(i);
  585|      1|}
ossl_pool_acquire_entropy:
  630|      1|{
  631|       |#  if defined(OPENSSL_RAND_SEED_NONE)
  632|       |    return ossl_rand_pool_entropy_available(pool);
  633|       |#  else
  634|      1|    size_t entropy_available = 0;
  635|       |
  636|      1|    (void)entropy_available;    /* avoid compiler warning */
  637|       |
  638|      1|#   if defined(OPENSSL_RAND_SEED_GETRANDOM)
  639|      1|    {
  640|      1|        size_t bytes_needed;
  641|      1|        unsigned char *buffer;
  642|      1|        ssize_t bytes;
  643|       |        /* Maximum allowed number of consecutive unsuccessful attempts */
  644|      1|        int attempts = 3;
  645|       |
  646|      1|        bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
  647|      2|        while (bytes_needed != 0 && attempts-- > 0) {
  ------------------
  |  Branch (647:16): [True: 1, False: 1]
  |  Branch (647:37): [True: 1, False: 0]
  ------------------
  648|      1|            buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
  649|      1|            bytes = syscall_random(buffer, bytes_needed);
  650|      1|            if (bytes > 0) {
  ------------------
  |  Branch (650:17): [True: 1, False: 0]
  ------------------
  651|      1|                ossl_rand_pool_add_end(pool, bytes, 8 * bytes);
  652|      1|                bytes_needed -= bytes;
  653|      1|                attempts = 3; /* reset counter after successful attempt */
  654|      1|            } else if (bytes < 0 && errno != EINTR) {
  ------------------
  |  Branch (654:24): [True: 0, False: 0]
  |  Branch (654:37): [True: 0, False: 0]
  ------------------
  655|      0|                break;
  656|      0|            }
  657|      1|        }
  658|      1|    }
  659|      1|    entropy_available = ossl_rand_pool_entropy_available(pool);
  660|      1|    if (entropy_available > 0)
  ------------------
  |  Branch (660:9): [True: 1, False: 0]
  ------------------
  661|      1|        return entropy_available;
  662|      0|#   endif
  663|       |
  664|      0|#   if defined(OPENSSL_RAND_SEED_DEVRANDOM)
  665|      0|    if (wait_random_seeded()) {
  ------------------
  |  Branch (665:9): [True: 0, False: 0]
  ------------------
  666|      0|        size_t bytes_needed;
  667|      0|        unsigned char *buffer;
  668|      0|        size_t i;
  669|       |
  670|      0|        bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
  671|      0|        for (i = 0; bytes_needed > 0 && i < OSSL_NELEM(random_device_paths);
  ------------------
  |  |   14|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (671:21): [True: 0, False: 0]
  |  Branch (671:41): [True: 0, False: 0]
  ------------------
  672|      0|             i++) {
  673|      0|            ssize_t bytes = 0;
  674|       |            /* Maximum number of consecutive unsuccessful attempts */
  675|      0|            int attempts = 3;
  676|      0|            const int fd = get_random_device(i);
  677|       |
  678|      0|            if (fd == -1)
  ------------------
  |  Branch (678:17): [True: 0, False: 0]
  ------------------
  679|      0|                continue;
  680|       |
  681|      0|            while (bytes_needed != 0 && attempts-- > 0) {
  ------------------
  |  Branch (681:20): [True: 0, False: 0]
  |  Branch (681:41): [True: 0, False: 0]
  ------------------
  682|      0|                buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
  683|      0|                bytes = read(fd, buffer, bytes_needed);
  684|       |
  685|      0|                if (bytes > 0) {
  ------------------
  |  Branch (685:21): [True: 0, False: 0]
  ------------------
  686|      0|                    ossl_rand_pool_add_end(pool, bytes, 8 * bytes);
  687|      0|                    bytes_needed -= bytes;
  688|      0|                    attempts = 3; /* reset counter on successful attempt */
  689|      0|                } else if (bytes < 0 && errno != EINTR) {
  ------------------
  |  Branch (689:28): [True: 0, False: 0]
  |  Branch (689:41): [True: 0, False: 0]
  ------------------
  690|      0|                    break;
  691|      0|                }
  692|      0|            }
  693|      0|            if (bytes < 0 || !keep_random_devices_open)
  ------------------
  |  Branch (693:17): [True: 0, False: 0]
  |  Branch (693:30): [True: 0, False: 0]
  ------------------
  694|      0|                close_random_device(i);
  695|       |
  696|      0|            bytes_needed = ossl_rand_pool_bytes_needed(pool, 1);
  697|      0|        }
  698|      0|        entropy_available = ossl_rand_pool_entropy_available(pool);
  699|      0|        if (entropy_available > 0)
  ------------------
  |  Branch (699:13): [True: 0, False: 0]
  ------------------
  700|      0|            return entropy_available;
  701|      0|    }
  702|      0|#   endif
  703|       |
  704|       |#   if defined(OPENSSL_RAND_SEED_RDTSC)
  705|       |    entropy_available = ossl_prov_acquire_entropy_from_tsc(pool);
  706|       |    if (entropy_available > 0)
  707|       |        return entropy_available;
  708|       |#   endif
  709|       |
  710|       |#   if defined(OPENSSL_RAND_SEED_RDCPU)
  711|       |    entropy_available = ossl_prov_acquire_entropy_from_cpu(pool);
  712|       |    if (entropy_available > 0)
  713|       |        return entropy_available;
  714|       |#   endif
  715|       |
  716|       |#   if defined(OPENSSL_RAND_SEED_EGD)
  717|       |    {
  718|       |        static const char *paths[] = { DEVRANDOM_EGD, NULL };
  719|       |        size_t bytes_needed;
  720|       |        unsigned char *buffer;
  721|       |        int i;
  722|       |
  723|       |        bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
  724|       |        for (i = 0; bytes_needed > 0 && paths[i] != NULL; i++) {
  725|       |            size_t bytes = 0;
  726|       |            int num;
  727|       |
  728|       |            buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
  729|       |            num = RAND_query_egd_bytes(paths[i],
  730|       |                                       buffer, (int)bytes_needed);
  731|       |            if (num == (int)bytes_needed)
  732|       |                bytes = bytes_needed;
  733|       |
  734|       |            ossl_rand_pool_add_end(pool, bytes, 8 * bytes);
  735|       |            bytes_needed = ossl_rand_pool_bytes_needed(pool, 1);
  736|       |        }
  737|       |        entropy_available = ossl_rand_pool_entropy_available(pool);
  738|       |        if (entropy_available > 0)
  739|       |            return entropy_available;
  740|       |    }
  741|       |#   endif
  742|       |
  743|      0|    return ossl_rand_pool_entropy_available(pool);
  744|      0|#  endif
  745|      0|}
rand_unix.c:close_random_device:
  561|      4|{
  562|      4|    struct random_device *rd = &random_devices[n];
  563|       |
  564|      4|    if (check_random_device(rd))
  ------------------
  |  Branch (564:9): [True: 0, False: 4]
  ------------------
  565|      0|        close(rd->fd);
  566|      4|    rd->fd = -1;
  567|      4|}
rand_unix.c:check_random_device:
  516|      4|{
  517|      4|    struct stat st;
  518|       |
  519|      4|    return rd->fd != -1
  ------------------
  |  Branch (519:12): [True: 0, False: 4]
  ------------------
  520|      4|           && fstat(rd->fd, &st) != -1
  ------------------
  |  Branch (520:15): [True: 0, False: 0]
  ------------------
  521|      4|           && rd->dev == st.st_dev
  ------------------
  |  Branch (521:15): [True: 0, False: 0]
  ------------------
  522|      4|           && rd->ino == st.st_ino
  ------------------
  |  Branch (522:15): [True: 0, False: 0]
  ------------------
  523|      4|           && ((rd->mode ^ st.st_mode) & ~(S_IRWXU | S_IRWXG | S_IRWXO)) == 0
  ------------------
  |  Branch (523:15): [True: 0, False: 0]
  ------------------
  524|      4|           && rd->rdev == st.st_rdev;
  ------------------
  |  Branch (524:15): [True: 0, False: 0]
  ------------------
  525|      4|}
rand_unix.c:syscall_random:
  334|      1|{
  335|       |    /*
  336|       |     * Note: 'buflen' equals the size of the buffer which is used by the
  337|       |     * get_entropy() callback of the RAND_DRBG. It is roughly bounded by
  338|       |     *
  339|       |     *   2 * RAND_POOL_FACTOR * (RAND_DRBG_STRENGTH / 8) = 2^14
  340|       |     *
  341|       |     * which is way below the OSSL_SSIZE_MAX limit. Therefore sign conversion
  342|       |     * between size_t and ssize_t is safe even without a range check.
  343|       |     */
  344|       |
  345|       |    /*
  346|       |     * Do runtime detection to find getentropy().
  347|       |     *
  348|       |     * Known OSs that should support this:
  349|       |     * - Darwin since 16 (OSX 10.12, IOS 10.0).
  350|       |     * - Solaris since 11.3
  351|       |     * - OpenBSD since 5.6
  352|       |     * - Linux since 3.17 with glibc 2.25
  353|       |     *
  354|       |     * Note: Sometimes getentropy() can be provided but not implemented
  355|       |     * internally. So we need to check errno for ENOSYS
  356|       |     */
  357|      1|#  if !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
  358|      1|#    if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
  359|      1|    extern int getentropy(void *buffer, size_t length) __attribute__((weak));
  360|       |
  361|      1|    if (getentropy != NULL) {
  ------------------
  |  Branch (361:9): [True: 1, False: 0]
  ------------------
  362|      1|        if (getentropy(buf, buflen) == 0)
  ------------------
  |  Branch (362:13): [True: 1, False: 0]
  ------------------
  363|      1|            return (ssize_t)buflen;
  364|      0|        if (errno != ENOSYS)
  ------------------
  |  Branch (364:13): [True: 0, False: 0]
  ------------------
  365|      0|            return -1;
  366|      0|    }
  367|       |#    elif defined(OPENSSL_APPLE_CRYPTO_RANDOM)
  368|       |
  369|       |    if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
  370|       |	    return (ssize_t)buflen;
  371|       |
  372|       |    return -1;
  373|       |#    else
  374|       |    union {
  375|       |        void *p;
  376|       |        int (*f)(void *buffer, size_t length);
  377|       |    } p_getentropy;
  378|       |
  379|       |    /*
  380|       |     * We could cache the result of the lookup, but we normally don't
  381|       |     * call this function often.
  382|       |     */
  383|       |    ERR_set_mark();
  384|       |    p_getentropy.p = DSO_global_lookup("getentropy");
  385|       |    ERR_pop_to_mark();
  386|       |    if (p_getentropy.p != NULL)
  387|       |        return p_getentropy.f(buf, buflen) == 0 ? (ssize_t)buflen : -1;
  388|       |#    endif
  389|      0|#  endif /* !__DragonFly__ && !__NetBSD__ && !__FreeBSD__ */
  390|       |
  391|       |    /* Linux supports this since version 3.17 */
  392|      0|#  if defined(__linux) && defined(__NR_getrandom)
  393|      0|    return syscall(__NR_getrandom, buf, buflen, 0);
  394|       |#  elif (defined(__DragonFly__)  && __DragonFly_version >= 500700) \
  395|       |     || (defined(__NetBSD__) && __NetBSD_Version >= 1000000000) \
  396|       |     || (defined(__FreeBSD__) && __FreeBSD_version >= 1200061)
  397|       |    return getrandom(buf, buflen, 0);
  398|       |#  elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
  399|       |    return sysctl_random(buf, buflen);
  400|       |#  elif defined(__wasi__)
  401|       |    if (getentropy(buf, buflen) == 0)
  402|       |      return (ssize_t)buflen;
  403|       |    return -1;
  404|       |#  else
  405|       |    errno = ENOSYS;
  406|       |    return -1;
  407|       |#  endif
  408|      1|}

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

