int index_index(CA_DB *db)
{
    if (!TXT_DB_create_index(db->db, DB_serial, NULL,
                             LHASH_HASH_FN(index_serial),
                             LHASH_COMP_FN(index_serial))) {
        BIO_printf(bio_err,
                   "error creating serial number index:(%ld,%ld,%ld)\n",
                   db->db->error, db->db->arg1, db->db->arg2);
        return 0;
    }
    if (db->attributes.unique_subject
        && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
                                LHASH_HASH_FN(index_name),
                                LHASH_COMP_FN(index_name))) {
        BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\n",
                   db->db->error, db->db->arg1, db->db->arg2);
        return 0;
    }
    return 1;
}
['int index_index(CA_DB *db)\n{\n    if (!TXT_DB_create_index(db->db, DB_serial, NULL,\n                             LHASH_HASH_FN(index_serial),\n                             LHASH_COMP_FN(index_serial))) {\n        BIO_printf(bio_err,\n                   "error creating serial number index:(%ld,%ld,%ld)\\n",\n                   db->db->error, db->db->arg1, db->db->arg2);\n        return 0;\n    }\n    if (db->attributes.unique_subject\n        && !TXT_DB_create_index(db->db, DB_name, index_name_qual,\n                                LHASH_HASH_FN(index_name),\n                                LHASH_COMP_FN(index_name))) {\n        BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\\n",\n                   db->db->error, db->db->arg1, db->db->arg2);\n        return 0;\n    }\n    return 1;\n}', 'int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),\n                        LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)\n{\n    LHASH_OF(OPENSSL_STRING) *idx;\n    OPENSSL_STRING *r;\n    int i, n;\n    if (field >= db->num_fields) {\n        db->error = DB_ERROR_INDEX_OUT_OF_RANGE;\n        return (0);\n    }\n    if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {\n        db->error = DB_ERROR_MALLOC;\n        return (0);\n    }\n    n = sk_OPENSSL_PSTRING_num(db->data);\n    for (i = 0; i < n; i++) {\n        r = sk_OPENSSL_PSTRING_value(db->data, i);\n        if ((qual != NULL) && (qual(r) == 0))\n            continue;\n        if ((r = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {\n            db->error = DB_ERROR_INDEX_CLASH;\n            db->arg1 = sk_OPENSSL_PSTRING_find(db->data, r);\n            db->arg2 = i;\n            lh_OPENSSL_STRING_free(idx);\n            return (0);\n        }\n    }\n    lh_OPENSSL_STRING_free(db->index[field]);\n    db->index[field] = idx;\n    db->qual[field] = qual;\n    return (1);\n}', '_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)\n{\n    _LHASH *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)\n        goto err0;\n    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)\n        goto err1;\n    ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);\n    ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);\n    ret->num_nodes = MIN_NODES / 2;\n    ret->num_alloc_nodes = MIN_NODES;\n    ret->pmax = MIN_NODES / 2;\n    ret->up_load = UP_LOAD;\n    ret->down_load = DOWN_LOAD;\n    return (ret);\n err1:\n    OPENSSL_free(ret);\n err0:\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}', 'DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}']