Dmitry Eremin-Solenikov dbaryshkov@gmail.com writes:
If src == dst, ctr16 code will fail to increment src and dst pointers, always overwriting first block.
Signed-off-by: Dmitry Eremin-Solenikov dbaryshkov@gmail.com
ctr16.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ctr16.c b/ctr16.c index 60418e8b9032..7e1c23d20832 100644 --- a/ctr16.c +++ b/ctr16.c @@ -91,7 +91,7 @@ _ctr_crypt16(const void *ctx, nettle_cipher_func *f, f(ctx, CTR_BUFFER_LIMIT, buffer->b, buffer->b); if (length - i < CTR_BUFFER_LIMIT) goto done;
memxor3 (dst, src, buffer->b, CTR_BUFFER_LIMIT);
memxor3 (dst + i, src + i, buffer->b, CTR_BUFFER_LIMIT);
}
if (blocks > 0)
Applied, thanks!
If I understand this correctly, bug is triggered only when processing >= 1024 bytes (2 * CTR_BUFFER_LIMIT) at a time. If you would like to write a test case, that's appreciated.
Regards, /Niels