diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-05 23:04:19 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-05 23:04:19 +0700 |
commit | 4ff3ad2363c111d8723821687b14c1189ecac675 (patch) | |
tree | 0c8683c876c827dcf2457ba425af85c74c4e582c /crypto/src/tls/TlsUtilities.cs | |
parent | Add TlsPeer.IgnoreCorruptDtlsRecords (diff) | |
download | BouncyCastle.NET-ed25519-4ff3ad2363c111d8723821687b14c1189ecac675.tar.xz |
Add Span-based variants in DTLS
Diffstat (limited to 'crypto/src/tls/TlsUtilities.cs')
-rw-r--r-- | crypto/src/tls/TlsUtilities.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs index f12198082..463928ba6 100644 --- a/crypto/src/tls/TlsUtilities.cs +++ b/crypto/src/tls/TlsUtilities.cs @@ -747,9 +747,16 @@ namespace Org.BouncyCastle.Tls public static short ReadUint8(byte[] buf, int offset) { - return (short)(buf[offset] & 0xff); + return (short)buf[offset]; } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public static short ReadUint8(ReadOnlySpan<byte> buffer) + { + return (short)buffer[0]; + } +#endif + public static int ReadUint16(Stream input) { int i1 = input.ReadByte(); |