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

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

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

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

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

ossl_bio_core_globals_free:
   26|      2|{
   27|      2|    OPENSSL_free(vbcg);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   28|      2|}
ossl_bio_core_globals_new:
   31|      2|{
   32|      2|    return OPENSSL_zalloc(sizeof(BIO_CORE_GLOBALS));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   33|      2|}

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

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

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

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

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

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

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

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

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

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

ossl_load_builtin_compressions:
   29|      2|{
   30|      2|    STACK_OF(SSL_COMP) *comp_methods = NULL;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
   31|      2|#ifndef OPENSSL_NO_COMP
   32|      2|    SSL_COMP *comp = NULL;
   33|      2|    COMP_METHOD *method = COMP_zlib();
   34|       |
   35|      2|    comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
  ------------------
  |  |   69|      2|#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
  ------------------
   36|       |
   37|      2|    if (COMP_get_type(method) != NID_undef && comp_methods != NULL) {
  ------------------
  |  |   18|      4|#define NID_undef                       0
  ------------------
  |  Branch (37:9): [True: 0, False: 2]
  |  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|      2|#endif
   48|      2|    return comp_methods;
   49|      2|}
ossl_free_compression_methods_int:
   57|      2|{
   58|      2|    sk_SSL_COMP_pop_free(methods, cmeth_free);
  ------------------
  |  |   81|      2|#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_freefunc_type(freefunc))
  ------------------
   59|      2|}

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

CONF_modules_unload:
  517|      2|{
  518|      2|    int i;
  519|      2|    CONF_MODULE *md;
  520|      2|    STACK_OF(CONF_MODULE) *old_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  521|      2|    STACK_OF(CONF_MODULE) *new_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  522|      2|    STACK_OF(CONF_MODULE) *to_delete;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  523|       |
  524|      2|    if (!conf_modules_finish_int()) /* also inits module list lock */
  ------------------
  |  Branch (524:9): [True: 0, False: 2]
  ------------------
  525|      0|        return;
  526|       |
  527|      2|    ossl_rcu_write_lock(module_list_lock);
  528|       |
  529|      2|    old_modules = ossl_rcu_deref(&supported_modules);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  530|      2|    new_modules = sk_CONF_MODULE_dup(old_modules);
  531|       |
  532|      2|    if (new_modules == NULL) {
  ------------------
  |  Branch (532:9): [True: 0, False: 2]
  ------------------
  533|      0|        ossl_rcu_write_unlock(module_list_lock);
  534|      0|        return;
  535|      0|    }
  536|       |
  537|      2|    to_delete = sk_CONF_MODULE_new_null();
  538|       |
  539|       |    /* unload modules in reverse order */
  540|      2|    for (i = sk_CONF_MODULE_num(new_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (540:51): [True: 0, False: 2]
  ------------------
  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|      2|    if (sk_CONF_MODULE_num(new_modules) == 0) {
  ------------------
  |  Branch (550:9): [True: 2, False: 0]
  ------------------
  551|      2|        sk_CONF_MODULE_free(new_modules);
  552|      2|        new_modules = NULL;
  553|      2|    }
  554|       |
  555|      2|    ossl_rcu_assign_ptr(&supported_modules, &new_modules);
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  556|      2|    ossl_rcu_write_unlock(module_list_lock);
  557|      2|    ossl_synchronize_rcu(module_list_lock);
  558|      2|    sk_CONF_MODULE_free(old_modules);
  559|      2|    sk_CONF_MODULE_pop_free(to_delete, module_free);
  560|       |
  561|      2|}
ossl_config_modules_free:
  632|      2|{
  633|      2|    CONF_modules_unload(1); /* calls CONF_modules_finish */
  634|      2|    module_lists_free();
  635|      2|}
conf_mod.c:do_init_module_list_lock:
  101|      2|{
  102|      2|    module_list_lock = ossl_rcu_lock_new(1, NULL);
  103|      2|    if (module_list_lock == NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  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|      2|    return 1;
  109|      2|}
conf_mod.c:conf_modules_finish_int:
  574|      2|{
  575|      2|    CONF_IMODULE *imod;
  576|      2|    STACK_OF(CONF_IMODULE) *old_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  577|      2|    STACK_OF(CONF_IMODULE) *new_modules = NULL;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  578|       |
  579|      2|    if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (579:9): [True: 0, False: 2]
  ------------------
  580|      0|        return 0;
  581|       |
  582|       |    /* If module_list_lock is NULL here it means we were already unloaded */
  583|      2|    if (module_list_lock == NULL)
  ------------------
  |  Branch (583:9): [True: 0, False: 2]
  ------------------
  584|      0|        return 0;
  585|       |
  586|      2|    ossl_rcu_write_lock(module_list_lock);
  587|      2|    old_modules = ossl_rcu_deref(&initialized_modules);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  588|      2|    ossl_rcu_assign_ptr(&initialized_modules, &new_modules);
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  589|      2|    ossl_rcu_write_unlock(module_list_lock);
  590|      2|    ossl_synchronize_rcu(module_list_lock);
  591|       |
  592|      2|    while (sk_CONF_IMODULE_num(old_modules) > 0) {
  ------------------
  |  Branch (592:12): [True: 0, False: 2]
  ------------------
  593|      0|        imod = sk_CONF_IMODULE_pop(old_modules);
  594|      0|        module_finish(imod);
  595|      0|    }
  596|      2|    sk_CONF_IMODULE_free(old_modules);
  597|       |
  598|      2|    return 1;
  599|      2|}
conf_mod.c:module_lists_free:
   89|      2|{
   90|      2|    ossl_rcu_lock_free(module_list_lock);
   91|      2|    module_list_lock = NULL;
   92|       |
   93|      2|    sk_CONF_MODULE_free(supported_modules);
   94|      2|    supported_modules = NULL;
   95|       |
   96|      2|    sk_CONF_IMODULE_free(initialized_modules);
   97|      2|    initialized_modules = NULL;
   98|      2|}

ossl_lib_ctx_default_deinit:
  412|      2|{
  413|      2|    if (!default_context_inited)
  ------------------
  |  Branch (413:9): [True: 0, False: 2]
  ------------------
  414|      0|        return;
  415|      2|    context_deinit(&default_context_int);
  416|      2|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  417|      2|    default_context_inited = 0;
  418|      2|}
ossl_lib_ctx_get_concrete:
  543|     39|{
  544|     39|#ifndef FIPS_MODULE
  545|     39|    if (ctx == NULL)
  ------------------
  |  Branch (545:9): [True: 4, False: 35]
  ------------------
  546|      4|        return get_default_context();
  547|     35|#endif
  548|     35|    return ctx;
  549|     39|}
ossl_lib_ctx_get_data:
  570|     16|{
  571|     16|    ctx = ossl_lib_ctx_get_concrete(ctx);
  572|     16|    if (ctx == NULL)
  ------------------
  |  Branch (572:9): [True: 0, False: 16]
  ------------------
  573|      0|        return NULL;
  574|       |
  575|     16|    switch (index) {
  576|     16|    case OSSL_LIB_CTX_PROPERTY_STRING_INDEX:
  ------------------
  |  |  101|     16|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  |  Branch (576:5): [True: 16, False: 0]
  ------------------
  577|     16|        return ctx->property_string_data;
  578|      0|    case OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX:
  ------------------
  |  |   98|      0|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
  |  Branch (578:5): [True: 0, False: 16]
  ------------------
  579|      0|        return ctx->evp_method_store;
  580|      0|    case OSSL_LIB_CTX_PROVIDER_STORE_INDEX:
  ------------------
  |  |   99|      0|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  |  Branch (580:5): [True: 0, False: 16]
  ------------------
  581|      0|        return ctx->provider_store;
  582|      0|    case OSSL_LIB_CTX_NAMEMAP_INDEX:
  ------------------
  |  |  102|      0|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  |  Branch (582:5): [True: 0, False: 16]
  ------------------
  583|      0|        return ctx->namemap;
  584|      0|    case OSSL_LIB_CTX_PROPERTY_DEFN_INDEX:
  ------------------
  |  |  100|      0|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
  |  Branch (584:5): [True: 0, False: 16]
  ------------------
  585|      0|        return ctx->property_defns;
  586|      0|    case OSSL_LIB_CTX_GLOBAL_PROPERTIES:
  ------------------
  |  |  114|      0|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  |  Branch (586:5): [True: 0, False: 16]
  ------------------
  587|      0|        return ctx->global_properties;
  588|      0|    case OSSL_LIB_CTX_DRBG_INDEX:
  ------------------
  |  |  103|      0|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  |  Branch (588:5): [True: 0, False: 16]
  ------------------
  589|      0|        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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  600|      0|        return ctx->decoder_store;
  601|      0|    case OSSL_LIB_CTX_DECODER_CACHE_INDEX:
  ------------------
  |  |  120|      0|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  |  Branch (601:5): [True: 0, False: 16]
  ------------------
  602|      0|        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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  626|      0|        return (void *)&ctx->comp_methods;
  627|       |
  628|      0|    default:
  ------------------
  |  Branch (628:5): [True: 0, False: 16]
  ------------------
  629|      0|        return NULL;
  630|     16|    }
  631|     16|}
ossl_lib_ctx_get_ex_data_global:
  639|      4|{
  640|      4|    ctx = ossl_lib_ctx_get_concrete(ctx);
  641|      4|    if (ctx == NULL)
  ------------------
  |  Branch (641:9): [True: 0, False: 4]
  ------------------
  642|      0|        return NULL;
  643|      4|    return &ctx->global;
  644|      4|}
ossl_lib_ctx_get_rcukey:
  660|     13|{
  661|     13|    libctx = ossl_lib_ctx_get_concrete(libctx);
  662|     13|    if (libctx == NULL)
  ------------------
  |  Branch (662:9): [True: 0, False: 13]
  ------------------
  663|      0|        return NULL;
  664|     13|    return &libctx->rcu_local_key;
  665|     13|}
context.c:context_deinit:
  370|      2|{
  371|      2|    if (ctx == NULL)
  ------------------
  |  Branch (371:9): [True: 0, False: 2]
  ------------------
  372|      0|        return 1;
  373|       |
  374|      2|    ossl_ctx_thread_stop(ctx);
  375|       |
  376|      2|    context_deinit_objs(ctx);
  377|       |
  378|      2|    ossl_crypto_cleanup_all_ex_data_int(ctx);
  379|       |
  380|      2|    CRYPTO_THREAD_lock_free(ctx->lock);
  381|      2|    ctx->lock = NULL;
  382|      2|    CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key);
  383|      2|    return 1;
  384|      2|}
context.c:context_deinit_objs:
  235|      2|{
  236|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  237|      2|    if (ctx->evp_method_store != NULL) {
  ------------------
  |  Branch (237:9): [True: 2, False: 0]
  ------------------
  238|      2|        ossl_method_store_free(ctx->evp_method_store);
  239|      2|        ctx->evp_method_store = NULL;
  240|      2|    }
  241|       |
  242|       |    /* P2. */
  243|      2|    if (ctx->drbg != NULL) {
  ------------------
  |  Branch (243:9): [True: 2, False: 0]
  ------------------
  244|      2|        ossl_rand_ctx_free(ctx->drbg);
  245|      2|        ctx->drbg = NULL;
  246|      2|    }
  247|       |
  248|      2|#ifndef FIPS_MODULE
  249|       |    /* P2. */
  250|      2|    if (ctx->provider_conf != NULL) {
  ------------------
  |  Branch (250:9): [True: 2, False: 0]
  ------------------
  251|      2|        ossl_prov_conf_ctx_free(ctx->provider_conf);
  252|      2|        ctx->provider_conf = NULL;
  253|      2|    }
  254|       |
  255|       |    /*
  256|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  257|       |     * provider store
  258|       |     */
  259|      2|    if (ctx->decoder_store != NULL) {
  ------------------
  |  Branch (259:9): [True: 2, False: 0]
  ------------------
  260|      2|        ossl_method_store_free(ctx->decoder_store);
  261|      2|        ctx->decoder_store = NULL;
  262|      2|    }
  263|      2|    if (ctx->decoder_cache != NULL) {
  ------------------
  |  Branch (263:9): [True: 2, False: 0]
  ------------------
  264|      2|        ossl_decoder_cache_free(ctx->decoder_cache);
  265|      2|        ctx->decoder_cache = NULL;
  266|      2|    }
  267|       |
  268|       |
  269|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  270|      2|    if (ctx->encoder_store != NULL) {
  ------------------
  |  Branch (270:9): [True: 2, False: 0]
  ------------------
  271|      2|        ossl_method_store_free(ctx->encoder_store);
  272|      2|        ctx->encoder_store = NULL;
  273|      2|    }
  274|       |
  275|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  276|      2|    if (ctx->store_loader_store != NULL) {
  ------------------
  |  Branch (276:9): [True: 2, False: 0]
  ------------------
  277|      2|        ossl_method_store_free(ctx->store_loader_store);
  278|      2|        ctx->store_loader_store = NULL;
  279|      2|    }
  280|      2|#endif
  281|       |
  282|       |    /* P1. Needs to be freed before the child provider data is freed */
  283|      2|    if (ctx->provider_store != NULL) {
  ------------------
  |  Branch (283:9): [True: 2, False: 0]
  ------------------
  284|      2|        ossl_provider_store_free(ctx->provider_store);
  285|      2|        ctx->provider_store = NULL;
  286|      2|    }
  287|       |
  288|       |    /* Default priority. */
  289|      2|    if (ctx->property_string_data != NULL) {
  ------------------
  |  Branch (289:9): [True: 2, False: 0]
  ------------------
  290|      2|        ossl_property_string_data_free(ctx->property_string_data);
  291|      2|        ctx->property_string_data = NULL;
  292|      2|    }
  293|       |
  294|      2|    if (ctx->namemap != NULL) {
  ------------------
  |  Branch (294:9): [True: 2, False: 0]
  ------------------
  295|      2|        ossl_stored_namemap_free(ctx->namemap);
  296|      2|        ctx->namemap = NULL;
  297|      2|    }
  298|       |
  299|      2|    if (ctx->property_defns != NULL) {
  ------------------
  |  Branch (299:9): [True: 2, False: 0]
  ------------------
  300|      2|        ossl_property_defns_free(ctx->property_defns);
  301|      2|        ctx->property_defns = NULL;
  302|      2|    }
  303|       |
  304|      2|    if (ctx->global_properties != NULL) {
  ------------------
  |  Branch (304:9): [True: 2, False: 0]
  ------------------
  305|      2|        ossl_ctx_global_properties_free(ctx->global_properties);
  306|      2|        ctx->global_properties = NULL;
  307|      2|    }
  308|       |
  309|      2|#ifndef FIPS_MODULE
  310|      2|    if (ctx->bio_core != NULL) {
  ------------------
  |  Branch (310:9): [True: 2, False: 0]
  ------------------
  311|      2|        ossl_bio_core_globals_free(ctx->bio_core);
  312|      2|        ctx->bio_core = NULL;
  313|      2|    }
  314|      2|#endif
  315|       |
  316|      2|    if (ctx->drbg_nonce != NULL) {
  ------------------
  |  Branch (316:9): [True: 2, False: 0]
  ------------------
  317|      2|        ossl_prov_drbg_nonce_ctx_free(ctx->drbg_nonce);
  318|      2|        ctx->drbg_nonce = NULL;
  319|      2|    }
  320|       |
  321|      2|#ifndef FIPS_MODULE
  322|      2|    if (ctx->indicator_cb != NULL) {
  ------------------
  |  Branch (322:9): [True: 2, False: 0]
  ------------------
  323|      2|        ossl_indicator_set_callback_free(ctx->indicator_cb);
  324|      2|        ctx->indicator_cb = NULL;
  325|      2|    }
  326|       |
  327|      2|    if (ctx->self_test_cb != NULL) {
  ------------------
  |  Branch (327:9): [True: 2, False: 0]
  ------------------
  328|      2|        ossl_self_test_set_callback_free(ctx->self_test_cb);
  329|      2|        ctx->self_test_cb = NULL;
  330|      2|    }
  331|      2|#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|      2|#ifndef OPENSSL_NO_THREAD_POOL
  346|      2|    if (ctx->threads != NULL) {
  ------------------
  |  Branch (346:9): [True: 2, False: 0]
  ------------------
  347|      2|        ossl_threads_ctx_free(ctx->threads);
  348|      2|        ctx->threads = NULL;
  349|      2|    }
  350|      2|#endif
  351|       |
  352|       |    /* Low priority. */
  353|      2|#ifndef FIPS_MODULE
  354|      2|    if (ctx->child_provider != NULL) {
  ------------------
  |  Branch (354:9): [True: 2, False: 0]
  ------------------
  355|      2|        ossl_child_prov_ctx_free(ctx->child_provider);
  356|      2|        ctx->child_provider = NULL;
  357|      2|    }
  358|      2|#endif
  359|       |
  360|      2|#ifndef FIPS_MODULE
  361|      2|    if (ctx->comp_methods != NULL) {
  ------------------
  |  Branch (361:9): [True: 2, False: 0]
  ------------------
  362|      2|        ossl_free_compression_methods_int(ctx->comp_methods);
  363|      2|        ctx->comp_methods = NULL;
  364|      2|    }
  365|      2|#endif
  366|       |
  367|      2|}
context.c:context_init:
   92|      2|{
   93|      2|    int exdata_done = 0;
   94|       |
   95|      2|    if (!CRYPTO_THREAD_init_local(&ctx->rcu_local_key, NULL))
  ------------------
  |  Branch (95:9): [True: 0, False: 2]
  ------------------
   96|      0|        return 0;
   97|       |
   98|      2|    ctx->lock = CRYPTO_THREAD_lock_new();
   99|      2|    if (ctx->lock == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 2]
  ------------------
  100|      0|        goto err;
  101|       |
  102|       |    /* Initialize ex_data. */
  103|      2|    if (!ossl_do_ex_data_init(ctx))
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        goto err;
  105|      2|    exdata_done = 1;
  106|       |
  107|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  108|      2|    ctx->evp_method_store = ossl_method_store_new(ctx);
  109|      2|    if (ctx->evp_method_store == NULL)
  ------------------
  |  Branch (109:9): [True: 0, False: 2]
  ------------------
  110|      0|        goto err;
  111|      2|    OSSL_TRACE1(QUERY, "context_init: allocating store %p\n", ctx->evp_method_store);
  ------------------
  |  |  291|      2|    OSSL_TRACEV(category, (trc_out, format, arg1))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  112|       |
  113|      2|#ifndef FIPS_MODULE
  114|       |    /* P2. Must be freed before the provider store is freed */
  115|      2|    ctx->provider_conf = ossl_prov_conf_ctx_new(ctx);
  116|      2|    if (ctx->provider_conf == NULL)
  ------------------
  |  Branch (116:9): [True: 0, False: 2]
  ------------------
  117|      0|        goto err;
  118|      2|#endif
  119|       |
  120|       |    /* P2. */
  121|      2|    ctx->drbg = ossl_rand_ctx_new(ctx);
  122|      2|    if (ctx->drbg == NULL)
  ------------------
  |  Branch (122:9): [True: 0, False: 2]
  ------------------
  123|      0|        goto err;
  124|       |
  125|      2|#ifndef FIPS_MODULE
  126|       |    /*
  127|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  128|       |     * provider store
  129|       |     */
  130|      2|    ctx->decoder_store = ossl_method_store_new(ctx);
  131|      2|    if (ctx->decoder_store == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 2]
  ------------------
  132|      0|        goto err;
  133|      2|    ctx->decoder_cache = ossl_decoder_cache_new(ctx);
  134|      2|    if (ctx->decoder_cache == NULL)
  ------------------
  |  Branch (134:9): [True: 0, False: 2]
  ------------------
  135|      0|        goto err;
  136|       |
  137|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  138|      2|    ctx->encoder_store = ossl_method_store_new(ctx);
  139|      2|    if (ctx->encoder_store == NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 2]
  ------------------
  140|      0|        goto err;
  141|       |
  142|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  143|      2|    ctx->store_loader_store = ossl_method_store_new(ctx);
  144|      2|    if (ctx->store_loader_store == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 2]
  ------------------
  145|      0|        goto err;
  146|      2|#endif
  147|       |
  148|       |    /* P1. Needs to be freed before the child provider data is freed */
  149|      2|    ctx->provider_store = ossl_provider_store_new(ctx);
  150|      2|    if (ctx->provider_store == NULL)
  ------------------
  |  Branch (150:9): [True: 0, False: 2]
  ------------------
  151|      0|        goto err;
  152|       |
  153|       |    /* Default priority. */
  154|      2|    ctx->property_string_data = ossl_property_string_data_new(ctx);
  155|      2|    if (ctx->property_string_data == NULL)
  ------------------
  |  Branch (155:9): [True: 0, False: 2]
  ------------------
  156|      0|        goto err;
  157|       |
  158|      2|    ctx->namemap = ossl_stored_namemap_new(ctx);
  159|      2|    if (ctx->namemap == NULL)
  ------------------
  |  Branch (159:9): [True: 0, False: 2]
  ------------------
  160|      0|        goto err;
  161|       |
  162|      2|    ctx->property_defns = ossl_property_defns_new(ctx);
  163|      2|    if (ctx->property_defns == NULL)
  ------------------
  |  Branch (163:9): [True: 0, False: 2]
  ------------------
  164|      0|        goto err;
  165|       |
  166|      2|    ctx->global_properties = ossl_ctx_global_properties_new(ctx);
  167|      2|    if (ctx->global_properties == NULL)
  ------------------
  |  Branch (167:9): [True: 0, False: 2]
  ------------------
  168|      0|        goto err;
  169|       |
  170|      2|#ifndef FIPS_MODULE
  171|      2|    ctx->bio_core = ossl_bio_core_globals_new(ctx);
  172|      2|    if (ctx->bio_core == NULL)
  ------------------
  |  Branch (172:9): [True: 0, False: 2]
  ------------------
  173|      0|        goto err;
  174|      2|#endif
  175|       |
  176|      2|    ctx->drbg_nonce = ossl_prov_drbg_nonce_ctx_new(ctx);
  177|      2|    if (ctx->drbg_nonce == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        goto err;
  179|       |
  180|      2|#ifndef FIPS_MODULE
  181|      2|    ctx->self_test_cb = ossl_self_test_set_callback_new(ctx);
  182|      2|    if (ctx->self_test_cb == NULL)
  ------------------
  |  Branch (182:9): [True: 0, False: 2]
  ------------------
  183|      0|        goto err;
  184|      2|    ctx->indicator_cb = ossl_indicator_set_callback_new(ctx);
  185|      2|    if (ctx->indicator_cb == NULL)
  ------------------
  |  Branch (185:9): [True: 0, False: 2]
  ------------------
  186|      0|        goto err;
  187|      2|#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|      2|#ifndef OPENSSL_NO_THREAD_POOL
  200|      2|    ctx->threads = ossl_threads_ctx_new(ctx);
  201|      2|    if (ctx->threads == NULL)
  ------------------
  |  Branch (201:9): [True: 0, False: 2]
  ------------------
  202|      0|        goto err;
  203|      2|#endif
  204|       |
  205|       |    /* Low priority. */
  206|      2|#ifndef FIPS_MODULE
  207|      2|    ctx->child_provider = ossl_child_prov_ctx_new(ctx);
  208|      2|    if (ctx->child_provider == NULL)
  ------------------
  |  Branch (208:9): [True: 0, False: 2]
  ------------------
  209|      0|        goto err;
  210|      2|#endif
  211|       |
  212|       |    /* Everything depends on properties, so we also pre-initialise that */
  213|      2|    if (!ossl_property_parse_init(ctx))
  ------------------
  |  Branch (213:9): [True: 0, False: 2]
  ------------------
  214|      0|        goto err;
  215|       |
  216|      2|#ifndef FIPS_MODULE
  217|      2|    ctx->comp_methods = ossl_load_builtin_compressions();
  218|      2|#endif
  219|       |
  220|      2|    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|      2|}
context.c:default_context_do_init:
  395|      2|{
  396|      2|    if (!CRYPTO_THREAD_init_local(&default_context_thread_local, NULL))
  ------------------
  |  Branch (396:9): [True: 0, False: 2]
  ------------------
  397|      0|        goto err;
  398|       |
  399|      2|    if (!context_init(&default_context_int))
  ------------------
  |  Branch (399:9): [True: 0, False: 2]
  ------------------
  400|      0|        goto deinit_thread;
  401|       |
  402|      2|    default_context_inited = 1;
  403|      2|    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|      4|{
  430|      4|    OSSL_LIB_CTX *current_defctx = get_thread_default_context();
  431|       |
  432|      4|    if (current_defctx == NULL && default_context_inited)
  ------------------
  |  Branch (432:9): [True: 4, False: 0]
  |  Branch (432:35): [True: 4, False: 0]
  ------------------
  433|      4|        current_defctx = &default_context_int;
  434|      4|    return current_defctx;
  435|      4|}
context.c:get_thread_default_context:
  421|      4|{
  422|      4|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|      4|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (422:9): [True: 0, False: 4]
  ------------------
  423|      0|        return NULL;
  424|       |
  425|      4|    return CRYPTO_THREAD_get_local(&default_context_thread_local);
  426|      4|}

ossl_stored_namemap_new:
   56|      2|{
   57|      2|    OSSL_NAMEMAP *namemap = ossl_namemap_new(libctx);
   58|       |
   59|      2|    if (namemap != NULL)
  ------------------
  |  Branch (59:9): [True: 2, False: 0]
  ------------------
   60|      2|        namemap->stored = 1;
   61|       |
   62|      2|    return namemap;
   63|      2|}
ossl_stored_namemap_free:
   66|      2|{
   67|      2|    OSSL_NAMEMAP *namemap = vnamemap;
   68|       |
   69|      2|    if (namemap != NULL) {
  ------------------
  |  Branch (69:9): [True: 2, False: 0]
  ------------------
   70|       |        /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
   71|      2|        namemap->stored = 0;
   72|      2|        ossl_namemap_free(namemap);
   73|      2|    }
   74|      2|}
ossl_namemap_new:
  522|      2|{
  523|      2|    OSSL_NAMEMAP *namemap;
  524|      2|    HT_CONFIG htconf = { NULL, NULL, NULL, NAMEMAP_HT_BUCKETS, 1, 1 };
  ------------------
  |  |   16|      2|#define NAMEMAP_HT_BUCKETS 2048
  ------------------
  525|       |
  526|      2|    htconf.ctx = libctx;
  527|       |
  528|      2|    if ((namemap = OPENSSL_zalloc(sizeof(*namemap))) == NULL)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  |  Branch (528:9): [True: 0, False: 2]
  ------------------
  529|      0|        goto err;
  530|       |
  531|      2|    if ((namemap->lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (531:9): [True: 0, False: 2]
  ------------------
  532|      0|        goto err;
  533|       |
  534|      2|    if ((namemap->namenum_ht = ossl_ht_new(&htconf)) == NULL)
  ------------------
  |  Branch (534:9): [True: 0, False: 2]
  ------------------
  535|      0|        goto err;
  536|       |
  537|      2|    if ((namemap->numnames = sk_NAMES_new_null()) == NULL)
  ------------------
  |  Branch (537:9): [True: 0, False: 2]
  ------------------
  538|      0|        goto err;
  539|       |
  540|      2|    return namemap;
  541|       |
  542|      0| err:
  543|      0|    ossl_namemap_free(namemap);
  544|      0|    return NULL;
  545|      2|}
ossl_namemap_free:
  548|      2|{
  549|      2|    if (namemap == NULL || namemap->stored)
  ------------------
  |  Branch (549:9): [True: 0, False: 2]
  |  Branch (549:28): [True: 0, False: 2]
  ------------------
  550|      0|        return;
  551|       |
  552|      2|    sk_NAMES_pop_free(namemap->numnames, names_free);
  553|       |
  554|      2|    ossl_ht_free(namemap->namenum_ht);
  555|       |
  556|      2|    CRYPTO_THREAD_lock_free(namemap->lock);
  557|      2|    OPENSSL_free(namemap);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  558|      2|}

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

OPENSSL_cpuid_setup:
   96|      2|{
   97|      2|    static int trigger = 0;
   98|      2|    IA32CAP OPENSSL_ia32_cpuid(unsigned int *);
   99|      2|    IA32CAP vec;
  100|      2|    const variant_char *env;
  101|      2|    int index = 2;
  102|       |
  103|      2|    if (trigger)
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        return;
  105|       |
  106|      2|    trigger = 1;
  107|      2|    if ((env = ossl_getenv("OPENSSL_ia32cap")) != NULL) {
  ------------------
  |  |   47|      2|#   define ossl_getenv getenv
  ------------------
  |  Branch (107:9): [True: 0, False: 2]
  ------------------
  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|      2|    } else {
  162|      2|        vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
  163|      2|    }
  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|      2|    OPENSSL_ia32cap_P[0] = (unsigned int)vec | (1 << 10);
  171|      2|    OPENSSL_ia32cap_P[1] = (unsigned int)(vec >> 32);
  172|      2|}

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

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

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

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

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

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

ossl_decoder_cache_new:
  703|      2|{
  704|      2|    DECODER_CACHE *cache = OPENSSL_malloc(sizeof(*cache));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  705|       |
  706|      2|    if (cache == NULL)
  ------------------
  |  Branch (706:9): [True: 0, False: 2]
  ------------------
  707|      0|        return NULL;
  708|       |
  709|      2|    cache->lock = CRYPTO_THREAD_lock_new();
  710|      2|    if (cache->lock == NULL) {
  ------------------
  |  Branch (710:9): [True: 0, False: 2]
  ------------------
  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|      2|    cache->hashtable = lh_DECODER_CACHE_ENTRY_new(decoder_cache_entry_hash,
  715|      2|                                                  decoder_cache_entry_cmp);
  716|      2|    if (cache->hashtable == NULL) {
  ------------------
  |  Branch (716:9): [True: 0, False: 2]
  ------------------
  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|      2|    return cache;
  723|      2|}
ossl_decoder_cache_free:
  726|      2|{
  727|      2|    DECODER_CACHE *cache = (DECODER_CACHE *)vcache;
  728|       |
  729|      2|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  730|      2|    lh_DECODER_CACHE_ENTRY_free(cache->hashtable);
  731|      2|    CRYPTO_THREAD_lock_free(cache->lock);
  732|      2|    OPENSSL_free(cache);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  733|      2|}

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

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

OSSL_ERR_STATE_free:
  202|      2|{
  203|      2|    int i;
  204|       |
  205|      2|    if (state == NULL)
  ------------------
  |  Branch (205:9): [True: 0, False: 2]
  ------------------
  206|      0|        return;
  207|     34|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|     34|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (207:17): [True: 32, False: 2]
  ------------------
  208|     32|        err_clear(state, i, 1);
  209|     32|    }
  210|      2|    CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  ------------------
                  CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  ------------------
  211|      2|}
err_cleanup:
  233|      2|{
  234|      2|    if (set_err_thread_local != 0)
  ------------------
  |  Branch (234:9): [True: 2, False: 0]
  ------------------
  235|      2|        CRYPTO_THREAD_cleanup_local(&err_thread_local);
  236|      2|    CRYPTO_THREAD_lock_free(err_string_lock);
  237|      2|    err_string_lock = NULL;
  238|      2|#ifndef OPENSSL_NO_ERR
  239|      2|    lh_ERR_STRING_DATA_free(int_error_hash);
  ------------------
  |  |  376|      2|#define lh_ERR_STRING_DATA_free(lh) OPENSSL_LH_free(ossl_check_ERR_STRING_DATA_lh_type(lh))
  ------------------
  240|      2|    int_error_hash = NULL;
  241|      2|#endif
  242|      2|}
ossl_err_load_ERR_strings:
  272|     70|{
  273|     70|#ifndef OPENSSL_NO_ERR
  274|     70|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|     70|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 70, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (274:9): [True: 0, False: 70]
  ------------------
  275|      0|        return 0;
  276|       |
  277|     70|    err_load_strings(ERR_str_libraries);
  278|     70|    err_load_strings(ERR_str_reasons);
  279|     70|#endif
  280|     70|    return 1;
  281|     70|}
ERR_load_strings_const:
  297|     68|{
  298|     68|#ifndef OPENSSL_NO_ERR
  299|     68|    if (ossl_err_load_ERR_strings() == 0)
  ------------------
  |  Branch (299:9): [True: 0, False: 68]
  ------------------
  300|      0|        return 0;
  301|     68|    err_load_strings(str);
  302|     68|#endif
  303|       |
  304|     68|    return 1;
  305|     68|}
ERR_clear_error:
  335|      2|{
  336|      2|    int i;
  337|      2|    ERR_STATE *es;
  338|       |
  339|      2|    es = ossl_err_get_state_int();
  340|      2|    if (es == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 2]
  ------------------
  341|      0|        return;
  342|       |
  343|     34|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|     34|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (343:17): [True: 32, False: 2]
  ------------------
  344|     32|        err_clear(es, i, 0);
  345|     32|    }
  346|      2|    es->top = es->bottom = 0;
  347|      2|}
ERR_reason_error_string:
  613|     68|{
  614|     68|#ifndef OPENSSL_NO_ERR
  615|     68|    ERR_STRING_DATA d, *p = NULL;
  616|     68|    unsigned long l, r;
  617|       |
  618|     68|    if (!RUN_ONCE(&err_string_init, do_err_strings_init)) {
  ------------------
  |  |  130|     68|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 68, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (618:9): [True: 0, False: 68]
  ------------------
  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|     68|    if (ERR_SYSTEM_ERROR(e))
  ------------------
  |  |  239|     68|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     68|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 68]
  |  |  ------------------
  ------------------
  628|      0|        return NULL;
  629|       |
  630|     68|    l = ERR_GET_LIB(e);
  631|     68|    r = ERR_GET_REASON(e);
  632|     68|    d.error = ERR_PACK(l, 0, r);
  ------------------
  |  |  279|     68|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     68|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     68|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     68|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     68|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  633|     68|    p = int_err_get_item(&d);
  634|     68|    if (p == NULL) {
  ------------------
  |  Branch (634:9): [True: 68, False: 0]
  ------------------
  635|     68|        d.error = ERR_PACK(0, 0, r);
  ------------------
  |  |  279|     68|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     68|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     68|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     68|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     68|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  636|     68|        p = int_err_get_item(&d);
  637|     68|    }
  638|     68|    return ((p == NULL) ? NULL : p->string);
  ------------------
  |  Branch (638:13): [True: 68, False: 0]
  ------------------
  639|       |#else
  640|       |    return NULL;
  641|       |#endif
  642|     68|}
ossl_err_get_state_int:
  673|      2|{
  674|      2|    ERR_STATE *state;
  675|      2|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|      2|# define get_last_sys_error()    errno
  ------------------
  676|       |
  677|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (677:9): [True: 0, False: 2]
  ------------------
  678|      0|        return NULL;
  679|       |
  680|      2|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (680:9): [True: 0, False: 2]
  ------------------
  681|      0|        return NULL;
  682|       |
  683|      2|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  684|      2|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (684:9): [True: 0, False: 2]
  ------------------
  685|      0|        return NULL;
  686|       |
  687|      2|    if (state == NULL) {
  ------------------
  |  Branch (687:9): [True: 2, False: 0]
  ------------------
  688|      2|        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (688:13): [True: 0, False: 2]
  ------------------
  689|      0|            return NULL;
  690|       |
  691|      2|        state = OSSL_ERR_STATE_new();
  692|      2|        if (state == NULL) {
  ------------------
  |  Branch (692:13): [True: 0, False: 2]
  ------------------
  693|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  694|      0|            return NULL;
  695|      0|        }
  696|       |
  697|      2|        if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state)
  ------------------
  |  Branch (697:13): [True: 0, False: 2]
  ------------------
  698|      2|                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  ------------------
  |  Branch (698:20): [True: 0, False: 2]
  ------------------
  699|      0|            OSSL_ERR_STATE_free(state);
  700|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  701|      0|            return NULL;
  702|      0|        }
  703|       |
  704|       |        /* Ignore failures from these */
  705|      2|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  706|      2|    }
  707|       |
  708|      2|    set_sys_error(saveerrno);
  ------------------
  |  |   32|      2|# define set_sys_error(e)        errno=(e)
  ------------------
  709|      2|    return state;
  710|      2|}
err_shelve_state:
  725|      2|{
  726|      2|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|      2|# define get_last_sys_error()    errno
  ------------------
  727|       |
  728|       |    /*
  729|       |     * Note, at present our only caller is OPENSSL_init_crypto(), indirectly
  730|       |     * via ossl_init_load_crypto_nodelete(), by which point the requested
  731|       |     * "base" initialization has already been performed, so the below call is a
  732|       |     * NOOP, that re-enters OPENSSL_init_crypto() only to quickly return.
  733|       |     *
  734|       |     * If are no other valid callers of this function, the call below can be
  735|       |     * removed, avoiding the re-entry into OPENSSL_init_crypto().  If there are
  736|       |     * potential uses that are not from inside OPENSSL_init_crypto(), then this
  737|       |     * call is needed, but some care is required to make sure that the re-entry
  738|       |     * remains a NOOP.
  739|       |     */
  740|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (740:9): [True: 0, False: 2]
  ------------------
  741|      0|        return 0;
  742|       |
  743|      2|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (743:9): [True: 0, False: 2]
  ------------------
  744|      0|        return 0;
  745|       |
  746|      2|    *state = CRYPTO_THREAD_get_local(&err_thread_local);
  747|      2|    if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (747:9): [True: 0, False: 2]
  ------------------
  748|      0|        return 0;
  749|       |
  750|      2|    set_sys_error(saveerrno);
  ------------------
  |  |   32|      2|# define set_sys_error(e)        errno=(e)
  ------------------
  751|      2|    return 1;
  752|      2|}
err_unshelve_state:
  759|      2|{
  760|      2|    if (state != (void*)-1)
  ------------------
  |  Branch (760:9): [True: 2, False: 0]
  ------------------
  761|      2|        CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)state);
  762|      2|}
err.c:do_err_strings_init:
  214|      2|{
  215|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (215:9): [True: 0, False: 2]
  ------------------
  216|      0|        return 0;
  217|      2|    err_string_lock = CRYPTO_THREAD_lock_new();
  218|      2|    if (err_string_lock == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 2]
  ------------------
  219|      0|        return 0;
  220|      2|#ifndef OPENSSL_NO_ERR
  221|      2|    int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
  ------------------
  |  |  375|      2|#define lh_ERR_STRING_DATA_new(hfn, cmp) ((LHASH_OF(ERR_STRING_DATA) *)OPENSSL_LH_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|      2|                                            err_string_data_cmp);
  223|      2|    if (int_error_hash == NULL) {
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        CRYPTO_THREAD_lock_free(err_string_lock);
  225|      0|        err_string_lock = NULL;
  226|      0|        return 0;
  227|      0|    }
  228|      2|#endif
  229|      2|    return 1;
  230|      2|}
err.c:err_string_data_hash:
  172|  8.75k|{
  173|  8.75k|    unsigned long ret, l;
  174|       |
  175|  8.75k|    l = a->error;
  176|  8.75k|    ret = l ^ ERR_GET_LIB(l);
  177|  8.75k|    return (ret ^ ret % 19 * 13);
  178|  8.75k|}
err.c:err_string_data_cmp:
  182|  5.89k|{
  183|  5.89k|    if (a->error == b->error)
  ------------------
  |  Branch (183:9): [True: 5.57k, False: 316]
  ------------------
  184|  5.57k|        return 0;
  185|    316|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (185:12): [True: 168, False: 148]
  ------------------
  186|  5.89k|}
err.c:err_load_strings:
  260|    208|{
  261|    208|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (261:9): [True: 0, False: 208]
  ------------------
  262|      0|        return 0;
  263|  8.83k|    for (; str->error; str++)
  ------------------
  |  Branch (263:12): [True: 8.62k, False: 208]
  ------------------
  264|  8.62k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  ------------------
  |  |  378|  8.83k|#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|    208|                                       (ERR_STRING_DATA *)str);
  266|    208|    CRYPTO_THREAD_unlock(err_string_lock);
  267|    208|    return 1;
  268|    208|}
err.c:int_err_get_item:
  189|    136|{
  190|    136|    ERR_STRING_DATA *p = NULL;
  191|       |
  192|    136|    if (!CRYPTO_THREAD_read_lock(err_string_lock))
  ------------------
  |  Branch (192:9): [True: 0, False: 136]
  ------------------
  193|      0|        return NULL;
  194|    136|    p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
  ------------------
  |  |  380|    136|#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|    136|    CRYPTO_THREAD_unlock(err_string_lock);
  196|       |
  197|    136|    return p;
  198|    136|}
err.c:err_do_init:
  667|      2|{
  668|      2|    set_err_thread_local = 1;
  669|      2|    return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
  670|      2|}
err.c:err_delete_thread_state:
  645|      2|{
  646|      2|    ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
  647|      2|    if (state == NULL)
  ------------------
  |  Branch (647:9): [True: 0, False: 2]
  ------------------
  648|      0|        return;
  649|       |
  650|      2|    CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  651|      2|    OSSL_ERR_STATE_free(state);
  652|      2|}

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

err.c:err_clear:
   85|     64|{
   86|     64|    err_clear_data(es, i, (deall));
   87|     64|    es->err_marks[i] = 0;
   88|     64|    es->err_flags[i] = 0;
   89|     64|    es->err_buffer[i] = 0;
   90|     64|    es->err_line[i] = -1;
   91|     64|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|     64|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     64|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     64|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|     64|    es->err_file[i] = NULL;
   93|     64|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|     64|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     64|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     64|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|     64|    es->err_func[i] = NULL;
   95|     64|}
err.c:err_clear_data:
   22|     64|{
   23|     64|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|     64|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 0, False: 64]
  ------------------
   24|      0|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   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|      0|        } 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|     64|    } else {
   34|     64|        es->err_data[i] = NULL;
   35|     64|        es->err_data_size[i] = 0;
   36|     64|        es->err_data_flags[i] = 0;
   37|     64|    }
   38|     64|}

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

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

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

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

EVP_RAND_CTX_free:
  386|      4|{
  387|      4|    int ref = 0;
  388|      4|    EVP_RAND_CTX *parent;
  389|       |
  390|      4|    if (ctx == NULL)
  ------------------
  |  Branch (390:9): [True: 4, False: 0]
  ------------------
  391|      4|        return;
  392|       |
  393|      0|    CRYPTO_DOWN_REF(&ctx->refcnt, &ref);
  394|      0|    if (ref > 0)
  ------------------
  |  Branch (394:9): [True: 0, False: 0]
  ------------------
  395|      0|        return;
  396|      0|    parent = ctx->parent;
  397|      0|    ctx->meth->freectx(ctx->algctx);
  398|      0|    ctx->algctx = NULL;
  399|      0|    EVP_RAND_free(ctx->meth);
  400|      0|    CRYPTO_FREE_REF(&ctx->refcnt);
  401|      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__
  |  |  ------------------
  ------------------
  402|      0|    EVP_RAND_CTX_free(parent);
  403|      0|}

evp_cleanup_int:
  180|      2|{
  181|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_KDF_METH);
  ------------------
  |  |   30|      2|# define OBJ_NAME_TYPE_KDF_METH          0x06
  ------------------
  182|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  183|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|      2|# 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|      2|    OBJ_NAME_cleanup(-1);
  190|       |
  191|      2|    EVP_PBE_cleanup();
  192|      2|    OBJ_sigid_free();
  193|       |
  194|      2|    evp_app_cleanup_int();
  195|      2|}

evp_app_cleanup_int:
  633|      2|{
  634|      2|    if (app_pkey_methods != NULL)
  ------------------
  |  Branch (634:9): [True: 0, False: 2]
  ------------------
  635|      0|        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
  636|      2|}

ossl_do_ex_data_init:
   15|      2|{
   16|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   17|       |
   18|      2|    if (global == NULL)
  ------------------
  |  Branch (18:9): [True: 0, False: 2]
  ------------------
   19|      0|        return 0;
   20|       |
   21|      2|    global->ex_data_lock = CRYPTO_THREAD_lock_new();
   22|      2|    return global->ex_data_lock != NULL;
   23|      2|}
ossl_crypto_cleanup_all_ex_data_int:
   73|      2|{
   74|      2|    int i;
   75|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   76|       |
   77|      2|    if (global == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 2]
  ------------------
   78|      0|        return;
   79|       |
   80|     38|    for (i = 0; i < CRYPTO_EX_INDEX__COUNT; ++i) {
  ------------------
  |  |  248|     38|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (80:17): [True: 36, False: 2]
  ------------------
   81|     36|        EX_CALLBACKS *ip = &global->ex_data[i];
   82|       |
   83|     36|        sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb);
   84|     36|        ip->meth = NULL;
   85|     36|    }
   86|       |
   87|      2|    CRYPTO_THREAD_lock_free(global->ex_data_lock);
   88|      2|    global->ex_data_lock = NULL;
   89|      2|}

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

ossl_ht_new:
  176|      4|{
  177|      4|    HT *new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  178|       |
  179|      4|    if (new == NULL)
  ------------------
  |  Branch (179:9): [True: 0, False: 4]
  ------------------
  180|      0|        return NULL;
  181|       |
  182|      4|    new->atomic_lock = CRYPTO_THREAD_lock_new();
  183|      4|    if (new->atomic_lock == NULL)
  ------------------
  |  Branch (183:9): [True: 0, False: 4]
  ------------------
  184|      0|        goto err;
  185|       |
  186|      4|    memcpy(&new->config, conf, sizeof(*conf));
  187|       |
  188|      4|    if (new->config.init_neighborhoods != 0) {
  ------------------
  |  Branch (188:9): [True: 2, False: 2]
  ------------------
  189|      2|        new->wpd.neighborhood_len = new->config.init_neighborhoods;
  190|       |        /* round up to the next power of 2 */
  191|      2|        new->wpd.neighborhood_len--;
  192|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 1;
  193|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 2;
  194|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 4;
  195|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 8;
  196|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 16;
  197|      2|        new->wpd.neighborhood_len++;
  198|      2|    } else {
  199|      2|        new->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  200|      2|    }
  201|       |
  202|      4|    if (new->config.ht_free_fn == NULL)
  ------------------
  |  Branch (202:9): [True: 2, False: 2]
  ------------------
  203|      2|        new->config.ht_free_fn = internal_free_nop;
  204|       |
  205|      4|    new->md = OPENSSL_zalloc(sizeof(*new->md));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  206|      4|    if (new->md == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 4]
  ------------------
  207|      0|        goto err;
  208|       |
  209|      4|    new->md->neighborhoods =
  210|      4|        alloc_new_neighborhood_list(new->wpd.neighborhood_len,
  211|      4|                                    &new->md->neighborhood_ptr_to_free);
  212|      4|    if (new->md->neighborhoods == NULL)
  ------------------
  |  Branch (212:9): [True: 0, False: 4]
  ------------------
  213|      0|        goto err;
  214|      4|    new->md->neighborhood_mask = new->wpd.neighborhood_len - 1;
  215|       |
  216|      4|    new->lock = ossl_rcu_lock_new(1, conf->ctx);
  217|      4|    if (new->lock == NULL)
  ------------------
  |  Branch (217:9): [True: 0, False: 4]
  ------------------
  218|      0|        goto err;
  219|       |
  220|      4|    if (new->config.ht_hash_fn == NULL)
  ------------------
  |  Branch (220:9): [True: 4, False: 0]
  ------------------
  221|      4|        new->config.ht_hash_fn = ossl_fnv1a_hash;
  222|       |
  223|      4|    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|      4|}
ossl_ht_read_lock:
  236|      6|{
  237|      6|    ossl_rcu_read_lock(htable->lock);
  238|      6|}
ossl_ht_read_unlock:
  241|      6|{
  242|      6|    ossl_rcu_read_unlock(htable->lock);
  243|      6|}
ossl_ht_write_lock:
  246|      4|{
  247|      4|    ossl_rcu_write_lock(htable->lock);
  248|      4|    htable->wpd.need_sync = 0;
  249|      4|}
ossl_ht_write_unlock:
  252|      4|{
  253|      4|    int need_sync = htable->wpd.need_sync;
  254|       |
  255|      4|    htable->wpd.need_sync = 0;
  256|      4|    ossl_rcu_write_unlock(htable->lock);
  257|      4|    if (need_sync)
  ------------------
  |  Branch (257:9): [True: 2, False: 2]
  ------------------
  258|      2|        ossl_synchronize_rcu(htable->lock);
  259|      4|}
ossl_ht_free:
  320|      2|{
  321|      2|    if (h == NULL)
  ------------------
  |  Branch (321:9): [True: 0, False: 2]
  ------------------
  322|      0|        return;
  323|       |
  324|      2|    ossl_ht_write_lock(h);
  325|      2|    ossl_ht_flush_internal(h);
  326|      2|    ossl_ht_write_unlock(h);
  327|       |    /* Freeing the lock does a final sync for us */
  328|      2|    CRYPTO_THREAD_lock_free(h->atomic_lock);
  329|      2|    ossl_rcu_lock_free(h->lock);
  330|      2|    OPENSSL_free(h->md->neighborhood_ptr_to_free);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  331|      2|    OPENSSL_free(h->md);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  332|      2|    OPENSSL_free(h);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  333|      2|    return;
  334|      2|}
ossl_ht_foreach_until:
  346|      3|{
  347|      3|    size_t i, j;
  348|      3|    struct ht_mutable_data_st *md;
  349|       |
  350|      3|    md = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      3|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  351|     51|    for (i = 0; i < md->neighborhood_mask + 1; i++) {
  ------------------
  |  Branch (351:17): [True: 48, False: 3]
  ------------------
  352|     48|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[i + 1]);
  ------------------
  |  |   83|     48|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  353|    240|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|    240|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|    240|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (353:21): [True: 192, False: 48]
  ------------------
  354|    192|            if (md->neighborhoods[i].entries[j].value != NULL) {
  ------------------
  |  Branch (354:17): [True: 4, False: 188]
  ------------------
  355|      4|                if (!cb((HT_VALUE *)md->neighborhoods[i].entries[j].value, arg))
  ------------------
  |  Branch (355:21): [True: 0, False: 4]
  ------------------
  356|      0|                    goto out;
  357|      4|            }
  358|    192|        }
  359|     48|    }
  360|      3|out:
  361|      3|    return;
  362|      3|}
ossl_ht_filter:
  367|      4|{
  368|      4|    struct ht_mutable_data_st *md;
  369|      4|    HT_VALUE_LIST *list = OPENSSL_zalloc(sizeof(HT_VALUE_LIST)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  370|      4|                                         + (sizeof(HT_VALUE *) * max_len));
  371|      4|    size_t i, j;
  372|      4|    struct ht_internal_value_st *v;
  373|       |
  374|      4|    if (list == NULL)
  ------------------
  |  Branch (374:9): [True: 0, False: 4]
  ------------------
  375|      0|        return NULL;
  376|       |
  377|       |    /*
  378|       |     * The list array lives just beyond the end of
  379|       |     * the struct
  380|       |     */
  381|      4|    list->list = (HT_VALUE **)(list + 1);
  382|       |
  383|      4|    md = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      4|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  384|     68|    for (i = 0; i < md->neighborhood_mask + 1; i++) {
  ------------------
  |  Branch (384:17): [True: 64, False: 4]
  ------------------
  385|     64|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[i+1]);
  ------------------
  |  |   83|     64|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  386|    320|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|    320|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|    320|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (386:21): [True: 256, False: 64]
  ------------------
  387|    256|            v = md->neighborhoods[i].entries[j].value;
  388|    256|            if (v != NULL && filter((HT_VALUE *)v, arg)) {
  ------------------
  |  Branch (388:17): [True: 4, False: 252]
  |  Branch (388:30): [True: 0, False: 4]
  ------------------
  389|      0|                list->list[list->list_len++] = (HT_VALUE *)v;
  390|      0|                if (list->list_len == max_len)
  ------------------
  |  Branch (390:21): [True: 0, False: 0]
  ------------------
  391|      0|                    goto out;
  392|      0|            }
  393|    256|        }
  394|     64|    }
  395|      4|out:
  396|      4|    return list;
  397|      4|}
ossl_ht_value_list_free:
  400|      4|{
  401|      4|    OPENSSL_free(list);
  ------------------
  |  |  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|}
ossl_ht_insert:
  629|      2|{
  630|      2|    struct ht_internal_value_st *newval = NULL;
  631|      2|    uint64_t hash;
  632|      2|    int rc = 0;
  633|      2|    int i;
  634|       |
  635|      2|    if (data->value == NULL)
  ------------------
  |  Branch (635:9): [True: 0, False: 2]
  ------------------
  636|      0|        goto out;
  637|       |
  638|      2|    newval = alloc_new_value(h, key, data->value, data->type_id);
  639|      2|    if (newval == NULL)
  ------------------
  |  Branch (639:9): [True: 0, False: 2]
  ------------------
  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|      2|    hash = h->config.ht_hash_fn(key->keybuf, key->keysize);
  647|       |
  648|      2|    for (i = 0;
  649|      2|         (rc = ossl_ht_insert_locked(h, hash, newval, olddata)) == -1
  ------------------
  |  Branch (649:10): [True: 0, False: 2]
  ------------------
  650|      2|         && i < 4;
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  ------------------
  651|      2|         ++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|      2|    if (rc <= 0)
  ------------------
  |  Branch (657:9): [True: 0, False: 2]
  ------------------
  658|      0|        free_value(newval);
  659|       |
  660|      2|out:
  661|      2|    return rc;
  662|      2|}
ossl_ht_get:
  665|      6|{
  666|      6|    struct ht_mutable_data_st *md;
  667|      6|    uint64_t hash;
  668|      6|    uint64_t neigh_idx_start;
  669|      6|    uint64_t neigh_idx;
  670|      6|    struct ht_internal_value_st *ival = NULL;
  671|      6|    size_t j;
  672|      6|    uint64_t ehash;
  673|      6|    int lockless_reads = h->config.lockless_reads;
  674|       |
  675|      6|    hash = h->config.ht_hash_fn(key->keybuf, key->keysize);
  676|       |
  677|      6|    md = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      6|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  678|      6|    neigh_idx = neigh_idx_start = hash & md->neighborhood_mask;
  679|      6|    do {
  680|      6|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[neigh_idx]);
  ------------------
  |  |   83|      6|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  681|     30|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|     30|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|     30|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (681:21): [True: 24, False: 6]
  ------------------
  682|     24|            ival = ossl_rcu_deref(&md->neighborhoods[neigh_idx].entries[j].value);
  ------------------
  |  |   30|     24|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  683|     24|            if (ival == NULL) {
  ------------------
  |  Branch (683:17): [True: 23, False: 1]
  ------------------
  684|     23|                if (lockless_reads)
  ------------------
  |  Branch (684:21): [True: 0, False: 23]
  ------------------
  685|       |                    /* lockless_reads implies no deletion, we can break out */
  686|      0|                    return NULL;
  687|     23|                continue;
  688|     23|            }
  689|      1|            if (!CRYPTO_atomic_load(&md->neighborhoods[neigh_idx].entries[j].hash,
  ------------------
  |  Branch (689:17): [True: 0, False: 1]
  ------------------
  690|      1|                                    &ehash, h->atomic_lock))
  691|      0|                return NULL;
  692|      1|            if (compare_hash(hash, ehash) && match_key(&ival->value.key, key))
  ------------------
  |  Branch (692:17): [True: 0, False: 1]
  |  Branch (692:46): [True: 0, False: 0]
  ------------------
  693|      0|                return (HT_VALUE *)ival;
  694|      1|        }
  695|      6|        if (!lockless_reads)
  ------------------
  |  Branch (695:13): [True: 6, False: 0]
  ------------------
  696|      6|            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|      6|    return NULL;
  702|      6|}
hashtable.c:alloc_new_neighborhood_list:
  154|      6|{
  155|      6|    struct ht_neighborhood_st *ret;
  156|       |
  157|      6|    ret = OPENSSL_aligned_alloc(sizeof(struct ht_neighborhood_st) * len,
  ------------------
  |  |  106|      6|        CRYPTO_aligned_alloc(num, alignment, freeptr, \
  |  |  107|      6|                             OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                                            OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  158|      6|                                CACHE_LINE_BYTES, freeptr);
  159|       |
  160|       |    /* fall back to regular malloc */
  161|      6|    if (ret == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 6]
  ------------------
  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|      6|    memset(ret, 0, sizeof(struct ht_neighborhood_st) * len);
  167|      6|    return ret;
  168|      6|}
hashtable.c:ossl_ht_flush_internal:
  284|      2|{
  285|      2|    struct ht_mutable_data_st *newmd = NULL;
  286|      2|    struct ht_mutable_data_st *oldmd = NULL;
  287|       |
  288|      2|    newmd = OPENSSL_zalloc(sizeof(*newmd));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  289|      2|    if (newmd == NULL)
  ------------------
  |  Branch (289:9): [True: 0, False: 2]
  ------------------
  290|      0|        return 0;
  291|       |
  292|      2|    newmd->neighborhoods = alloc_new_neighborhood_list(DEFAULT_NEIGH_LEN,
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  293|      2|                                                       &newmd->neighborhood_ptr_to_free);
  294|      2|    if (newmd->neighborhoods == NULL) {
  ------------------
  |  Branch (294:9): [True: 0, False: 2]
  ------------------
  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|      2|    newmd->neighborhood_mask = DEFAULT_NEIGH_LEN - 1;
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  300|       |
  301|       |    /* Swap the old and new mutable data sets */
  302|      2|    oldmd = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  303|      2|    ossl_rcu_assign_ptr(&h->md, &newmd);
  ------------------
  |  |   31|      2|#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|      2|    h->wpd.value_count = 0;
  307|      2|    h->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  308|       |
  309|      2|    ossl_rcu_call(h->lock, free_oldmd, oldmd);
  310|      2|    h->wpd.need_sync = 1;
  311|      2|    return 1;
  312|      2|}
hashtable.c:free_oldmd:
  262|      2|{
  263|      2|    struct ht_mutable_data_st *oldmd = arg;
  264|      2|    size_t i, j;
  265|      2|    size_t neighborhood_len = (size_t)oldmd->neighborhood_mask + 1;
  266|      2|    struct ht_internal_value_st *v;
  267|       |
  268|  4.09k|    for (i = 0; i < neighborhood_len; i++) {
  ------------------
  |  Branch (268:17): [True: 4.09k, False: 2]
  ------------------
  269|  4.09k|        PREFETCH_NEIGHBORHOOD(oldmd->neighborhoods[i + 1]);
  ------------------
  |  |   83|  4.09k|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  270|  20.4k|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|  20.4k|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|  20.4k|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (270:21): [True: 16.3k, False: 4.09k]
  ------------------
  271|  16.3k|            if (oldmd->neighborhoods[i].entries[j].value != NULL) {
  ------------------
  |  Branch (271:17): [True: 0, False: 16.3k]
  ------------------
  272|      0|                v = oldmd->neighborhoods[i].entries[j].value;
  273|      0|                v->ht->config.ht_free_fn((HT_VALUE *)v);
  274|      0|                free_value(v);
  275|      0|            }
  276|  16.3k|        }
  277|  4.09k|    }
  278|       |
  279|      2|    OPENSSL_free(oldmd->neighborhood_ptr_to_free);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  280|      2|    OPENSSL_free(oldmd);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  281|      2|}
hashtable.c:alloc_new_value:
  597|      2|{
  598|      2|    struct ht_internal_value_st *tmp;
  599|      2|    size_t nvsize = sizeof(*tmp);
  600|       |
  601|      2|    if (h->config.collision_check == 1)
  ------------------
  |  Branch (601:9): [True: 2, False: 0]
  ------------------
  602|      2|        nvsize += key->keysize;
  603|       |
  604|      2|    tmp = OPENSSL_malloc(nvsize);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  605|       |
  606|      2|    if (tmp == NULL)
  ------------------
  |  Branch (606:9): [True: 0, False: 2]
  ------------------
  607|      0|        return NULL;
  608|       |
  609|      2|    tmp->ht = h;
  610|      2|    tmp->value.value = data;
  611|      2|    tmp->value.type_id = type;
  612|      2|    tmp->value.key.keybuf = NULL;
  613|      2|    if (h->config.collision_check) {
  ------------------
  |  Branch (613:9): [True: 2, False: 0]
  ------------------
  614|      2|        tmp->value.key.keybuf = (uint8_t *)(tmp + 1);
  615|      2|        tmp->value.key.keysize = key->keysize;
  616|      2|        memcpy(tmp->value.key.keybuf, key->keybuf, key->keysize);
  617|      2|    }
  618|       |
  619|       |
  620|      2|    return tmp;
  621|      2|}
hashtable.c:ossl_ht_insert_locked:
  532|      2|{
  533|      2|    struct ht_mutable_data_st *md = h->md;
  534|      2|    uint64_t neigh_idx_start = hash & md->neighborhood_mask;
  535|      2|    uint64_t neigh_idx = neigh_idx_start;
  536|      2|    size_t j;
  537|      2|    uint64_t ihash;
  538|      2|    HT_VALUE *ival;
  539|      2|    size_t empty_idx = SIZE_MAX;
  540|      2|    int lockless_reads = h->config.lockless_reads;
  541|       |
  542|      2|    do {
  543|      2|        PREFETCH_NEIGHBORHOOD(md->neighborhoods[neigh_idx]);
  ------------------
  |  |   83|      2|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  544|       |
  545|     10|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|     10|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|     10|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (545:21): [True: 8, False: 2]
  ------------------
  546|      8|            ival = ossl_rcu_deref(&md->neighborhoods[neigh_idx].entries[j].value);
  ------------------
  |  |   30|      8|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  547|      8|            if (ival == NULL) {
  ------------------
  |  Branch (547:17): [True: 7, False: 1]
  ------------------
  548|      7|                empty_idx = j;
  549|       |                /* lockless_reads implies no deletion, we can break out */
  550|      7|                if (lockless_reads)
  ------------------
  |  Branch (550:21): [True: 0, False: 7]
  ------------------
  551|      0|                    goto not_found;
  552|      7|                continue;
  553|      7|            }
  554|      1|            if (!CRYPTO_atomic_load(&md->neighborhoods[neigh_idx].entries[j].hash,
  ------------------
  |  Branch (554:17): [True: 0, False: 1]
  ------------------
  555|      1|                                    &ihash, h->atomic_lock))
  556|      0|                return 0;
  557|      1|            if (compare_hash(hash, ihash) && match_key(&newval->value.key,
  ------------------
  |  Branch (557:17): [True: 0, False: 1]
  |  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|      1|        }
  575|      2|        if (!lockless_reads)
  ------------------
  |  Branch (575:13): [True: 2, False: 0]
  ------------------
  576|      2|            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|      2| not_found:
  582|       |    /* If we get to here, its just an insert */
  583|      2|    if (empty_idx == SIZE_MAX)
  ------------------
  |  Branch (583:9): [True: 0, False: 2]
  ------------------
  584|      0|        return -1; /* out of space */
  585|      2|    if (!CRYPTO_atomic_store(&md->neighborhoods[neigh_idx].entries[empty_idx].hash,
  ------------------
  |  Branch (585:9): [True: 0, False: 2]
  ------------------
  586|      2|                             hash, h->atomic_lock))
  587|      0|        return 0;
  588|      2|    h->wpd.value_count++;
  589|      2|    ossl_rcu_assign_ptr(&md->neighborhoods[neigh_idx].entries[empty_idx].value,
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  590|      2|                        &newval);
  591|      2|    return 1;
  592|      2|}
hashtable.c:compare_hash:
  405|      2|{
  406|      2|    return (hash1 == hash2);
  407|      2|}

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

ossl_indicator_set_callback_new:
   22|      2|{
   23|      2|    INDICATOR_CB *cb;
   24|       |
   25|      2|    cb = OPENSSL_zalloc(sizeof(*cb));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   26|      2|    return cb;
   27|      2|}
ossl_indicator_set_callback_free:
   30|      2|{
   31|      2|    OPENSSL_free(cb);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   32|      2|}

OPENSSL_cleanup:
  378|      2|{
  379|      2|    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|      2|    if (!base_inited)
  ------------------
  |  Branch (387:9): [True: 0, False: 2]
  ------------------
  388|      0|        return;
  389|       |
  390|       |    /* Might be explicitly called and also by atexit */
  391|      2|    if (stopped)
  ------------------
  |  Branch (391:9): [True: 0, False: 2]
  ------------------
  392|      0|        return;
  393|      2|    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|      2|    OPENSSL_thread_stop();
  400|       |
  401|      2|    currhandler = stop_handlers;
  402|      2|    while (currhandler != NULL) {
  ------------------
  |  Branch (402:12): [True: 0, False: 2]
  ------------------
  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|      2|    stop_handlers = NULL;
  409|       |
  410|      2|    CRYPTO_THREAD_lock_free(optsdone_lock);
  411|      2|    optsdone_lock = NULL;
  412|      2|    CRYPTO_THREAD_lock_free(init_lock);
  413|      2|    init_lock = NULL;
  414|       |
  415|      2|    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|      2|#ifndef OPENSSL_NO_COMP
  423|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  424|      2|    ossl_comp_zlib_cleanup();
  425|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_brotli_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  426|      2|    ossl_comp_brotli_cleanup();
  427|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zstd_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  428|      2|    ossl_comp_zstd_cleanup();
  429|      2|#endif
  430|       |
  431|      2|    if (async_inited) {
  ------------------
  |  Branch (431:9): [True: 0, False: 2]
  ------------------
  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|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_rand_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  448|      2|    ossl_rand_cleanup_int();
  449|       |
  450|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_config_modules_free()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  451|      2|    ossl_config_modules_free();
  452|       |
  453|      2|#ifndef OPENSSL_NO_ENGINE
  454|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: engine_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  455|      2|    engine_cleanup_int();
  456|      2|#endif
  457|       |
  458|      2|#ifndef OPENSSL_NO_DEPRECATED_3_0
  459|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_store_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  460|      2|    ossl_store_cleanup_int();
  461|      2|#endif
  462|       |
  463|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_lib_ctx_default_deinit()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  464|      2|    ossl_lib_ctx_default_deinit();
  465|       |
  466|      2|    ossl_cleanup_thread();
  467|       |
  468|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: bio_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  469|      2|    bio_cleanup();
  470|       |
  471|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: evp_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  472|      2|    evp_cleanup_int();
  473|       |
  474|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_obj_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  475|      2|    ossl_obj_cleanup_int();
  476|       |
  477|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: err_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  478|      2|    err_cleanup();
  479|       |
  480|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: CRYPTO_secure_malloc_done()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  481|      2|    CRYPTO_secure_malloc_done();
  482|       |
  483|      2|#ifndef OPENSSL_NO_CMP
  484|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: OSSL_CMP_log_close()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  485|      2|    OSSL_CMP_log_close();
  486|      2|#endif
  487|       |
  488|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_trace_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  489|      2|    ossl_trace_cleanup();
  490|       |
  491|      2|    base_inited = 0;
  492|      2|}
OPENSSL_init_crypto:
  500|     12|{
  501|     12|    uint64_t tmp;
  502|     12|    int aloaddone = 0;
  503|       |
  504|       |   /* Applications depend on 0 being returned when cleanup was already done */
  505|     12|    if (stopped) {
  ------------------
  |  Branch (505:9): [True: 0, False: 12]
  ------------------
  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|     12|    if (CRYPTO_atomic_load(&optsdone, &tmp, NULL)) {
  ------------------
  |  Branch (524:9): [True: 12, False: 0]
  ------------------
  525|     12|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (525:13): [True: 2, False: 10]
  ------------------
  526|      2|            return 1;
  527|     10|        aloaddone = 1;
  528|     10|    }
  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|     10|    if (!RUN_ONCE(&base, ossl_init_base))
  ------------------
  |  |  130|     10|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (544:9): [True: 0, False: 10]
  ------------------
  545|      0|        return 0;
  546|       |
  547|     10|    if (opts & OPENSSL_INIT_BASE_ONLY)
  ------------------
  |  |   31|     10|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (547:9): [True: 8, False: 2]
  ------------------
  548|      8|        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|      2|    if (!aloaddone) {
  ------------------
  |  Branch (555:9): [True: 0, False: 2]
  ------------------
  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|      2|    if ((opts & OPENSSL_INIT_NO_ATEXIT) != 0) {
  ------------------
  |  |  485|      2|# define OPENSSL_INIT_NO_ATEXIT              0x00080000L
  ------------------
  |  Branch (568:9): [True: 0, False: 2]
  ------------------
  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|      2|    } else if (!RUN_ONCE(&register_atexit, ossl_init_register_atexit)) {
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (572:16): [True: 0, False: 2]
  ------------------
  573|      0|        return 0;
  574|      0|    }
  575|       |
  576|      2|    if (!RUN_ONCE(&load_crypto_nodelete, ossl_init_load_crypto_nodelete))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (576:9): [True: 0, False: 2]
  ------------------
  577|      0|        return 0;
  578|       |
  579|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  466|      2|# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
  ------------------
  |  Branch (579:9): [True: 0, False: 2]
  ------------------
  580|      2|            && !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|      2|                             ossl_init_no_load_crypto_strings,
  582|      2|                             ossl_init_load_crypto_strings))
  583|      0|        return 0;
  584|       |
  585|      2|    if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  |  Branch (585:9): [True: 2, False: 0]
  ------------------
  586|      2|            && !RUN_ONCE(&load_crypto_strings, ossl_init_load_crypto_strings))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (586:16): [True: 0, False: 2]
  ------------------
  587|      0|        return 0;
  588|       |
  589|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_SSL_STRINGS)
  ------------------
  |  | 2806|      2|# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS    0x00100000L
  ------------------
  |  Branch (589:9): [True: 0, False: 2]
  ------------------
  590|      2|        && !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|      2|                         ossl_init_load_ssl_strings))
  592|      0|        return 0;
  593|       |
  594|      2|    if ((opts & OPENSSL_INIT_LOAD_SSL_STRINGS)
  ------------------
  |  | 2807|      2|# define OPENSSL_INIT_LOAD_SSL_STRINGS       0x00200000L
  ------------------
  |  Branch (594:9): [True: 0, False: 2]
  ------------------
  595|      2|        && !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|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_CIPHERS)
  ------------------
  |  |  470|      2|# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS     0x00000010L
  ------------------
  |  Branch (598:9): [True: 0, False: 2]
  ------------------
  599|      2|            && !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|      2|                             ossl_init_add_all_ciphers))
  601|      0|        return 0;
  602|       |
  603|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_CIPHERS)
  ------------------
  |  |  468|      2|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  |  Branch (603:9): [True: 0, False: 2]
  ------------------
  604|      2|            && !RUN_ONCE(&add_all_ciphers, ossl_init_add_all_ciphers))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (604:16): [True: 0, False: 0]
  ------------------
  605|      0|        return 0;
  606|       |
  607|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_DIGESTS)
  ------------------
  |  |  471|      2|# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS     0x00000020L
  ------------------
  |  Branch (607:9): [True: 0, False: 2]
  ------------------
  608|      2|            && !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|      2|                             ossl_init_add_all_digests))
  610|      0|        return 0;
  611|       |
  612|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_DIGESTS)
  ------------------
  |  |  469|      2|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  |  Branch (612:9): [True: 0, False: 2]
  ------------------
  613|      2|            && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (613:16): [True: 0, False: 0]
  ------------------
  614|      0|        return 0;
  615|       |
  616|      2|    if ((opts & OPENSSL_INIT_ATFORK)
  ------------------
  |  |  483|      2|# define OPENSSL_INIT_ATFORK                 0x00020000L
  ------------------
  |  Branch (616:9): [True: 0, False: 2]
  ------------------
  617|      2|            && !openssl_init_fork_handlers())
  ------------------
  |  Branch (617:16): [True: 0, False: 0]
  ------------------
  618|      0|        return 0;
  619|       |
  620|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG)
  ------------------
  |  |  473|      2|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (620:9): [True: 0, False: 2]
  ------------------
  621|      2|            && !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|      2|    if (opts & OPENSSL_INIT_LOAD_CONFIG) {
  ------------------
  |  |  472|      2|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (624:9): [True: 0, False: 2]
  ------------------
  625|      0|        int loading = CRYPTO_THREAD_get_local(&in_init_config_local) != NULL;
  626|       |
  627|       |        /* If called recursively from OBJ_ calls, just skip it. */
  628|      0|        if (!loading) {
  ------------------
  |  Branch (628:13): [True: 0, False: 0]
  ------------------
  629|      0|            int ret;
  630|       |
  631|      0|            if (!CRYPTO_THREAD_set_local(&in_init_config_local, (void *)-1))
  ------------------
  |  Branch (631:17): [True: 0, False: 0]
  ------------------
  632|      0|                return 0;
  633|      0|            if (settings == NULL) {
  ------------------
  |  Branch (633:17): [True: 0, False: 0]
  ------------------
  634|      0|                ret = RUN_ONCE(&config, ossl_init_config);
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  635|      0|            } 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|      0|            if (ret <= 0)
  ------------------
  |  Branch (645:17): [True: 0, False: 0]
  ------------------
  646|      0|                return 0;
  647|      0|        }
  648|      0|    }
  649|       |
  650|      2|    if ((opts & OPENSSL_INIT_ASYNC)
  ------------------
  |  |  474|      2|# define OPENSSL_INIT_ASYNC                  0x00000100L
  ------------------
  |  Branch (650:9): [True: 0, False: 2]
  ------------------
  651|      2|            && !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|      2|#ifndef OPENSSL_NO_ENGINE
  655|      2|    if ((opts & OPENSSL_INIT_ENGINE_OPENSSL)
  ------------------
  |  |  477|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  |  Branch (655:9): [True: 0, False: 2]
  ------------------
  656|      2|            && !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|      2|# ifndef OPENSSL_NO_RDRAND
  659|      2|    if ((opts & OPENSSL_INIT_ENGINE_RDRAND)
  ------------------
  |  |  475|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  ------------------
  |  Branch (659:9): [True: 0, False: 2]
  ------------------
  660|      2|            && !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|      2|# endif
  663|      2|    if ((opts & OPENSSL_INIT_ENGINE_DYNAMIC)
  ------------------
  |  |  476|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  ------------------
  |  Branch (663:9): [True: 0, False: 2]
  ------------------
  664|      2|            && !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|      2|# 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|      2|#  if !defined(OPENSSL_NO_PADLOCKENG)
  673|      2|    if ((opts & OPENSSL_INIT_ENGINE_PADLOCK)
  ------------------
  |  |  480|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  ------------------
  |  Branch (673:9): [True: 0, False: 2]
  ------------------
  674|      2|            && !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|      2|#  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|      2|#  if !defined(OPENSSL_NO_AFALGENG)
  683|      2|    if ((opts & OPENSSL_INIT_ENGINE_AFALG)
  ------------------
  |  |  481|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  |  Branch (683:9): [True: 0, False: 2]
  ------------------
  684|      2|            && !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|      2|#  endif
  687|      2|# endif
  688|      2|    if (opts & (OPENSSL_INIT_ENGINE_ALL_BUILTIN
  ------------------
  |  |  497|      2|    (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  475|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  |  |  ------------------
  |  |                   (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  476|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  |  |  ------------------
  |  |  498|      2|    | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  478|      2|# define OPENSSL_INIT_ENGINE_CRYPTODEV       0x00001000L
  |  |  ------------------
  |  |                   | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  479|      2|# define OPENSSL_INIT_ENGINE_CAPI            0x00002000L
  |  |  ------------------
  |  |  499|      2|    OPENSSL_INIT_ENGINE_PADLOCK)
  |  |  ------------------
  |  |  |  |  480|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  |  |  ------------------
  ------------------
  |  Branch (688:9): [True: 0, False: 2]
  ------------------
  689|      2|                | OPENSSL_INIT_ENGINE_OPENSSL
  ------------------
  |  |  477|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  690|      2|                | OPENSSL_INIT_ENGINE_AFALG)) {
  ------------------
  |  |  481|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  691|      0|        ENGINE_register_all_complete();
  692|      0|    }
  693|      2|#endif
  694|       |
  695|      2|    if (!CRYPTO_atomic_or(&optsdone, opts, &tmp, optsdone_lock))
  ------------------
  |  Branch (695:9): [True: 0, False: 2]
  ------------------
  696|      0|        return 0;
  697|       |
  698|      2|    return 1;
  699|      2|}
init.c:ossl_init_base:
   58|      2|{
   59|       |    /* no need to init trace */
   60|       |
   61|      2|    OSSL_TRACE(INIT, "ossl_init_base: setting up stop handlers\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   62|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
   63|       |    ossl_malloc_setup_failures();
   64|       |#endif
   65|       |
   66|      2|    if ((optsdone_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  ------------------
   67|      2|        || (init_lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (67:12): [True: 0, False: 2]
  ------------------
   68|      0|        goto err;
   69|       |
   70|      2|    OPENSSL_cpuid_setup();
   71|       |
   72|      2|    if (!ossl_init_thread())
  ------------------
  |  Branch (72:9): [True: 0, False: 2]
  ------------------
   73|      0|        goto err;
   74|       |
   75|      2|    if (!CRYPTO_THREAD_init_local(&in_init_config_local, NULL))
  ------------------
  |  Branch (75:9): [True: 0, False: 2]
  ------------------
   76|      0|        goto err;
   77|       |
   78|      2|    base_inited = 1;
   79|      2|    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|      2|}
init.c:ossl_init_register_atexit:
  101|      2|{
  102|      2|#ifndef OPENSSL_NO_ATEXIT
  103|       |# ifdef OPENSSL_INIT_DEBUG
  104|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
  105|       |# endif
  106|      2|# 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|      2|    if (atexit(OPENSSL_cleanup) != 0)
  ------------------
  |  Branch (112:9): [True: 0, False: 2]
  ------------------
  113|      0|        return 0;
  114|      2|#  endif
  115|      2|# endif
  116|      2|#endif
  117|       |
  118|      2|    return 1;
  119|      2|}
init.c:ossl_init_load_crypto_nodelete:
  133|      2|{
  134|      2|    OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  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|      2|    return 1;
  181|      2|}
init.c:ossl_init_load_crypto_strings:
  186|      2|{
  187|      2|    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|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
  193|      2|    void *err;
  194|       |
  195|      2|    if (!err_shelve_state(&err))
  ------------------
  |  Branch (195:9): [True: 0, False: 2]
  ------------------
  196|      0|        return 0;
  197|       |
  198|      2|    OSSL_TRACE(INIT, "ossl_err_load_crypto_strings()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  199|      2|    ret = ossl_err_load_crypto_strings();
  200|       |
  201|      2|    err_unshelve_state(err);
  202|      2|#endif
  203|      2|    return ret;
  204|      2|}

ossl_init_thread:
  203|      2|{
  204|      2|    if (!CRYPTO_THREAD_init_local(&destructor_key.value,
  ------------------
  |  Branch (204:9): [True: 0, False: 2]
  ------------------
  205|      2|                                  init_thread_destructor))
  206|      0|        return 0;
  207|       |
  208|      2|    return 1;
  209|      2|}
ossl_cleanup_thread:
  212|      2|{
  213|      2|    init_thread_deregister(NULL, 1);
  214|      2|    CRYPTO_THREAD_cleanup_local(&destructor_key.value);
  215|      2|    destructor_key.sane = -1;
  216|      2|}
OPENSSL_thread_stop:
  230|      2|{
  231|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (231:9): [True: 2, False: 0]
  ------------------
  232|      2|        THREAD_EVENT_HANDLER **hands
  233|      2|            = init_get_thread_local(&destructor_key.value, 0, 0);
  234|      2|        init_thread_stop(NULL, hands);
  235|       |
  236|      2|        init_thread_remove_handlers(hands);
  237|      2|        OPENSSL_free(hands);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  238|      2|    }
  239|      2|}
ossl_ctx_thread_stop:
  242|      2|{
  243|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (243:9): [True: 2, False: 0]
  ------------------
  244|      2|        THREAD_EVENT_HANDLER **hands
  245|      2|            = init_get_thread_local(&destructor_key.value, 0, 1);
  246|      2|        init_thread_stop(ctx, hands);
  247|      2|    }
  248|      2|}
ossl_init_thread_start:
  369|      3|{
  370|      3|    THREAD_EVENT_HANDLER **hands;
  371|      3|    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|      3|    CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
  390|      3|#endif
  391|       |
  392|      3|    hands = init_get_thread_local(local, 1, 0);
  393|      3|    if (hands == NULL)
  ------------------
  |  Branch (393:9): [True: 0, False: 3]
  ------------------
  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|      3|    hand = OPENSSL_malloc(sizeof(*hand));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  409|      3|    if (hand == NULL)
  ------------------
  |  Branch (409:9): [True: 0, False: 3]
  ------------------
  410|      0|        return 0;
  411|       |
  412|      3|    hand->handfn = handfn;
  413|      3|    hand->arg = arg;
  414|      3|#ifndef FIPS_MODULE
  415|      3|    hand->index = index;
  416|      3|#endif
  417|      3|    hand->next = *hands;
  418|      3|    *hands = hand;
  419|       |
  420|      3|    return 1;
  421|      3|}
initthread.c:init_get_thread_local:
   95|      7|{
   96|      7|    THREAD_EVENT_HANDLER **hands = CRYPTO_THREAD_get_local(local);
   97|       |
   98|      7|    if (alloc) {
  ------------------
  |  Branch (98:9): [True: 3, False: 4]
  ------------------
   99|      3|        if (hands == NULL) {
  ------------------
  |  Branch (99:13): [True: 2, False: 1]
  ------------------
  100|       |
  101|      2|            if ((hands = OPENSSL_zalloc(sizeof(*hands))) == NULL)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  |  Branch (101:17): [True: 0, False: 2]
  ------------------
  102|      0|                return NULL;
  103|       |
  104|      2|            if (!CRYPTO_THREAD_set_local(local, hands)) {
  ------------------
  |  Branch (104:17): [True: 0, False: 2]
  ------------------
  105|      0|                OPENSSL_free(hands);
  ------------------
  |  |  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|      2|#ifndef FIPS_MODULE
  110|      2|            if (!init_thread_push_handlers(hands)) {
  ------------------
  |  Branch (110:17): [True: 0, False: 2]
  ------------------
  111|      0|                CRYPTO_THREAD_set_local(local, NULL);
  112|      0|                OPENSSL_free(hands);
  ------------------
  |  |  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|      2|#endif
  116|      2|        }
  117|      4|    } else if (!keep) {
  ------------------
  |  Branch (117:16): [True: 2, False: 2]
  ------------------
  118|      2|        CRYPTO_THREAD_set_local(local, NULL);
  119|      2|    }
  120|       |
  121|      7|    return hands;
  122|      7|}
initthread.c:init_thread_push_handlers:
  155|      2|{
  156|      2|    int ret;
  157|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  158|       |
  159|      2|    gtr = get_global_tevent_register();
  160|      2|    if (gtr == NULL)
  ------------------
  |  Branch (160:9): [True: 0, False: 2]
  ------------------
  161|      0|        return 0;
  162|       |
  163|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (163:9): [True: 0, False: 2]
  ------------------
  164|      0|        return 0;
  165|      2|    ret = (sk_THREAD_EVENT_HANDLER_PTR_push(gtr->skhands, hands) != 0);
  166|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  167|       |
  168|      2|    return ret;
  169|      2|}
initthread.c:get_global_tevent_register:
   78|      8|{
   79|      8|    if (!RUN_ONCE(&tevent_register_runonce, create_global_tevent_register))
  ------------------
  |  |  130|      8|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 8, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (79:9): [True: 0, False: 8]
  ------------------
   80|      0|        return NULL;
   81|      8|    return glob_tevent_reg;
   82|      8|}
initthread.c:create_global_tevent_register:
   59|      2|{
   60|      2|    glob_tevent_reg = OPENSSL_zalloc(sizeof(*glob_tevent_reg));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   61|      2|    if (glob_tevent_reg == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 2]
  ------------------
   62|      0|        return 0;
   63|       |
   64|      2|    glob_tevent_reg->skhands = sk_THREAD_EVENT_HANDLER_PTR_new_null();
   65|      2|    glob_tevent_reg->lock = CRYPTO_THREAD_lock_new();
   66|      2|    if (glob_tevent_reg->skhands == NULL || glob_tevent_reg->lock == NULL) {
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  |  Branch (66:45): [True: 0, False: 2]
  ------------------
   67|      0|        sk_THREAD_EVENT_HANDLER_PTR_free(glob_tevent_reg->skhands);
   68|      0|        CRYPTO_THREAD_lock_free(glob_tevent_reg->lock);
   69|      0|        OPENSSL_free(glob_tevent_reg);
  ------------------
  |  |  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|      2|    return 1;
   75|      2|}
initthread.c:init_thread_remove_handlers:
  172|      2|{
  173|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  174|      2|    int i;
  175|       |
  176|      2|    gtr = get_global_tevent_register();
  177|      2|    if (gtr == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        return;
  179|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (179:9): [True: 0, False: 2]
  ------------------
  180|      0|        return;
  181|      2|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (181:17): [True: 2, False: 0]
  ------------------
  182|      2|        THREAD_EVENT_HANDLER **hands
  183|      2|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  184|       |
  185|      2|        if (hands == handsin) {
  ------------------
  |  Branch (185:13): [True: 2, False: 0]
  ------------------
  186|      2|            sk_THREAD_EVENT_HANDLER_PTR_delete(gtr->skhands, i);
  187|      2|            CRYPTO_THREAD_unlock(gtr->lock);
  188|      2|            return;
  189|      2|        }
  190|      2|    }
  191|      0|    CRYPTO_THREAD_unlock(gtr->lock);
  192|      0|    return;
  193|      2|}
initthread.c:init_thread_stop:
  325|      4|{
  326|      4|    THREAD_EVENT_HANDLER *curr, *prev = NULL, *tmp;
  327|      4|#ifndef FIPS_MODULE
  328|      4|    GLOBAL_TEVENT_REGISTER *gtr;
  329|      4|#endif
  330|       |
  331|       |    /* Can't do much about this */
  332|      4|    if (hands == NULL)
  ------------------
  |  Branch (332:9): [True: 2, False: 2]
  ------------------
  333|      2|        return;
  334|       |
  335|      2|#ifndef FIPS_MODULE
  336|      2|    gtr = get_global_tevent_register();
  337|      2|    if (gtr == NULL)
  ------------------
  |  Branch (337:9): [True: 0, False: 2]
  ------------------
  338|      0|        return;
  339|       |
  340|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (340:9): [True: 0, False: 2]
  ------------------
  341|      0|        return;
  342|      2|#endif
  343|       |
  344|      2|    curr = *hands;
  345|      5|    while (curr != NULL) {
  ------------------
  |  Branch (345:12): [True: 3, False: 2]
  ------------------
  346|      3|        if (arg != NULL && curr->arg != arg) {
  ------------------
  |  Branch (346:13): [True: 0, False: 3]
  |  Branch (346:28): [True: 0, False: 0]
  ------------------
  347|      0|            prev = curr;
  348|      0|            curr = curr->next;
  349|      0|            continue;
  350|      0|        }
  351|      3|        curr->handfn(curr->arg);
  352|      3|        if (prev == NULL)
  ------------------
  |  Branch (352:13): [True: 3, False: 0]
  ------------------
  353|      3|            *hands = curr->next;
  354|      0|        else
  355|      0|            prev->next = curr->next;
  356|       |
  357|      3|        tmp = curr;
  358|      3|        curr = curr->next;
  359|       |
  360|      3|        OPENSSL_free(tmp);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  361|      3|    }
  362|      2|#ifndef FIPS_MODULE
  363|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  364|      2|#endif
  365|      2|}
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: 0, False: 2]
  ------------------
  433|      0|        if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (433:13): [True: 0, False: 0]
  ------------------
  434|      0|            return 0;
  435|      2|    } else {
  436|      2|        glob_tevent_reg = NULL;
  437|      2|    }
  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: 2, False: 0]
  ------------------
  467|      2|        CRYPTO_THREAD_lock_free(gtr->lock);
  468|      2|        sk_THREAD_EVENT_HANDLER_PTR_free(gtr->skhands);
  469|      2|        OPENSSL_free(gtr);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  470|      2|    } else {
  471|      0|        CRYPTO_THREAD_unlock(gtr->lock);
  472|      0|    }
  473|      2|    return 1;
  474|      2|}

OPENSSL_LH_set_thunks:
   52|     10|{
   53|       |
   54|     10|    if (lh == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 10]
  ------------------
   55|      0|        return NULL;
   56|     10|    lh->compw = cw;
   57|     10|    lh->hashw = hw;
   58|     10|    lh->daw = daw;
   59|     10|    lh->daaw = daaw;
   60|     10|    return lh;
   61|     10|}
OPENSSL_LH_new:
   64|     10|{
   65|     10|    OPENSSL_LHASH *ret;
   66|       |
   67|     10|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  104|     10|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (67:9): [True: 0, False: 10]
  ------------------
   68|      0|        return NULL;
   69|     10|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |  104|     10|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 10]
  ------------------
   70|      0|        goto err;
   71|     10|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (71:18): [True: 0, False: 10]
  ------------------
   72|     10|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (72:18): [True: 0, False: 10]
  ------------------
   73|     10|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   74|     10|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   75|     10|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   76|     10|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|     10|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   85|     10|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   77|     10|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|     10|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   85|     10|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   78|     10|    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|     10|}
OPENSSL_LH_free:
   87|     12|{
   88|     12|    if (lh == NULL)
  ------------------
  |  Branch (88:9): [True: 2, False: 10]
  ------------------
   89|      2|        return;
   90|       |
   91|     10|    OPENSSL_LH_flush(lh);
   92|     10|    OPENSSL_free(lh->b);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   93|     10|    OPENSSL_free(lh);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   94|     10|}
OPENSSL_LH_flush:
   97|     10|{
   98|     10|    unsigned int i;
   99|     10|    OPENSSL_LH_NODE *n, *nn;
  100|       |
  101|     10|    if (lh == NULL)
  ------------------
  |  Branch (101:9): [True: 0, False: 10]
  ------------------
  102|      0|        return;
  103|       |
  104|  1.59k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (104:17): [True: 1.58k, False: 10]
  ------------------
  105|  1.58k|        n = lh->b[i];
  106|  4.64k|        while (n != NULL) {
  ------------------
  |  Branch (106:16): [True: 3.06k, False: 1.58k]
  ------------------
  107|  3.06k|            nn = n->next;
  108|  3.06k|            OPENSSL_free(n);
  ------------------
  |  |  115|  3.06k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.06k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.06k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  109|  3.06k|            n = nn;
  110|  3.06k|        }
  111|  1.58k|        lh->b[i] = NULL;
  112|  1.58k|    }
  113|       |
  114|     10|    lh->num_items = 0;
  115|     10|}
OPENSSL_LH_insert:
  118|  8.63k|{
  119|  8.63k|    unsigned long hash;
  120|  8.63k|    OPENSSL_LH_NODE *nn, **rn;
  121|  8.63k|    void *ret;
  122|       |
  123|  8.63k|    lh->error = 0;
  124|  8.63k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   85|  8.63k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (124:9): [True: 1.50k, False: 7.13k]
  |  Branch (124:76): [True: 0, False: 1.50k]
  ------------------
  125|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  126|       |
  127|  8.63k|    rn = getrn(lh, data, &hash);
  128|       |
  129|  8.63k|    if (*rn == NULL) {
  ------------------
  |  Branch (129:9): [True: 3.06k, False: 5.57k]
  ------------------
  130|  3.06k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |  102|  3.06k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.06k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.06k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (130:13): [True: 0, False: 3.06k]
  ------------------
  131|      0|            lh->error++;
  132|      0|            return NULL;
  133|      0|        }
  134|  3.06k|        nn->data = data;
  135|  3.06k|        nn->next = NULL;
  136|  3.06k|        nn->hash = hash;
  137|  3.06k|        *rn = nn;
  138|  3.06k|        ret = NULL;
  139|  3.06k|        lh->num_items++;
  140|  5.57k|    } else {                    /* replace same key */
  141|  5.57k|        ret = (*rn)->data;
  142|  5.57k|        (*rn)->data = data;
  143|  5.57k|    }
  144|  8.63k|    return ret;
  145|  8.63k|}
OPENSSL_LH_retrieve:
  174|    168|{
  175|    168|    unsigned long hash;
  176|    168|    OPENSSL_LH_NODE **rn;
  177|       |
  178|    168|    if (lh->error != 0)
  ------------------
  |  Branch (178:9): [True: 0, False: 168]
  ------------------
  179|      0|        lh->error = 0;
  180|       |
  181|    168|    rn = getrn(lh, data, &hash);
  182|       |
  183|    168|    return *rn == NULL ? NULL : (*rn)->data;
  ------------------
  |  Branch (183:12): [True: 168, False: 0]
  ------------------
  184|    168|}
OPENSSL_LH_doall:
  217|      8|{
  218|      8|    if (lh == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 8]
  ------------------
  219|      0|        return;
  220|       |
  221|      8|    doall_util_fn(lh, 0, lh->daw, func, (OPENSSL_LH_DOALL_FUNCARG)NULL,
  222|      8|                  (OPENSSL_LH_DOALL_FUNCARG_THUNK)NULL, NULL);
  223|      8|}
OPENSSL_LH_strhash:
  362|     48|{
  363|     48|    unsigned long ret = 0;
  364|     48|    long n;
  365|     48|    unsigned long v;
  366|     48|    int r;
  367|       |
  368|     48|    if ((c == NULL) || (*c == '\0'))
  ------------------
  |  Branch (368:9): [True: 0, False: 48]
  |  Branch (368:24): [True: 0, False: 48]
  ------------------
  369|      0|        return ret;
  370|       |
  371|     48|    n = 0x100;
  372|    312|    while (*c) {
  ------------------
  |  Branch (372:12): [True: 264, False: 48]
  ------------------
  373|    264|        v = n | (*c);
  374|    264|        n += 0x100;
  375|    264|        r = (int)((v >> 2) ^ v) & 0x0f;
  376|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  377|    264|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  378|    264|        ret &= 0xFFFFFFFFL;
  379|    264|        ret ^= v * v;
  380|    264|        c++;
  381|    264|    }
  382|     48|    return (ret >> 16) ^ ret;
  383|     48|}
OPENSSL_LH_error:
  442|     16|{
  443|     16|    return lh->error;
  444|     16|}
lhash.c:doall_util_fn:
  192|      8|{
  193|      8|    int i;
  194|      8|    OPENSSL_LH_NODE *a, *n;
  195|       |
  196|      8|    if (lh == NULL)
  ------------------
  |  Branch (196:9): [True: 0, False: 8]
  ------------------
  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|     72|    for (i = lh->num_nodes - 1; i >= 0; i--) {
  ------------------
  |  Branch (203:33): [True: 64, False: 8]
  ------------------
  204|     64|        a = lh->b[i];
  205|     80|        while (a != NULL) {
  ------------------
  |  Branch (205:16): [True: 16, False: 64]
  ------------------
  206|     16|            n = a->next;
  207|     16|            if (use_arg)
  ------------------
  |  Branch (207:17): [True: 0, False: 16]
  ------------------
  208|      0|                wfunc_arg(a->data, arg, func_arg);
  209|     16|            else
  210|     16|                wfunc(a->data, func);
  211|     16|            a = n;
  212|     16|        }
  213|     64|    }
  214|      8|}
lhash.c:expand:
  244|  1.50k|{
  245|  1.50k|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  246|  1.50k|    unsigned int p, pmax, nni, j;
  247|  1.50k|    unsigned long hash;
  248|       |
  249|  1.50k|    nni = lh->num_alloc_nodes;
  250|  1.50k|    p = lh->p;
  251|  1.50k|    pmax = lh->pmax;
  252|  1.50k|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (252:9): [True: 12, False: 1.49k]
  ------------------
  253|     12|        j = nni * 2;
  254|     12|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  109|     12|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     12|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     12|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  255|     12|        if (n == NULL) {
  ------------------
  |  Branch (255:13): [True: 0, False: 12]
  ------------------
  256|      0|            lh->error++;
  257|      0|            return 0;
  258|      0|        }
  259|     12|        lh->b = n;
  260|     12|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  261|     12|        lh->pmax = nni;
  262|     12|        lh->num_alloc_nodes = j;
  263|     12|        lh->p = 0;
  264|  1.49k|    } else {
  265|  1.49k|        lh->p++;
  266|  1.49k|    }
  267|       |
  268|  1.50k|    lh->num_nodes++;
  269|  1.50k|    n1 = &(lh->b[p]);
  270|  1.50k|    n2 = &(lh->b[p + pmax]);
  271|  1.50k|    *n2 = NULL;
  272|       |
  273|  6.97k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (273:20): [True: 5.47k, False: 1.50k]
  ------------------
  274|  5.47k|        hash = np->hash;
  275|  5.47k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (275:13): [True: 786, False: 4.68k]
  ------------------
  276|    786|            *n1 = (*n1)->next;
  277|    786|            np->next = *n2;
  278|    786|            *n2 = np;
  279|    786|        } else
  280|  4.68k|            n1 = &((*n1)->next);
  281|  5.47k|        np = *n1;
  282|  5.47k|    }
  283|       |
  284|  1.50k|    return 1;
  285|  1.50k|}
lhash.c:getrn:
  322|  8.80k|{
  323|  8.80k|    OPENSSL_LH_NODE **ret, *n1;
  324|  8.80k|    unsigned long hash, nn;
  325|       |
  326|  8.80k|    if (lh->hashw != NULL)
  ------------------
  |  Branch (326:9): [True: 8.80k, False: 0]
  ------------------
  327|  8.80k|        hash = lh->hashw(data, lh->hash);
  328|      0|    else
  329|      0|        hash = lh->hash(data);
  330|       |
  331|  8.80k|    *rhash = hash;
  332|       |
  333|  8.80k|    nn = hash % lh->pmax;
  334|  8.80k|    if (nn < lh->p)
  ------------------
  |  Branch (334:9): [True: 4.07k, False: 4.72k]
  ------------------
  335|  4.07k|        nn = hash % lh->num_alloc_nodes;
  336|       |
  337|  8.80k|    ret = &(lh->b[(int)nn]);
  338|  22.5k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (338:21): [True: 19.3k, False: 3.22k]
  ------------------
  339|  19.3k|        if (n1->hash != hash) {
  ------------------
  |  Branch (339:13): [True: 13.4k, False: 5.89k]
  ------------------
  340|  13.4k|            ret = &(n1->next);
  341|  13.4k|            continue;
  342|  13.4k|        }
  343|       |
  344|  5.89k|        if (lh->compw != NULL) {
  ------------------
  |  Branch (344:13): [True: 5.89k, False: 0]
  ------------------
  345|  5.89k|            if (lh->compw(n1->data, data, lh->comp) == 0)
  ------------------
  |  Branch (345:17): [True: 5.57k, False: 316]
  ------------------
  346|  5.57k|                break;
  347|  5.89k|        } else {
  348|      0|            if (lh->comp(n1->data, data) == 0)
  ------------------
  |  Branch (348:17): [True: 0, False: 0]
  ------------------
  349|      0|                break;
  350|      0|        }
  351|    316|        ret = &(n1->next);
  352|    316|    }
  353|  8.80k|    return ret;
  354|  8.80k|}

CRYPTO_malloc:
  187|  3.25k|{
  188|  3.25k|    void *ptr;
  189|       |
  190|  3.25k|    INCREMENT(malloc_count);
  191|  3.25k|    if (malloc_impl != CRYPTO_malloc) {
  ------------------
  |  Branch (191:9): [True: 0, False: 3.25k]
  ------------------
  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|  3.25k|    if (num == 0)
  ------------------
  |  Branch (198:9): [True: 0, False: 3.25k]
  ------------------
  199|      0|        return NULL;
  200|       |
  201|  3.25k|    FAILTEST();
  202|  3.25k|    if (allow_customize) {
  ------------------
  |  Branch (202:9): [True: 2, False: 3.25k]
  ------------------
  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|      2|        allow_customize = 0;
  209|      2|    }
  210|       |
  211|  3.25k|    ptr = malloc(num);
  212|  3.25k|    if (ptr != NULL)
  ------------------
  |  Branch (212:9): [True: 3.25k, False: 0]
  ------------------
  213|  3.25k|        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|  3.25k|}
CRYPTO_zalloc:
  228|    171|{
  229|    171|    void *ret;
  230|       |
  231|    171|    ret = CRYPTO_malloc(num, file, line);
  232|    171|    if (ret != NULL)
  ------------------
  |  Branch (232:9): [True: 171, False: 0]
  ------------------
  233|    171|        memset(ret, 0, num);
  234|       |
  235|    171|    return ret;
  236|    171|}
CRYPTO_aligned_alloc:
  240|      6|{
  241|      6|    void *ret;
  242|       |
  243|      6|    *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|      6|    if (malloc_impl == CRYPTO_malloc) {
  ------------------
  |  Branch (251:9): [True: 6, False: 0]
  ------------------
  252|      6|#if defined(_BSD_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
  253|      6|        if (posix_memalign(&ret, alignment, num))
  ------------------
  |  Branch (253:13): [True: 0, False: 6]
  ------------------
  254|      0|            return NULL;
  255|      6|        *freeptr = ret;
  256|      6|        return ret;
  257|       |#elif defined(_ISOC11_SOURCE)
  258|       |        ret = *freeptr = aligned_alloc(alignment, num);
  259|       |        return ret;
  260|       |#endif
  261|      6|    }
  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|     14|{
  302|     14|    INCREMENT(realloc_count);
  303|     14|    if (realloc_impl != CRYPTO_realloc)
  ------------------
  |  Branch (303:9): [True: 0, False: 14]
  ------------------
  304|      0|        return realloc_impl(str, num, file, line);
  305|       |
  306|     14|    if (str == NULL)
  ------------------
  |  Branch (306:9): [True: 0, False: 14]
  ------------------
  307|      0|        return CRYPTO_malloc(num, file, line);
  308|       |
  309|     14|    if (num == 0) {
  ------------------
  |  Branch (309:9): [True: 0, False: 14]
  ------------------
  310|      0|        CRYPTO_free(str, file, line);
  311|      0|        return NULL;
  312|      0|    }
  313|       |
  314|     14|    FAILTEST();
  315|     14|    return realloc(str, num);
  316|     14|}
CRYPTO_free:
  346|  3.41k|{
  347|  3.41k|    INCREMENT(free_count);
  348|  3.41k|    if (free_impl != CRYPTO_free) {
  ------------------
  |  Branch (348:9): [True: 0, False: 3.41k]
  ------------------
  349|      0|        free_impl(str, file, line);
  350|      0|        return;
  351|      0|    }
  352|       |
  353|  3.41k|    free(str);
  354|  3.41k|}

CRYPTO_secure_malloc_done:
  132|      2|{
  133|      2|#ifndef OPENSSL_NO_SECURE_MEMORY
  134|      2|    if (secure_mem_used == 0) {
  ------------------
  |  Branch (134:9): [True: 2, False: 0]
  ------------------
  135|      2|        sh_done();
  136|      2|        secure_mem_initialized = 0;
  137|      2|        CRYPTO_THREAD_lock_free(sec_malloc_lock);
  138|      2|        sec_malloc_lock = NULL;
  139|      2|        return 1;
  140|      2|    }
  141|      0|#endif /* OPENSSL_NO_SECURE_MEMORY */
  142|      0|    return 0;
  143|      2|}
mem_sec.c:sh_done:
  599|      2|{
  600|      2|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  601|      2|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  602|      2|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  603|      2|#if !defined(_WIN32)
  604|      2|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (604:9): [True: 2, False: 0]
  |  Branch (604:40): [True: 0, False: 2]
  ------------------
  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|      2|    memset(&sh, 0, sizeof(sh));
  611|      2|}

CRYPTO_strdup:
   23|      2|{
   24|      2|    char *ret;
   25|       |
   26|      2|    if (str == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 2]
  ------------------
   27|      0|        return NULL;
   28|      2|    ret = CRYPTO_malloc(strlen(str) + 1, file, line);
   29|      2|    if (ret != NULL)
  ------------------
  |  Branch (29:9): [True: 2, False: 0]
  ------------------
   30|      2|        strcpy(ret, str);
   31|      2|    return ret;
   32|      2|}

OBJ_NAME_cleanup:
  368|      8|{
  369|      8|    unsigned long down_load;
  370|       |
  371|      8|    if (names_lh == NULL)
  ------------------
  |  Branch (371:9): [True: 8, False: 0]
  ------------------
  372|      8|        return;
  373|       |
  374|      0|    free_type = type;
  375|      0|    down_load = lh_OBJ_NAME_get_down_load(names_lh);
  376|      0|    lh_OBJ_NAME_set_down_load(names_lh, 0);
  377|       |
  378|      0|    lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
  379|      0|    if (type < 0) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|        lh_OBJ_NAME_free(names_lh);
  381|      0|        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
  382|      0|        CRYPTO_THREAD_lock_free(obj_lock);
  383|      0|        names_lh = NULL;
  384|      0|        name_funcs_stack = NULL;
  385|      0|        obj_lock = NULL;
  386|      0|    } else
  387|      0|        lh_OBJ_NAME_set_down_load(names_lh, down_load);
  388|      0|}

ossl_obj_cleanup_int:
  212|      2|{
  213|      2|    if (added != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 2]
  ------------------
  214|      0|        lh_ADDED_OBJ_set_down_load(added, 0);
  215|      0|        lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */
  216|      0|        lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */
  217|      0|        lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */
  218|      0|        lh_ADDED_OBJ_free(added);
  219|      0|        added = NULL;
  220|      0|    }
  221|      2|    objs_free_locks();
  222|      2|}
obj_dat.c:objs_free_locks:
   49|      2|{
   50|      2|    CRYPTO_THREAD_lock_free(ossl_obj_lock);
   51|      2|    ossl_obj_lock = NULL;
   52|       |#ifdef TSAN_REQUIRES_LOCKING
   53|       |    CRYPTO_THREAD_lock_free(ossl_obj_nid_lock);
   54|       |    ossl_obj_nid_lock = NULL;
   55|       |#endif
   56|      2|}

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

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

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

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

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

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

ossl_property_defns_free:
   52|      2|{
   53|      2|    LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns = vproperty_defns;
  ------------------
  |  |  149|      2|# define LHASH_OF(type) struct lhash_st_##type
  ------------------
   54|       |
   55|      2|    if (property_defns != NULL) {
  ------------------
  |  Branch (55:9): [True: 2, False: 0]
  ------------------
   56|      2|        lh_PROPERTY_DEFN_ELEM_doall(property_defns,
   57|      2|                                    &property_defn_free);
   58|      2|        lh_PROPERTY_DEFN_ELEM_free(property_defns);
   59|      2|    }
   60|      2|}
ossl_property_defns_new:
   62|      2|void *ossl_property_defns_new(OSSL_LIB_CTX *ctx) {
   63|      2|    return lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash, &property_defn_cmp);
   64|      2|}

ossl_ctx_global_properties_free:
  115|      2|{
  116|      2|    OSSL_GLOBAL_PROPERTIES *globp = vglobp;
  117|       |
  118|      2|    if (globp != NULL) {
  ------------------
  |  Branch (118:9): [True: 2, False: 0]
  ------------------
  119|      2|        ossl_property_free(globp->list);
  120|      2|        OPENSSL_free(globp);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  121|      2|    }
  122|      2|}
ossl_ctx_global_properties_new:
  125|      2|{
  126|      2|    return OPENSSL_zalloc(sizeof(OSSL_GLOBAL_PROPERTIES));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  127|      2|}
ossl_method_store_new:
  244|      8|{
  245|      8|    OSSL_METHOD_STORE *res;
  246|       |
  247|      8|    res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      8|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  248|      8|    if (res != NULL) {
  ------------------
  |  Branch (248:9): [True: 8, False: 0]
  ------------------
  249|      8|        res->ctx = ctx;
  250|      8|        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL
  ------------------
  |  Branch (250:13): [True: 0, False: 8]
  ------------------
  251|      8|            || (res->lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (251:16): [True: 0, False: 8]
  ------------------
  252|      8|            || (res->biglock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (252:16): [True: 0, False: 8]
  ------------------
  253|      0|            ossl_method_store_free(res);
  254|      0|            return NULL;
  255|      0|        }
  256|      8|    }
  257|      8|    return res;
  258|      8|}
ossl_method_store_free:
  261|      8|{
  262|      8|    if (store != NULL) {
  ------------------
  |  Branch (262:9): [True: 8, False: 0]
  ------------------
  263|      8|        if (store->algs != NULL)
  ------------------
  |  Branch (263:13): [True: 8, False: 0]
  ------------------
  264|      8|            ossl_sa_ALGORITHM_doall_arg(store->algs, &alg_cleanup, store);
  265|      8|        ossl_sa_ALGORITHM_free(store->algs);
  266|      8|        CRYPTO_THREAD_lock_free(store->lock);
  267|      8|        CRYPTO_THREAD_lock_free(store->biglock);
  268|      8|        OPENSSL_free(store);
  ------------------
  |  |  115|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  269|      8|    }
  270|      8|}

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

ossl_property_free:
  530|      2|{
  531|      2|    OPENSSL_free(p);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  532|      2|}
ossl_property_parse_init:
  575|      2|{
  576|      2|    static const char *const predefined_names[] = {
  577|      2|        "provider",     /* Name of provider (default, legacy, fips) */
  578|      2|        "version",      /* Version number of this provider */
  579|      2|        "fips",         /* FIPS validated or FIPS supporting algorithm */
  580|      2|        "output",       /* Output type for encoders */
  581|      2|        "input",        /* Input type for decoders */
  582|      2|        "structure",    /* Structure name for encoders and decoders */
  583|      2|    };
  584|      2|    size_t i;
  585|       |
  586|     14|    for (i = 0; i < OSSL_NELEM(predefined_names); i++)
  ------------------
  |  |   14|     14|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (586:17): [True: 12, False: 2]
  ------------------
  587|     12|        if (ossl_property_name(ctx, predefined_names[i], 1) == 0)
  ------------------
  |  Branch (587:13): [True: 0, False: 12]
  ------------------
  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|      2|    if ((ossl_property_value(ctx, "yes", 1) != OSSL_PROPERTY_TRUE)
  ------------------
  |  |   37|      2|#define OSSL_PROPERTY_TRUE      1
  ------------------
  |  Branch (595:9): [True: 0, False: 2]
  ------------------
  596|      2|        || (ossl_property_value(ctx, "no", 1) != OSSL_PROPERTY_FALSE))
  ------------------
  |  |   38|      2|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (596:12): [True: 0, False: 2]
  ------------------
  597|      0|        goto err;
  598|       |
  599|      2|    return 1;
  600|      0|err:
  601|      0|    return 0;
  602|      2|}

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

ossl_child_prov_ctx_new:
   38|      2|{
   39|      2|    return OPENSSL_zalloc(sizeof(struct child_prov_globals));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   40|      2|}
ossl_child_prov_ctx_free:
   43|      2|{
   44|      2|    struct child_prov_globals *gbl = vgbl;
   45|       |
   46|      2|    CRYPTO_THREAD_lock_free(gbl->lock);
   47|      2|    OPENSSL_free(gbl);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   48|      2|}

ossl_prov_conf_ctx_new:
   31|      2|{
   32|      2|    PROVIDER_CONF_GLOBAL *pcgbl = OPENSSL_zalloc(sizeof(*pcgbl));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   33|       |
   34|      2|    if (pcgbl == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 2]
  ------------------
   35|      0|        return NULL;
   36|       |
   37|      2|    pcgbl->lock = CRYPTO_THREAD_lock_new();
   38|      2|    if (pcgbl->lock == NULL) {
  ------------------
  |  Branch (38:9): [True: 0, False: 2]
  ------------------
   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|      2|    return pcgbl;
   44|      2|}
ossl_prov_conf_ctx_free:
   47|      2|{
   48|      2|    PROVIDER_CONF_GLOBAL *pcgbl = vpcgbl;
   49|       |
   50|      2|    sk_OSSL_PROVIDER_pop_free(pcgbl->activated_providers,
   51|      2|                              ossl_provider_free);
   52|       |
   53|      2|    OSSL_TRACE(CONF, "Cleaned up providers\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   54|      2|    CRYPTO_THREAD_lock_free(pcgbl->lock);
   55|      2|    OPENSSL_free(pcgbl);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   56|      2|}

ossl_provider_store_free:
  288|      2|{
  289|      2|    struct provider_store_st *store = vstore;
  290|      2|    size_t i;
  291|       |
  292|      2|    if (store == NULL)
  ------------------
  |  Branch (292:9): [True: 0, False: 2]
  ------------------
  293|      0|        return;
  294|      2|    store->freeing = 1;
  295|      2|    OPENSSL_free(store->default_path);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  296|      2|    sk_OSSL_PROVIDER_pop_free(store->providers, provider_deactivate_free);
  297|      2|#ifndef FIPS_MODULE
  298|      2|    sk_OSSL_PROVIDER_CHILD_CB_pop_free(store->child_cbs,
  299|      2|                                       ossl_provider_child_cb_free);
  300|      2|#endif
  301|      2|    CRYPTO_THREAD_lock_free(store->default_path_lock);
  302|      2|    CRYPTO_THREAD_lock_free(store->lock);
  303|      2|    for (i = 0; i < store->numprovinfo; i++)
  ------------------
  |  Branch (303:17): [True: 0, False: 2]
  ------------------
  304|      0|        ossl_provider_info_clear(&store->provinfo[i]);
  305|      2|    OPENSSL_free(store->provinfo);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  306|      2|    OPENSSL_free(store);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  307|      2|}
ossl_provider_store_new:
  310|      2|{
  311|      2|    struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  312|       |
  313|      2|    if (store == NULL
  ------------------
  |  Branch (313:9): [True: 0, False: 2]
  ------------------
  314|      2|        || (store->providers = sk_OSSL_PROVIDER_new(ossl_provider_cmp)) == NULL
  ------------------
  |  Branch (314:12): [True: 0, False: 2]
  ------------------
  315|      2|        || (store->default_path_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (315:12): [True: 0, False: 2]
  ------------------
  316|      2|#ifndef FIPS_MODULE
  317|      2|        || (store->child_cbs = sk_OSSL_PROVIDER_CHILD_CB_new_null()) == NULL
  ------------------
  |  Branch (317:12): [True: 0, False: 2]
  ------------------
  318|      2|#endif
  319|      2|        || (store->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (319:12): [True: 0, False: 2]
  ------------------
  320|      0|        ossl_provider_store_free(store);
  321|      0|        return NULL;
  322|      0|    }
  323|      2|    store->libctx = ctx;
  324|      2|    store->use_fallbacks = 1;
  325|       |
  326|      2|    return store;
  327|      2|}

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

ossl_rand_cleanup_int:
  180|      2|{
  181|      2|# ifndef OPENSSL_NO_DEPRECATED_3_0
  182|      2|    const RAND_METHOD *meth = default_RAND_meth;
  183|       |
  184|      2|    if (!rand_inited)
  ------------------
  |  Branch (184:9): [True: 2, False: 0]
  ------------------
  185|      2|        return;
  186|       |
  187|      0|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (187:9): [True: 0, False: 0]
  |  Branch (187:25): [True: 0, False: 0]
  ------------------
  188|      0|        meth->cleanup();
  189|      0|    RAND_set_rand_method(NULL);
  190|      0|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  191|      0|    ossl_rand_pool_cleanup();
  192|      0|# ifndef OPENSSL_NO_ENGINE
  193|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
  194|      0|    rand_engine_lock = NULL;
  195|      0|# endif     /* !OPENSSL_NO_ENGINE */
  196|      0|# ifndef OPENSSL_NO_DEPRECATED_3_0
  197|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
  198|      0|    rand_meth_lock = NULL;
  199|      0|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  200|      0|    ossl_release_default_drbg_ctx();
  201|      0|    rand_inited = 0;
  202|      0|}
ossl_rand_ctx_new:
  520|      2|{
  521|      2|    RAND_GLOBAL *dgbl = OPENSSL_zalloc(sizeof(*dgbl));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  522|       |
  523|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (523:9): [True: 0, False: 2]
  ------------------
  524|      0|        return NULL;
  525|       |
  526|      2|#ifndef FIPS_MODULE
  527|       |    /*
  528|       |     * We need to ensure that base libcrypto thread handling has been
  529|       |     * initialised.
  530|       |     */
  531|      2|    OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL);
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  532|       |
  533|       |    /* Prepopulate the random provider name */
  534|      2|    dgbl->random_provider_name = OPENSSL_strdup(random_provider_fips_name);
  ------------------
  |  |  119|      2|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  535|      2|    if (dgbl->random_provider_name == NULL)
  ------------------
  |  Branch (535:9): [True: 0, False: 2]
  ------------------
  536|      0|        goto err0;
  537|      2|#endif
  538|       |
  539|      2|    dgbl->lock = CRYPTO_THREAD_lock_new();
  540|      2|    if (dgbl->lock == NULL)
  ------------------
  |  Branch (540:9): [True: 0, False: 2]
  ------------------
  541|      0|        goto err1;
  542|       |
  543|      2|    if (!CRYPTO_THREAD_init_local(&dgbl->private, NULL))
  ------------------
  |  Branch (543:9): [True: 0, False: 2]
  ------------------
  544|      0|        goto err1;
  545|       |
  546|      2|    if (!CRYPTO_THREAD_init_local(&dgbl->public, NULL))
  ------------------
  |  Branch (546:9): [True: 0, False: 2]
  ------------------
  547|      0|        goto err2;
  548|       |
  549|      2|    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|      2|{
  565|      2|    RAND_GLOBAL *dgbl = vdgbl;
  566|       |
  567|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (567:9): [True: 0, False: 2]
  ------------------
  568|      0|        return;
  569|       |
  570|      2|    CRYPTO_THREAD_lock_free(dgbl->lock);
  571|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  572|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->public);
  573|      2|    EVP_RAND_CTX_free(dgbl->primary);
  574|      2|    EVP_RAND_CTX_free(dgbl->seed);
  575|      2|#ifndef FIPS_MODULE
  576|      2|    OPENSSL_free(dgbl->random_provider_name);
  ------------------
  |  |  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|#endif      /* !FIPS_MODULE */
  578|      2|    OPENSSL_free(dgbl->rng_name);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  579|      2|    OPENSSL_free(dgbl->rng_cipher);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  580|      2|    OPENSSL_free(dgbl->rng_digest);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  581|      2|    OPENSSL_free(dgbl->rng_propq);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  582|      2|    OPENSSL_free(dgbl->seed_name);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  583|      2|    OPENSSL_free(dgbl->seed_propq);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  584|       |
  585|      2|    OPENSSL_free(dgbl);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  586|      2|}

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

ossl_self_test_set_callback_new:
   35|      2|{
   36|      2|    SELF_TEST_CB *stcb;
   37|       |
   38|      2|    stcb = OPENSSL_zalloc(sizeof(*stcb));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   39|      2|    return stcb;
   40|      2|}
ossl_self_test_set_callback_free:
   43|      2|{
   44|      2|    OPENSSL_free(stcb);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   45|      2|}

ossl_sa_new:
   59|      8|{
   60|      8|    OPENSSL_SA *res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      8|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|       |
   62|      8|    return res;
   63|      8|}
ossl_sa_free:
  111|      8|{
  112|      8|    if (sa != NULL) {
  ------------------
  |  Branch (112:9): [True: 8, False: 0]
  ------------------
  113|      8|        sa_doall(sa, &sa_free_node, NULL, NULL);
  114|      8|        OPENSSL_free(sa);
  ------------------
  |  |  115|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  115|      8|    }
  116|      8|}
ossl_sa_doall_arg:
  146|      8|{
  147|      8|    if (sa != NULL)
  ------------------
  |  Branch (147:9): [True: 8, False: 0]
  ------------------
  148|      8|        sa_doall(sa, NULL, leaf, arg);
  149|      8|}
sparse_array.c:sa_doall:
   67|     16|{
   68|     16|    int i[SA_BLOCK_MAX_LEVELS];
   69|     16|    void *nodes[SA_BLOCK_MAX_LEVELS];
   70|     16|    ossl_uintmax_t idx = 0;
   71|     16|    int l = 0;
   72|       |
   73|     16|    i[0] = 0;
   74|     16|    nodes[0] = sa->nodes;
   75|    288|    while (l >= 0) {
  ------------------
  |  Branch (75:12): [True: 272, False: 16]
  ------------------
   76|    272|        const int n = i[l];
   77|    272|        void ** const p = nodes[l];
   78|       |
   79|    272|        if (n >= SA_BLOCK_MAX) {
  ------------------
  |  |   45|    272|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|    272|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (79:13): [True: 16, False: 256]
  ------------------
   80|     16|            if (p != NULL && node != NULL)
  ------------------
  |  Branch (80:17): [True: 0, False: 16]
  |  Branch (80:30): [True: 0, False: 0]
  ------------------
   81|      0|                (*node)(p);
   82|     16|            l--;
   83|     16|            idx >>= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|     16|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   84|    256|        } else {
   85|    256|            i[l] = n + 1;
   86|    256|            if (p != NULL && p[n] != NULL) {
  ------------------
  |  Branch (86:17): [True: 0, False: 256]
  |  Branch (86:30): [True: 0, False: 0]
  ------------------
   87|      0|                idx = (idx & ~SA_BLOCK_MASK) | n;
  ------------------
  |  |   46|      0|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|      0|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|      0|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   88|      0|                if (l < sa->levels - 1) {
  ------------------
  |  Branch (88:21): [True: 0, False: 0]
  ------------------
   89|      0|                    i[++l] = 0;
   90|      0|                    nodes[l] = p[n];
   91|      0|                    idx <<= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|      0|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   92|      0|                } else if (leaf != NULL) {
  ------------------
  |  Branch (92:28): [True: 0, False: 0]
  ------------------
   93|      0|                    (*leaf)(idx, p[n], arg);
   94|      0|                }
   95|      0|            }
   96|    256|        }
   97|    272|    }
   98|     16|}

OPENSSL_sk_dup:
   49|      2|{
   50|      2|    OPENSSL_STACK *ret;
   51|       |
   52|      2|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  |  Branch (52:9): [True: 0, False: 2]
  ------------------
   53|      0|        goto err;
   54|       |
   55|      2|    if (sk == NULL) {
  ------------------
  |  Branch (55:9): [True: 2, False: 0]
  ------------------
   56|      2|        ret->num = 0;
   57|      2|        ret->sorted = 0;
   58|      2|        ret->comp = NULL;
   59|      2|    } else {
   60|       |        /* direct structure assignment */
   61|      0|        *ret = *sk;
   62|      0|    }
   63|       |
   64|      2|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (64:9): [True: 2, False: 0]
  |  Branch (64:23): [True: 0, False: 0]
  ------------------
   65|       |        /* postpone |ret->data| allocation */
   66|      2|        ret->data = NULL;
   67|      2|        ret->num_alloc = 0;
   68|      2|        return ret;
   69|      2|    }
   70|       |
   71|       |    /* duplicate |sk->data| content */
   72|      0|    ret->data = OPENSSL_malloc(sizeof(*ret->data) * sk->num_alloc);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
   73|      0|    if (ret->data == NULL)
  ------------------
  |  Branch (73:9): [True: 0, False: 0]
  ------------------
   74|      0|        goto err;
   75|      0|    memcpy(ret->data, sk->data, sizeof(void *) * sk->num);
   76|      0|    return ret;
   77|       |
   78|      0| err:
   79|      0|    OPENSSL_sk_free(ret);
   80|      0|    return NULL;
   81|      0|}
OPENSSL_sk_new_null:
  132|     12|{
  133|     12|    return OPENSSL_sk_new_reserve(NULL, 0);
  134|     12|}
OPENSSL_sk_new:
  137|      4|{
  138|      4|    return OPENSSL_sk_new_reserve(c, 0);
  139|      4|}
OPENSSL_sk_new_reserve:
  228|     16|{
  229|     16|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |  104|     16|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|       |
  231|     16|    if (st == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 16]
  ------------------
  232|      0|        return NULL;
  233|       |
  234|     16|    st->comp = c;
  235|       |
  236|     16|    if (n <= 0)
  ------------------
  |  Branch (236:9): [True: 16, False: 0]
  ------------------
  237|     16|        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|     52|{
  261|     52|    if (st != NULL)
  ------------------
  |  Branch (261:9): [True: 10, False: 42]
  ------------------
  262|     10|        st->free_thunk = f_thunk;
  263|       |
  264|     52|    return st;
  265|     52|}
OPENSSL_sk_insert:
  268|     18|{
  269|     18|    if (st == NULL) {
  ------------------
  |  Branch (269:9): [True: 0, False: 18]
  ------------------
  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|     18|    if (st->num == max_nodes) {
  ------------------
  |  Branch (273:9): [True: 0, False: 18]
  ------------------
  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|     18|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (278:9): [True: 0, False: 18]
  ------------------
  279|      0|        return 0;
  280|       |
  281|     18|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (281:9): [True: 18, False: 0]
  |  Branch (281:29): [True: 0, False: 0]
  ------------------
  282|     18|        st->data[st->num] = data;
  283|     18|    } 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|     18|    st->num++;
  289|     18|    st->sorted = 0;
  290|     18|    return st->num;
  291|     18|}
OPENSSL_sk_delete:
  319|      2|{
  320|      2|    if (st == NULL || loc < 0 || loc >= st->num)
  ------------------
  |  Branch (320:9): [True: 0, False: 2]
  |  Branch (320:23): [True: 0, False: 2]
  |  Branch (320:34): [True: 0, False: 2]
  ------------------
  321|      0|        return NULL;
  322|       |
  323|      2|    return internal_delete(st, loc);
  324|      2|}
OPENSSL_sk_push:
  407|     18|{
  408|     18|    if (st == NULL)
  ------------------
  |  Branch (408:9): [True: 0, False: 18]
  ------------------
  409|      0|        return 0;
  410|     18|    return OPENSSL_sk_insert(st, data, st->num);
  411|     18|}
OPENSSL_sk_pop_free:
  441|     52|{
  442|     52|    int i;
  443|       |
  444|     52|    if (st == NULL)
  ------------------
  |  Branch (444:9): [True: 42, False: 10]
  ------------------
  445|     42|        return;
  446|       |
  447|     10|    for (i = 0; i < st->num; i++) {
  ------------------
  |  Branch (447:17): [True: 0, False: 10]
  ------------------
  448|      0|        if (st->data[i] != NULL) {
  ------------------
  |  Branch (448:13): [True: 0, False: 0]
  ------------------
  449|      0|            if (st->free_thunk != NULL)
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|                st->free_thunk(func, (void *)st->data[i]);
  451|      0|            else
  452|      0|                func((void *)st->data[i]);
  453|      0|        }
  454|      0|    }
  455|     10|    OPENSSL_sk_free(st);
  456|     10|}
OPENSSL_sk_free:
  459|     28|{
  460|     28|    if (st == NULL)
  ------------------
  |  Branch (460:9): [True: 10, False: 18]
  ------------------
  461|     10|        return;
  462|     18|    OPENSSL_free(st->data);
  ------------------
  |  |  115|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  463|     18|    OPENSSL_free(st);
  ------------------
  |  |  115|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  464|     18|}
OPENSSL_sk_num:
  467|     10|{
  468|     10|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (468:12): [True: 2, False: 8]
  ------------------
  469|     10|}
OPENSSL_sk_value:
  472|      2|{
  473|      2|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (473:9): [True: 0, False: 2]
  |  Branch (473:23): [True: 0, False: 2]
  |  Branch (473:32): [True: 0, False: 2]
  ------------------
  474|      0|        return NULL;
  475|      2|    return (void *)st->data[i];
  476|      2|}
stack.c:sk_reserve:
  179|     18|{
  180|     18|    const void **tmpdata;
  181|     18|    int num_alloc;
  182|       |
  183|       |    /* Check to see the reservation isn't exceeding the hard limit */
  184|     18|    if (n > max_nodes - st->num) {
  ------------------
  |  Branch (184:9): [True: 0, False: 18]
  ------------------
  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|     18|    num_alloc = st->num + n;
  191|     18|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (191:9): [True: 12, False: 6]
  ------------------
  192|     12|        num_alloc = min_nodes;
  193|       |
  194|       |    /* If |st->data| allocation was postponed */
  195|     18|    if (st->data == NULL) {
  ------------------
  |  Branch (195:9): [True: 6, False: 12]
  ------------------
  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|      6|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL)
  ------------------
  |  |  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 (200:13): [True: 0, False: 6]
  ------------------
  201|      0|            return 0;
  202|      6|        st->num_alloc = num_alloc;
  203|      6|        return 1;
  204|      6|    }
  205|       |
  206|     12|    if (!exact) {
  ------------------
  |  Branch (206:9): [True: 12, False: 0]
  ------------------
  207|     12|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (207:13): [True: 10, False: 2]
  ------------------
  208|     10|            return 1;
  209|      2|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  210|      2|        if (num_alloc == 0) {
  ------------------
  |  Branch (210:13): [True: 0, False: 2]
  ------------------
  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|      2|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  ------------------
  215|      0|        return 1;
  216|      0|    }
  217|       |
  218|      2|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  109|      2|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|      2|    if (tmpdata == NULL)
  ------------------
  |  Branch (219:9): [True: 0, False: 2]
  ------------------
  220|      0|        return 0;
  221|       |
  222|      2|    st->data = tmpdata;
  223|      2|    st->num_alloc = num_alloc;
  224|      2|    return 1;
  225|      2|}
stack.c:compute_growth:
  161|      2|{
  162|      2|    int err = 0;
  163|       |
  164|      4|    while (current < target) {
  ------------------
  |  Branch (164:12): [True: 2, False: 2]
  ------------------
  165|      2|        if (current >= max_nodes)
  ------------------
  |  Branch (165:13): [True: 0, False: 2]
  ------------------
  166|      0|            return 0;
  167|       |
  168|      2|        current = safe_muldiv_int(current, 8, 5, &err);
  169|      2|        if (err != 0)
  ------------------
  |  Branch (169:13): [True: 0, False: 2]
  ------------------
  170|      0|            return 0;
  171|      2|        if (current >= max_nodes)
  ------------------
  |  Branch (171:13): [True: 0, False: 2]
  ------------------
  172|      0|            current = max_nodes;
  173|      2|    }
  174|      2|    return current;
  175|      2|}
stack.c:internal_delete:
  294|      2|{
  295|      2|    const void *ret = st->data[loc];
  296|       |
  297|      2|    if (loc != st->num - 1)
  ------------------
  |  Branch (297:9): [True: 0, False: 2]
  ------------------
  298|      0|        memmove(&st->data[loc], &st->data[loc + 1],
  299|      0|                sizeof(st->data[0]) * (st->num - loc - 1));
  300|      2|    st->num--;
  301|       |
  302|      2|    return (void *)ret;
  303|      2|}

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

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

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

ossl_crypto_mutex_new:
   97|      2|{
   98|      2|    pthread_mutex_t *mutex;
   99|       |
  100|      2|    if ((mutex = OPENSSL_zalloc(sizeof(*mutex))) == NULL)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  |  Branch (100:9): [True: 0, False: 2]
  ------------------
  101|      0|        return NULL;
  102|      2|    if (pthread_mutex_init(mutex, NULL) != 0) {
  ------------------
  |  Branch (102:9): [True: 0, False: 2]
  ------------------
  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|      2|    return (CRYPTO_MUTEX *)mutex;
  107|      2|}
ossl_crypto_mutex_free:
  142|      2|{
  143|      2|    pthread_mutex_t **mutex_p;
  144|       |
  145|      2|    if (mutex == NULL)
  ------------------
  |  Branch (145:9): [True: 0, False: 2]
  ------------------
  146|      0|        return;
  147|       |
  148|      2|    mutex_p = (pthread_mutex_t **)mutex;
  149|      2|    if (*mutex_p != NULL)
  ------------------
  |  Branch (149:9): [True: 2, False: 0]
  ------------------
  150|      2|        pthread_mutex_destroy(*mutex_p);
  151|      2|    OPENSSL_free(*mutex_p);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  152|      2|    *mutex = NULL;
  153|      2|}
ossl_crypto_condvar_new:
  156|      2|{
  157|      2|    pthread_cond_t *cv_p;
  158|       |
  159|      2|    if ((cv_p = OPENSSL_zalloc(sizeof(*cv_p))) == NULL)
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  |  Branch (159:9): [True: 0, False: 2]
  ------------------
  160|      0|        return NULL;
  161|      2|    if (pthread_cond_init(cv_p, NULL) != 0) {
  ------------------
  |  Branch (161:9): [True: 0, False: 2]
  ------------------
  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|      2|    return (CRYPTO_CONDVAR *) cv_p;
  166|      2|}
ossl_crypto_condvar_free:
  220|      2|{
  221|      2|    pthread_cond_t **cv_p;
  222|       |
  223|      2|    if (cv == NULL)
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        return;
  225|       |
  226|      2|    cv_p = (pthread_cond_t **)cv;
  227|      2|    if (*cv_p != NULL)
  ------------------
  |  Branch (227:9): [True: 2, False: 0]
  ------------------
  228|      2|        pthread_cond_destroy(*cv_p);
  229|      2|    OPENSSL_free(*cv_p);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  230|      2|    *cv_p = NULL;
  231|      2|}

ossl_threads_ctx_new:
  128|      2|{
  129|      2|    struct openssl_threads_st *t = OPENSSL_zalloc(sizeof(*t));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  130|       |
  131|      2|    if (t == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 2]
  ------------------
  132|      0|        return NULL;
  133|       |
  134|      2|    t->lock = ossl_crypto_mutex_new();
  135|      2|    t->cond_finished = ossl_crypto_condvar_new();
  136|       |
  137|      2|    if (t->lock == NULL || t->cond_finished == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 2]
  |  Branch (137:28): [True: 0, False: 2]
  ------------------
  138|      0|        goto fail;
  139|       |
  140|      2|    return t;
  141|       |
  142|      0|fail:
  143|      0|    ossl_threads_ctx_free((void *)t);
  144|      0|    return NULL;
  145|      2|}
ossl_threads_ctx_free:
  148|      2|{
  149|      2|    OSSL_LIB_CTX_THREADS *t = (OSSL_LIB_CTX_THREADS *) vdata;
  150|       |
  151|      2|    if (t == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 2]
  ------------------
  152|      0|        return;
  153|       |
  154|      2|    ossl_crypto_mutex_free(&t->lock);
  155|      2|    ossl_crypto_condvar_free(&t->cond_finished);
  156|      2|    OPENSSL_free(t);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  157|      2|}

ossl_rcu_read_lock:
  303|      6|{
  304|      6|    struct rcu_thr_data *data;
  305|      6|    int i, available_qp = -1;
  306|      6|    CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx);
  307|       |
  308|       |    /*
  309|       |     * we're going to access current_qp here so ask the
  310|       |     * processor to fetch it
  311|       |     */
  312|      6|    data = CRYPTO_THREAD_get_local(lkey);
  313|       |
  314|      6|    if (data == NULL) {
  ------------------
  |  Branch (314:9): [True: 1, False: 5]
  ------------------
  315|      1|        data = OPENSSL_zalloc(sizeof(*data));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  316|      1|        OPENSSL_assert(data != NULL);
  ------------------
  |  |  438|      1|    (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: 1, False: 0]
  |  |  ------------------
  ------------------
  317|      1|        CRYPTO_THREAD_set_local(lkey, data);
  318|      1|        ossl_init_thread_start(NULL, lock->ctx, ossl_rcu_free_local_data);
  319|      1|    }
  320|       |
  321|     66|    for (i = 0; i < MAX_QPS; i++) {
  ------------------
  |  |  196|     66|# define MAX_QPS 10
  ------------------
  |  Branch (321:17): [True: 60, False: 6]
  ------------------
  322|     60|        if (data->thread_qps[i].qp == NULL && available_qp == -1)
  ------------------
  |  Branch (322:13): [True: 60, False: 0]
  |  Branch (322:47): [True: 6, False: 54]
  ------------------
  323|      6|            available_qp = i;
  324|       |        /* If we have a hold on this lock already, we're good */
  325|     60|        if (data->thread_qps[i].lock == lock) {
  ------------------
  |  Branch (325:13): [True: 0, False: 60]
  ------------------
  326|      0|            data->thread_qps[i].depth++;
  327|      0|            return;
  328|      0|        }
  329|     60|    }
  330|       |
  331|       |    /*
  332|       |     * if we get here, then we don't have a hold on this lock yet
  333|       |     */
  334|      6|    assert(available_qp != -1);
  335|       |
  336|      6|    data->thread_qps[available_qp].qp = get_hold_current_qp(lock);
  337|      6|    data->thread_qps[available_qp].depth = 1;
  338|      6|    data->thread_qps[available_qp].lock = lock;
  339|      6|}
ossl_rcu_read_unlock:
  342|      6|{
  343|      6|    int i;
  344|      6|    CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx);
  345|      6|    struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey);
  346|      6|    uint64_t ret;
  347|       |
  348|      6|    assert(data != NULL);
  349|       |
  350|      6|    for (i = 0; i < MAX_QPS; i++) {
  ------------------
  |  |  196|      6|# define MAX_QPS 10
  ------------------
  |  Branch (350:17): [True: 6, False: 0]
  ------------------
  351|      6|        if (data->thread_qps[i].lock == lock) {
  ------------------
  |  Branch (351:13): [True: 6, False: 0]
  ------------------
  352|       |            /*
  353|       |             * we have to use __ATOMIC_RELEASE here
  354|       |             * to ensure that all preceding read instructions complete
  355|       |             * before the decrement is visible to ossl_synchronize_rcu
  356|       |             */
  357|      6|            data->thread_qps[i].depth--;
  358|      6|            if (data->thread_qps[i].depth == 0) {
  ------------------
  |  Branch (358:17): [True: 6, False: 0]
  ------------------
  359|      6|                ret = ATOMIC_SUB_FETCH(&data->thread_qps[i].qp->users,
  ------------------
  |  |  100|      6|#  define ATOMIC_SUB_FETCH(p, v, o) __atomic_sub_fetch(p, v, o)
  ------------------
  360|      6|                                       (uint64_t)1, __ATOMIC_RELEASE);
  361|      6|                OPENSSL_assert(ret != UINT64_MAX);
  ------------------
  |  |  438|      6|    (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: 6, False: 0]
  |  |  ------------------
  ------------------
  362|      6|                data->thread_qps[i].qp = NULL;
  363|      6|                data->thread_qps[i].lock = NULL;
  364|      6|            }
  365|      6|            return;
  366|      6|        }
  367|      6|    }
  368|       |    /*
  369|       |     * If we get here, we're trying to unlock a lock that we never acquired -
  370|       |     * that's fatal.
  371|       |     */
  372|      0|    assert(0);
  373|      0|}
ossl_rcu_write_lock:
  441|      8|{
  442|      8|    pthread_mutex_lock(&lock->write_lock);
  443|      8|    TSAN_FAKE_UNLOCK(&lock->write_lock);
  444|      8|}
ossl_rcu_write_unlock:
  447|      8|{
  448|      8|    TSAN_FAKE_LOCK(&lock->write_lock);
  449|      8|    pthread_mutex_unlock(&lock->write_lock);
  450|      8|}
ossl_synchronize_rcu:
  453|     10|{
  454|     10|    struct rcu_qp *qp;
  455|     10|    uint64_t count;
  456|     10|    uint32_t curr_id;
  457|     10|    struct rcu_cb_item *cb_items, *tmpcb;
  458|       |
  459|     10|    pthread_mutex_lock(&lock->write_lock);
  460|     10|    cb_items = lock->cb_items;
  461|     10|    lock->cb_items = NULL;
  462|     10|    pthread_mutex_unlock(&lock->write_lock);
  463|       |
  464|     10|    qp = update_qp(lock, &curr_id);
  465|       |
  466|       |    /* retire in order */
  467|     10|    pthread_mutex_lock(&lock->prior_lock);
  468|     10|    while (lock->next_to_retire != curr_id)
  ------------------
  |  Branch (468:12): [True: 0, False: 10]
  ------------------
  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|     10|    do {
  481|     10|        count = ATOMIC_LOAD_N(uint64_t, &qp->users, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|     10|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  482|     10|    } while (count != (uint64_t)0);
  ------------------
  |  Branch (482:14): [True: 0, False: 10]
  ------------------
  483|       |
  484|     10|    lock->next_to_retire++;
  485|     10|    pthread_cond_broadcast(&lock->prior_signal);
  486|     10|    pthread_mutex_unlock(&lock->prior_lock);
  487|       |
  488|     10|    retire_qp(lock, qp);
  489|       |
  490|       |    /* handle any callbacks that we have */
  491|     12|    while (cb_items != NULL) {
  ------------------
  |  Branch (491:12): [True: 2, False: 10]
  ------------------
  492|      2|        tmpcb = cb_items;
  493|      2|        cb_items = cb_items->next;
  494|      2|        tmpcb->fn(tmpcb->data);
  495|      2|        OPENSSL_free(tmpcb);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  496|      2|    }
  497|     10|}
ossl_rcu_call:
  504|      2|{
  505|      2|    struct rcu_cb_item *new =
  506|      2|        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__
  |  |  ------------------
  ------------------
  507|       |
  508|      2|    if (new == NULL)
  ------------------
  |  Branch (508:9): [True: 0, False: 2]
  ------------------
  509|      0|        return 0;
  510|       |
  511|      2|    new->data = data;
  512|      2|    new->fn = cb;
  513|       |
  514|      2|    new->next = lock->cb_items;
  515|      2|    lock->cb_items = new;
  516|       |
  517|      2|    return 1;
  518|      2|}
ossl_rcu_uptr_deref:
  521|     51|{
  522|     51|    return ATOMIC_LOAD_N(pvoid, p, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|     51|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  523|     51|}
ossl_rcu_assign_uptr:
  526|      8|{
  527|      8|    ATOMIC_STORE(pvoid, p, v, __ATOMIC_RELEASE);
  ------------------
  |  |   98|      8|#  define ATOMIC_STORE(t, p, v, o) __atomic_store(p, v, o)
  ------------------
  528|      8|}
ossl_rcu_lock_new:
  531|      6|{
  532|      6|    struct rcu_lock_st *new;
  533|       |
  534|       |    /*
  535|       |     * We need a minimum of 2 qp's
  536|       |     */
  537|      6|    if (num_writers < 2)
  ------------------
  |  Branch (537:9): [True: 6, False: 0]
  ------------------
  538|      6|        num_writers = 2;
  539|       |
  540|      6|    ctx = ossl_lib_ctx_get_concrete(ctx);
  541|      6|    if (ctx == NULL)
  ------------------
  |  Branch (541:9): [True: 0, False: 6]
  ------------------
  542|      0|        return 0;
  543|       |
  544|      6|    new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  545|      6|    if (new == NULL)
  ------------------
  |  Branch (545:9): [True: 0, False: 6]
  ------------------
  546|      0|        return NULL;
  547|       |
  548|      6|    new->ctx = ctx;
  549|      6|    pthread_mutex_init(&new->write_lock, NULL);
  550|      6|    pthread_mutex_init(&new->prior_lock, NULL);
  551|      6|    pthread_mutex_init(&new->alloc_lock, NULL);
  552|      6|    pthread_cond_init(&new->prior_signal, NULL);
  553|      6|    pthread_cond_init(&new->alloc_signal, NULL);
  554|       |
  555|      6|    new->qp_group = allocate_new_qp_group(new, num_writers);
  556|      6|    if (new->qp_group == NULL) {
  ------------------
  |  Branch (556:9): [True: 0, False: 6]
  ------------------
  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|      6|    return new;
  562|      6|}
ossl_rcu_lock_free:
  565|      4|{
  566|      4|    struct rcu_lock_st *rlock = (struct rcu_lock_st *)lock;
  567|       |
  568|      4|    if (lock == NULL)
  ------------------
  |  Branch (568:9): [True: 0, False: 4]
  ------------------
  569|      0|        return;
  570|       |
  571|       |    /* make sure we're synchronized */
  572|      4|    ossl_synchronize_rcu(rlock);
  573|       |
  574|      4|    OPENSSL_free(rlock->qp_group);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  575|       |    /* There should only be a single qp left now */
  576|      4|    OPENSSL_free(rlock);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  577|      4|}
CRYPTO_THREAD_lock_new:
  580|     48|{
  581|     48|# ifdef USE_RWLOCK
  582|     48|    CRYPTO_RWLOCK *lock;
  583|       |
  584|     48|    if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL)
  ------------------
  |  |  104|     48|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     48|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     48|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (584:9): [True: 0, False: 48]
  ------------------
  585|       |        /* Don't set error, to avoid recursion blowup. */
  586|      0|        return NULL;
  587|       |
  588|     48|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (588:9): [True: 0, False: 48]
  ------------------
  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|     48|    return lock;
  622|     48|}
CRYPTO_THREAD_read_lock:
  625|    152|{
  626|    152|# ifdef USE_RWLOCK
  627|    152|    if (!ossl_assert(pthread_rwlock_rdlock(lock) == 0))
  ------------------
  |  |   52|    152|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    152|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (627:9): [True: 0, False: 152]
  ------------------
  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|    152|    return 1;
  637|    152|}
CRYPTO_THREAD_write_lock:
  640|    230|{
  641|    230|# ifdef USE_RWLOCK
  642|    230|    if (!ossl_assert(pthread_rwlock_wrlock(lock) == 0))
  ------------------
  |  |   52|    230|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    230|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (642:9): [True: 0, False: 230]
  ------------------
  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|    230|    return 1;
  652|    230|}
CRYPTO_THREAD_unlock:
  655|    382|{
  656|    382|# ifdef USE_RWLOCK
  657|    382|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (657:9): [True: 0, False: 382]
  ------------------
  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|    382|    return 1;
  667|    382|}
CRYPTO_THREAD_lock_free:
  670|     60|{
  671|     60|    if (lock == NULL)
  ------------------
  |  Branch (671:9): [True: 14, False: 46]
  ------------------
  672|     14|        return;
  673|       |
  674|     46|# ifdef USE_RWLOCK
  675|     46|    pthread_rwlock_destroy(lock);
  676|       |# else
  677|       |    pthread_mutex_destroy(lock);
  678|       |# endif
  679|     46|    OPENSSL_free(lock);
  ------------------
  |  |  115|     46|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     46|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     46|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  680|       |
  681|     46|    return;
  682|     60|}
CRYPTO_THREAD_run_once:
  685|    172|{
  686|    172|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (686:9): [True: 0, False: 172]
  ------------------
  687|      0|        return 0;
  688|       |
  689|    172|    return 1;
  690|    172|}
CRYPTO_THREAD_init_local:
  693|     14|{
  694|     14|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (694:9): [True: 0, False: 14]
  ------------------
  695|      0|        return 0;
  696|       |
  697|     14|    return 1;
  698|     14|}
CRYPTO_THREAD_get_local:
  701|     30|{
  702|     30|    return pthread_getspecific(*key);
  703|     30|}
CRYPTO_THREAD_set_local:
  706|     16|{
  707|     16|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (707:9): [True: 0, False: 16]
  ------------------
  708|      0|        return 0;
  709|       |
  710|     16|    return 1;
  711|     16|}
CRYPTO_THREAD_cleanup_local:
  714|     14|{
  715|     14|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (715:9): [True: 0, False: 14]
  ------------------
  716|      0|        return 0;
  717|       |
  718|     14|    return 1;
  719|     14|}
CRYPTO_atomic_or:
  811|      2|{
  812|      2|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  813|      2|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (813:9): [Folded - Ignored]
  ------------------
  814|      2|        *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
  815|      2|        return 1;
  816|      2|    }
  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|     14|{
  837|     14|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  838|     14|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (838:9): [Folded - Ignored]
  ------------------
  839|     14|        __atomic_load(val, ret, __ATOMIC_ACQUIRE);
  840|     14|        return 1;
  841|     14|    }
  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|      2|{
  860|      2|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  861|      2|    if (__atomic_is_lock_free(sizeof(*dst), dst)) {
  ------------------
  |  Branch (861:9): [Folded - Ignored]
  ------------------
  862|      2|        __atomic_store(dst, &val, __ATOMIC_RELEASE);
  863|      2|        return 1;
  864|      2|    }
  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|}
threads_pthread.c:ossl_rcu_free_local_data:
  293|      1|{
  294|      1|    OSSL_LIB_CTX *ctx = arg;
  295|      1|    CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(ctx);
  296|      1|    struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey);
  297|       |
  298|      1|    OPENSSL_free(data);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  299|      1|    CRYPTO_THREAD_set_local(lkey, NULL);
  300|      1|}
threads_pthread.c:get_hold_current_qp:
  259|      6|{
  260|      6|    uint32_t qp_idx;
  261|       |
  262|       |    /* get the current qp index */
  263|      6|    for (;;) {
  264|      6|        qp_idx = ATOMIC_LOAD_N(uint32_t, &lock->reader_idx, __ATOMIC_RELAXED);
  ------------------
  |  |   96|      6|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  265|       |
  266|       |        /*
  267|       |         * Notes on use of __ATOMIC_ACQUIRE
  268|       |         * We need to ensure the following:
  269|       |         * 1) That subsequent operations aren't optimized by hoisting them above
  270|       |         * this operation.  Specifically, we don't want the below re-load of
  271|       |         * qp_idx to get optimized away
  272|       |         * 2) We want to ensure that any updating of reader_idx on the write side
  273|       |         * of the lock is flushed from a local cpu cache so that we see any
  274|       |         * updates prior to the load.  This is a non-issue on cache coherent
  275|       |         * systems like x86, but is relevant on other arches
  276|       |         */
  277|      6|        ATOMIC_ADD_FETCH(&lock->qp_group[qp_idx].users, (uint64_t)1,
  ------------------
  |  |   99|      6|#  define ATOMIC_ADD_FETCH(p, v, o) __atomic_add_fetch(p, v, o)
  ------------------
  278|      6|                         __ATOMIC_ACQUIRE);
  279|       |
  280|       |        /* if the idx hasn't changed, we're good, else try again */
  281|      6|        if (qp_idx == ATOMIC_LOAD_N(uint32_t, &lock->reader_idx,
  ------------------
  |  |   96|      6|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  |  Branch (281:13): [True: 6, False: 0]
  ------------------
  282|      6|                                    __ATOMIC_RELAXED))
  283|      6|            break;
  284|       |
  285|      0|        ATOMIC_SUB_FETCH(&lock->qp_group[qp_idx].users, (uint64_t)1,
  ------------------
  |  |  100|      0|#  define ATOMIC_SUB_FETCH(p, v, o) __atomic_sub_fetch(p, v, o)
  ------------------
  286|      0|                         __ATOMIC_RELAXED);
  287|      0|    }
  288|       |
  289|      6|    return &lock->qp_group[qp_idx];
  290|      6|}
threads_pthread.c:update_qp:
  380|     10|{
  381|     10|    uint32_t current_idx;
  382|       |
  383|     10|    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|     10|    while (lock->group_count - lock->writers_alloced < 2)
  ------------------
  |  Branch (390:12): [True: 0, False: 10]
  ------------------
  391|       |        /* we have to wait for one to be free */
  392|      0|        pthread_cond_wait(&lock->alloc_signal, &lock->alloc_lock);
  393|       |
  394|     10|    current_idx = lock->current_alloc_idx;
  395|       |
  396|       |    /* Allocate the qp */
  397|     10|    lock->writers_alloced++;
  398|       |
  399|       |    /* increment the allocation index */
  400|     10|    lock->current_alloc_idx =
  401|     10|        (lock->current_alloc_idx + 1) % lock->group_count;
  402|       |
  403|     10|    *curr_id = lock->id_ctr;
  404|     10|    lock->id_ctr++;
  405|       |
  406|     10|    ATOMIC_STORE_N(uint32_t, &lock->reader_idx, lock->current_alloc_idx,
  ------------------
  |  |   97|     10|#  define ATOMIC_STORE_N(t, p, v, o) __atomic_store_n(p, v, o)
  ------------------
  407|     10|                   __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|     10|    ATOMIC_ADD_FETCH(&lock->qp_group[current_idx].users, (uint64_t)0,
  ------------------
  |  |   99|     10|#  define ATOMIC_ADD_FETCH(p, v, o) __atomic_add_fetch(p, v, o)
  ------------------
  414|     10|                     __ATOMIC_RELEASE);
  415|       |
  416|       |    /* wake up any waiters */
  417|     10|    pthread_cond_signal(&lock->alloc_signal);
  418|     10|    pthread_mutex_unlock(&lock->alloc_lock);
  419|     10|    return &lock->qp_group[current_idx];
  420|     10|}
threads_pthread.c:retire_qp:
  423|     10|{
  424|     10|    pthread_mutex_lock(&lock->alloc_lock);
  425|     10|    lock->writers_alloced--;
  426|     10|    pthread_cond_signal(&lock->alloc_signal);
  427|     10|    pthread_mutex_unlock(&lock->alloc_lock);
  428|     10|}
threads_pthread.c:allocate_new_qp_group:
  432|      6|{
  433|      6|    struct rcu_qp *new =
  434|      6|        OPENSSL_zalloc(sizeof(*new) * count);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  435|       |
  436|      6|    lock->group_count = count;
  437|      6|    return new;
  438|      6|}

ossl_trace_cleanup:
  340|      2|{
  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|      2|}
OSSL_trace_set_channel:
  362|      2|{
  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|      2|    return 0;
  369|      2|}

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

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

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

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

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

FuzzerInitialize:
  101|      2|{
  102|      2|    HT_CONFIG fuzz_conf = {NULL, fuzz_free_cb, NULL, 0, 1};
  103|       |
  104|      2|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  105|      2|    ERR_clear_error();
  106|      2|    prediction_table = OPENSSL_zalloc(sizeof(FUZZER_VALUE) * 65537);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  107|      2|    if (prediction_table == NULL)
  ------------------
  |  Branch (107:9): [True: 0, False: 2]
  ------------------
  108|      0|        return -1;
  109|      2|    fuzzer_table = ossl_ht_new(&fuzz_conf);
  110|      2|    if (fuzzer_table == NULL) {
  ------------------
  |  Branch (110:9): [True: 0, False: 2]
  ------------------
  111|      0|        OPENSSL_free(prediction_table);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  112|      0|        return -1;
  113|      0|    }
  114|       |
  115|      2|    return 0;
  116|      2|}
FuzzerTestOneInput:
  119|     15|{
  120|     15|    uint8_t op_flags;
  121|     15|    uint16_t keyval;
  122|     15|    int rc;
  123|     15|    int rc_prediction = 1;
  124|     15|    size_t i;
  125|     15|    FUZZER_VALUE *valptr, *lval;
  126|     15|    FUZZER_KEY key;
  127|     15|    HT_VALUE *v = NULL;
  128|     15|    HT_VALUE tv;
  129|     15|    HT_VALUE_LIST *htvlist;
  130|       |
  131|       |    /*
  132|       |     * We need at least 11 bytes to be able to do anything here
  133|       |     * 1 byte to detect the operation to perform, 2 bytes
  134|       |     * for the lookup key, and 8 bytes of value
  135|       |     */
  136|     15|    if (len < 11) {
  ------------------
  |  Branch (136:9): [True: 0, False: 15]
  ------------------
  137|      0|        skipped_values++;
  138|      0|        return -1;
  139|      0|    }
  140|       |
  141|       |    /*
  142|       |     * parse out our operation flags and key
  143|       |     */
  144|     15|    op_flags = buf[0];
  145|     15|    memcpy(&keyval, &buf[1], sizeof(uint16_t));
  146|       |
  147|       |    /*
  148|       |     * Initialize our key
  149|       |     */
  150|     15|    HT_INIT_KEY(&key);
  ------------------
  |  |  107|     15|#define HT_INIT_KEY(key) do { \
  |  |  108|     15|memset((key), 0, sizeof(*(key))); \
  |  |  109|     15|(key)->key_header.keysize = (sizeof(*(key)) - sizeof(HT_KEY)); \
  |  |  110|     15|(key)->key_header.keybuf = (((uint8_t *)key) + sizeof(HT_KEY)); \
  |  |  111|     15|} while(0)
  |  |  ------------------
  |  |  |  Branch (111:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|       |
  152|       |    /*
  153|       |     * Now do our operation
  154|       |     */
  155|     15|    switch(OPERATION(op_flags)) {
  ------------------
  |  |   65|     15|#define OPERATION(x) (((x) & OP_MASK) % OP_END)
  |  |  ------------------
  |  |  |  |   63|     15|#define OP_MASK 0x3f
  |  |  ------------------
  |  |               #define OPERATION(x) (((x) & OP_MASK) % OP_END)
  |  |  ------------------
  |  |  |  |   61|     15|#define OP_END     6 
  |  |  ------------------
  ------------------
  156|      2|    case OP_INSERT:
  ------------------
  |  |   55|      2|#define OP_INSERT  0
  ------------------
  |  Branch (156:5): [True: 2, False: 13]
  ------------------
  157|      2|        valptr = &prediction_table[keyval];
  158|       |
  159|       |        /* reset our key */
  160|      2|        HT_KEY_RESET(&key);
  ------------------
  |  |  116|      2|#define HT_KEY_RESET(key) memset((key)->key_header.keybuf, 0, (key)->key_header.keysize)
  ------------------
  161|       |
  162|       |        /* set the proper key value */
  163|      2|        HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
  ------------------
  |  |  121|      2|#define HT_SET_KEY_FIELD(key, member, value) (key)->keyfields.member = value;
  ------------------
  164|       |
  165|       |        /* lock the table */
  166|      2|        ossl_ht_write_lock(fuzzer_table);
  167|       |
  168|       |        /*
  169|       |         * If the value to insert is already allocated
  170|       |         * then we expect a conflict in the insert
  171|       |         * i.e. we predict a return code of 0 instead
  172|       |         * of 1. On replacement, we expect it to succeed
  173|       |         * always
  174|       |         */
  175|      2|        if (valptr->flags & FZ_FLAG_ALLOCATED) {
  ------------------
  |  |   31|      2|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  |  Branch (175:13): [True: 0, False: 2]
  ------------------
  176|      0|            if (!IS_REPLACE(op_flags))
  ------------------
  |  |   66|      0|#define IS_REPLACE(x) ((x) & INSERT_REPLACE_MASK)
  |  |  ------------------
  |  |  |  |   64|      0|#define INSERT_REPLACE_MASK 0x40
  |  |  ------------------
  ------------------
  |  Branch (176:17): [True: 0, False: 0]
  ------------------
  177|      0|                rc_prediction = 0;
  178|      0|        }
  179|       |
  180|      2|        memcpy(&valptr->value, &buf[3], sizeof(uint64_t));
  181|       |        /*
  182|       |         * do the insert/replace
  183|       |         */
  184|      2|        if (IS_REPLACE(op_flags))
  ------------------
  |  |   66|      2|#define IS_REPLACE(x) ((x) & INSERT_REPLACE_MASK)
  |  |  ------------------
  |  |  |  |   64|      2|#define INSERT_REPLACE_MASK 0x40
  |  |  ------------------
  |  |  |  Branch (66:23): [True: 1, False: 1]
  |  |  ------------------
  ------------------
  185|      1|            rc = ossl_ht_fz_FUZZER_VALUE_insert(fuzzer_table, TO_HT_KEY(&key),
  ------------------
  |  |  173|      1|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  186|      1|                                                valptr, &lval);
  187|      1|        else
  188|      1|            rc = ossl_ht_fz_FUZZER_VALUE_insert(fuzzer_table, TO_HT_KEY(&key),
  ------------------
  |  |  173|      1|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  189|      1|                                                valptr, NULL);
  190|       |
  191|      2|        if (rc == -1)
  ------------------
  |  Branch (191:13): [True: 0, False: 2]
  ------------------
  192|       |            /* failed to grow the hash table due to too many collisions */
  193|      0|            break;
  194|       |
  195|       |        /*
  196|       |         * mark the entry as being allocated
  197|       |         */
  198|      2|        valptr->flags |= FZ_FLAG_ALLOCATED;
  ------------------
  |  |   31|      2|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  199|       |
  200|       |        /*
  201|       |         * unlock the table
  202|       |         */
  203|      2|        ossl_ht_write_unlock(fuzzer_table);
  204|       |
  205|       |        /*
  206|       |         * Now check to make sure we did the right thing
  207|       |         */
  208|      2|        OPENSSL_assert(rc == rc_prediction);
  ------------------
  |  |  438|      2|    (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: 2, False: 0]
  |  |  ------------------
  ------------------
  209|       |
  210|       |        /*
  211|       |         * successful insertion if there wasn't a conflict
  212|       |         */
  213|      2|        if (rc_prediction == 1)
  ------------------
  |  Branch (213:13): [True: 2, False: 0]
  ------------------
  214|      2|            IS_REPLACE(op_flags) ? replacements++ : inserts++;
  ------------------
  |  |   66|      2|#define IS_REPLACE(x) ((x) & INSERT_REPLACE_MASK)
  |  |  ------------------
  |  |  |  |   64|      2|#define INSERT_REPLACE_MASK 0x40
  |  |  ------------------
  |  |  |  Branch (66:23): [True: 1, False: 1]
  |  |  ------------------
  ------------------
  215|      2|        break;
  216|       |
  217|      0|    case OP_DELETE:
  ------------------
  |  |   56|      0|#define OP_DELETE  1
  ------------------
  |  Branch (217:5): [True: 0, False: 15]
  ------------------
  218|      0|        valptr = &prediction_table[keyval];
  219|       |
  220|       |        /* reset our key */
  221|      0|        HT_KEY_RESET(&key);
  ------------------
  |  |  116|      0|#define HT_KEY_RESET(key) memset((key)->key_header.keybuf, 0, (key)->key_header.keysize)
  ------------------
  222|       |
  223|       |        /* set the proper key value */
  224|      0|        HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
  ------------------
  |  |  121|      0|#define HT_SET_KEY_FIELD(key, member, value) (key)->keyfields.member = value;
  ------------------
  225|       |
  226|       |        /* lock the table */
  227|      0|        ossl_ht_write_lock(fuzzer_table);
  228|       |
  229|       |        /*
  230|       |         * If the value to delete is not already allocated
  231|       |         * then we expect a miss in the delete
  232|       |         * i.e. we predict a return code of 0 instead
  233|       |         * of 1
  234|       |         */
  235|      0|        if (!(valptr->flags & FZ_FLAG_ALLOCATED))
  ------------------
  |  |   31|      0|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  |  Branch (235:13): [True: 0, False: 0]
  ------------------
  236|      0|            rc_prediction = 0;
  237|       |
  238|       |        /*
  239|       |         * do the delete
  240|       |         */
  241|      0|        rc = ossl_ht_delete(fuzzer_table, TO_HT_KEY(&key));
  ------------------
  |  |  173|      0|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  242|       |
  243|       |        /*
  244|       |         * unlock the table
  245|       |         */
  246|      0|        ossl_ht_write_unlock(fuzzer_table);
  247|       |
  248|       |        /*
  249|       |         * Now check to make sure we did the right thing
  250|       |         */
  251|      0|        OPENSSL_assert(rc == rc_prediction);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  252|       |
  253|       |        /*
  254|       |         * once the unlock is done, the table rcu will have synced
  255|       |         * meaning the free function has run, so we can confirm now
  256|       |         * that the valptr is no longer allocated
  257|       |         */
  258|      0|        OPENSSL_assert(!(valptr->flags & FZ_FLAG_ALLOCATED));
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  259|       |
  260|       |        /*
  261|       |         * successful deletion if there wasn't a conflict
  262|       |         */
  263|      0|        if (rc_prediction == 1)
  ------------------
  |  Branch (263:13): [True: 0, False: 0]
  ------------------
  264|      0|            deletes++;
  265|       |
  266|      0|        break;
  267|       |
  268|      6|    case OP_LOOKUP:
  ------------------
  |  |   57|      6|#define OP_LOOKUP  2
  ------------------
  |  Branch (268:5): [True: 6, False: 9]
  ------------------
  269|      6|        valptr = &prediction_table[keyval];
  270|      6|        lval = NULL;
  271|       |
  272|       |        /* reset our key */
  273|      6|        HT_KEY_RESET(&key);
  ------------------
  |  |  116|      6|#define HT_KEY_RESET(key) memset((key)->key_header.keybuf, 0, (key)->key_header.keysize)
  ------------------
  274|       |
  275|       |        /* set the proper key value */
  276|      6|        HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
  ------------------
  |  |  121|      6|#define HT_SET_KEY_FIELD(key, member, value) (key)->keyfields.member = value;
  ------------------
  277|       |
  278|       |        /* lock the table for reading */
  279|      6|        ossl_ht_read_lock(fuzzer_table);
  280|       |
  281|       |        /*
  282|       |         * If the value to find is not already allocated
  283|       |         * then we expect a miss in the lookup
  284|       |         * i.e. we predict a return code of NULL instead
  285|       |         * of a pointer
  286|       |         */
  287|      6|        if (!(valptr->flags & FZ_FLAG_ALLOCATED))
  ------------------
  |  |   31|      6|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  |  Branch (287:13): [True: 6, False: 0]
  ------------------
  288|      6|            valptr = NULL;
  289|       |
  290|       |        /*
  291|       |         * do the lookup
  292|       |         */
  293|      6|        lval = ossl_ht_fz_FUZZER_VALUE_get(fuzzer_table, TO_HT_KEY(&key), &v);
  ------------------
  |  |  173|      6|#define TO_HT_KEY(key) &(key)->key_header
  ------------------
  294|       |
  295|       |        /*
  296|       |         * unlock the table
  297|       |         */
  298|      6|        ossl_ht_read_unlock(fuzzer_table);
  299|       |
  300|       |        /*
  301|       |         * Now check to make sure we did the right thing
  302|       |         */
  303|      6|        OPENSSL_assert(lval == valptr);
  ------------------
  |  |  438|      6|    (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: 6, False: 0]
  |  |  ------------------
  ------------------
  304|       |
  305|       |        /*
  306|       |         * if we expect a positive lookup, make sure that
  307|       |         * we can use the _type and to_value functions
  308|       |         */
  309|      6|        if (valptr != NULL) {
  ------------------
  |  Branch (309:13): [True: 0, False: 6]
  ------------------
  310|      0|            OPENSSL_assert(ossl_ht_fz_FUZZER_VALUE_type(v) == 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:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  311|       |
  312|      0|            v = ossl_ht_fz_FUZZER_VALUE_to_value(lval, &tv);
  313|      0|            OPENSSL_assert(v->value == lval);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  314|      0|        }
  315|       |
  316|       |        /*
  317|       |         * successful lookup if we didn't expect a miss
  318|       |         */
  319|      6|        if (valptr != NULL)
  ------------------
  |  Branch (319:13): [True: 0, False: 6]
  ------------------
  320|      0|            lookups++;
  321|       |
  322|      6|        break;
  323|       |
  324|      0|    case OP_FLUSH:
  ------------------
  |  |   58|      0|#define OP_FLUSH   3
  ------------------
  |  Branch (324:5): [True: 0, False: 15]
  ------------------
  325|       |        /*
  326|       |         * only flush the table rarely 
  327|       |         */
  328|      0|        if ((flushes % 100000) != 1) {
  ------------------
  |  Branch (328:13): [True: 0, False: 0]
  ------------------
  329|      0|            skipped_values++;
  330|      0|            flushes++;
  331|      0|            return 0;
  332|      0|        }
  333|       |
  334|       |        /*
  335|       |         * lock the table
  336|       |         */
  337|      0|        ossl_ht_write_lock(fuzzer_table);
  338|      0|        ossl_ht_flush(fuzzer_table);
  339|      0|        ossl_ht_write_unlock(fuzzer_table);
  340|       |
  341|       |        /*
  342|       |         * now check to make sure everything is free
  343|       |         */
  344|      0|       for (i = 0; i < USHRT_MAX; i++)
  ------------------
  |  Branch (344:20): [True: 0, False: 0]
  ------------------
  345|      0|            OPENSSL_assert((prediction_table[i].flags & FZ_FLAG_ALLOCATED) == 0);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  346|       |
  347|       |        /* good flush */
  348|      0|        flushes++;
  349|      0|        break;
  350|       |
  351|      3|    case OP_FOREACH:
  ------------------
  |  |   59|      3|#define OP_FOREACH 4
  ------------------
  |  Branch (351:5): [True: 3, False: 12]
  ------------------
  352|      3|        valfound = 0;
  353|      3|        valptr = &prediction_table[keyval];
  354|       |
  355|      3|        rc_prediction = 0;
  356|      3|        if (valptr->flags & FZ_FLAG_ALLOCATED)
  ------------------
  |  |   31|      3|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  |  Branch (356:13): [True: 0, False: 3]
  ------------------
  357|      0|            rc_prediction = 1;
  358|       |
  359|      3|        ossl_ht_foreach_until(fuzzer_table, table_iterator, &keyval);
  360|       |
  361|      3|        OPENSSL_assert(valfound == rc_prediction);
  ------------------
  |  |  438|      3|    (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: 3, False: 0]
  |  |  ------------------
  ------------------
  362|       |
  363|      3|        foreaches++;
  364|      3|        break;
  365|       |
  366|      4|    case OP_FILTER:
  ------------------
  |  |   60|      4|#define OP_FILTER  5
  ------------------
  |  Branch (366:5): [True: 4, False: 11]
  ------------------
  367|      4|        valptr = &prediction_table[keyval];
  368|       |
  369|      4|        rc_prediction = 0;
  370|      4|        if (valptr->flags & FZ_FLAG_ALLOCATED)
  ------------------
  |  |   31|      4|#define FZ_FLAG_ALLOCATED (1 << 0)
  ------------------
  |  Branch (370:13): [True: 0, False: 4]
  ------------------
  371|      0|            rc_prediction = 1;
  372|       |
  373|      4|        htvlist = ossl_ht_filter(fuzzer_table, 1, filter_iterator, &keyval);
  374|       |
  375|      4|        OPENSSL_assert(htvlist->list_len == (size_t)rc_prediction);
  ------------------
  |  |  438|      4|    (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: 4, False: 0]
  |  |  ------------------
  ------------------
  376|       |
  377|      4|        ossl_ht_value_list_free(htvlist);
  378|      4|        filters++;
  379|      4|        break;
  380|       |
  381|      0|    default:
  ------------------
  |  Branch (381:5): [True: 0, False: 15]
  ------------------
  382|      0|        return -1;
  383|     15|    }
  384|       |
  385|     15|    return 0;
  386|     15|}
hashtable.c:table_iterator:
   69|      4|{
   70|      4|    uint16_t keyval = (*(uint16_t *)arg);
   71|      4|    FUZZER_VALUE *f = ossl_ht_fz_FUZZER_VALUE_from_value(v);
   72|       |
   73|      4|    if (f != NULL && f == &prediction_table[keyval]) {
  ------------------
  |  Branch (73:9): [True: 4, False: 0]
  |  Branch (73:22): [True: 0, False: 4]
  ------------------
   74|      0|        valfound = 1;
   75|      0|        return 0;
   76|      0|    }
   77|       |
   78|      4|    return 1;
   79|      4|}
hashtable.c:filter_iterator:
   82|      4|{
   83|      4|    uint16_t keyval = (*(uint16_t *)arg);
   84|      4|    FUZZER_VALUE *f = ossl_ht_fz_FUZZER_VALUE_from_value(v);
   85|       |
   86|      4|    if (f != NULL && f == &prediction_table[keyval])
  ------------------
  |  Branch (86:9): [True: 4, False: 0]
  |  Branch (86:22): [True: 0, False: 4]
  ------------------
   87|      0|        return 1;
   88|       |
   89|      4|    return 0;
   90|      4|}

property.c:ossl_sa_ALGORITHM_new:
   27|      8|    { \
   28|      8|        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
   29|      8|    } \
property.c:ossl_sa_ALGORITHM_doall_arg:
   56|      8|    { \
   57|      8|        ossl_sa_doall_arg((OPENSSL_SA *)sa, \
   58|      8|                          (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
   59|      8|    } \
property.c:ossl_sa_ALGORITHM_free:
   32|      8|    { \
   33|      8|        ossl_sa_free((OPENSSL_SA *)sa); \
   34|      8|    } \

threads_pthread.c:ossl_assert_int:
   45|    382|{
   46|    382|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 382]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    382|    return expr;
   50|    382|}

hashtable.c:ossl_ht_fz_FUZZER_VALUE_from_value:
  206|      8|pfx ossl_unused vtype *ossl_ht_##name##_##vtype##_from_value(HT_VALUE *v)      \
  207|      8|{                                                                              \
  208|      8|    uintptr_t *expect_type = &name##_##vtype##_id;                             \
  209|      8|    if (v == NULL)                                                             \
  ------------------
  |  Branch (209:9): [True: 0, False: 8]
  ------------------
  210|      8|        return NULL;                                                           \
  211|      8|    if (v->type_id != expect_type)                                             \
  ------------------
  |  Branch (211:9): [True: 0, False: 8]
  ------------------
  212|      8|        return NULL;                                                           \
  213|      8|    return (vtype *)v->value;                                                  \
  214|      8|}                                                                              \
hashtable.c:ossl_ht_fz_FUZZER_VALUE_insert:
  193|      2|                                                      vtype **olddata) {       \
  194|      2|    HT_VALUE inval;                                                            \
  195|      2|    HT_VALUE *oval = NULL;                                                     \
  196|      2|    int rc;                                                                    \
  197|      2|                                                                               \
  198|      2|    inval.value = data;                                                        \
  199|      2|    inval.type_id = &name##_##vtype##_id;                                      \
  200|      2|    rc = ossl_ht_insert(h, key, &inval, olddata == NULL ? NULL : &oval);       \
  ------------------
  |  Branch (200:41): [True: 1, False: 1]
  ------------------
  201|      2|    if (oval != NULL)                                                          \
  ------------------
  |  Branch (201:9): [True: 0, False: 2]
  ------------------
  202|      2|        *olddata = (vtype *)oval->value;                                       \
  203|      2|    return rc;                                                                 \
  204|      2|}                                                                              \
hashtable.c:ossl_ht_fz_FUZZER_VALUE_get:
  218|      6|                                                                  HT_VALUE **v)\
  219|      6|{                                                                              \
  220|      6|    HT_VALUE *vv;                                                              \
  221|      6|    vv = ossl_ht_get(h, key);                                                  \
  222|      6|    if (vv == NULL)                                                            \
  ------------------
  |  Branch (222:9): [True: 6, False: 0]
  ------------------
  223|      6|        return NULL;                                                           \
  224|      6|    *v = ossl_rcu_deref(&vv);                                                  \
  ------------------
  |  |   30|      0|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  225|      0|    return ossl_ht_##name##_##vtype##_from_value(*v);                          \
  226|      6|}                                                                              \

bio_lib.c:CRYPTO_FREE_REF:
  285|      2|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      2|{
  287|      2|}

stack.c:safe_muldiv_int:
  324|      2|    {                                                                        \
  325|      2|        int e2 = 0;                                                          \
  326|      2|        type q, r, x, y;                                                     \
  327|      2|                                                                             \
  328|      2|        if (c == 0) {                                                        \
  ------------------
  |  Branch (328:13): [True: 0, False: 2]
  ------------------
  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|      2|        x = safe_mul_ ## type_name(a, b, &e2);                               \
  333|      2|        if (!e2)                                                             \
  ------------------
  |  Branch (333:13): [True: 2, False: 0]
  ------------------
  334|      2|            return safe_div_ ## type_name(x, c, err);                        \
  335|      2|        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|      2|    }
stack.c:safe_mul_int:
  138|      2|    {                                                                        \
  139|      2|        type r;                                                              \
  140|      2|                                                                             \
  141|      2|        if (!__builtin_mul_overflow(a, b, &r))                               \
  ------------------
  |  Branch (141:13): [True: 2, False: 0]
  ------------------
  142|      2|            return r;                                                        \
  143|      2|        *err |= 1;                                                           \
  144|      0|        return (a < 0) ^ (b < 0) ? min : max;                                \
  ------------------
  |  Branch (144:16): [True: 0, False: 0]
  ------------------
  145|      2|    }
stack.c:safe_div_int:
  201|      2|    {                                                                        \
  202|      2|        if (b == 0) {                                                        \
  ------------------
  |  Branch (202:13): [True: 0, False: 2]
  ------------------
  203|      0|            *err |= 1;                                                       \
  204|      0|            return a < 0 ? min : max;                                        \
  ------------------
  |  Branch (204:20): [True: 0, False: 0]
  ------------------
  205|      0|        }                                                                    \
  206|      2|        if (b == -1 && a == min) {                                           \
  ------------------
  |  Branch (206:13): [True: 0, False: 2]
  |  Branch (206:24): [True: 0, False: 0]
  ------------------
  207|      0|            *err |= 1;                                                       \
  208|      0|            return max;                                                      \
  209|      0|        }                                                                    \
  210|      2|        return a / b;                                                        \
  211|      2|    }

err.c:do_err_strings_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
err.c:err_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_base_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_register_atexit_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_nodelete_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_strings_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
initthread.c:create_global_tevent_register_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
conf_mod.c:do_init_module_list_lock_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
context.c:default_context_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \

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

err.c:ossl_check_ERR_STRING_DATA_lh_type:
  196|  8.76k|    { \
  197|  8.76k|        return (OPENSSL_LHASH *)lh; \
  198|  8.76k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_hashfunc_type:
  206|      2|    { \
  207|      2|        return (OPENSSL_LH_HASHFUNC)hfn; \
  208|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_compfunc_type:
  201|      2|    { \
  202|      2|        return (OPENSSL_LH_COMPFUNC)cmp; \
  203|      2|    } \
err.c:lh_ERR_STRING_DATA_hash_thunk:
  160|  8.75k|    { \
  161|  8.75k|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  162|  8.75k|        return hfn_conv((const type *)data); \
  163|  8.75k|    } \
err.c:lh_ERR_STRING_DATA_comp_thunk:
  165|  5.89k|    { \
  166|  5.89k|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  167|  5.89k|        return cfn_conv((const type *)da, (const type *)db); \
  168|  5.89k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_plain_type:
  181|  8.62k|    { \
  182|  8.62k|        return ptr; \
  183|  8.62k|    } \
err.c:ossl_check_const_ERR_STRING_DATA_lh_plain_type:
  186|    136|    { \
  187|    136|        return ptr; \
  188|    136|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_doall:
  311|      2|    { \
  312|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_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_doall:
  311|      4|    { \
  312|      4|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      4|    } \
property_string.c:lh_PROPERTY_STRING_free:
  254|      4|    { \
  255|      4|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      4|    } \
property_string.c:lh_PROPERTY_STRING_new:
  317|      4|    { \
  318|      4|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      4|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      4|                                lh_##type##_doall_thunk, \
  321|      4|                                lh_##type##_doall_arg_thunk); \
  322|      4|    } \
property_string.c:lh_PROPERTY_STRING_hfn_thunk:
  243|     48|    { \
  244|     48|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|     48|        return hfn_conv((const type *)data); \
  246|     48|    } \
property_string.c:lh_PROPERTY_STRING_doall_thunk:
  299|     16|    { \
  300|     16|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|     16|        doall_conv((type *)node); \
  302|     16|    } \
property_string.c:lh_PROPERTY_STRING_retrieve:
  274|     32|    { \
  275|     32|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|     32|    } \
property_string.c:lh_PROPERTY_STRING_insert:
  264|     16|    { \
  265|     16|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|     16|    } \
property_string.c:lh_PROPERTY_STRING_error:
  279|     16|    { \
  280|     16|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|     16|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_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|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_doall:
  311|      2|    { \
  312|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      2|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \

initthread.c:sk_THREAD_EVENT_HANDLER_PTR_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_free:
  112|      2|    { \
  113|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_push:
  129|      2|    { \
  130|      2|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_num:
   80|      4|    { \
   81|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      4|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_value:
   84|      2|    { \
   85|      2|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_delete:
  120|      2|    { \
  121|      2|        return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
  122|      2|    } \
conf_mod.c:sk_CONF_IMODULE_free:
  112|      4|    { \
  113|      4|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      4|    } \
conf_mod.c:sk_CONF_MODULE_dup:
  182|      2|    { \
  183|      2|        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
  184|      2|    } \
conf_mod.c:sk_CONF_MODULE_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
conf_mod.c:sk_CONF_MODULE_num:
   80|      4|    { \
   81|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      4|    } \
conf_mod.c:sk_CONF_MODULE_free:
  112|      6|    { \
  113|      6|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      6|    } \
conf_mod.c:sk_CONF_MODULE_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   80|      2|    { \
   81|      2|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      2|    } \
core_namemap.c:sk_NAMES_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
core_namemap.c:sk_NAMES_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
ex_data.c:sk_EX_CALLBACK_pop_free:
  145|     36|    { \
  146|     36|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|     36|        \
  148|     36|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|     36|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|     36|        \
  151|     36|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|     36|    } \
provider_conf.c:sk_OSSL_PROVIDER_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_new:
   88|      2|    { \
   89|      2|        OPENSSL_STACK *ret = OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   90|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
   91|      2|        \
   92|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
   93|      2|        return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \
   94|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
obj_xref.c:sk_nid_triple_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
obj_xref.c:sk_nid_triple_free:
  112|      2|    { \
  113|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      2|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_sk_type:
   53|     20|    { \
   54|     20|        return (OPENSSL_STACK *)sk; \
   55|     20|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_type:
   45|     16|    { \
   46|     16|        return ptr; \
   47|     16|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_compfunc_type:
   57|      2|    { \
   58|      2|        return (OPENSSL_sk_compfunc)cmp; \
   59|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_sk_type:
   53|      2|    { \
   54|      2|        return (OPENSSL_STACK *)sk; \
   55|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_freefunc_type:
   65|      2|    { \
   66|      2|        return (OPENSSL_sk_freefunc)fr; \
   67|      2|    }

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

ossl_prov_drbg_nonce_ctx_new:
  272|      2|{
  273|      2|    PROV_DRBG_NONCE_GLOBAL *dngbl = OPENSSL_zalloc(sizeof(*dngbl));
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  274|       |
  275|      2|    if (dngbl == NULL)
  ------------------
  |  Branch (275:9): [True: 0, False: 2]
  ------------------
  276|      0|        return NULL;
  277|       |
  278|      2|    dngbl->rand_nonce_lock = CRYPTO_THREAD_lock_new();
  279|      2|    if (dngbl->rand_nonce_lock == NULL) {
  ------------------
  |  Branch (279:9): [True: 0, False: 2]
  ------------------
  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|      2|    return dngbl;
  285|      2|}
ossl_prov_drbg_nonce_ctx_free:
  288|      2|{
  289|      2|    PROV_DRBG_NONCE_GLOBAL *dngbl = vdngbl;
  290|       |
  291|      2|    if (dngbl == NULL)
  ------------------
  |  Branch (291:9): [True: 0, False: 2]
  ------------------
  292|      0|        return;
  293|       |
  294|      2|    CRYPTO_THREAD_lock_free(dngbl->rand_nonce_lock);
  295|       |
  296|      2|    OPENSSL_free(dngbl);
  ------------------
  |  |  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__
  |  |  ------------------
  ------------------
  297|      2|}

