Fix safestack issues in x509.h
authorMatt Caswell <matt@openssl.org>
Thu, 3 Sep 2020 09:23:44 +0000 (10:23 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 13 Sep 2020 10:09:45 +0000 (11:09 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12781)

106 files changed:
.gitignore
apps/ca.c
apps/cmp.c
apps/cmp_mock_srv.c
apps/cms.c
apps/crl2p7.c
apps/lib/apps.c
apps/lib/s_cb.c
apps/nseq.c
apps/ocsp.c
apps/pkcs12.c
apps/pkcs7.c
apps/rehash.c
apps/s_client.c
apps/s_server.c
apps/smime.c
apps/verify.c
apps/x509.c
build.info
crypto/cmp/cmp_client.c
crypto/cmp/cmp_ctx.c
crypto/cmp/cmp_msg.c
crypto/cmp/cmp_protect.c
crypto/cmp/cmp_server.c
crypto/cmp/cmp_util.c
crypto/cmp/cmp_vfy.c
crypto/cms/cms_env.c
crypto/cms/cms_ess.c
crypto/cms/cms_lib.c
crypto/cms/cms_sd.c
crypto/cms/cms_smime.c
crypto/crmf/crmf_lib.c
crypto/ess/ess_lib.c
crypto/evp/p_lib.c
crypto/ocsp/ocsp_cl.c
crypto/ocsp/ocsp_prn.c
crypto/ocsp/ocsp_srv.c
crypto/ocsp/ocsp_vfy.c
crypto/pem/pem_info.c
crypto/pkcs12/p12_crt.c
crypto/pkcs12/p12_kiss.c
crypto/pkcs7/pk7_doit.c
crypto/pkcs7/pk7_lib.c
crypto/pkcs7/pk7_smime.c
crypto/store/store_result.c
crypto/ts/ts_conf.c
crypto/ts/ts_req_utils.c
crypto/ts/ts_rsp_sign.c
crypto/ts/ts_rsp_utils.c
crypto/ts/ts_rsp_verify.c
crypto/ts/ts_verify_ctx.c
crypto/x509/by_file.c
crypto/x509/pcy_tree.c
crypto/x509/t_crl.c
crypto/x509/t_req.c
crypto/x509/t_x509.c
crypto/x509/v3_addr.c
crypto/x509/v3_asid.c
crypto/x509/v3_conf.c
crypto/x509/v3_crld.c
crypto/x509/v3_lib.c
crypto/x509/v3_prn.c
crypto/x509/v3_utl.c
crypto/x509/x509_att.c
crypto/x509/x509_cmp.c
crypto/x509/x509_lu.c
crypto/x509/x509_obj.c
crypto/x509/x509_r2x.c
crypto/x509/x509_trs.c
crypto/x509/x509_v3.c
crypto/x509/x509_vfy.c
crypto/x509/x509cset.c
crypto/x509/x509name.c
crypto/x509/x_crl.c
crypto/x509/x_name.c
crypto/x509/x_req.c
engines/e_capi.c
engines/e_loader_attic.c
include/openssl/x509.h.in [moved from include/openssl/x509.h with 98% similarity]
providers/implementations/storemgmt/file_store.c
ssl/s3_lib.c
ssl/ssl_cert.c
ssl/ssl_conf.c
ssl/ssl_lib.c
ssl/ssl_rsa.c
ssl/ssl_sess.c
ssl/statem/extensions.c
ssl/statem/extensions_srvr.c
ssl/statem/statem_clnt.c
ssl/statem/statem_lib.c
ssl/statem/statem_srvr.c
ssl/t1_lib.c
test/cmp_client_test.c
test/cmp_ctx_test.c
test/cmp_protect_test.c
test/cmp_testlib.c
test/cmsapitest.c
test/crltest.c
test/danetest.c
test/handshake_helper.c
test/ocspapitest.c
test/pkcs12_helper.c
test/ssl_test.c
test/ssl_test_ctx.c
test/sslapitest.c
test/verify_extra_test.c

index 498d3ae..1996b07 100644 (file)
@@ -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
index 3c2bee8..cb1c909 100644 (file)
--- 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()
 
index db0d418..4d77b54 100644 (file)
@@ -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;
index 3a08190..2c82567 100644 (file)
@@ -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)
  
index d154f46..fada7b5 100644 (file)
@@ -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)
index e0de95a..545fe0a 100644 (file)
@@ -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);
index 5d95ce0..bd6a6bc 100644 (file)
@@ -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)
index 0ae851d..b53d4cb 100644 (file)
@@ -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 };
index de18963..92ae7bd 100644 (file)
@@ -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,
index 4f42d66..ad69962 100644 (file)
@@ -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)
index 23ffa98..fddfdbc 100644 (file)
 #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
index 95d3ca0..e6ac26e 100644 (file)
@@ -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,
index 866b8cf..efa0b65 100644 (file)
@@ -42,7 +42,6 @@
 # include <openssl/pem.h>
 # include <openssl/x509.h>
 
-DEFINE_STACK_OF(X509_INFO)
 DEFINE_STACK_OF_STRING()
 
 # ifndef PATH_MAX
index 2a58589..32aa6fa 100644 (file)
@@ -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()
 
index f1ea550..c970080 100644 (file)
@@ -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);
index dbfcdbe..ed3d63a 100644 (file)
@@ -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);
index ed20b69..c43a4e6 100644 (file)
@@ -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);
index 169530f..4b2200c 100644 (file)
@@ -29,7 +29,6 @@
 #endif
 
 DEFINE_STACK_OF(ASN1_OBJECT)
-DEFINE_STACK_OF(X509_EXTENSION)
 DEFINE_STACK_OF_STRING()
 
 #undef POSTFIX
index c1933bf..02a36cd 100644 (file)
@@ -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
index fe71689..567eb45 100644 (file)
@@ -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)
index 6bbd351..f324763 100644 (file)
@@ -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)
index 64e00fc..11f43ab 100644 (file)
@@ -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)
index a6a0f9f..eb162e3 100644 (file)
@@ -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.
  *
index 2ba6cb7..3c24733 100644 (file)
@@ -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)
 
index c2ee9b6..ec292ee 100644 (file)
@@ -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)
 
index f5026e0..00757c1 100644 (file)
@@ -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)
index 944846c..f0c8957 100644 (file)
@@ -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);
index b6b2037..6fc0ca2 100644 (file)
@@ -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)
 
index 9fc8453..0b9a3f2 100644 (file)
@@ -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)
 
index c11d444..ac07dde 100644 (file)
@@ -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 */
 
index 92de68a..b2287c6 100644 (file)
@@ -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)
 
index 3202f35..5c3acaf 100644 (file)
@@ -36,7 +36,6 @@
 #include <openssl/err.h>
 #include <openssl/evp.h>
 
-DEFINE_STACK_OF(X509_EXTENSION)
 DEFINE_STACK_OF(OSSL_CRMF_MSG)
 
 /*-
index ad0d6f3..92073b9 100644 (file)
@@ -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,
index cb72048..8fe7027 100644 (file)
@@ -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"
 
index f45bf1d..b977e88 100644 (file)
@@ -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)
 
index c782a8e..c4917ee 100644 (file)
@@ -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)
index d20a714..a87fea8 100644 (file)
@@ -17,7 +17,6 @@
 #include "ocsp_local.h"
 
 DEFINE_STACK_OF(OCSP_ONEREQ)
-DEFINE_STACK_OF(X509)
 DEFINE_STACK_OF(OCSP_SINGLERESP)
 
 /*
index cf76026..35a01c4 100644 (file)
@@ -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,
index a3981c9..ef02320 100644 (file)
@@ -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,
index 699f1b7..757b6ae 100644 (file)
@@ -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)
 
index 5413aec..433bccd 100644 (file)
@@ -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)
 
index c48c629..faefa9e 100644 (file)
@@ -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)
 
index d891ca2..59e23a4 100644 (file)
@@ -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)
index 1dfdd69..2bd495a 100644 (file)
@@ -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)
 
index 47dd21a..0c78e94 100644 (file)
@@ -59,8 +59,6 @@
  * reference.
  */
 
-DEFINE_STACK_OF(X509)
-
 struct extracted_param_data_st {
     int object_type;
     const char *data_type;
index 71664fa..9d40115 100644 (file)
@@ -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. */
index 2d14ed1..e4b3eee 100644 (file)
@@ -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);
index 33f2b51..a190471 100644 (file)
@@ -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)
index 86e1a9d..92dcb5b 100644 (file)
@@ -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;
index c909b21..1ca14bc 100644 (file)
@@ -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)
index 2c95fd1..776d5cf 100644 (file)
@@ -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));
index d5e6dde..a4ec328 100644 (file)
@@ -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,
index 3087919..8b127cf 100644 (file)
@@ -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,
index 0824bb6..44be2f2 100644 (file)
@@ -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)
 {
index e1ee12d..abcca0a 100644 (file)
@@ -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)
 {
index f0240f1..8f4b8e8 100644 (file)
@@ -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
index d965d74..b369f79 100644 (file)
@@ -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.
index 0fc7641..e5fcff5 100644 (file)
@@ -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.
index 88e29f9..3471ce0 100644 (file)
@@ -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);
index 8b4e100..2daaad8 100644 (file)
@@ -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);
index b1e32bb..093e33b 100644 (file)
@@ -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;
 
index 4b2ad26..de39a0f 100644 (file)
@@ -15,7 +15,6 @@
 #include <openssl/x509v3.h>
 
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF(X509_EXTENSION)
 
 /* Extension printing routines */
 
index e31be45..ce64aa6 100644 (file)
@@ -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);
index ce00361..bb4bfe0 100644 (file)
@@ -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)
index 32e1568..e74c842 100644 (file)
@@ -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;
index f37e09d..77488b6 100644 (file)
@@ -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)
 {
index 7bed79a..0acfaa3 100644 (file)
@@ -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.
index a284bf7..a03ba24 100644 (file)
@@ -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;
index ebd45b6..92e2220 100644 (file)
@@ -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);
index f059667..96ba940 100644 (file)
@@ -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)
index 4a067e5..cc264d0 100644 (file)
 #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()
 
index d5b3778..22143da 100644 (file)
@@ -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)
index 7e2704f..b00e5f5 100644 (file)
@@ -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)
 {
index 44f374a..21dffc8 100644 (file)
@@ -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);
index 2db9aa3..1a57b22 100644 (file)
@@ -16,7 +16,6 @@
 #include "crypto/asn1.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF(X509_NAME_ENTRY)
 DEFINE_STACK_OF(ASN1_VALUE)
 
 /*
index 10b82df..21215b4 100644 (file)
@@ -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
index cff57d6..8e5693d 100644 (file)
@@ -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
index 581bfb0..be01c55 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "e_loader_attic_err.c"
 
-DEFINE_STACK_OF(X509)
 DEFINE_STACK_OF(OSSL_STORE_INFO)
 
 #ifdef _WIN32
similarity index 98%
rename from include/openssl/x509.h
rename to include/openssl/x509.h.in
index bbe2d62..bded195 100644 (file)
@@ -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
index 70dbac6..ee64fd9 100644 (file)
@@ -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
index c49f211..88bab0e 100644 (file)
@@ -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)
index e6262bf..ace164f 100644 (file)
@@ -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);
index 56590da..acf9385 100644 (file)
@@ -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.
index 139fd62..ccb0a60 100644 (file)
@@ -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)
 
index 144dd2c..3a28b60 100644 (file)
@@ -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);
 
index 63624e9..83fc149 100644 (file)
@@ -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);
index c842e20..ec38b2f 100644 (file)
@@ -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);
index c686d00..6adb9ca 100644 (file)
@@ -13,7 +13,6 @@
 #include "internal/cryptlib.h"
 
 DEFINE_STACK_OF(OCSP_RESPID)
-DEFINE_STACK_OF(X509_EXTENSION)
 
 #define COOKIE_STATE_FORMAT_VERSION     0
 
index f8a3d25..a3e7b5a 100644 (file)
@@ -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);
 
index 79195b2..6d0efb3 100644 (file)
@@ -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.
  */
index f42e786..a1a28e9 100644 (file)
@@ -26,8 +26,6 @@
 #include <openssl/core_names.h>
 #include <openssl/asn1t.h>
 
-DEFINE_STACK_OF(X509)
-
 #define TICKET_NONCE_SIZE       8
 
 typedef struct {
index 7026224..f2043ae 100644 (file)
@@ -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);
 
index 9043ee1..9c72c58 100644 (file)
@@ -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;
index 8b797f2..f3f4988 100644 (file)
@@ -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)
 
index 7132ccc..8f76a14 100644 (file)
@@ -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;
index 754a6ba..7a8570a 100644 (file)
@@ -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;
index f90200e..a69fcc9 100644 (file)
@@ -16,8 +16,6 @@
 
 #include "testutil.h"
 
-DEFINE_STACK_OF(X509)
-
 static X509 *cert = NULL;
 static EVP_PKEY *privkey = NULL;
 
index ff2fada..5d255d3 100644 (file)
@@ -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[] = {
index 96b9579..b0d6ffe 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "internal/nelem.h"
 
-DEFINE_STACK_OF(X509)
-
 #define _UC(c) ((unsigned char)(c))
 
 static const char *basedomain;
index bc6762d..5253f0d 100644 (file)
@@ -26,8 +26,6 @@
 #include <netinet/sctp.h>
 #endif
 
-DEFINE_STACK_OF(X509_NAME)
-
 HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void)
 {
     HANDSHAKE_RESULT *ret;
index 4ea6c63..9e8c306 100644 (file)
@@ -18,8 +18,6 @@
 
 #include "testutil.h"
 
-DEFINE_STACK_OF(X509)
-
 static const char *certstr;
 static const char *privkeystr;
 
index 22bebe8..a3490e7 100644 (file)
 #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;
index 18e92c7..1fbe938 100644 (file)
@@ -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;
index 726ee37..c3adb50 100644 (file)
@@ -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. */
index 240cadd..2451f3f 100644 (file)
@@ -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;
index 99a6361..668b62d 100644 (file)
@@ -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;