Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2014-07-24 12:37:11 +0400
committerDavid Hook <dgh@cryptoworkshop.com>2014-07-24 12:37:11 +0400
commitcfe9eb7503b0a831b562704b3ca8b4361f6aa056 (patch)
treee02acfc575b420dde9137809907b74292ef8994f
parent679ac4f12fdc7d5dfe7522d33143dce950c29509 (diff)
parent4802f833909cb5a30439600ae370429bb89c27fe (diff)
Merge remote-tracking branch 'origin/master'
-rw-r--r--core/src/main/j2me/org/bouncycastle/crypto/tls/OCSPStatusRequest.java4
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/OCSPStatusRequest.java4
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/TlsUtils.java39
3 files changed, 43 insertions, 4 deletions
diff --git a/core/src/main/j2me/org/bouncycastle/crypto/tls/OCSPStatusRequest.java b/core/src/main/j2me/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
index cd7d7c09..57219998 100644
--- a/core/src/main/j2me/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
+++ b/core/src/main/j2me/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
@@ -90,11 +90,11 @@ public class OCSPStatusRequest
}
/**
- * Parse a {@link OCSPStatusRequest} from an {@link InputStream}.
+ * Parse an {@link OCSPStatusRequest} from an {@link InputStream}.
*
* @param input
* the {@link InputStream} to parse from.
- * @return a {@link OCSPStatusRequest} object.
+ * @return an {@link OCSPStatusRequest} object.
* @throws IOException
*/
public static OCSPStatusRequest parse(InputStream input) throws IOException
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/OCSPStatusRequest.java b/core/src/main/java/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
index db8168fc..473db23f 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/OCSPStatusRequest.java
@@ -90,11 +90,11 @@ public class OCSPStatusRequest
}
/**
- * Parse a {@link OCSPStatusRequest} from an {@link InputStream}.
+ * Parse an {@link OCSPStatusRequest} from an {@link InputStream}.
*
* @param input
* the {@link InputStream} to parse from.
- * @return a {@link OCSPStatusRequest} object.
+ * @return an {@link OCSPStatusRequest} object.
* @throws IOException
*/
public static OCSPStatusRequest parse(InputStream input) throws IOException
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/TlsUtils.java b/core/src/main/java/org/bouncycastle/crypto/tls/TlsUtils.java
index a1cf9d4b..552486b3 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/TlsUtils.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/TlsUtils.java
@@ -63,6 +63,14 @@ public class TlsUtils
}
}
+ public static void checkUint8(long i) throws IOException
+ {
+ if (!isValidUint8(i))
+ {
+ throw new TlsFatalAlert(AlertDescription.internal_error);
+ }
+ }
+
public static void checkUint16(int i) throws IOException
{
if (!isValidUint16(i))
@@ -71,6 +79,14 @@ public class TlsUtils
}
}
+ public static void checkUint16(long i) throws IOException
+ {
+ if (!isValidUint16(i))
+ {
+ throw new TlsFatalAlert(AlertDescription.internal_error);
+ }
+ }
+
public static void checkUint24(int i) throws IOException
{
if (!isValidUint24(i))
@@ -79,6 +95,14 @@ public class TlsUtils
}
}
+ public static void checkUint24(long i) throws IOException
+ {
+ if (!isValidUint24(i))
+ {
+ throw new TlsFatalAlert(AlertDescription.internal_error);
+ }
+ }
+
public static void checkUint32(long i) throws IOException
{
if (!isValidUint32(i))
@@ -113,16 +137,31 @@ public class TlsUtils
return (i & 0xFF) == i;
}
+ public static boolean isValidUint8(long i)
+ {
+ return (i & 0xFFL) == i;
+ }
+
public static boolean isValidUint16(int i)
{
return (i & 0xFFFF) == i;
}
+ public static boolean isValidUint16(long i)
+ {
+ return (i & 0xFFFFL) == i;
+ }
+
public static boolean isValidUint24(int i)
{
return (i & 0xFFFFFF) == i;
}
+ public static boolean isValidUint24(long i)
+ {
+ return (i & 0xFFFFFFL) == i;
+ }
+
public static boolean isValidUint32(long i)
{
return (i & 0xFFFFFFFFL) == i;