summary refs log tree commit diff
path: root/crypto/src/tls/TlsUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-10-26 16:28:58 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-10-26 16:28:58 +0700
commitbaffac980d9962290dc401f2d81c6c980e4d81b8 (patch)
tree6c7411b7ed45a70c0e279c5d8f6a554623a99124 /crypto/src/tls/TlsUtilities.cs
parentRefactoring in Ed448 (diff)
downloadBouncyCastle.NET-ed25519-baffac980d9962290dc401f2d81c6c980e4d81b8.tar.xz
DTLS: Fixed retransmission in response to re-receipt of an aggregated ChangeCipherSpec
- see https://github.com/bcgit/bc-java/pull/1491
Diffstat (limited to 'crypto/src/tls/TlsUtilities.cs')
-rw-r--r--crypto/src/tls/TlsUtilities.cs13
1 files changed, 11 insertions, 2 deletions
diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs
index 2887b0df1..67a49e5ef 100644
--- a/crypto/src/tls/TlsUtilities.cs
+++ b/crypto/src/tls/TlsUtilities.cs
@@ -770,11 +770,20 @@ namespace Org.BouncyCastle.Tls
 
         public static int ReadUint16(byte[] buf, int offset)
         {
-            int n = (buf[offset] & 0xff) << 8;
-            n |= (buf[++offset] & 0xff);
+            int n = buf[offset] << 8;
+            n |= buf[++offset];
             return n;
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        public static int ReadUint16(ReadOnlySpan<byte> buffer)
+        {
+            int n = buffer[0] << 8;
+            n |= buffer[1];
+            return n;
+        }
+#endif
+
         public static int ReadUint24(Stream input)
         {
             int i1 = input.ReadByte();