Welcome to little lamb

Code » limb » master » tree

[master] / src / liblimb / shldata.h / shldata_decrypt.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>

int
shldata_decrypt(char *dst, const char *sce, size_t len, shldata_ctx *ctx)
{
    if (ctx->done + len > ctx->len)
        return 0;

    ccpl_decrypt(dst, sce, len, &ctx->ccpl);
    ctx->done += len;
    return 1;
}