return NULL;
if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
- hdr.class != ASN1_CLASS_UNIVERSAL || hdr.tag != ASN1_TAG_INTEGER) {
- wpa_printf(MSG_DEBUG, "RSA: Expected INTEGER - found class %d "
- "tag 0x%x", hdr.class, hdr.tag);
+ !asn1_is_integer(&hdr)) {
+ asn1_unexpected(&hdr, "RSA: Expected INTEGER");
return NULL;
}
* }
*/
- if (asn1_get_next(buf, len, &hdr) < 0 ||
- hdr.class != ASN1_CLASS_UNIVERSAL ||
- hdr.tag != ASN1_TAG_SEQUENCE) {
- wpa_printf(MSG_DEBUG, "RSA: Expected SEQUENCE "
- "(public key) - found class %d tag 0x%x",
- hdr.class, hdr.tag);
+ if (asn1_get_next(buf, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) {
+ asn1_unexpected(&hdr, "RSA: Expected SEQUENCE (public key)");
goto error;
}
pos = hdr.payload;
*
* Version ::= INTEGER -- shall be 0 for this version of the standard
*/
- if (asn1_get_next(buf, len, &hdr) < 0 ||
- hdr.class != ASN1_CLASS_UNIVERSAL ||
- hdr.tag != ASN1_TAG_SEQUENCE) {
- wpa_printf(MSG_DEBUG, "RSA: Expected SEQUENCE "
- "(public key) - found class %d tag 0x%x",
- hdr.class, hdr.tag);
+ if (asn1_get_next(buf, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) {
+ asn1_unexpected(&hdr, "RSA: Expected SEQUENCE (public key)");
goto error;
}
pos = hdr.payload;