From feebe21adeb5bb52eb4efe5f2f46d39ea2ae3c24 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Thu, 4 Jul 2024 14:53:20 +0200 Subject: [PATCH] fixup! refactor and constify X509_REQ_get_extensions() --- crypto/x509/x509_req.c | 2 +- include/openssl/types.h | 6 ++++++ include/openssl/x509.h.in | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c index dec70ae991ee6a..d6413708a2654b 100644 --- a/crypto/x509/x509_req.c +++ b/crypto/x509/x509_req.c @@ -139,7 +139,7 @@ static STACK_OF(X509_EXTENSION) *get_extensions_by_nid(const X509_REQ *req, ASN1_ITEM_rptr(X509_EXTENSIONS)); } -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(const X509_REQ *req) +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(TYPEQOSSL_CONST_FUTURE X509_REQ *req) { STACK_OF(X509_EXTENSION) *exts = NULL; int *pnid; diff --git a/include/openssl/types.h b/include/openssl/types.h index c28028681fcefa..e4e18860e66cb5 100644 --- a/include/openssl/types.h +++ b/include/openssl/types.h @@ -33,6 +33,12 @@ extern "C" { # include # include +#if OPENSSL_VERSION_MAJOR >= 4 +# define OSSL_CONST_FUTURE const +#else +# define TYPEQOSSL_CONST_FUTURE +#endif + typedef struct ossl_provider_st OSSL_PROVIDER; /* Provider Object */ # ifdef NO_ASN1_TYPEDEFS diff --git a/include/openssl/x509.h.in b/include/openssl/x509.h.in index 6f13feee09e969..7f31131a62021b 100644 --- a/include/openssl/x509.h.in +++ b/include/openssl/x509.h.in @@ -710,7 +710,7 @@ X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); int X509_REQ_extension_nid(int nid); int *X509_REQ_get_extension_nids(void); void X509_REQ_set_extension_nids(int *nids); -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(const X509_REQ *req); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(TYPEQOSSL_CONST_FUTURE X509_REQ *req); int X509_REQ_add_extensions_nid(X509_REQ *req, const STACK_OF(X509_EXTENSION) *exts, int nid); int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *ext);