Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: net/base/asn1_util.h

Issue 6993027: net: followup to codereview for cl/7096014 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/asn1_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/asn1_util.h
diff --git a/net/base/asn1_util.h b/net/base/asn1_util.h
index ea6277ac0345bac929552a9e7a4bbf5ea9101e24..dc9982be8d463a77798625d09da24dc53525ce58 100644
--- a/net/base/asn1_util.h
+++ b/net/base/asn1_util.h
@@ -24,10 +24,12 @@ static const unsigned kSEQUENCE = 0x30;
// These are flags that can be ORed with the above tag numbers.
static const unsigned kContextSpecific = 0x80;
-static const unsigned kCompound = 0x20;
+static const unsigned kConstructed = 0x20;
// kAny matches any tag value;
static const unsigned kAny = 0x10000;
+// kOptional denotes an optional element.
+static const unsigned kOptional = 0x20000;
// ParseElement parses a DER encoded ASN1 element from |in|, requiring that
// it have the given |tag_value|. It returns true on success. The following
@@ -38,6 +40,9 @@ static const unsigned kAny = 0x10000;
// |in| is advanced over the element
// |out| contains the element, including the tag and length bytes.
// |out_header_len| contains the length of the tag and length bytes in |out|.
+//
+// If |tag_value & kOptional| is true then *out_header_len can be zero after a
+// true return value if the element was not found.
bool ParseElement(base::StringPiece* in,
unsigned tag_value,
base::StringPiece* out,
@@ -45,11 +50,13 @@ bool ParseElement(base::StringPiece* in,
// GetElement performs the same actions as ParseElement, except that the header
// bytes are not included in the output.
+//
+// If |tag_value & kOptional| is true then this function cannot distinguish
+// between a missing optional element and an empty one.
bool GetElement(base::StringPiece* in,
unsigned tag_value,
base::StringPiece* out);
-
// ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and
// extracts the bytes of the SubjectPublicKeyInfo. On successful return,
// |spki_out| is set to contain the SPKI, pointing into |cert|.
@@ -63,6 +70,8 @@ NET_TEST bool ExtractSPKIFromDERCert(base::StringPiece cert,
// CRLs that only cover a subset of the reasons are omitted as the spec
// requires that at least one CRL be included that covers all reasons.
//
+// CRLs that use an alternative issuer are also omitted.
+//
// The nested set of GeneralNames is flattened into a single list because
// having several CRLs with one location is equivalent to having one CRL with
// several locations as far as a CRL filter is concerned.
« no previous file with comments | « no previous file | net/base/asn1_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698