int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
                      const unsigned char *in, int inl)
{
    int i, j;
    size_t total = 0;
    *outl = 0;
    if (inl <= 0)
        return 0;
    OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));
    if (ctx->length - ctx->num > inl) {
        memcpy(&(ctx->enc_data[ctx->num]), in, inl);
        ctx->num += inl;
        return 1;
    }
    if (ctx->num != 0) {
        i = ctx->length - ctx->num;
        memcpy(&(ctx->enc_data[ctx->num]), in, i);
        in += i;
        inl -= i;
        j = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->length);
        ctx->num = 0;
        out += j;
        total = j;
        if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) {
            *(out++) = '\n';
            total++;
        }
        *out = '\0';
    }
    while (inl >= ctx->length && total <= INT_MAX) {
        j = evp_encodeblock_int(ctx, out, in, ctx->length);
        in += ctx->length;
        inl -= ctx->length;
        out += j;
        total += j;
        if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) {
            *(out++) = '\n';
            total++;
        }
        *out = '\0';
    }
    if (total > INT_MAX) {
        *outl = 0;
        return 0;
    }
    if (inl != 0)
        memcpy(&(ctx->enc_data[0]), in, inl);
    ctx->num = inl;
    *outl = total;
    return 1;
}
["static int t_tob64(char *dst, const unsigned char *src, int size)\n{\n    EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new();\n    int outl = 0, outl2 = 0;\n    unsigned char pad[2] = {0, 0};\n    size_t leadz = 0;\n    if (ctx == NULL)\n        return 0;\n    EVP_EncodeInit(ctx);\n    evp_encode_ctx_set_flags(ctx, EVP_ENCODE_CTX_NO_NEWLINES\n                                  | EVP_ENCODE_CTX_USE_SRP_ALPHABET);\n    leadz = 3 - (size % 3);\n    if (leadz != 3\n            && !EVP_EncodeUpdate(ctx, (unsigned char *)dst, &outl, pad,\n                                 leadz)) {\n        EVP_ENCODE_CTX_free(ctx);\n        return 0;\n    }\n    if (!EVP_EncodeUpdate(ctx, (unsigned char *)dst + outl, &outl2, src,\n                          size)) {\n        EVP_ENCODE_CTX_free(ctx);\n        return 0;\n    }\n    outl += outl2;\n    EVP_EncodeFinal(ctx, (unsigned char *)dst + outl, &outl2);\n    outl += outl2;\n    if (leadz != 3) {\n        memmove(dst, dst + leadz, outl - leadz);\n        dst[outl - leadz] = '\\0';\n    }\n    EVP_ENCODE_CTX_free(ctx);\n    return 1;\n}", "int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n                      const unsigned char *in, int inl)\n{\n    int i, j;\n    size_t total = 0;\n    *outl = 0;\n    if (inl <= 0)\n        return 0;\n    OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));\n    if (ctx->length - ctx->num > inl) {\n        memcpy(&(ctx->enc_data[ctx->num]), in, inl);\n        ctx->num += inl;\n        return 1;\n    }\n    if (ctx->num != 0) {\n        i = ctx->length - ctx->num;\n        memcpy(&(ctx->enc_data[ctx->num]), in, i);\n        in += i;\n        inl -= i;\n        j = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->length);\n        ctx->num = 0;\n        out += j;\n        total = j;\n        if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) {\n            *(out++) = '\\n';\n            total++;\n        }\n        *out = '\\0';\n    }\n    while (inl >= ctx->length && total <= INT_MAX) {\n        j = evp_encodeblock_int(ctx, out, in, ctx->length);\n        in += ctx->length;\n        inl -= ctx->length;\n        out += j;\n        total += j;\n        if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) {\n            *(out++) = '\\n';\n            total++;\n        }\n        *out = '\\0';\n    }\n    if (total > INT_MAX) {\n        *outl = 0;\n        return 0;\n    }\n    if (inl != 0)\n        memcpy(&(ctx->enc_data[0]), in, inl);\n    ctx->num = inl;\n    *outl = total;\n    return 1;\n}"]