int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src,
                           void *keyenc, void *keydec)
{
    memcpy(dest, src, sizeof(OCB128_CONTEXT));
    if (keyenc)
        dest->keyenc = keyenc;
    if (keydec)
        dest->keydec = keydec;
    if (src->l) {
        dest->l = OPENSSL_malloc(src->max_l_index * 16);
        if (dest->l == NULL)
            return 0;
        memcpy(dest->l, src->l, (src->l_index + 1) * 16);
    }
    return 1;
}
['static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)\n{\n    EVP_AES_OCB_CTX *octx = EVP_C_DATA(EVP_AES_OCB_CTX,c);\n    EVP_CIPHER_CTX *newc;\n    EVP_AES_OCB_CTX *new_octx;\n    switch (type) {\n    case EVP_CTRL_INIT:\n        octx->key_set = 0;\n        octx->iv_set = 0;\n        octx->ivlen = EVP_CIPHER_CTX_iv_length(c);\n        octx->iv = EVP_CIPHER_CTX_iv_noconst(c);\n        octx->taglen = 16;\n        octx->data_buf_len = 0;\n        octx->aad_buf_len = 0;\n        return 1;\n    case EVP_CTRL_AEAD_SET_IVLEN:\n        if (arg <= 0 || arg > 15)\n            return 0;\n        octx->ivlen = arg;\n        return 1;\n    case EVP_CTRL_AEAD_SET_TAG:\n        if (!ptr) {\n            if (arg < 0 || arg > 16)\n                return 0;\n            octx->taglen = arg;\n            return 1;\n        }\n        if (arg != octx->taglen || EVP_CIPHER_CTX_encrypting(c))\n            return 0;\n        memcpy(octx->tag, ptr, arg);\n        return 1;\n    case EVP_CTRL_AEAD_GET_TAG:\n        if (arg != octx->taglen || !EVP_CIPHER_CTX_encrypting(c))\n            return 0;\n        memcpy(ptr, octx->tag, arg);\n        return 1;\n    case EVP_CTRL_COPY:\n        newc = (EVP_CIPHER_CTX *)ptr;\n        new_octx = EVP_C_DATA(EVP_AES_OCB_CTX,newc);\n        return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb,\n                                      &new_octx->ksenc.ks,\n                                      &new_octx->ksdec.ks);\n    default:\n        return -1;\n    }\n}', 'int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src,\n                           void *keyenc, void *keydec)\n{\n    memcpy(dest, src, sizeof(OCB128_CONTEXT));\n    if (keyenc)\n        dest->keyenc = keyenc;\n    if (keydec)\n        dest->keydec = keydec;\n    if (src->l) {\n        dest->l = OPENSSL_malloc(src->max_l_index * 16);\n        if (dest->l == NULL)\n            return 0;\n        memcpy(dest->l, src->l, (src->l_index + 1) * 16);\n    }\n    return 1;\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}']