summary refs log tree commit diff
path: root/crypto/src/tls/TlsProtocol.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-04 18:18:43 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-04 18:18:43 +0700
commit2d280660f30fe7653ebdc5d1e3d991e20c8bc92f (patch)
treef5e24398c52a45304e2d9d0ef7ceab492ab1d471 /crypto/src/tls/TlsProtocol.cs
parentFix test namespaces (diff)
downloadBouncyCastle.NET-ed25519-2d280660f30fe7653ebdc5d1e3d991e20c8bc92f.tar.xz
Fixes for new_session_ticket
- see https://github.com/bcgit/bc-csharp/issues/317
Diffstat (limited to 'crypto/src/tls/TlsProtocol.cs')
-rw-r--r--crypto/src/tls/TlsProtocol.cs28
1 files changed, 27 insertions, 1 deletions
diff --git a/crypto/src/tls/TlsProtocol.cs b/crypto/src/tls/TlsProtocol.cs
index 8d0e3fc0d..8fe6dc225 100644
--- a/crypto/src/tls/TlsProtocol.cs
+++ b/crypto/src/tls/TlsProtocol.cs
@@ -450,7 +450,7 @@ namespace Org.BouncyCastle.Tls
                         .SetServerExtensions(m_serverExtensions)
                         .Build();
 
-                    this.m_tlsSession = TlsUtilities.ImportSession(m_tlsSession.SessionID, m_sessionParameters);
+                    this.m_tlsSession = TlsUtilities.ImportSession(securityParameters.SessionID, m_sessionParameters);
                 }
                 else
                 {
@@ -590,8 +590,21 @@ namespace Org.BouncyCastle.Tls
                  */
                 case HandshakeType.hello_request:
                 case HandshakeType.key_update:
+                    break;
+
+                /*
+                 * Not included in the transcript for (D)TLS 1.3+
+                 */
                 case HandshakeType.new_session_ticket:
+                {
+                    ProtocolVersion negotiatedVersion = Context.ServerVersion;
+                    if (null != negotiatedVersion && !TlsUtilities.IsTlsV13(negotiatedVersion))
+                    {
+                        buf.UpdateHash(m_handshakeHash);
+                    }
+
                     break;
+                }
 
                 /*
                  * These message types are deferred to the handler to explicitly update the transcript.
@@ -956,8 +969,21 @@ namespace Org.BouncyCastle.Tls
              */
             case HandshakeType.hello_request:
             case HandshakeType.key_update:
+                break;
+
+            /*
+             * Not included in the transcript for (D)TLS 1.3+
+             */
             case HandshakeType.new_session_ticket:
+            {
+                ProtocolVersion negotiatedVersion = Context.ServerVersion;
+                if (null != negotiatedVersion && !TlsUtilities.IsTlsV13(negotiatedVersion))
+                {
+                    m_handshakeHash.Update(buf, off, len);
+                }
+
                 break;
+            }
 
             /*
              * These message types are deferred to the writer to explicitly update the transcript.