diff options
author | tb <> | 2024-05-03 02:52:00 +0000 |
---|---|---|
committer | tb <> | 2024-05-03 02:52:00 +0000 |
commit | e679c1b3b0f5cb90dcd621542a46d60836db83d5 (patch) | |
tree | 990bf6270fa19c34c30524f03c101d4c9daea4bd /src/lib/libcrypto/asn1/t_req.c | |
parent | b7471a707d84ac22bacbbf9a540ce3d3cfa813c5 (diff) | |
download | openbsd-e679c1b3b0f5cb90dcd621542a46d60836db83d5.tar.gz openbsd-e679c1b3b0f5cb90dcd621542a46d60836db83d5.tar.bz2 openbsd-e679c1b3b0f5cb90dcd621542a46d60836db83d5.zip |
Align CRL and CSR version printing with certs
Only print specified 0-based versions and print them with the 1-based
human interpretation. Use a colon and error check the BIO_printf()
calls. (There's a lot more to clean up in here, but that's for another
day).
Notably, X509_CRL_print_ex() is missing... I guess that's better than
having one with signature and semantics differing from X509_print_ex()
und X509_REQ_print_ex().
ok beck
Diffstat (limited to 'src/lib/libcrypto/asn1/t_req.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_req.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index ac011705ef..1d4be9865d 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_req.c,v 1.27 2024/04/09 13:55:02 beck Exp $ */ | 1 | /* $OpenBSD: t_req.c,v 1.28 2024/05/03 02:52:00 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 | * |
@@ -99,7 +99,6 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, | |||
99 | { | 99 | { |
100 | unsigned long l; | 100 | unsigned long l; |
101 | int i; | 101 | int i; |
102 | const char *neg; | ||
103 | X509_REQ_INFO *ri; | 102 | X509_REQ_INFO *ri; |
104 | EVP_PKEY *pkey; | 103 | EVP_PKEY *pkey; |
105 | STACK_OF(X509_ATTRIBUTE) *sk; | 104 | STACK_OF(X509_ATTRIBUTE) *sk; |
@@ -124,15 +123,14 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, | |||
124 | goto err; | 123 | goto err; |
125 | } | 124 | } |
126 | if (!(cflag & X509_FLAG_NO_VERSION)) { | 125 | if (!(cflag & X509_FLAG_NO_VERSION)) { |
127 | neg = (ri->version->type == V_ASN1_NEG_INTEGER) ? "-" : ""; | 126 | if ((l = X509_REQ_get_version(x)) == 0) { |
128 | l = 0; | 127 | if (BIO_printf(bp, "%8sVersion: 1 (0x0)\n", "") <= 0) |
129 | for (i = 0; i < ri->version->length; i++) { | 128 | goto err; |
130 | l <<= 8; | 129 | } else { |
131 | l += ri->version->data[i]; | 130 | if (BIO_printf(bp, "%8sVersion: unknown (%ld)\n", |
131 | "", l) <= 0) | ||
132 | goto err; | ||
132 | } | 133 | } |
133 | if (BIO_printf(bp, "%8sVersion: %s%lu (%s0x%lx)\n", "", neg, | ||
134 | l, neg, l) <= 0) | ||
135 | goto err; | ||
136 | } | 134 | } |
137 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { | 135 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { |
138 | if (BIO_printf(bp, " Subject:%c", mlch) <= 0) | 136 | if (BIO_printf(bp, " Subject:%c", mlch) <= 0) |