Chromium Code Reviews| Index: net/base/asn1_util.h |
| diff --git a/net/base/asn1_util.h b/net/base/asn1_util.h |
| index 904d7a568ded6a224089bd9250cd10180b323acc..a301b98dec4abbca63d947e8aa4d82d4a6f46446 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. |
|
wtc
2011/06/07 18:17:54
I think this will allow us to distinguish between
|
| 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. |