summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/t_crl.c
diff options
context:
space:
mode:
authortb <>2024-05-03 02:52:00 +0000
committertb <>2024-05-03 02:52:00 +0000
commit36210a6ed3ad6990b01d972488bb2311c4ef337a (patch)
tree990bf6270fa19c34c30524f03c101d4c9daea4bd /src/lib/libcrypto/asn1/t_crl.c
parent59e8f6acf45942f143391180b9af714b15665e13 (diff)
downloadopenbsd-36210a6ed3ad6990b01d972488bb2311c4ef337a.tar.gz
openbsd-36210a6ed3ad6990b01d972488bb2311c4ef337a.tar.bz2
openbsd-36210a6ed3ad6990b01d972488bb2311c4ef337a.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_crl.c')
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
index 39e04507ed..6449e7f199 100644
--- a/src/lib/libcrypto/asn1/t_crl.c
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_crl.c,v 1.25 2024/05/02 15:33:59 tb Exp $ */ 1/* $OpenBSD: t_crl.c,v 1.26 2024/05/03 02:52:00 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -96,9 +96,15 @@ X509_CRL_print(BIO *out, X509_CRL *x)
96 96
97 BIO_printf(out, "Certificate Revocation List (CRL):\n"); 97 BIO_printf(out, "Certificate Revocation List (CRL):\n");
98 l = X509_CRL_get_version(x); 98 l = X509_CRL_get_version(x);
99 if (l < 0 || l == LONG_MAX) 99 if (l >= 0 && l <= 1) {
100 goto err; 100 if (BIO_printf(out, "%8sVersion: %lu (0x%lx)\n",
101 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 101 "", l + 1, l) <= 0)
102 goto err;
103 } else {
104 if (BIO_printf(out, "%8sVersion: unknown (%ld)\n",
105 "", l) <= 0)
106 goto err;
107 }
102 if (X509_signature_print(out, x->sig_alg, NULL) == 0) 108 if (X509_signature_print(out, x->sig_alg, NULL) == 0)
103 goto err; 109 goto err;
104 p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); 110 p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);