char *CRYPTO_strdup(const char *str, const char* file, int line)
{
    char *ret;
    size_t size;
    if (str == NULL)
        return NULL;
    size = strlen(str) + 1;
    ret = CRYPTO_malloc(size, file, line);
    if (ret != NULL)
        memcpy(ret, str, size);
    return ret;
}
["static int handle_symlink(const char *filename, const char *fullpath)\n{\n    unsigned int hash = 0;\n    int i, type, id;\n    unsigned char ch;\n    char linktarget[PATH_MAX], *endptr;\n    ssize_t n;\n    for (i = 0; i < 8; i++) {\n        ch = filename[i];\n        if (!isxdigit(ch))\n            return -1;\n        hash <<= 4;\n        hash += app_hex(ch);\n    }\n    if (filename[i++] != '.')\n        return -1;\n    for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--)\n        if (strcasecmp(suffixes[type], &filename[i]) == 0)\n            break;\n    i += strlen(suffixes[type]);\n    id = strtoul(&filename[i], &endptr, 10);\n    if (*endptr != '\\0')\n        return -1;\n    n = readlink(fullpath, linktarget, sizeof(linktarget));\n    if (n < 0 || n >= (int)sizeof(linktarget))\n        return -1;\n    linktarget[n] = 0;\n    return add_entry(type, hash, linktarget, NULL, 0, id);\n}", 'static int add_entry(enum Type type, unsigned int hash, const char *filename,\n                      const unsigned char *digest, int need_symlink,\n                      unsigned short old_id)\n{\n    static BUCKET nilbucket;\n    static HENTRY nilhentry;\n    BUCKET *bp;\n    HENTRY *ep, *found = NULL;\n    unsigned int ndx = (type + hash) % OSSL_NELEM(hash_table);\n    for (bp = hash_table[ndx]; bp; bp = bp->next)\n        if (bp->type == type && bp->hash == hash)\n            break;\n    if (bp == NULL) {\n        bp = app_malloc(sizeof(*bp), "hash bucket");\n        *bp = nilbucket;\n        bp->next = hash_table[ndx];\n        bp->type = type;\n        bp->hash = hash;\n        hash_table[ndx] = bp;\n    }\n    for (ep = bp->first_entry; ep; ep = ep->next) {\n        if (digest && memcmp(digest, ep->digest, evpmdsize) == 0) {\n            BIO_printf(bio_err,\n                       "%s: skipping duplicate certificate in %s\\n",\n                       opt_getprog(), filename);\n            return 1;\n        }\n        if (strcmp(filename, ep->filename) == 0) {\n            found = ep;\n            if (digest == NULL)\n                break;\n        }\n    }\n    ep = found;\n    if (ep == NULL) {\n        if (bp->num_needed >= MAX_COLLISIONS) {\n            BIO_printf(bio_err,\n                       "%s: hash table overflow for %s\\n",\n                       opt_getprog(), filename);\n            return 1;\n        }\n        ep = app_malloc(sizeof(*ep), "collision bucket");\n        *ep = nilhentry;\n        ep->old_id = ~0;\n        ep->filename = OPENSSL_strdup(filename);\n        if (bp->last_entry)\n            bp->last_entry->next = ep;\n        if (bp->first_entry == NULL)\n            bp->first_entry = ep;\n        bp->last_entry = ep;\n    }\n    if (old_id < ep->old_id)\n        ep->old_id = old_id;\n    if (need_symlink && !ep->need_symlink) {\n        ep->need_symlink = 1;\n        bp->num_needed++;\n        memcpy(ep->digest, digest, evpmdsize);\n    }\n    return 0;\n}', 'char *CRYPTO_strdup(const char *str, const char* file, int line)\n{\n    char *ret;\n    size_t size;\n    if (str == NULL)\n        return NULL;\n    size = strlen(str) + 1;\n    ret = CRYPTO_malloc(size, file, line);\n    if (ret != NULL)\n        memcpy(ret, str, size);\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}']