static int cipher_test_init(EVP_TEST *t, const char *alg)
{
    const EVP_CIPHER *cipher;
    CIPHER_DATA *cdat;
    int m;
    if ((cipher = EVP_get_cipherbyname(alg)) == NULL) {
        if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {
            t->skip = 1;
            return 1;
        }
        return 0;
    }
    cdat = OPENSSL_zalloc(sizeof(*cdat));
    cdat->cipher = cipher;
    cdat->enc = -1;
    m = EVP_CIPHER_mode(cipher);
    if (m == EVP_CIPH_GCM_MODE
            || m == EVP_CIPH_OCB_MODE
            || m == EVP_CIPH_SIV_MODE
            || m == EVP_CIPH_CCM_MODE)
        cdat->aead = m;
    else if (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)
        cdat->aead = -1;
    else
        cdat->aead = 0;
    t->data = cdat;
    return 1;
}
['static int cipher_test_init(EVP_TEST *t, const char *alg)\n{\n    const EVP_CIPHER *cipher;\n    CIPHER_DATA *cdat;\n    int m;\n    if ((cipher = EVP_get_cipherbyname(alg)) == NULL) {\n        if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {\n            t->skip = 1;\n            return 1;\n        }\n        return 0;\n    }\n    cdat = OPENSSL_zalloc(sizeof(*cdat));\n    cdat->cipher = cipher;\n    cdat->enc = -1;\n    m = EVP_CIPHER_mode(cipher);\n    if (m == EVP_CIPH_GCM_MODE\n            || m == EVP_CIPH_OCB_MODE\n            || m == EVP_CIPH_SIV_MODE\n            || m == EVP_CIPH_CCM_MODE)\n        cdat->aead = m;\n    else if (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)\n        cdat->aead = -1;\n    else\n        cdat->aead = 0;\n    t->data = cdat;\n    return 1;\n}', 'const EVP_CIPHER *EVP_get_cipherbyname(const char *name)\n{\n    const EVP_CIPHER *cp;\n    if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL))\n        return NULL;\n    cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);\n    return cp;\n}', 'const char *OBJ_NAME_get(const char *name, int type)\n{\n    OBJ_NAME on, *ret;\n    int num = 0, alias;\n    const char *value = NULL;\n    if (name == NULL)\n        return NULL;\n    if (!OBJ_NAME_init())\n        return NULL;\n    CRYPTO_THREAD_read_lock(obj_lock);\n    alias = type & OBJ_NAME_ALIAS;\n    type &= ~OBJ_NAME_ALIAS;\n    on.name = name;\n    on.type = type;\n    for (;;) {\n        ret = lh_OBJ_NAME_retrieve(names_lh, &on);\n        if (ret == NULL)\n            break;\n        if ((ret->alias) && !alias) {\n            if (++num > 10)\n                break;\n            on.name = ret->data;\n        } else {\n            value = ret->data;\n            break;\n        }\n    }\n    CRYPTO_THREAD_unlock(obj_lock);\n    return value;\n}', 'int OBJ_NAME_init(void)\n{\n    return RUN_ONCE(&init, o_names_init);\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}', 'int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)\n{\n# ifdef USE_RWLOCK\n    if (pthread_rwlock_rdlock(lock) != 0)\n        return 0;\n# else\n    if (pthread_mutex_lock(lock) != 0)\n        return 0;\n# endif\n    return 1;\n}', 'void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE **rn;\n    void *ret;\n    tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        tsan_counter(&lh->num_retrieve_miss);\n        return NULL;\n    } else {\n        ret = (*rn)->data;\n        tsan_counter(&lh->num_retrieve);\n    }\n    return ret;\n}', 'int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)\n{\n# ifdef USE_RWLOCK\n    if (pthread_rwlock_unlock(lock) != 0)\n        return 0;\n# else\n    if (pthread_mutex_unlock(lock) != 0)\n        return 0;\n# endif\n    return 1;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']