diff options
author | 2020-04-10 07:05:24 +0000 | |
---|---|---|
committer | 2020-04-10 07:05:24 +0000 | |
commit | 7f8f8deddf97791fa2c29ffa0c447b4f33cc54e0 (patch) | |
tree | 4287f4d0cb92d52d76e880d3a3487cbf03145f67 | |
parent | Add tests for TOKEN expansion of LocalForward and RemoteForward. (diff) | |
download | wireguard-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.c | 6 |
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 = "-"; |