Welcome to little lamb

Code » limb » release » tree

[release] / src / liblimb / buffer-shldata.h / buffer_shldata_putinit.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/buffer-shldata.h>
#include <limb/shldata.h>

ssize_t
buffer_shldata_putinit(buffer *b, const char *pwd, size_t plen, unsigned algo,
                       unsigned iter, size_t len, buffer_shldata_ctx *ctx)
{
    char buf[64];
    ssize_t l;

    l = shldata_initw(buf, sizeof(buf), pwd, plen, algo, iter, len, &ctx->sd);
    if (l < 0) return l;

    return buffer_put(b, buf, l);
}