From baffac980d9962290dc401f2d81c6c980e4d81b8 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 26 Oct 2023 16:28:58 +0700 Subject: DTLS: Fixed retransmission in response to re-receipt of an aggregated ChangeCipherSpec - see https://github.com/bcgit/bc-java/pull/1491 --- crypto/src/tls/TlsUtilities.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'crypto/src/tls/TlsUtilities.cs') 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 buffer) + { + int n = buffer[0] << 8; + n |= buffer[1]; + return n; + } +#endif + public static int ReadUint24(Stream input) { int i1 = input.ReadByte(); -- cgit 1.4.1