bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix bug in rijndael


From: Simon Josefsson
Subject: fix bug in rijndael
Date: Fri, 21 Oct 2005 15:47:09 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

I have installed the patch below.  It seems the example Rijndael
implementation didn't implement CBC mode correctly...

--- rijndael-api-fst.c  14 Oct 2005 15:33:22 +0200      1.1
+++ rijndael-api-fst.c  19 Oct 2005 16:08:10 +0200      
@@ -244,7 +244,7 @@
          ((uint32_t *) block)[3] = ((uint32_t *) input)[3] ^
            ((uint32_t *) iv)[3];
          rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
-         iv = outBuffer;
+         memcpy (cipher->IV, outBuffer, 16);
          input += 16;
          outBuffer += 16;
        }
@@ -327,7 +327,7 @@
          ((uint32_t *) block)[3] = ((uint32_t *) input)[3] ^
            ((uint32_t *) iv)[3];
          rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
-         iv = outBuffer;
+         memcpy (cipher->IV, outBuffer, 16);
          input += 16;
          outBuffer += 16;
        }
@@ -342,6 +342,7 @@
          block[i] = (char) padLen ^ iv[i];
        }
       rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
+      memcpy (cipher->IV, outBuffer, 16);
       break;
 
     default:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]