[PATCH] Fix undefined variable in CTR mode

Jussi Kivilinna jussi.kivilinna at iki.fi
Wed Nov 7 18:16:43 CET 2018


* cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Set N to BLOCKSIZE
before counter loop.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 0 files changed

diff --git a/cipher/cipher-ctr.c b/cipher/cipher-ctr.c
index 2df0b8c3e..546d4f8e6 100644
--- a/cipher/cipher-ctr.c
+++ b/cipher/cipher-ctr.c
@@ -77,6 +77,7 @@ _gcry_cipher_ctr_encrypt (gcry_cipher_hd_t c,
     {
       unsigned char tmp[MAX_BLOCKSIZE];
 
+      n = blocksize;
       do
         {
           nburn = enc_fn (&c->context.c, tmp, c->u_ctr.ctr);
@@ -91,7 +92,6 @@ _gcry_cipher_ctr_encrypt (gcry_cipher_hd_t c,
 
           if (inbuflen < blocksize)
             break;
-          n = blocksize;
           cipher_block_xor(outbuf, inbuf, tmp, blocksize);
 
           inbuflen -= n;




More information about the Gcrypt-devel mailing list