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

Unified Diff: net/der/parser.cc

Issue 1248043002: Add functions for DER parsing a BIT STRING. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
Index: net/der/parser.cc
diff --git a/net/der/parser.cc b/net/der/parser.cc
index 1d9cbc51086b00a7470addbe0d0448fdf03ecc90..c42d4200d6e6f721bcc70362db816636ed8d2300 100644
--- a/net/der/parser.cc
+++ b/net/der/parser.cc
@@ -186,6 +186,20 @@ bool Parser::ReadUint64(uint64_t* out) {
return ParseUint64(encoded_int, out);
}
+bool Parser::ReadBitString(Input* bytes, uint8_t* unused_bits) {
+ Input value;
+ if (!ReadTag(kBitString, &value))
+ return false;
+ return ParseBitString(value, bytes, unused_bits);
+}
+
+bool Parser::ReadBitStringNoUnusedBits(Input* bytes) {
+ uint8_t unused_bits;
+ if (!ReadBitString(bytes, &unused_bits))
+ return false;
+ return unused_bits == 0;
nharper 2015/07/21 23:23:47 This approach results in modifying *bytes even if
eroman 2015/07/22 17:05:23 Done.
+}
+
} // namespace der
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698