summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-09-03 11:23:44 +0200
committerMatt Caswell <matt@openssl.org>2020-09-13 12:09:45 +0200
commite6623cfbffcc03e2483632359e005ca13adacc9d (patch)
tree64caba9fa625624f304162011a54a55b09b0ad41
parentFix safestack issues in ssl.h (diff)
downloadopenssl-e6623cfbffcc03e2483632359e005ca13adacc9d.tar.xz
openssl-e6623cfbffcc03e2483632359e005ca13adacc9d.zip
Fix safestack issues in x509.h
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12781)
-rw-r--r--.gitignore1
-rw-r--r--apps/ca.c2
-rw-r--r--apps/cmp.c2
-rw-r--r--apps/cmp_mock_srv.c1
-rw-r--r--apps/cms.c1
-rw-r--r--apps/crl2p7.c3
-rw-r--r--apps/lib/apps.c4
-rw-r--r--apps/lib/s_cb.c3
-rw-r--r--apps/nseq.c2
-rw-r--r--apps/ocsp.c1
-rw-r--r--apps/pkcs12.c2
-rw-r--r--apps/pkcs7.c3
-rw-r--r--apps/rehash.c1
-rw-r--r--apps/s_client.c3
-rw-r--r--apps/s_server.c3
-rw-r--r--apps/smime.c1
-rw-r--r--apps/verify.c2
-rw-r--r--apps/x509.c1
-rw-r--r--build.info2
-rw-r--r--crypto/cmp/cmp_client.c2
-rw-r--r--crypto/cmp/cmp_ctx.c2
-rw-r--r--crypto/cmp/cmp_msg.c2
-rw-r--r--crypto/cmp/cmp_protect.c2
-rw-r--r--crypto/cmp/cmp_server.c1
-rw-r--r--crypto/cmp/cmp_util.c1
-rw-r--r--crypto/cmp/cmp_vfy.c2
-rw-r--r--crypto/cms/cms_env.c1
-rw-r--r--crypto/cms/cms_ess.c1
-rw-r--r--crypto/cms/cms_lib.c2
-rw-r--r--crypto/cms/cms_sd.c2
-rw-r--r--crypto/cms/cms_smime.c2
-rw-r--r--crypto/crmf/crmf_lib.c1
-rw-r--r--crypto/ess/ess_lib.c1
-rw-r--r--crypto/evp/p_lib.c1
-rw-r--r--crypto/ocsp/ocsp_cl.c1
-rw-r--r--crypto/ocsp/ocsp_prn.c1
-rw-r--r--crypto/ocsp/ocsp_srv.c1
-rw-r--r--crypto/ocsp/ocsp_vfy.c1
-rw-r--r--crypto/pem/pem_info.c2
-rw-r--r--crypto/pkcs12/p12_crt.c1
-rw-r--r--crypto/pkcs12/p12_kiss.c1
-rw-r--r--crypto/pkcs7/pk7_doit.c1
-rw-r--r--crypto/pkcs7/pk7_lib.c2
-rw-r--r--crypto/pkcs7/pk7_smime.c2
-rw-r--r--crypto/store/store_result.c2
-rw-r--r--crypto/ts/ts_conf.c2
-rw-r--r--crypto/ts/ts_req_utils.c2
-rw-r--r--crypto/ts/ts_rsp_sign.c2
-rw-r--r--crypto/ts/ts_rsp_utils.c2
-rw-r--r--crypto/ts/ts_rsp_verify.c1
-rw-r--r--crypto/ts/ts_verify_ctx.c2
-rw-r--r--crypto/x509/by_file.c2
-rw-r--r--crypto/x509/pcy_tree.c1
-rw-r--r--crypto/x509/t_crl.c2
-rw-r--r--crypto/x509/t_req.c2
-rw-r--r--crypto/x509/t_x509.c1
-rw-r--r--crypto/x509/v3_addr.c1
-rw-r--r--crypto/x509/v3_asid.c1
-rw-r--r--crypto/x509/v3_conf.c1
-rw-r--r--crypto/x509/v3_crld.c1
-rw-r--r--crypto/x509/v3_lib.c1
-rw-r--r--crypto/x509/v3_prn.c1
-rw-r--r--crypto/x509/v3_utl.c1
-rw-r--r--crypto/x509/x509_att.c1
-rw-r--r--crypto/x509/x509_cmp.c2
-rw-r--r--crypto/x509/x509_lu.c2
-rw-r--r--crypto/x509/x509_obj.c2
-rw-r--r--crypto/x509/x509_r2x.c2
-rw-r--r--crypto/x509/x509_trs.c1
-rw-r--r--crypto/x509/x509_v3.c2
-rw-r--r--crypto/x509/x509_vfy.c4
-rw-r--r--crypto/x509/x509cset.c2
-rw-r--r--crypto/x509/x509name.c2
-rw-r--r--crypto/x509/x_crl.c2
-rw-r--r--crypto/x509/x_name.c1
-rw-r--r--crypto/x509/x_req.c2
-rw-r--r--engines/e_capi.c3
-rw-r--r--engines/e_loader_attic.c1
-rw-r--r--include/openssl/x509.h.in (renamed from include/openssl/x509.h)36
-rw-r--r--providers/implementations/storemgmt/file_store.c1
-rw-r--r--ssl/s3_lib.c3
-rw-r--r--ssl/ssl_cert.c3
-rw-r--r--ssl/ssl_conf.c2
-rw-r--r--ssl/ssl_lib.c3
-rw-r--r--ssl/ssl_rsa.c2
-rw-r--r--ssl/ssl_sess.c2
-rw-r--r--ssl/statem/extensions.c2
-rw-r--r--ssl/statem/extensions_srvr.c1
-rw-r--r--ssl/statem/statem_clnt.c2
-rw-r--r--ssl/statem/statem_lib.c3
-rw-r--r--ssl/statem/statem_srvr.c2
-rw-r--r--ssl/t1_lib.c3
-rw-r--r--test/cmp_client_test.c1
-rw-r--r--test/cmp_ctx_test.c2
-rw-r--r--test/cmp_protect_test.c2
-rw-r--r--test/cmp_testlib.c2
-rw-r--r--test/cmsapitest.c2
-rw-r--r--test/crltest.c3
-rw-r--r--test/danetest.c2
-rw-r--r--test/handshake_helper.c2
-rw-r--r--test/ocspapitest.c2
-rw-r--r--test/pkcs12_helper.c2
-rw-r--r--test/ssl_test.c2
-rw-r--r--test/ssl_test_ctx.c1
-rw-r--r--test/sslapitest.c2
-rw-r--r--test/verify_extra_test.c2
106 files changed, 30 insertions, 193 deletions
diff --git a/.gitignore b/.gitignore
index 498d3aeffa..1996b07fa1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@
/include/openssl/opensslv.h
/include/openssl/fipskey.h
/include/openssl/ssl.h
+/include/openssl/x509.h
# Auto generated doc files
doc/man1/openssl-*.pod
diff --git a/apps/ca.c b/apps/ca.c
index 3c2bee8f2f..cb1c90991c 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -34,8 +34,6 @@
#include "apps.h"
#include "progs.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
diff --git a/apps/cmp.c b/apps/cmp.c
index db0d418bd4..4d77b541c4 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -42,8 +42,6 @@
#include <openssl/objects.h>
#include <openssl/x509.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
static char *opt_config = NULL;
diff --git a/apps/cmp_mock_srv.c b/apps/cmp_mock_srv.c
index 3a0819008b..2c82567856 100644
--- a/apps/cmp_mock_srv.c
+++ b/apps/cmp_mock_srv.c
@@ -15,7 +15,6 @@
#include <openssl/err.h>
#include <openssl/cmperr.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
DEFINE_STACK_OF(ASN1_UTF8STRING)
diff --git a/apps/cms.c b/apps/cms.c
index d154f460b3..fada7b57a9 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -23,7 +23,6 @@
# include <openssl/x509v3.h>
# include <openssl/cms.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(CMS_SignerInfo)
DEFINE_STACK_OF(GENERAL_NAME)
DEFINE_STACK_OF(GENERAL_NAMES)
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index e0de95a12a..545fe0a53b 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -19,9 +19,6 @@
#include <openssl/pem.h>
#include <openssl/objects.h>
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_INFO)
DEFINE_STACK_OF_STRING()
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 5d95ce0c65..bd6a6bc54b 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -63,10 +63,6 @@ static int WIN32_rename(const char *from, const char *to);
DEFINE_STACK_OF(CONF)
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509_INFO)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(X509_POLICY_NODE)
DEFINE_STACK_OF(GENERAL_NAME)
DEFINE_STACK_OF(DIST_POINT)
diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c
index 0ae851d792..b53d4cbd40 100644
--- a/apps/lib/s_cb.c
+++ b/apps/lib/s_cb.c
@@ -26,9 +26,6 @@
#define COOKIE_SECRET_LENGTH 16
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509_NAME)
DEFINE_STACK_OF_STRING()
VERIFY_CB_ARGS verify_args = { -1, 0, X509_V_OK, 0 };
diff --git a/apps/nseq.c b/apps/nseq.c
index de189632b2..92ae7bd34d 100644
--- a/apps/nseq.c
+++ b/apps/nseq.c
@@ -14,8 +14,6 @@
#include <openssl/pem.h>
#include <openssl/err.h>
-DEFINE_STACK_OF(X509)
-
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_TOSEQ, OPT_IN, OPT_OUT,
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 4f42d66c0e..ad699629f6 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -35,7 +35,6 @@
DEFINE_STACK_OF(OCSP_CERTID)
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF_STRING()
#if defined(__TANDEM)
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 23ffa98f77..fddfdbca36 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -20,10 +20,8 @@
#include <openssl/pkcs12.h>
#include <openssl/provider.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(PKCS7)
DEFINE_STACK_OF(PKCS12_SAFEBAG)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
DEFINE_STACK_OF_STRING()
#define NOKEYS 0x1
diff --git a/apps/pkcs7.c b/apps/pkcs7.c
index 95d3ca0845..e6ac26e6f9 100644
--- a/apps/pkcs7.c
+++ b/apps/pkcs7.c
@@ -20,9 +20,6 @@
#include <openssl/pkcs7.h>
#include <openssl/pem.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
-
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOOUT,
diff --git a/apps/rehash.c b/apps/rehash.c
index 866b8cfe20..efa0b65497 100644
--- a/apps/rehash.c
+++ b/apps/rehash.c
@@ -42,7 +42,6 @@
# include <openssl/pem.h>
# include <openssl/x509.h>
-DEFINE_STACK_OF(X509_INFO)
DEFINE_STACK_OF_STRING()
# ifndef PATH_MAX
diff --git a/apps/s_client.c b/apps/s_client.c
index 2a58589ce2..32aa6fafcb 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -59,9 +59,6 @@ typedef unsigned int u_int;
# endif
#endif
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509_NAME)
DEFINE_STACK_OF(SCT)
DEFINE_STACK_OF_STRING()
diff --git a/apps/s_server.c b/apps/s_server.c
index f1ea550fed..c970080d83 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -60,9 +60,6 @@ typedef unsigned int u_int;
#endif
#include "internal/sockets.h"
-DEFINE_STACK_OF(X509_EXTENSION)
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF_STRING()
static int not_resumable_sess_cb(SSL *s, int is_forward_secure);
diff --git a/apps/smime.c b/apps/smime.c
index dbfcdbeb5a..ed3d63af6c 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -19,7 +19,6 @@
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF_STRING()
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
diff --git a/apps/verify.c b/apps/verify.c
index ed20b69b17..c43a4e69a4 100644
--- a/apps/verify.c
+++ b/apps/verify.c
@@ -18,8 +18,6 @@
#include <openssl/x509v3.h>
#include <openssl/pem.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
DEFINE_STACK_OF_STRING()
static int cb(int ok, X509_STORE_CTX *ctx);
diff --git a/apps/x509.c b/apps/x509.c
index 169530f6d6..4b2200c35b 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -29,7 +29,6 @@
#endif
DEFINE_STACK_OF(ASN1_OBJECT)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF_STRING()
#undef POSTFIX
diff --git a/build.info b/build.info
index c1933bf73c..02a36cd435 100644
--- a/build.info
+++ b/build.info
@@ -16,6 +16,7 @@ DEPEND[libssl]=libcrypto
DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/fipskey.h \
include/openssl/ssl.h \
+ include/openssl/x509.h \
include/crypto/bn_conf.h include/crypto/dso_conf.h \
doc/man7/openssl_user_macros.pod
@@ -23,6 +24,7 @@ GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
GENERATE[include/openssl/fipskey.h]=include/openssl/fipskey.h.in
GENERATE[include/openssl/ssl.h]=include/openssl/ssl.h.in
+GENERATE[include/openssl/x509.h]=include/openssl/x509.h.in
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in
diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c
index fe7168916a..567eb45519 100644
--- a/crypto/cmp/cmp_client.c
+++ b/crypto/cmp/cmp_client.c
@@ -22,8 +22,6 @@
#include "openssl/cmp_util.h"
DEFINE_STACK_OF(ASN1_UTF8STRING)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
DEFINE_STACK_OF(OSSL_CMP_PKISI)
DEFINE_STACK_OF(OSSL_CRMF_CERTID)
diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c
index 6bbd3510c7..f324763bf1 100644
--- a/crypto/cmp/cmp_ctx.c
+++ b/crypto/cmp/cmp_ctx.c
@@ -21,8 +21,6 @@
#include <openssl/crmf.h>
#include <openssl/err.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(POLICYINFO)
DEFINE_STACK_OF(ASN1_UTF8STRING)
DEFINE_STACK_OF(GENERAL_NAME)
diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c
index 64e00fc884..11f43ab588 100644
--- a/crypto/cmp/cmp_msg.c
+++ b/crypto/cmp/cmp_msg.c
@@ -24,8 +24,6 @@
DEFINE_STACK_OF(OSSL_CMP_CERTSTATUS)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
DEFINE_STACK_OF(GENERAL_NAME)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(OSSL_CMP_PKISI)
DEFINE_STACK_OF(OSSL_CRMF_MSG)
DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c
index a6a0f9f9e0..eb162e382d 100644
--- a/crypto/cmp/cmp_protect.c
+++ b/crypto/cmp/cmp_protect.c
@@ -18,8 +18,6 @@
#include <openssl/err.h>
#include <openssl/x509.h>
-DEFINE_STACK_OF(X509)
-
/*
* This function is also used by the internal verify_PBMAC() in cmp_vfy.c.
*
diff --git a/crypto/cmp/cmp_server.c b/crypto/cmp/cmp_server.c
index 2ba6cb7984..3c247336fc 100644
--- a/crypto/cmp/cmp_server.c
+++ b/crypto/cmp/cmp_server.c
@@ -20,7 +20,6 @@
#include <openssl/err.h>
DEFINE_STACK_OF(OSSL_CRMF_MSG)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
DEFINE_STACK_OF(OSSL_CMP_CERTSTATUS)
diff --git a/crypto/cmp/cmp_util.c b/crypto/cmp/cmp_util.c
index c2ee9b6e0d..ec292ee352 100644
--- a/crypto/cmp/cmp_util.c
+++ b/crypto/cmp/cmp_util.c
@@ -16,7 +16,6 @@
#include <openssl/err.h> /* should be implied by cmperr.h */
#include <openssl/x509v3.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(X509_OBJECT)
DEFINE_STACK_OF(ASN1_UTF8STRING)
diff --git a/crypto/cmp/cmp_vfy.c b/crypto/cmp/cmp_vfy.c
index f5026e0bbc..00757c11ae 100644
--- a/crypto/cmp/cmp_vfy.c
+++ b/crypto/cmp/cmp_vfy.c
@@ -22,8 +22,6 @@
#include <openssl/x509.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509)
-
/* Verify a message protected by signature according to RFC section 5.1.3.3 */
static int verify_signature(const OSSL_CMP_CTX *cmp_ctx,
const OSSL_CMP_MSG *msg, X509 *cert)
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c
index 944846ca98..f0c895704f 100644
--- a/crypto/cms/cms_env.c
+++ b/crypto/cms/cms_env.c
@@ -21,7 +21,6 @@
DEFINE_STACK_OF(CMS_RecipientInfo)
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
/* CMS EnvelopedData Utilities */
static void cms_env_set_version(CMS_EnvelopedData *env);
diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c
index b6b2037532..6fc0ca27d9 100644
--- a/crypto/cms/cms_ess.c
+++ b/crypto/cms/cms_ess.c
@@ -24,7 +24,6 @@ DEFINE_STACK_OF(GENERAL_NAMES)
DEFINE_STACK_OF(CMS_SignerInfo)
DEFINE_STACK_OF(ESS_CERT_ID)
DEFINE_STACK_OF(ESS_CERT_ID_V2)
-DEFINE_STACK_OF(X509)
IMPLEMENT_ASN1_FUNCTIONS(CMS_ReceiptRequest)
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 9fc8453d99..0b9a3f2b2f 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -22,8 +22,6 @@ static STACK_OF(CMS_CertificateChoices)
**cms_get0_certificate_choices(CMS_ContentInfo *cms);
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
IMPLEMENT_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index c11d44487b..ac07ddefe9 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -24,9 +24,7 @@
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
DEFINE_STACK_OF(CMS_SignerInfo)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(X509_ALGOR)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
/* CMS SignedData Utilities */
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index 92de68aa57..b2287c624d 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -17,8 +17,6 @@
#include "crypto/asn1.h"
DEFINE_STACK_OF(CMS_SignerInfo)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
DEFINE_STACK_OF(CMS_RecipientInfo)
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c
index 3202f357c1..5c3acaf4b2 100644
--- a/crypto/crmf/crmf_lib.c
+++ b/crypto/crmf/crmf_lib.c
@@ -36,7 +36,6 @@
#include <openssl/err.h>
#include <openssl/evp.h>
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(OSSL_CRMF_MSG)
/*-
diff --git a/crypto/ess/ess_lib.c b/crypto/ess/ess_lib.c
index ad0d6f332c..92073b9598 100644
--- a/crypto/ess/ess_lib.c
+++ b/crypto/ess/ess_lib.c
@@ -17,7 +17,6 @@
DEFINE_STACK_OF(ESS_CERT_ID)
DEFINE_STACK_OF(ESS_CERT_ID_V2)
DEFINE_STACK_OF(GENERAL_NAME)
-DEFINE_STACK_OF(X509)
static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed);
static ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new_init(const EVP_MD *hash_alg,
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index cb72048f86..8fe702787d 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -38,7 +38,6 @@
#include "internal/evp.h"
#include "internal/provider.h"
#include "evp_local.h"
-DEFINE_STACK_OF(X509_ATTRIBUTE)
#include "crypto/ec.h"
diff --git a/crypto/ocsp/ocsp_cl.c b/crypto/ocsp/ocsp_cl.c
index f45bf1d6dc..b977e88d03 100644
--- a/crypto/ocsp/ocsp_cl.c
+++ b/crypto/ocsp/ocsp_cl.c
@@ -18,7 +18,6 @@
#include <openssl/ocsp.h>
#include "ocsp_local.h"
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OCSP_ONEREQ)
DEFINE_STACK_OF(OCSP_SINGLERESP)
diff --git a/crypto/ocsp/ocsp_prn.c b/crypto/ocsp/ocsp_prn.c
index c782a8e531..c4917ee184 100644
--- a/crypto/ocsp/ocsp_prn.c
+++ b/crypto/ocsp/ocsp_prn.c
@@ -15,7 +15,6 @@
#include <openssl/pem.h>
DEFINE_STACK_OF(OCSP_ONEREQ)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OCSP_SINGLERESP)
static int ocsp_certid_print(BIO *bp, OCSP_CERTID *a, int indent)
diff --git a/crypto/ocsp/ocsp_srv.c b/crypto/ocsp/ocsp_srv.c
index d20a714855..a87fea892d 100644
--- a/crypto/ocsp/ocsp_srv.c
+++ b/crypto/ocsp/ocsp_srv.c
@@ -17,7 +17,6 @@
#include "ocsp_local.h"
DEFINE_STACK_OF(OCSP_ONEREQ)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OCSP_SINGLERESP)
/*
diff --git a/crypto/ocsp/ocsp_vfy.c b/crypto/ocsp/ocsp_vfy.c
index cf7602616f..35a01c444d 100644
--- a/crypto/ocsp/ocsp_vfy.c
+++ b/crypto/ocsp/ocsp_vfy.c
@@ -13,7 +13,6 @@
#include <string.h>
DEFINE_STACK_OF(OCSP_ONEREQ)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OCSP_SINGLERESP)
static int ocsp_find_signer(X509 **psigner, OCSP_BASICRESP *bs,
diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c
index a3981c9dda..ef023205c0 100644
--- a/crypto/pem/pem_info.c
+++ b/crypto/pem/pem_info.c
@@ -23,8 +23,6 @@
#include <openssl/rsa.h>
#include <openssl/dsa.h>
-DEFINE_STACK_OF(X509_INFO)
-
#ifndef OPENSSL_NO_STDIO
STACK_OF(X509_INFO)
*PEM_X509_INFO_read_with_libctx(FILE *fp, STACK_OF(X509_INFO) *sk,
diff --git a/crypto/pkcs12/p12_crt.c b/crypto/pkcs12/p12_crt.c
index 699f1b7d61..757b6ae631 100644
--- a/crypto/pkcs12/p12_crt.c
+++ b/crypto/pkcs12/p12_crt.c
@@ -12,7 +12,6 @@
#include <openssl/pkcs12.h>
#include "p12_local.h"
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(PKCS7)
DEFINE_STACK_OF(PKCS12_SAFEBAG)
diff --git a/crypto/pkcs12/p12_kiss.c b/crypto/pkcs12/p12_kiss.c
index 5413aecb1c..433bccdb30 100644
--- a/crypto/pkcs12/p12_kiss.c
+++ b/crypto/pkcs12/p12_kiss.c
@@ -12,7 +12,6 @@
#include <openssl/pkcs12.h>
#include "crypto/x509.h" /* for X509_add_cert_new() */
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(PKCS7)
DEFINE_STACK_OF(PKCS12_SAFEBAG)
diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c
index c48c629398..faefa9e95b 100644
--- a/crypto/pkcs7/pk7_doit.c
+++ b/crypto/pkcs7/pk7_doit.c
@@ -17,7 +17,6 @@
#include "pk7_local.h"
DEFINE_STACK_OF(X509_ALGOR)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
DEFINE_STACK_OF(PKCS7_RECIP_INFO)
DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
diff --git a/crypto/pkcs7/pk7_lib.c b/crypto/pkcs7/pk7_lib.c
index d891ca22e8..59e23a445f 100644
--- a/crypto/pkcs7/pk7_lib.c
+++ b/crypto/pkcs7/pk7_lib.c
@@ -16,8 +16,6 @@
#include "crypto/x509.h" /* for sk_X509_add1_cert() */
#include "pk7_local.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
DEFINE_STACK_OF(X509_ALGOR)
DEFINE_STACK_OF(PKCS7_RECIP_INFO)
DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
index 1dfdd69e51..2bd495a717 100644
--- a/crypto/pkcs7/pk7_smime.c
+++ b/crypto/pkcs7/pk7_smime.c
@@ -17,8 +17,6 @@
#define BUFFERSIZE 4096
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
DEFINE_STACK_OF(X509_ALGOR)
DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
diff --git a/crypto/store/store_result.c b/crypto/store/store_result.c
index 47dd21acb9..0c78e94ec4 100644
--- a/crypto/store/store_result.c
+++ b/crypto/store/store_result.c
@@ -59,8 +59,6 @@
* reference.
*/
-DEFINE_STACK_OF(X509)
-
struct extracted_param_data_st {
int object_type;
const char *data_type;
diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
index 71664fa091..9d4011519e 100644
--- a/crypto/ts/ts_conf.c
+++ b/crypto/ts/ts_conf.c
@@ -18,8 +18,6 @@
#include <openssl/engine.h>
#include <openssl/ts.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_INFO)
DEFINE_STACK_OF(CONF_VALUE)
/* Macro definitions for the configuration file. */
diff --git a/crypto/ts/ts_req_utils.c b/crypto/ts/ts_req_utils.c
index 2d14ed1145..e4b3eee48f 100644
--- a/crypto/ts/ts_req_utils.c
+++ b/crypto/ts/ts_req_utils.c
@@ -14,8 +14,6 @@
#include <openssl/ts.h>
#include "ts_local.h"
-DEFINE_STACK_OF(X509_EXTENSION)
-
int TS_REQ_set_version(TS_REQ *a, long version)
{
return ASN1_INTEGER_set(a->version, version);
diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c
index 33f2b511e8..a1904719cc 100644
--- a/crypto/ts/ts_rsp_sign.c
+++ b/crypto/ts/ts_rsp_sign.c
@@ -17,8 +17,6 @@
#include "ts_local.h"
#include "crypto/ess.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(ASN1_UTF8STRING)
DEFINE_STACK_OF(ASN1_OBJECT)
DEFINE_STACK_OF_CONST(EVP_MD)
diff --git a/crypto/ts/ts_rsp_utils.c b/crypto/ts/ts_rsp_utils.c
index 86e1a9d49d..92dcb5bff7 100644
--- a/crypto/ts/ts_rsp_utils.c
+++ b/crypto/ts/ts_rsp_utils.c
@@ -14,8 +14,6 @@
#include <openssl/pkcs7.h>
#include "ts_local.h"
-DEFINE_STACK_OF(X509_EXTENSION)
-
int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *status_info)
{
TS_STATUS_INFO *new_status_info;
diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c
index c909b211d4..1ca14bc056 100644
--- a/crypto/ts/ts_rsp_verify.c
+++ b/crypto/ts/ts_rsp_verify.c
@@ -16,7 +16,6 @@
#include "crypto/ess.h"
DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(ESS_CERT_ID)
DEFINE_STACK_OF(ESS_CERT_ID_V2)
DEFINE_STACK_OF(ASN1_UTF8STRING)
diff --git a/crypto/ts/ts_verify_ctx.c b/crypto/ts/ts_verify_ctx.c
index 2c95fd1f14..776d5cf43e 100644
--- a/crypto/ts/ts_verify_ctx.c
+++ b/crypto/ts/ts_verify_ctx.c
@@ -12,8 +12,6 @@
#include <openssl/ts.h>
#include "ts_local.h"
-DEFINE_STACK_OF(X509)
-
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
{
TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
index d5e6dde4f8..a4ec328312 100644
--- a/crypto/x509/by_file.c
+++ b/crypto/x509/by_file.c
@@ -17,8 +17,6 @@
#include <openssl/pem.h>
#include "x509_local.h"
-DEFINE_STACK_OF(X509_INFO)
-
static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
long argl, char **ret);
static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd,
diff --git a/crypto/x509/pcy_tree.c b/crypto/x509/pcy_tree.c
index 30879197f8..8b127cf291 100644
--- a/crypto/x509/pcy_tree.c
+++ b/crypto/x509/pcy_tree.c
@@ -15,7 +15,6 @@
#include "pcy_local.h"
DEFINE_STACK_OF(ASN1_OBJECT)
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(X509_POLICY_NODE)
static void expected_print(BIO *channel,
diff --git a/crypto/x509/t_crl.c b/crypto/x509/t_crl.c
index 0824bb6def..44be2f237b 100644
--- a/crypto/x509/t_crl.c
+++ b/crypto/x509/t_crl.c
@@ -15,8 +15,6 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-DEFINE_STACK_OF(X509_REVOKED)
-
#ifndef OPENSSL_NO_STDIO
int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
{
diff --git a/crypto/x509/t_req.c b/crypto/x509/t_req.c
index e1ee12de95..abcca0a8f5 100644
--- a/crypto/x509/t_req.c
+++ b/crypto/x509/t_req.c
@@ -17,8 +17,6 @@
#include <openssl/rsa.h>
#include <openssl/dsa.h>
-DEFINE_STACK_OF(X509_EXTENSION)
-
#ifndef OPENSSL_NO_STDIO
int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
{
diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c
index f0240f12c3..8f4b8e8222 100644
--- a/crypto/x509/t_x509.c
+++ b/crypto/x509/t_x509.c
@@ -17,7 +17,6 @@
#include "crypto/asn1.h"
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(ASN1_OBJECT)
#ifndef OPENSSL_NO_STDIO
diff --git a/crypto/x509/v3_addr.c b/crypto/x509/v3_addr.c
index d965d74553..b369f79d01 100644
--- a/crypto/x509/v3_addr.c
+++ b/crypto/x509/v3_addr.c
@@ -29,7 +29,6 @@
DEFINE_STACK_OF(IPAddressOrRange)
DEFINE_STACK_OF(IPAddressFamily)
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509)
/*
* OpenSSL ASN.1 template translation of RFC 3779 2.2.3.
diff --git a/crypto/x509/v3_asid.c b/crypto/x509/v3_asid.c
index 0fc7641386..e5fcff5522 100644
--- a/crypto/x509/v3_asid.c
+++ b/crypto/x509/v3_asid.c
@@ -58,7 +58,6 @@ IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
DEFINE_STACK_OF(ASIdOrRange)
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509)
/*
* i2r method for an ASIdentifierChoice.
diff --git a/crypto/x509/v3_conf.c b/crypto/x509/v3_conf.c
index 88e29f9cc4..3471ce098f 100644
--- a/crypto/x509/v3_conf.c
+++ b/crypto/x509/v3_conf.c
@@ -18,7 +18,6 @@
#include <openssl/x509v3.h>
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509_EXTENSION)
static int v3_check_critical(const char **value);
static int v3_check_generic(const char **value);
diff --git a/crypto/x509/v3_crld.c b/crypto/x509/v3_crld.c
index 8b4e100714..2daaad84c1 100644
--- a/crypto/x509/v3_crld.c
+++ b/crypto/x509/v3_crld.c
@@ -21,7 +21,6 @@
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF(GENERAL_NAME)
DEFINE_STACK_OF(DIST_POINT)
-DEFINE_STACK_OF(X509_NAME_ENTRY)
static void *v2i_crld(const X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
diff --git a/crypto/x509/v3_lib.c b/crypto/x509/v3_lib.c
index b1e32bb419..093e33b102 100644
--- a/crypto/x509/v3_lib.c
+++ b/crypto/x509/v3_lib.c
@@ -17,7 +17,6 @@
#include "ext_dat.h"
DEFINE_STACK_OF(X509V3_EXT_METHOD)
-DEFINE_STACK_OF(X509_EXTENSION)
static STACK_OF(X509V3_EXT_METHOD) *ext_list = NULL;
diff --git a/crypto/x509/v3_prn.c b/crypto/x509/v3_prn.c
index 4b2ad2685b..de39a0f0b0 100644
--- a/crypto/x509/v3_prn.c
+++ b/crypto/x509/v3_prn.c
@@ -15,7 +15,6 @@
#include <openssl/x509v3.h>
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509_EXTENSION)
/* Extension printing routines */
diff --git a/crypto/x509/v3_utl.c b/crypto/x509/v3_utl.c
index e31be45e03..ce64aa658b 100644
--- a/crypto/x509/v3_utl.c
+++ b/crypto/x509/v3_utl.c
@@ -24,7 +24,6 @@
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF(GENERAL_NAME)
DEFINE_STACK_OF(ACCESS_DESCRIPTION)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF_STRING()
static char *strip_spaces(char *name);
diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c
index ce003615ec..bb4bfe03f4 100644
--- a/crypto/x509/x509_att.c
+++ b/crypto/x509/x509_att.c
@@ -17,7 +17,6 @@
#include <openssl/x509v3.h>
#include "x509_local.h"
-DEFINE_STACK_OF(X509_ATTRIBUTE)
DEFINE_STACK_OF(ASN1_TYPE)
int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x)
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index 32e15682b1..e74c842fdc 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -16,8 +16,6 @@
#include <openssl/core_names.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509)
-
int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
{
int i;
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index f37e09dcdf..77488b6e05 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -17,8 +17,6 @@
DEFINE_STACK_OF(X509_LOOKUP)
DEFINE_STACK_OF(X509_OBJECT)
-DEFINE_STACK_OF(X509_CRL)
-DEFINE_STACK_OF(X509)
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
{
diff --git a/crypto/x509/x509_obj.c b/crypto/x509/x509_obj.c
index 7bed79a2d5..0acfaa3589 100644
--- a/crypto/x509/x509_obj.c
+++ b/crypto/x509/x509_obj.c
@@ -15,8 +15,6 @@
#include "crypto/x509.h"
#include "crypto/ctype.h"
-DEFINE_STACK_OF(X509_NAME_ENTRY)
-
/*
* Limit to ensure we don't overflow: much greater than
* anything encountered in practice.
diff --git a/crypto/x509/x509_r2x.c b/crypto/x509/x509_r2x.c
index a284bf72ca..a03ba24926 100644
--- a/crypto/x509/x509_r2x.c
+++ b/crypto/x509/x509_r2x.c
@@ -17,8 +17,6 @@
#include <openssl/objects.h>
#include <openssl/buffer.h>
-DEFINE_STACK_OF(X509_ATTRIBUTE)
-
X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
{
X509 *ret = NULL;
diff --git a/crypto/x509/x509_trs.c b/crypto/x509/x509_trs.c
index ebd45b68b0..92e2220a13 100644
--- a/crypto/x509/x509_trs.c
+++ b/crypto/x509/x509_trs.c
@@ -12,7 +12,6 @@
#include <openssl/x509v3.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509_TRUST)
DEFINE_STACK_OF(ASN1_OBJECT)
static int tr_cmp(const X509_TRUST *const *a, const X509_TRUST *const *b);
diff --git a/crypto/x509/x509_v3.c b/crypto/x509/x509_v3.c
index f059667263..96ba940aa4 100644
--- a/crypto/x509/x509_v3.c
+++ b/crypto/x509/x509_v3.c
@@ -17,8 +17,6 @@
#include <openssl/x509v3.h>
#include "x509_local.h"
-DEFINE_STACK_OF(X509_EXTENSION)
-
int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x)
{
if (x == NULL)
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index 4a067e5ff4..cc264d0fa8 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -25,11 +25,7 @@
#include "crypto/x509.h"
#include "x509_local.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_EXTENSION)
-DEFINE_STACK_OF(X509_REVOKED)
DEFINE_STACK_OF(GENERAL_NAME)
-DEFINE_STACK_OF(X509_CRL)
DEFINE_STACK_OF(DIST_POINT)
DEFINE_STACK_OF_STRING()
diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c
index d5b3778035..22143da65e 100644
--- a/crypto/x509/x509cset.c
+++ b/crypto/x509/x509cset.c
@@ -16,8 +16,6 @@
#include <openssl/x509.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509_REVOKED)
-
int X509_CRL_set_version(X509_CRL *x, long version)
{
if (x == NULL)
diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c
index 7e2704fb68..b00e5f5b38 100644
--- a/crypto/x509/x509name.c
+++ b/crypto/x509/x509name.c
@@ -16,8 +16,6 @@
#include <openssl/x509.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509_NAME_ENTRY)
-
int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
char *buf, int len)
{
diff --git a/crypto/x509/x_crl.c b/crypto/x509/x_crl.c
index 44f374aed3..21dffc8b6e 100644
--- a/crypto/x509/x_crl.c
+++ b/crypto/x509/x_crl.c
@@ -17,8 +17,6 @@
DEFINE_STACK_OF(GENERAL_NAME)
DEFINE_STACK_OF(GENERAL_NAMES)
-DEFINE_STACK_OF(X509_REVOKED)
-DEFINE_STACK_OF(X509_EXTENSION)
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
const X509_REVOKED *const *b);
diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c
index 2db9aa34ca..1a57b2232d 100644
--- a/crypto/x509/x_name.c
+++ b/crypto/x509/x_name.c
@@ -16,7 +16,6 @@
#include "crypto/asn1.h"
#include "x509_local.h"
-DEFINE_STACK_OF(X509_NAME_ENTRY)
DEFINE_STACK_OF(ASN1_VALUE)
/*
diff --git a/crypto/x509/x_req.c b/crypto/x509/x_req.c
index 10b82df559..21215b4778 100644
--- a/crypto/x509/x_req.c
+++ b/crypto/x509/x_req.c
@@ -13,8 +13,6 @@
#include <openssl/x509.h>
#include "crypto/x509.h"
-DEFINE_STACK_OF(X509_ATTRIBUTE)
-
/*-
* X509_REQ_INFO is handled in an unusual way to get round
* invalid encodings. Some broken certificate requests don't
diff --git a/engines/e_capi.c b/engines/e_capi.c
index cff57d69e8..8e5693d25e 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -34,9 +34,6 @@
# include <openssl/rsa.h>
# include <openssl/dsa.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
-
/*
* This module uses several "new" interfaces, among which is
* CertGetCertificateContextProperty. CERT_KEY_PROV_INFO_PROP_ID is
diff --git a/engines/e_loader_attic.c b/engines/e_loader_attic.c
index 581bfb0285..be01c55718 100644
--- a/engines/e_loader_attic.c
+++ b/engines/e_loader_attic.c
@@ -37,7 +37,6 @@
#include "e_loader_attic_err.c"
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OSSL_STORE_INFO)
#ifdef _WIN32
diff --git a/include/openssl/x509.h b/include/openssl/x509.h.in
index bbe2d62cf9..bded195d78 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h.in
@@ -1,4 +1,6 @@
/*
+ * {- join("\n * ", @autowarntext) -}
+ *
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
*
@@ -8,6 +10,10 @@
* https://www.openssl.org/source/license.html
*/
+{-
+use OpenSSL::stackhash qw(generate_stack_macros generate_const_stack_macros);
+-}
+
#ifndef OPENSSL_X509_H
# define OPENSSL_X509_H
# pragma once
@@ -41,10 +47,12 @@ extern "C" {
#endif
/* Needed stacks for types defined in other headers */
-DEFINE_OR_DECLARE_STACK_OF(X509_NAME)
-DEFINE_OR_DECLARE_STACK_OF(X509)
-DEFINE_OR_DECLARE_STACK_OF(X509_REVOKED)
-DEFINE_OR_DECLARE_STACK_OF(X509_CRL)
+{-
+ generate_stack_macros("X509_NAME")
+ .generate_stack_macros("X509")
+ .generate_stack_macros("X509_REVOKED")
+ .generate_stack_macros("X509_CRL");
+-}
/* Flags for X509_get_signature_info() */
/* Signature info is valid */
@@ -82,16 +90,22 @@ typedef struct X509_val_st {
typedef struct X509_sig_st X509_SIG;
typedef struct X509_name_entry_st X509_NAME_ENTRY;
-DEFINE_OR_DECLARE_STACK_OF(X509_NAME_ENTRY)
+{-
+ generate_stack_macros("X509_NAME_ENTRY");
+-}
# define X509_EX_V_NETSCAPE_HACK 0x8000
# define X509_EX_V_INIT 0x0001
typedef struct X509_extension_st X509_EXTENSION;
-DEFINE_OR_DECLARE_STACK_OF(X509_EXTENSION)
+{-
+ generate_stack_macros("X509_EXTENSION");
+-}
typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
typedef struct x509_attributes_st X509_ATTRIBUTE;
-DEFINE_OR_DECLARE_STACK_OF(X509_ATTRIBUTE)
+{-
+ generate_stack_macros("X509_ATTRIBUTE");
+-}
typedef struct X509_req_info_st X509_REQ_INFO;
typedef struct X509_req_st X509_REQ;
typedef struct x509_cert_aux_st X509_CERT_AUX;
@@ -107,7 +121,9 @@ typedef struct x509_trust_st {
int arg1;
void *arg2;
} X509_TRUST;
-DEFINE_OR_DECLARE_STACK_OF(X509_TRUST)
+{-
+ generate_stack_macros("X509_TRUST");
+-}
/* standard trust ids */
@@ -246,7 +262,9 @@ typedef struct X509_info_st {
int enc_len;
char *enc_data;
} X509_INFO;
-DEFINE_OR_DECLARE_STACK_OF(X509_INFO)
+{-
+ generate_stack_macros("X509_INFO");
+-}
/*
* The next 2 structures and their 8 routines are used to manipulate Netscape's
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c
index 70dbac600b..ee64fd9fe8 100644
--- a/providers/implementations/storemgmt/file_store.c
+++ b/providers/implementations/storemgmt/file_store.c
@@ -33,7 +33,6 @@
#include "prov/providercommonerr.h"
#include "file_store_local.h"
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OSSL_STORE_INFO)
#ifdef _WIN32
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index c49f2118ca..88bab0edc4 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -20,9 +20,6 @@
#include <openssl/x509v3.h>
#include "internal/cryptlib.h"
-DEFINE_STACK_OF(X509_NAME)
-DEFINE_STACK_OF(X509)
-
#define TLS13_NUM_CIPHERS OSSL_NELEM(tls13_ciphers)
#define SSL3_NUM_CIPHERS OSSL_NELEM(ssl3_ciphers)
#define SSL3_NUM_SCSVS OSSL_NELEM(ssl3_scsvs)
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index e6262bfaeb..ace164f673 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -25,9 +25,6 @@
#include "ssl_cert_table.h"
#include "internal/thread_once.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
-
static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx,
int op, int bits, int nid, void *other,
void *ex);
diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
index 56590da207..acf9385785 100644
--- a/ssl/ssl_conf.c
+++ b/ssl/ssl_conf.c
@@ -14,8 +14,6 @@
#include <openssl/dh.h>
#include "internal/nelem.h"
-DEFINE_STACK_OF(X509_NAME)
-
/*
* structure holding name tables. This is used for permitted elements in lists
* such as TLSv1.
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 139fd628af..ccb0a6087f 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -28,9 +28,6 @@
#include "internal/refcount.h"
#include "internal/ktls.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(OCSP_RESPID)
DEFINE_STACK_OF(SCT)
diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c
index 144dd2c374..3a28b60ba6 100644
--- a/ssl/ssl_rsa.c
+++ b/ssl/ssl_rsa.c
@@ -17,8 +17,6 @@
#include <openssl/x509v3.h>
#include <openssl/pem.h>
-DEFINE_STACK_OF(X509)
-
static int ssl_set_cert(CERT *c, X509 *x509);
static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey);
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 63624e9e80..83fc149cfd 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -19,8 +19,6 @@
#include "ssl_local.h"
#include "statem/statem_local.h"
-DEFINE_STACK_OF(X509)
-
static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s);
static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *s);
static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck);
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c
index c842e20fbf..ec38b2f6a0 100644
--- a/ssl/statem/extensions.c
+++ b/ssl/statem/extensions.c
@@ -14,8 +14,6 @@
#include "statem_local.h"
#include "internal/cryptlib.h"
-DEFINE_STACK_OF(X509_NAME)
-
static int final_renegotiate(SSL *s, unsigned int context, int sent);
static int init_server_name(SSL *s, unsigned int context);
static int final_server_name(SSL *s, unsigned int context, int sent);
diff --git a/ssl/statem/extensions_srvr.c b/ssl/statem/extensions_srvr.c
index c686d00f0e..6adb9cab82 100644
--- a/ssl/statem/extensions_srvr.c
+++ b/ssl/statem/extensions_srvr.c
@@ -13,7 +13,6 @@
#include "internal/cryptlib.h"
DEFINE_STACK_OF(OCSP_RESPID)
-DEFINE_STACK_OF(X509_EXTENSION)
#define COOKIE_STATE_FORMAT_VERSION 0
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c
index f8a3d25c08..a3e7b5ad0a 100644
--- a/ssl/statem/statem_clnt.c
+++ b/ssl/statem/statem_clnt.c
@@ -28,8 +28,6 @@
#include <openssl/trace.h>
#include <internal/cryptlib.h>
-DEFINE_STACK_OF(X509)
-
static MSG_PROCESS_RETURN tls_process_as_hello_retry_request(SSL *s, PACKET *pkt);
static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt);
diff --git a/ssl/statem/statem_lib.c b/ssl/statem/statem_lib.c
index 79195b2aa2..6d0efb3239 100644
--- a/ssl/statem/statem_lib.c
+++ b/ssl/statem/statem_lib.c
@@ -21,9 +21,6 @@
#include <openssl/x509.h>
#include <openssl/trace.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
-
/*
* Map error codes to TLS/SSL alart types.
*/
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
index f42e7865eb..a1a28e905a 100644
--- a/ssl/statem/statem_srvr.c
+++ b/ssl/statem/statem_srvr.c
@@ -26,8 +26,6 @@
#include <openssl/core_names.h>
#include <openssl/asn1t.h>
-DEFINE_STACK_OF(X509)
-
#define TICKET_NONCE_SIZE 8
typedef struct {
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 702622487f..f2043aef7e 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -28,9 +28,6 @@
#include "ssl_local.h"
#include <openssl/ct.h>
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
-
static const SIGALG_LOOKUP *find_sig_alg(SSL *s, X509 *x, EVP_PKEY *pkey);
static int tls12_sigalg_allowed(const SSL *s, int op, const SIGALG_LOOKUP *lu);
diff --git a/test/cmp_client_test.c b/test/cmp_client_test.c
index 9043ee1196..9c72c58ad3 100644
--- a/test/cmp_client_test.c
+++ b/test/cmp_client_test.c
@@ -15,7 +15,6 @@
#ifndef NDEBUG /* tests need mock server, which is available only if !NDEBUG */
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
static const char *server_key_f;
diff --git a/test/cmp_ctx_test.c b/test/cmp_ctx_test.c
index 8b797f2e98..f3f49888bc 100644
--- a/test/cmp_ctx_test.c
+++ b/test/cmp_ctx_test.c
@@ -13,9 +13,7 @@
#include <openssl/x509_vfy.h>
-DEFINE_STACK_OF(X509)
DEFINE_STACK_OF(ASN1_UTF8STRING)
-DEFINE_STACK_OF(X509_EXTENSION)
DEFINE_STACK_OF(OSSL_CMP_ITAV)
DEFINE_STACK_OF(POLICYINFO)
diff --git a/test/cmp_protect_test.c b/test/cmp_protect_test.c
index 7132ccc5cb..8f76a14222 100644
--- a/test/cmp_protect_test.c
+++ b/test/cmp_protect_test.c
@@ -11,8 +11,6 @@
#include "cmp_testlib.h"
-DEFINE_STACK_OF(X509)
-
static const char *ir_protected_f;
static const char *ir_unprotected_f;
static const char *ip_PBM_f;
diff --git a/test/cmp_testlib.c b/test/cmp_testlib.c
index 754a6ba845..7a8570afeb 100644
--- a/test/cmp_testlib.c
+++ b/test/cmp_testlib.c
@@ -12,8 +12,6 @@
#include "cmp_testlib.h"
#include <openssl/rsa.h> /* needed in case config no-deprecated */
-DEFINE_STACK_OF(X509)
-
EVP_PKEY *load_pem_key(const char *file, OPENSSL_CTX *libctx)
{
EVP_PKEY *key = NULL;
diff --git a/test/cmsapitest.c b/test/cmsapitest.c
index f90200e9ac..a69fcc949d 100644
--- a/test/cmsapitest.c
+++ b/test/cmsapitest.c
@@ -16,8 +16,6 @@
#include "testutil.h"
-DEFINE_STACK_OF(X509)
-
static X509 *cert = NULL;
static EVP_PKEY *privkey = NULL;
diff --git a/test/crltest.c b/test/crltest.c
index ff2fadaa6b..5d255d368a 100644
--- a/test/crltest.c
+++ b/test/crltest.c
@@ -17,9 +17,6 @@
#include "testutil.h"
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_CRL)
-
#define PARAM_TIME 1474934400 /* Sep 27th, 2016 */
static const char *kCRLTestRoot[] = {
diff --git a/test/danetest.c b/test/danetest.c
index 96b9579f3c..b0d6ffe563 100644
--- a/test/danetest.c
+++ b/test/danetest.c
@@ -26,8 +26,6 @@
#include "internal/nelem.h"
-DEFINE_STACK_OF(X509)
-
#define _UC(c) ((unsigned char)(c))
static const char *basedomain;
diff --git a/test/handshake_helper.c b/test/handshake_helper.c
index bc6762d475..5253f0d602 100644
--- a/test/handshake_helper.c
+++ b/test/handshake_helper.c
@@ -26,8 +26,6 @@
#include <netinet/sctp.h>
#endif
-DEFINE_STACK_OF(X509_NAME)
-
HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void)
{
HANDSHAKE_RESULT *ret;
diff --git a/test/ocspapitest.c b/test/ocspapitest.c
index 4ea6c636d4..9e8c306259 100644
--- a/test/ocspapitest.c
+++ b/test/ocspapitest.c
@@ -18,8 +18,6 @@
#include "testutil.h"
-DEFINE_STACK_OF(X509)
-
static const char *certstr;
static const char *privkeystr;
diff --git a/test/pkcs12_helper.c b/test/pkcs12_helper.c
index 22bebe8e2b..a3490e74e3 100644
--- a/test/pkcs12_helper.c
+++ b/test/pkcs12_helper.c
@@ -21,10 +21,8 @@
#include "testutil.h"
#include "pkcs12_helper.h"
-
DEFINE_STACK_OF(PKCS7)
DEFINE_STACK_OF(PKCS12_SAFEBAG)
-DEFINE_STACK_OF(X509_ATTRIBUTE)
/* Set this to > 0 write test data to file */
int write_files = 0;
diff --git a/test/ssl_test.c b/test/ssl_test.c
index 18e92c7f77..1fbe938309 100644
--- a/test/ssl_test.c
+++ b/test/ssl_test.c
@@ -19,8 +19,6 @@
#include "ssl_test_ctx.h"
#include "testutil.h"
-DEFINE_STACK_OF(X509_NAME)
-
static CONF *conf = NULL;
static OSSL_PROVIDER *defctxnull = NULL, *thisprov = NULL;
static OPENSSL_CTX *libctx = NULL;
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c
index 726ee37583..c3adb50581 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -21,7 +21,6 @@
#endif
DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509_NAME)
static const int default_app_data_size = 256;
/* Default set to be as small as possible to exercise fragmentation. */
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 240cadde90..2451f3f832 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -48,8 +48,6 @@ int tls_provider_init(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH **out,
void **provctx);
DEFINE_STACK_OF(OCSP_RESPID)
-DEFINE_STACK_OF(X509)
-DEFINE_STACK_OF(X509_NAME)
static OPENSSL_CTX *libctx = NULL;
static OSSL_PROVIDER *defctxnull = NULL;
diff --git a/test/verify_extra_test.c b/test/verify_extra_test.c
index 99a6361142..668b62d408 100644
--- a/test/verify_extra_test.c
+++ b/test/verify_extra_test.c
@@ -16,8 +16,6 @@
#include <openssl/err.h>
#include "testutil.h"
-DEFINE_STACK_OF(X509)
-
static const char *root_f;
static const char *roots_f;
static const char *untrusted_f;