]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
ctr16: fix encryption if src == dst
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Wed, 10 Oct 2018 17:26:25 +0000 (19:26 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 10 Oct 2018 17:26:25 +0000 (19:26 +0200)
ChangeLog
ctr16.c

index 16560c14a50fb5e3daef3cb5a4873ef0145bf4dd..015155754638ef8cd4e8414a7fce227de88f2b5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-10-10  Dmitry Eremin-Solenikov  <dbaryshkov@gmail.com>
+
+       * 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  <nisse@lysator.liu.se>
 
        * aes-set-encrypt-key.c: Add missing include of stdlib.h.
diff --git a/ctr16.c b/ctr16.c
index 60418e8b90323e14fb45ea79e79b19def38e0ee0..7e1c23d20832660d1bb8ef1688ca4eff02b9eb34 100644 (file)
--- 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)