void chacha_init(chacha_ctx *ctx, const void *key, size_t ksz,
const void *nonce)
{
void chacha_init(chacha_ctx *ctx, const void *key, size_t ksz,
const void *nonce)
{
populate(ctx->a, key, ksz);
chacha_setnonce(ctx, nonce ? nonce : zerononce);
}
populate(ctx->a, key, ksz);
chacha_setnonce(ctx, nonce ? nonce : zerononce);
}
void XCHACHA_INIT(r, XCHACHA_CTX(r) *ctx, \
const void *key, size_t ksz, const void *nonce) \
{ \
void XCHACHA_INIT(r, XCHACHA_CTX(r) *ctx, \
const void *key, size_t ksz, const void *nonce) \
{ \
populate(ctx->k, key, ksz); \
ctx->s.a[ 0] = CHACHA_A256; \
ctx->s.a[ 1] = CHACHA_B256; \
populate(ctx->k, key, ksz); \
ctx->s.a[ 0] = CHACHA_A256; \
ctx->s.a[ 1] = CHACHA_B256; \