summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2016-02-02 16:54:13 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2016-02-02 16:54:13 +0700
commit716152cd047d1fefdf3dde69bfbcb797a171797a (patch)
tree2a0d56c96025b4abbff905d5ccc517219008d58a /crypto
parentAdd DTLS-SRTP protection profiles from RFC 7714 (diff)
downloadBouncyCastle.NET-ed25519-716152cd047d1fefdf3dde69bfbcb797a171797a.tar.xz
Just check the final ReadByte return value
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/tls/TlsUtilities.cs18
1 files changed, 3 insertions, 15 deletions
diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs
index 07e62d9e5..0e32f866a 100644
--- a/crypto/src/crypto/tls/TlsUtilities.cs
+++ b/crypto/src/crypto/tls/TlsUtilities.cs
@@ -349,9 +349,7 @@ namespace Org.BouncyCastle.Crypto.Tls
         {
             int i = input.ReadByte();
             if (i < 0)
-            {
                 throw new EndOfStreamException();
-            }
             return (byte)i;
         }
 
@@ -364,11 +362,9 @@ namespace Org.BouncyCastle.Crypto.Tls
         {
             int i1 = input.ReadByte();
             int i2 = input.ReadByte();
-            if ((i1 | i2) < 0)
-            {
+            if (i2 < 0)
                 throw new EndOfStreamException();
-            }
-            return i1 << 8 | i2;
+            return (i1 << 8) | i2;
         }
 
         public static int ReadUint16(byte[] buf, int offset)
@@ -383,10 +379,8 @@ namespace Org.BouncyCastle.Crypto.Tls
             int i1 = input.ReadByte();
             int i2 = input.ReadByte();
             int i3 = input.ReadByte();
-            if ((i1 | i2 | i3) < 0)
-            {
+            if (i3 < 0)
                 throw new EndOfStreamException();
-            }
             return (i1 << 16) | (i2 << 8) | i3;
         }
 
@@ -405,9 +399,7 @@ namespace Org.BouncyCastle.Crypto.Tls
             int i3 = input.ReadByte();
             int i4 = input.ReadByte();
             if (i4 < 0)
-            {
                 throw new EndOfStreamException();
-            }
             return (long)(uint)((i1 << 24) | (i2 << 16) | (i3 << 8) | i4);
         }
 
@@ -515,9 +507,7 @@ namespace Org.BouncyCastle.Crypto.Tls
             int i1 = input.ReadByte();
             int i2 = input.ReadByte();
             if (i2 < 0)
-            {
                 throw new EndOfStreamException();
-            }
             return ProtocolVersion.Get(i1, i2);
         }
 
@@ -531,9 +521,7 @@ namespace Org.BouncyCastle.Crypto.Tls
             int i1 = input.ReadByte();
             int i2 = input.ReadByte();
             if (i2 < 0)
-            {
                 throw new EndOfStreamException();
-            }
             return (i1 << 8) | i2;
         }