-/* $OpenBSD: t_crl.c,v 1.25 2024/05/02 15:33:59 tb Exp $ */
+/* $OpenBSD: t_crl.c,v 1.26 2024/05/03 02:52:00 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
BIO_printf(out, "Certificate Revocation List (CRL):\n");
l = X509_CRL_get_version(x);
- if (l < 0 || l == LONG_MAX)
- goto err;
- BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l);
+ if (l >= 0 && l <= 1) {
+ if (BIO_printf(out, "%8sVersion: %lu (0x%lx)\n",
+ "", l + 1, l) <= 0)
+ goto err;
+ } else {
+ if (BIO_printf(out, "%8sVersion: unknown (%ld)\n",
+ "", l) <= 0)
+ goto err;
+ }
if (X509_signature_print(out, x->sig_alg, NULL) == 0)
goto err;
p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
-/* $OpenBSD: t_req.c,v 1.27 2024/04/09 13:55:02 beck Exp $ */
+/* $OpenBSD: t_req.c,v 1.28 2024/05/03 02:52:00 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
{
unsigned long l;
int i;
- const char *neg;
X509_REQ_INFO *ri;
EVP_PKEY *pkey;
STACK_OF(X509_ATTRIBUTE) *sk;
goto err;
}
if (!(cflag & X509_FLAG_NO_VERSION)) {
- neg = (ri->version->type == V_ASN1_NEG_INTEGER) ? "-" : "";
- l = 0;
- for (i = 0; i < ri->version->length; i++) {
- l <<= 8;
- l += ri->version->data[i];
+ if ((l = X509_REQ_get_version(x)) == 0) {
+ if (BIO_printf(bp, "%8sVersion: 1 (0x0)\n", "") <= 0)
+ goto err;
+ } else {
+ if (BIO_printf(bp, "%8sVersion: unknown (%ld)\n",
+ "", l) <= 0)
+ goto err;
}
- if (BIO_printf(bp, "%8sVersion: %s%lu (%s0x%lx)\n", "", neg,
- l, neg, l) <= 0)
- goto err;
}
if (!(cflag & X509_FLAG_NO_SUBJECT)) {
if (BIO_printf(bp, " Subject:%c", mlch) <= 0)