diff options
author | tb <> | 2020-04-10 07:05:24 +0000 |
---|---|---|
committer | tb <> | 2020-04-10 07:05:24 +0000 |
commit | da4034c084e35db0f8c561294d6b99b21f3770bf (patch) | |
tree | 53b8eec1e84da1dbf8840b14d612f21a67fcf0e9 | |
parent | aac4a18c7244667683abb07c55687fbe9e44eacd (diff) | |
download | openbsd-da4034c084e35db0f8c561294d6b99b21f3770bf.tar.gz openbsd-da4034c084e35db0f8c561294d6b99b21f3770bf.tar.bz2 openbsd-da4034c084e35db0f8c561294d6b99b21f3770bf.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-- | src/lib/libcrypto/asn1/t_x509.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index e287a6cf6a..73a0491c00 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_x509.c,v 1.31 2018/05/18 18:23:24 tb Exp $ */ | 1 | /* $OpenBSD: t_x509.c,v 1.32 2020/04/10 07:05:24 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -145,8 +145,10 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
145 | goto err; | 145 | goto err; |
146 | 146 | ||
147 | bs = X509_get_serialNumber(x); | 147 | bs = X509_get_serialNumber(x); |
148 | if (bs->length <= (int)sizeof(long)) { | 148 | l = -1; |
149 | if (bs->length <= (int)sizeof(long)) | ||
149 | l = ASN1_INTEGER_get(bs); | 150 | l = ASN1_INTEGER_get(bs); |
151 | if (l != -1) { | ||
150 | if (bs->type == V_ASN1_NEG_INTEGER) { | 152 | if (bs->type == V_ASN1_NEG_INTEGER) { |
151 | l = -l; | 153 | l = -l; |
152 | neg = "-"; | 154 | neg = "-"; |