mirror of https://github.com/openssl/openssl.git
feat: use ossl_serial_number_print in X509_print_ex
Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25428)
This commit is contained in:
parent
935f6e63c9
commit
c90451d89d
|
@ -88,37 +88,10 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
|
||||||
|
|
||||||
if (BIO_write(bp, " Serial Number:", 22) <= 0)
|
if (BIO_write(bp, " Serial Number:", 22) <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
if (ossl_serial_number_print(bp, bs, 12) != 0)
|
||||||
if (bs->length <= (int)sizeof(long)) {
|
goto err;
|
||||||
ERR_set_mark();
|
if (BIO_puts(bp, "\n") <= 0)
|
||||||
l = ASN1_INTEGER_get(bs);
|
goto err;
|
||||||
ERR_pop_to_mark();
|
|
||||||
} else {
|
|
||||||
l = -1;
|
|
||||||
}
|
|
||||||
if (l != -1) {
|
|
||||||
unsigned long ul;
|
|
||||||
if (bs->type == V_ASN1_NEG_INTEGER) {
|
|
||||||
ul = 0 - (unsigned long)l;
|
|
||||||
neg = "-";
|
|
||||||
} else {
|
|
||||||
ul = l;
|
|
||||||
neg = "";
|
|
||||||
}
|
|
||||||
if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, ul, neg, ul) <= 0)
|
|
||||||
goto err;
|
|
||||||
} else {
|
|
||||||
neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";
|
|
||||||
if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
for (i = 0; i < bs->length; i++) {
|
|
||||||
if (BIO_printf(bp, "%02x%c", bs->data[i],
|
|
||||||
((i + 1 == bs->length) ? '\n' : ':')) <= 0)
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cflag & X509_FLAG_NO_SIGNAME)) {
|
if (!(cflag & X509_FLAG_NO_SIGNAME)) {
|
||||||
|
|
Loading…
Reference in New Issue