If src == dst, ctr16 code will fail to increment src and dst pointers,
always overwriting first block.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov(a)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)
--
2.18.0