Welcome to little lamb

Code » limb » master » tree

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

int
ccpl_aad(const void *data, size_t dlen, void *ctx_)
{
    ccpl_ctx *ctx = ctx_;

    /* can't be called after calls to ccpl_crypt() */
    if (ctx->w) return 0;

    poly1305_update(data, dlen, &ctx->pl);
    ctx->alen += dlen;

    return 1;
}