partly imported from tenfourfox: #578: M1579060 M1586176

This commit is contained in:
Roy Tam 2019-12-10 10:53:09 +08:00
commit 91821d6b92
2 changed files with 18 additions and 12 deletions

View file

@ -123,6 +123,17 @@ ExpectTagAndSkipValue(Reader& input, uint8_t tag)
return ExpectTagAndGetValue(input, tag, ignoredValue);
}
// This skips IMPLICIT OPTIONAL tags that are "primitive" (not constructed),
// given the number in the class of the tag (i.e. the number in the brackets in
// `issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL`).
inline Result SkipOptionalImplicitPrimitiveTag(Reader& input,
uint8_t numberInClass) {
if (input.Peek(CONTEXT_SPECIFIC | numberInClass)) {
return ExpectTagAndSkipValue(input, CONTEXT_SPECIFIC | numberInClass);
}
return Success;
}
// Like ExpectTagAndGetValue, except the output Input will contain the
// encoded tag and length along with the value.
inline Result