diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-04-28 16:44:22 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-04-28 16:44:22 +0400 |
commit | 9a9983c0777f94dc208c5d4dd56599a33b4d5682 (patch) | |
tree | 7cd06a5daca13bb4564ecd50c6bbc42af90a9d8c /mcs/class/Mono.Security | |
parent | 49522e9076f0b912ce3953effa888c0fc1b37a3a (diff) |
2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
* SymmetricTransform.cs: Fixed bug when offset > 0 in destination
buffer.
svn path=/trunk/mcs/; revision=26139
Diffstat (limited to 'mcs/class/Mono.Security')
-rw-r--r-- | mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog | 5 | ||||
-rwxr-xr-x | mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog index d2c368d0121..1c2431947a5 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,8 @@ +2004-04-28 Sebastien Pouliot <sebastien@ximian.com> + + * SymmetricTransform.cs: Fixed bug when offset > 0 in destination + buffer. + 2004-04-22 Sebastien Pouliot <sebastien@ximian.com> * CryptoConvert.cs: FxCop-ized. Sealed class. Use Buffer.BlockCopy. diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs index b870e6521f1..62129142cff 100755 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs @@ -246,11 +246,13 @@ namespace Mono.Security.Cryptography { } byte[] res = new byte [total]; + int outputOffset = 0; // process all blocks except the last (final) block while (total > BlockSizeByte) { - TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, inputOffset); + TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset); inputOffset += BlockSizeByte; + outputOffset += BlockSizeByte; total -= BlockSizeByte; } @@ -264,7 +266,7 @@ namespace Mono.Security.Cryptography { TransformBlock (res, full, BlockSizeByte, res, full); } else - TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, inputOffset); + TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset); return res; } @@ -276,9 +278,11 @@ namespace Mono.Security.Cryptography { int total = inputCount; byte[] res = new byte [total]; + int outputOffset = 0; while (inputCount > 0) { - TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, inputOffset); + TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset); inputOffset += BlockSizeByte; + outputOffset += BlockSizeByte; inputCount -= BlockSizeByte; } |