int EVP_PKEY_asn1_add_alias(int to, int from)
{
    EVP_PKEY_ASN1_METHOD *ameth;
    ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL);
    if (ameth == NULL)
        return 0;
    ameth->pkey_base_id = to;
    if (!EVP_PKEY_asn1_add0(ameth)) {
        EVP_PKEY_asn1_free(ameth);
        return 0;
    }
    return 1;
}
['int EVP_PKEY_asn1_add_alias(int to, int from)\n{\n    EVP_PKEY_ASN1_METHOD *ameth;\n    ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL);\n    if (ameth == NULL)\n        return 0;\n    ameth->pkey_base_id = to;\n    if (!EVP_PKEY_asn1_add0(ameth)) {\n        EVP_PKEY_asn1_free(ameth);\n        return 0;\n    }\n    return 1;\n}', 'EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,\n                                        const char *pem_str, const char *info)\n{\n    EVP_PKEY_ASN1_METHOD *ameth = OPENSSL_zalloc(sizeof(*ameth));\n    if (ameth == NULL)\n        return NULL;\n    ameth->pkey_id = id;\n    ameth->pkey_base_id = id;\n    ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;\n    if (info) {\n        ameth->info = OPENSSL_strdup(info);\n        if (!ameth->info)\n            goto err;\n    }\n    if (pem_str) {\n        ameth->pem_str = OPENSSL_strdup(pem_str);\n        if (!ameth->pem_str)\n            goto err;\n    }\n    return ameth;\n err:\n    EVP_PKEY_asn1_free(ameth);\n    return NULL;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\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    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\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;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth)\n{\n    if (app_methods == NULL) {\n        app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp);\n        if (app_methods == NULL)\n            return 0;\n    }\n    if (!sk_EVP_PKEY_ASN1_METHOD_push(app_methods, ameth))\n        return 0;\n    sk_EVP_PKEY_ASN1_METHOD_sort(app_methods);\n    return 1;\n}', 'int sk_push(_STACK *st, void *data)\n{\n    return (sk_insert(st, data, st->num));\n}', 'int sk_insert(_STACK *st, void *data, int loc)\n{\n    char **s;\n    if (st == NULL)\n        return 0;\n    if (st->num_alloc <= st->num + 1) {\n        s = OPENSSL_realloc((char *)st->data,\n                            (unsigned int)sizeof(char *) * st->num_alloc * 2);\n        if (s == NULL)\n            return (0);\n        st->data = s;\n        st->num_alloc *= 2;\n    }\n    if ((loc >= (int)st->num) || (loc < 0))\n        st->data[st->num] = data;\n    else {\n        memmove(&(st->data[loc + 1]),\n                &(st->data[loc]), sizeof(char *) * (st->num - loc));\n        st->data[loc] = data;\n    }\n    st->num++;\n    st->sorted = 0;\n    return (st->num);\n}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}', 'void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth)\n{\n    if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) {\n        OPENSSL_free(ameth->pem_str);\n        OPENSSL_free(ameth->info);\n        OPENSSL_free(ameth);\n    }\n}']