summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2020-04-10 07:05:24 +0000
committertb <tb@openbsd.org>2020-04-10 07:05:24 +0000
commit7f8f8deddf97791fa2c29ffa0c447b4f33cc54e0 (patch)
tree4287f4d0cb92d52d76e880d3a3487cbf03145f67
parentAdd tests for TOKEN expansion of LocalForward and RemoteForward. (diff)
downloadwireguard-openbsd-7f8f8deddf97791fa2c29ffa0c447b4f33cc54e0.tar.xz
wireguard-openbsd-7f8f8deddf97791fa2c29ffa0c447b4f33cc54e0.zip
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
-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 = "-";