From 10a058e381da1de25da70ebe56d2f0563447d851 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 11 May 2022 11:38:01 +0700 Subject: Refactoring --- crypto/src/tls/crypto/impl/TlsAeadCipher.cs | 5 ++--- 1 file 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); } -- cgit 1.4.1