Permalink
Browse files

Use the right variable to compute the padding length

  • Loading branch information...
1 parent 3a6e861 commit d87a7d097416d75b47e68038f1ae0503329ddc0c @spouliot spouliot committed Jul 17, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 class/Crimson.CryptoDev/Crimson.CryptoDev/CryptoDevTransform.cs
@@ -404,12 +404,12 @@ private byte[] FinalDecrypt (byte[] inputBuffer, int inputOffset, int inputCount
if (res [total - 1 - i] != 0x00)
ThrowBadPaddingException (padding, -1, i);
}
- total -= padding;
+ total -= pad;
break;
case PaddingMode.ISO10126:
if ((pad == 0) || (pad > BlockSizeByte))
ThrowBadPaddingException (padding, pad, -1);
- total -= padding;
+ total -= pad;
break;
case PaddingMode.PKCS7:
if ((pad == 0) || (pad > BlockSizeByte))
@@ -418,7 +418,7 @@ private byte[] FinalDecrypt (byte[] inputBuffer, int inputOffset, int inputCount
if (res [total - 1 - i] != pad)
ThrowBadPaddingException (padding, -1, i);
}
- total -= padding;
+ total -= pad;
break;
case PaddingMode.None: // nothing to do - it's a multiple of block size
case PaddingMode.Zeros: // nothing to do - user must unpad himself

0 comments on commit d87a7d0

Please sign in to comment.