Welcome to little lamb

Code » limb » release » tree

[release] / src / liblimb / shldata.h / shldata_encrypt.c

/* This file is part of limb                           https://lila.oss/limb
 * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <limb/ccpl.h>
#include <limb/shldata.h>
#include "shldata.h"

int
shldata_encrypt(char *dst, const char *data, size_t dlen, shldata_ctx *ctx)
{
    if (ctx->len && ctx->done + dlen > ctx->len)
        return 0;

    ccpl_encrypt(dst, data, dlen, &ctx->ccpl);
    ctx->done += dlen;
    return 1;
}