

#include <openssl/evp.h>
#include "testutil.h"


static int test_no_deflt_ctx_init(void)
{
    int testresult = 0;
    EVP_MD *md = NULL;
    OSSL_LIB_CTX *ctx = OSSL_LIB_CTX_new();

    if (!TEST_ptr(ctx))
        return 0;

    md = EVP_MD_fetch(ctx, "SHA2-256", NULL);
    if (!TEST_ptr(md))
        goto err;

    
    OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL);

    
    if (!TEST_true(OSSL_PROVIDER_available(NULL, "default")))
        goto err;
    if (!TEST_false(OSSL_PROVIDER_available(NULL, "null")))
        goto err;

    testresult = 1;
 err:
    EVP_MD_free(md);
    OSSL_LIB_CTX_free(ctx);
    return testresult;
}

int setup_tests(void)
{
    ADD_TEST(test_no_deflt_ctx_init);
    return 1;
}
