Index: net/der/parse_values.h |
diff --git a/net/der/parse_values.h b/net/der/parse_values.h |
index 39c3c029966fe04bfbfb58a3f9934ec36c7b8b52..92cd81f08e0e5c4bf833da3b0fcdb6ac20d2b214 100644 |
--- a/net/der/parse_values.h |
+++ b/net/der/parse_values.h |
@@ -22,12 +22,30 @@ NET_EXPORT bool ParseBool(const Input& in, bool* out) WARN_UNUSED_RESULT; |
// value that is a valid BER encoding will be parsed successfully. |
NET_EXPORT bool ParseBoolRelaxed(const Input& in, bool* out) WARN_UNUSED_RESULT; |
+// Checks the validity of a DER-encoded ASN.1 INTEGER value from |in|, and |
+// determines the sign and length of the number. Returns true on success and |
+// fills |negative| and |numeric_length|. Otherwise returns false and does not |
+// modify any outputs. |
+// |
+// in: The value portion of an INTEGER. |
+// negative: Out parameter that is set to true if the number is negative, |
+// and false otherwise (zero counts as !negative). |
+// numeric_length: The minimum number of bytes needed to represent this |
+// INTEGER using either a signed or unsigned twos-complement |
+// representation. For negative INTEGERs the numeric_length will always |
+// be in.Length(). However for non-negative numbers the numeric_length |
+// may be one less than in.Length(). This happens because the first byte |
+// may be entirely zero simply to indicate that it is not negative. |
+NET_EXPORT bool ParseInteger(const Input& in, |
nharper
2015/08/14 22:23:41
All of the other Parse* functions here are of the
eroman
2015/08/14 23:19:38
Done. Renamed to IsValidInteger().
|
+ bool* negative, |
+ size_t* numeric_length) WARN_UNUSED_RESULT; |
+ |
// Reads a DER-encoded ASN.1 INTEGER value from |in| and puts the resulting |
// value in |out|. ASN.1 INTEGERs are arbitrary precision; this function is |
// provided as a convenience when the caller knows that the value is unsigned |
-// and is between 0 and 2^63-1. This function does not support the full range of |
-// uint64_t. This function returns false if the value is too big to fit in a |
-// uint64_t, is negative, or if there is an error reading the integer. |
+// and is between 0 and 2^64-1. This function returns false if the value is too |
+// big to fit in a uint64_t, is negative, or if there is an error reading the |
+// integer. |
NET_EXPORT bool ParseUint64(const Input& in, uint64_t* out) WARN_UNUSED_RESULT; |
// The BitString class is a helper for representing a valid parsed BIT STRING. |