]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Constify X509_print_fp and X509_print_ex_fp
authorNeil Horman <nhorman@openssl.org>
Wed, 18 Feb 2026 21:04:52 +0000 (16:04 -0500)
committerNeil Horman <nhorman@openssl.org>
Fri, 20 Feb 2026 21:25:26 +0000 (16:25 -0500)
Make the X509 argument to both functions const, as we don't modify the
object at all in these functions.

Again, these functions, while public, appear undocumented, and so I'm
omitting any HISTORY notes

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb 20 21:26:47 2026
(Merged from https://github.com/openssl/openssl/pull/30073)

crypto/x509/t_x509.c
include/openssl/x509.h.in

index 8ccebbb4b5beb59f9e5c8b6f4b296b76ffe2b84b..a06e14990ab92a102fae482729a57a9e9208b875 100644 (file)
@@ -24,12 +24,12 @@ void OSSL_STACK_OF_X509_free(STACK_OF(X509) *certs)
 }
 
 #ifndef OPENSSL_NO_STDIO
-int X509_print_fp(FILE *fp, X509 *x)
+int X509_print_fp(FILE *fp, const X509 *x)
 {
     return X509_print_ex_fp(fp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
 }
 
-int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cflag)
+int X509_print_ex_fp(FILE *fp, const X509 *x, unsigned long nmflag, unsigned long cflag)
 {
     BIO *b;
     int ret;
index 010141a060ca3454d01b1f2bdfd8b5503440a936..457fd03c7307d95d88fed4cc1cd82f63a1ae7855 100644 (file)
@@ -825,8 +825,8 @@ int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
 int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
 int X509_aux_print(BIO *out, const X509 *x, int indent);
 #ifndef OPENSSL_NO_STDIO
-int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, unsigned long cflag);
-int X509_print_fp(FILE *bp, X509 *x);
+int X509_print_ex_fp(FILE *bp, const X509 *x, unsigned long nmflag, unsigned long cflag);
+int X509_print_fp(FILE *bp, const X509 *x);
 int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
 int X509_REQ_print_fp(FILE *bp, const X509_REQ *req);
 int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, unsigned long flags);