summary refs log tree commit diff
path: root/crypto/src/tls/TlsProtocol.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-05 15:39:36 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-05 15:39:36 +0700
commit62ef1a674bbf28517321f07c855a111c9290854d (patch)
tree2ce007798566a4624daea623168be0acee48fb3f /crypto/src/tls/TlsProtocol.cs
parentRemove redundant test and add Parallelizable (diff)
downloadBouncyCastle.NET-ed25519-62ef1a674bbf28517321f07c855a111c9290854d.tar.xz
Move m_resumedSession to SecurityParameters
Diffstat (limited to 'crypto/src/tls/TlsProtocol.cs')
-rw-r--r--crypto/src/tls/TlsProtocol.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/crypto/src/tls/TlsProtocol.cs b/crypto/src/tls/TlsProtocol.cs
index 67ee5773b..dbbb6e0f5 100644
--- a/crypto/src/tls/TlsProtocol.cs
+++ b/crypto/src/tls/TlsProtocol.cs
@@ -150,7 +150,6 @@ namespace Org.BouncyCastle.Tls
         protected IDictionary<int, byte[]> m_serverExtensions = null;
 
         protected short m_connectionState = CS_START;
-        protected bool m_resumedSession = false;
         protected bool m_selectedPsk13 = false;
         protected bool m_receivedChangeCipherSpec = false;
         protected bool m_expectSessionTicket = false;
@@ -361,7 +360,6 @@ namespace Org.BouncyCastle.Tls
 
             this.m_handshakeHash = new DeferredHash(context);
             this.m_connectionState = CS_START;
-            this.m_resumedSession = false;
             this.m_selectedPsk13 = false;
 
             context.HandshakeBeginning(peer);
@@ -392,7 +390,6 @@ namespace Org.BouncyCastle.Tls
             this.m_clientExtensions = null;
             this.m_serverExtensions = null;
 
-            this.m_resumedSession = false;
             this.m_selectedPsk13 = false;
             this.m_receivedChangeCipherSpec = false;
             this.m_expectSessionTicket = false;
@@ -1320,9 +1317,8 @@ namespace Org.BouncyCastle.Tls
                     return false;
 
                 /*
-                 * NOTE: For session resumption without extended_master_secret, renegotiation MUST be
-                 * disabled (see RFC 7627 5.4). We currently do not implement renegotiation and it is
-                 * unlikely we ever would since it was removed in TLS 1.3.
+                 * NOTE: For session resumption without extended_master_secret, renegotiation MUST be disabled
+                 * (see RFC 7627 5.4).
                  */
             }
 
@@ -1385,7 +1381,7 @@ namespace Org.BouncyCastle.Tls
 
             securityParameters.m_peerVerifyData = expected_verify_data;
 
-            if (!m_resumedSession || securityParameters.IsExtendedMasterSecret)
+            if (!securityParameters.IsResumedSession || securityParameters.IsExtendedMasterSecret)
             {
                 if (null == securityParameters.LocalVerifyData)
                 {
@@ -1553,7 +1549,7 @@ namespace Org.BouncyCastle.Tls
 
             securityParameters.m_localVerifyData = verify_data;
 
-            if (!m_resumedSession || securityParameters.IsExtendedMasterSecret)
+            if (!securityParameters.IsResumedSession || securityParameters.IsExtendedMasterSecret)
             {
                 if (null == securityParameters.PeerVerifyData)
                 {
@@ -1660,9 +1656,9 @@ namespace Org.BouncyCastle.Tls
             short maxFragmentLength = TlsExtensionsUtilities.GetMaxFragmentLengthExtension(serverExtensions);
             if (maxFragmentLength >= 0)
             {
-                if (!MaxFragmentLength.IsValid(maxFragmentLength)
-                    || (!m_resumedSession &&
-                        maxFragmentLength != TlsExtensionsUtilities.GetMaxFragmentLengthExtension(clientExtensions)))
+                if (!MaxFragmentLength.IsValid(maxFragmentLength) ||
+                (clientExtensions != null &&
+                    maxFragmentLength != TlsExtensionsUtilities.GetMaxFragmentLengthExtension(clientExtensions)))
                 {
                     throw new TlsFatalAlert(alertDescription);
                 }