summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2020-04-10 07:05:25 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2020-04-10 07:05:25 +0000
commit0a29c7a624b6eeaeb17ca6fc9923d670aefaaec9 (patch)
treedb62616d2467f0ebd9ffd6e7e7692b191aeb858e /lib
parent7a56bd909b4fe46d2e1b1be743ea79ebfad99e4d (diff)
When printing the serialNumber, fall back to the colon separated hex
bytes in case ASN1_INTEGER_get() failed. This happens more often since asn1/a_int.c -r1.34. Matches OpenSSL behavior. Issue in openssl x509 -text output reported by sthen ok jsing sthen
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/t_x509.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/t_x509.c b/lib/libcrypto/asn1/t_x509.c
index e287a6cf6a4..73a0491c003 100644
--- a/lib/libcrypto/asn1/t_x509.c
+++ b/lib/libcrypto/asn1/t_x509.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_x509.c,v 1.31 2018/05/18 18:23:24 tb Exp $ */
+/* $OpenBSD: t_x509.c,v 1.32 2020/04/10 07:05:24 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -145,8 +145,10 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
goto err;
bs = X509_get_serialNumber(x);
- if (bs->length <= (int)sizeof(long)) {
+ l = -1;
+ if (bs->length <= (int)sizeof(long))
l = ASN1_INTEGER_get(bs);
+ if (l != -1) {
if (bs->type == V_ASN1_NEG_INTEGER) {
l = -l;
neg = "-";