changeset 13:7ea528b61802

Fixed two errors in ManagedBlockCipher where inputs equal to the block size of the cipher would cause a bounds error and incorrect output of finishOutputSize respectively.
author Thomas Dixon <reikon@reikon.us>
date Fri, 12 Sep 2008 05:20:43 -0400
parents 8c7f8fecdd75
children 5ce3012f1def
files dcrypt/crypto/ManagedBlockCipher.d
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dcrypt/crypto/ManagedBlockCipher.d	Sat Aug 30 14:38:23 2008 -0400
+++ b/dcrypt/crypto/ManagedBlockCipher.d	Fri Sep 12 05:20:43 2008 -0400
@@ -86,7 +86,7 @@
              len = input.length,
              diff = buffer.length - index,
              i = 0;
-        if (len > diff) {
+        if (len >= diff) {
             buffer[index..buffer.length] = input[i..diff];
             result += cipher.update(buffer, output[i..i+blockSize]);
             index = 0;
@@ -181,7 +181,7 @@
         
         // Input is a multiple of block size
         if (!diff)
-            return result;
+            return ((padding is null) ? result : result+blockSize);
         
         // No padding, return result if stream mode, 0 if not (it'll error)
         if (padding is null)