summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-11 11:38:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-11 11:38:01 +0700
commit10a058e381da1de25da70ebe56d2f0563447d851 (patch)
treea43f2c8ca90598917ac77eb4b6832d85ffbe3f99
parentRewrite test cases without MD5 (diff)
downloadBouncyCastle.NET-ed25519-10a058e381da1de25da70ebe56d2f0563447d851.tar.xz
Refactoring
-rw-r--r--crypto/src/tls/crypto/impl/TlsAeadCipher.cs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/src/tls/crypto/impl/TlsAeadCipher.cs b/crypto/src/tls/crypto/impl/TlsAeadCipher.cs
index ec76e98c1..04f9ce80f 100644
--- a/crypto/src/tls/crypto/impl/TlsAeadCipher.cs
+++ b/crypto/src/tls/crypto/impl/TlsAeadCipher.cs
@@ -175,14 +175,13 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl
 
             try
             {
-                m_encryptCipher.Init(nonce, m_macSize, additionalData);
-
                 Array.Copy(plaintext, plaintextOffset, output, outputPos, plaintextLength);
                 if (m_isTlsV13)
                 {
                     output[outputPos + plaintextLength] = (byte)contentType;
                 }
 
+                m_encryptCipher.Init(nonce, m_macSize, additionalData);
                 outputPos += m_encryptCipher.DoFinal(output, outputPos, plaintextLength + extraLength, output,
                     outputPos);
             }
@@ -354,7 +353,7 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl
             Array.Copy(iv, 0, nonce, 0, m_fixed_iv_length);
 
             // NOTE: Ensure dummy nonce is not part of the generated sequence(s)
-            iv [0] ^= 0x80;
+            iv[0] ^= 0x80;
             cipher.Init(iv, m_macSize, null);
         }