Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-06-23 21:37:27 +0400
committerSebastien Pouliot <sebastien@ximian.com>2004-06-23 21:37:27 +0400
commit62a65807c936cd1a3a499725dfedabea7ef4f0f0 (patch)
tree3b3a574fd78384d3c914031288cce9d5777c8dbc /mcs/class/Mono.Security
parent59312205f7e5015cd05e409c49b1827527793d3b (diff)
2004-06-23 Sebastien Pouliot <sebastien@ximian.com>
* SymmetricTransform.cs: The condition to keep a block is a little more complex so it was moved as a private property. svn path=/trunk/mcs/; revision=30223
Diffstat (limited to 'mcs/class/Mono.Security')
-rwxr-xr-xmcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
index c93637ce746..8eb2a4a2265 100755
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
@@ -237,6 +237,12 @@ namespace Mono.Security.Cryptography {
return InternalTransformBlock (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
}
+ private bool KeepLastBlock {
+ get {
+ return ((!encrypt) && (algo.Mode != CipherMode.ECB) && (algo.Padding != PaddingMode.None));
+ }
+ }
+
private int InternalTransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
{
int offs = inputOffset;
@@ -253,7 +259,7 @@ namespace Mono.Security.Cryptography {
else
full = 1;
- if (!encrypt)
+ if (KeepLastBlock)
full--;
int total = 0;
@@ -275,7 +281,7 @@ namespace Mono.Security.Cryptography {
total += BlockSizeByte;
}
- if (!encrypt) {
+ if (KeepLastBlock) {
Buffer.BlockCopy (inputBuffer, offs, workBuff, 0, BlockSizeByte);
lastBlock = true;
}