2020-11-30 Niels Möller <nisse@lysator.liu.se>
+ * chacha-crypt.c (_nettle_chacha_crypt32_3core): Fix bug in
+ handling of counter; this function should not propagate any carry.
+
* aes-internal.h: Delete name mangling of internal symbols. Update
all internal references to use _nettle prefix.
* camellia-internal.h: Likewise.
{
_nettle_chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
ctx->state[12] += 3;
- ctx->state[13] += (ctx->state[12] < 3);
if (length <= 3*CHACHA_BLOCK_SIZE)
{
memxor3 (dst, src, x, length);
if (length <= CHACHA_BLOCK_SIZE)
{
_nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
- ctx->state[13] += (++ctx->state[12] == 0);
+ ++ctx->state[12];
}
else
{
_nettle_chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
ctx->state[12] += 2;
- ctx->state[13] += (ctx->state[12] < 2);
}
memxor3 (dst, src, x, length);
}