diff --git a/lib/asn1/check-der.c b/lib/asn1/check-der.c index 12bcfd9ee..c48e7e2a2 100644 --- a/lib/asn1/check-der.c +++ b/lib/asn1/check-der.c @@ -706,17 +706,30 @@ test_heim_oid_format_same(const char *str, const heim_oid *oid) { int ret; char *p; + heim_oid o2; - ret = der_print_heim_oid(oid, &p); + ret = der_print_heim_oid(oid, ' ', &p); if (ret) { printf("fail to print oid: %s\n", str); return 1; } ret = strcmp(p, str); - if (ret) + if (ret) { printf("oid %s != formated oid %s\n", str, p); - free(p); - return ret != 0; + free(p); + return ret; + } + + ret = der_parse_heim_oid(p, " ", &o2); + if (ret) { + printf("failed to parse %s\n", p); + free(p); + return ret; + } + ret = heim_oid_cmp(&o2, oid); + free_oid(&o2); + + return ret; } static int diff --git a/lib/asn1/der.h b/lib/asn1/der.h index 7ca7ee6f7..636db7ee4 100644 --- a/lib/asn1/der.h +++ b/lib/asn1/der.h @@ -243,7 +243,8 @@ int der_get_tag_num(const char *); int der_parse_hex_heim_integer(const char *, heim_integer *); int der_print_hex_heim_integer(const heim_integer *, char **); -int der_print_heim_oid (const heim_oid *data, char **); +int der_print_heim_oid (const heim_oid *, char, char **); +int der_parse_heim_oid (const char *, const char *, heim_oid *); #endif /* __DER_H__ */