Commit 76f8005e34 for openssl.org
commit 76f8005e3412523a404ab34482f1ff2ac5573b88
Author: Bob Beck <beck@openssl.org>
Date: Thu Feb 19 13:20:20 2026 -0700
Return the correct error message in ossl_X509_print_ex_brief
X509_verify_cert_times returns a verify error code,
so X509_verify_cert_error_string() must be used to
convert it to text.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Sun Feb 22 17:52:13 2026
(Merged from https://github.com/openssl/openssl/pull/30097)
diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c
index a06e14990a..a23a913f55 100644
--- a/crypto/x509/t_x509.c
+++ b/crypto/x509/t_x509.c
@@ -404,10 +404,9 @@ int ossl_x509_print_ex_brief(BIO *bio, X509 *cert, unsigned long neg_cflags)
goto err;
if (!X509_check_certificate_times(vpm, cert, &error)) {
- char msg[128];
-
- ERR_error_string_n(error, msg, sizeof(msg));
- if (BIO_printf(bio, " %s\n", msg) <= 0)
+ if (BIO_printf(bio, " %s\n",
+ X509_verify_cert_error_string(error))
+ <= 0)
goto err;
}
ret = X509_print_ex(bio, cert, flags,
diff --git a/doc/man3/X509_check_certificate_times.pod b/doc/man3/X509_check_certificate_times.pod
index 53f8c9fe80..e801f43fec 100644
--- a/doc/man3/X509_check_certificate_times.pod
+++ b/doc/man3/X509_check_certificate_times.pod
@@ -136,7 +136,7 @@ L<ASN1_GENERALIZEDTIME_check(3)>
L<ASN1_UTCTIME_check(3)>
L<ASN1_TIME_to_tm(3)>
L<OPENSSL_tm_to_posix(3)> L<OPENSSL_posix_to_tm(3)>
-L<ERR_error_string_n(3)>
+L<X509_verify_cert_error_string(3)>
=head1 HISTORY