* The data type will need to be resolved using the dictionary and the tag value
*/
- if (parent == NULL) {
+ if (!parent) {
fr_strerror_const("No parent attribute to resolve tag");
return -1;
}
- if (tag_class == fr_der_flag_class(parent)) {
- if (*tag == fr_der_flag_tagnum(parent)) {
- *tag = fr_der_flag_der_type(parent);
- } else {
- goto bad_tag;
- }
- } else {
+ if (tag_class != fr_der_flag_class(parent)) {
bad_tag:
fr_strerror_printf("Invalid tag %" PRIu64 " for attribute %s. Expected %" PRIu32, *tag, parent->name,
fr_der_flag_tagnum(parent));
return -1;
}
+
+ if (*tag != fr_der_flag_tagnum(parent)) goto bad_tag;
+
+ *tag = fr_der_flag_der_type(parent);
}
if ((*tag > NUM_ELEMENTS(tag_funcs)) || (*tag == FR_DER_TAG_INVALID)) {
}
func = &tag_funcs[*tag];
+
/*
* Check if the tag is an OID. OID tags will be handled differently
*/
#define DER_TAG_CONSTRUCTED_MASK 0x20 //!< Mask to check if the tag is constructed.
#define DER_TAG_NUM_MASK 0x1f //!< Mask to extract the tag number from the tag.
-#define DER_MAX_TAG_NUM 0xfe * 8 //!< Maximum tag number that can be encoded in a single byte.
-
#define DER_TAG_CONTINUATION 0x1f //!< Mask to check if the tag is a continuation.
#define DER_LEN_MULTI_BYTE 0x80 //!< Mask to check if the length is multi-byte.