From: Dmitry Eremin-Solenikov Date: Wed, 10 Oct 2018 17:26:25 +0000 (+0200) Subject: ctr16: fix encryption if src == dst X-Git-Tag: nettle_3.5rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd2d1e28184b9924bceda22aab7d09e8034352b3;p=thirdparty%2Fnettle.git ctr16: fix encryption if src == dst --- diff --git a/ChangeLog b/ChangeLog index 16560c14..01515575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-10-10 Dmitry Eremin-Solenikov + + * ctr16.c (_ctr_crypt16): Bugfix for the src == dst case, when + processing more than on full block of size CTR_BUFFER_LIMIT, src + and dst arguments to memxor3 were not properly updated. + 2018-10-10 Niels Möller * aes-set-encrypt-key.c: Add missing include of stdlib.h. diff --git a/ctr16.c b/ctr16.c index 60418e8b..7e1c23d2 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)