]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix safestack issues in conf.h
authorMatt Caswell <matt@openssl.org>
Thu, 3 Sep 2020 15:14:28 +0000 (16:14 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 13 Sep 2020 10:11:20 +0000 (11:11 +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)

43 files changed:
.gitignore
apps/ca.c
apps/lib/apps.c
apps/ocsp.c
apps/req.c
build.info
crypto/asn1/asn1_gen.c
crypto/asn1/asn_moid.c
crypto/asn1/asn_mstbl.c
crypto/cmp/cmp_http.c
crypto/conf/conf_api.c
crypto/conf/conf_mod.c
crypto/conf/conf_ssl.c
crypto/engine/eng_cnf.c
crypto/evp/evp_cnf.c
crypto/http/http_client.c
crypto/provider_conf.c
crypto/ts/ts_conf.c
crypto/ts/ts_rsp_print.c
crypto/x509/v3_addr.c
crypto/x509/v3_akey.c
crypto/x509/v3_alt.c
crypto/x509/v3_asid.c
crypto/x509/v3_bcons.c
crypto/x509/v3_bitst.c
crypto/x509/v3_conf.c
crypto/x509/v3_cpols.c
crypto/x509/v3_crld.c
crypto/x509/v3_extku.c
crypto/x509/v3_info.c
crypto/x509/v3_ist.c
crypto/x509/v3_ncons.c
crypto/x509/v3_pci.c
crypto/x509/v3_pcons.c
crypto/x509/v3_pmaps.c
crypto/x509/v3_prn.c
crypto/x509/v3_sxnet.c
crypto/x509/v3_tlsf.c
crypto/x509/v3_utl.c
include/openssl/conf.h.in [moved from include/openssl/conf.h with 97% similarity]
test/confdump.c
test/http_test.c
test/ssl_test_ctx.c

index 038f8b4f372cf017b80734725e4adef07b493409..68e7b2abd1b2ebd67b3749b85e1a6e667b87355b 100644 (file)
@@ -27,6 +27,7 @@
 /include/openssl/bio.h
 /include/openssl/cmp.h
 /include/openssl/cms.h
+/include/openssl/conf.h
 /include/openssl/configuration.h
 /include/openssl/crmf.h
 /include/openssl/ct.h
index 9ddd464534973c41dacc197ee7fc4d1a6fa9ead2..6ae52c227743007509a7325ea4df761167d66eb5 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -34,8 +34,6 @@
 #include "apps.h"
 #include "progs.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 #ifndef W_OK
 # define F_OK 0
 # define W_OK 2
index 9bc976317d4c0a170d62b539f8baa2b07d270106..9c608e6582bd5b5d9ea0bea8414f7e6a0c9f7af5 100644 (file)
@@ -62,7 +62,6 @@ static int WIN32_rename(const char *from, const char *to);
 #define PASS_SOURCE_SIZE_MAX 4
 
 DEFINE_STACK_OF(CONF)
-DEFINE_STACK_OF(CONF_VALUE)
 
 typedef struct {
     const char *name;
index 2540ce118ee228e3382ed817d0ed5b0528b9ad8c..93c17f4a073fdce27dd8c375557de1ac1b12a6fa 100644 (file)
@@ -33,8 +33,6 @@
 #include <openssl/bn.h>
 #include <openssl/x509v3.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 #if defined(__TANDEM)
 # if defined(OPENSSL_TANDEM_FLOSS)
 #  include <floss.h(floss_fork)>
index 5f3c7b5fc834740e9d49198619f4ed35b20c2939..cb5850c6b543296dcde7908ae705b1faf0634dc5 100644 (file)
@@ -35,8 +35,6 @@
 # include <openssl/dsa.h>
 #endif
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 #define BITS            "default_bits"
 #define KEYFILE         "default_keyfile"
 #define PROMPT          "prompt"
index e5cd3da971fd8bfe2783a9658b19479f8e3957e9..b091a1c3466d18c910a08cad687d7e413d17f1fe 100644 (file)
@@ -18,6 +18,7 @@ DEPEND[]=include/openssl/asn1.h \
          include/openssl/bio.h \
          include/openssl/cmp.h \
          include/openssl/cms.h \
+         include/openssl/conf.h \
          include/openssl/configuration.h \
          include/openssl/crmf.h \
          include/openssl/ct.h \
@@ -40,6 +41,7 @@ GENERATE[include/openssl/asn1t.h]=include/openssl/asn1t.h.in
 GENERATE[include/openssl/bio.h]=include/openssl/bio.h.in
 GENERATE[include/openssl/cmp.h]=include/openssl/cmp.h.in
 GENERATE[include/openssl/cms.h]=include/openssl/cms.h.in
+GENERATE[include/openssl/conf.h]=include/openssl/conf.h.in
 GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
 GENERATE[include/openssl/crmf.h]=include/openssl/crmf.h.in
 GENERATE[include/openssl/ct.h]=include/openssl/ct.h.in
index 97094b3e0e06913c183a2ec8d1a1936bc92b19ed..896fc89c460a6c4676dfdec203c5d2b22755ab0e 100644 (file)
@@ -23,8 +23,6 @@
 
 #define ASN1_GEN_STR(str,val)   {str, sizeof(str) - 1, val}
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 #define ASN1_FLAG_EXP_MAX       20
 /* Maximum number of nested sequences */
 #define ASN1_GEN_SEQ_MAX_DEPTH  50
index 676d1eca2d6c6db92c011c285eadf483c7f74d73..549f8f7cb17b174204544a66a37337c0d454bee6 100644 (file)
@@ -16,8 +16,6 @@
 #include "crypto/asn1.h"
 #include "crypto/objects.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Simple ASN1 OID module: add all objects in a given section */
 
 static int do_create(const char *value, const char *name);
index fc21cb30984ac2a9286a76cc4fbccebda97de0ae..ec08ecb3d8d46417462db5dddf60a714ce553059 100644 (file)
@@ -13,7 +13,6 @@
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
 /* Multi string module: add table entries from a given section */
 
 static int do_tcreate(const char *value, const char *name);
index f3cd06fb23ef7f8d75c7d449fc1d91233e084f83..33b5f6af7a2438cebf0b1e9000f4e43bc398a92d 100644 (file)
@@ -28,8 +28,6 @@
 #include <openssl/cmp.h>
 #include <openssl/err.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /*
  * Send the PKIMessage req and on success return the response, else NULL.
  * Any previous error queue entries will likely be removed by ERR_clear_error().
index b4edfb28aee968ef5dcfeec86f9c100c099c4643..d64cc5031a23db14d217dddd0958f1dc75b90a20 100644 (file)
@@ -16,8 +16,6 @@
 #include <openssl/conf.h>
 #include <openssl/conf_api.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf);
 static void value_free_stack_doall(CONF_VALUE *a);
 
index a0b9fd3b61553bd8e79fe8ca1ced4d60c0305faa..fa7f6b9d9fa9adc61a1fd561e0e47c544b806003 100644 (file)
@@ -21,7 +21,6 @@
 #include <openssl/trace.h>
 #include <openssl/engine.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
 DEFINE_STACK_OF(CONF_MODULE)
 DEFINE_STACK_OF(CONF_IMODULE)
 
index eefd279a109eeb196f6632982244d4049b019f45..5b949be616ec3392815b6f3b81fb1240a7560dc0 100644 (file)
@@ -14,8 +14,6 @@
 #include "internal/sslconf.h"
 #include "conf_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /*
  * SSL library configuration module placeholder. We load it here but defer
  * all decisions about its contents to libssl.
index dcc30b6c622933dc6a1619a0af0adc05aa9e05b2..0fb576c847569934cadafc41589f04d0a92b20a5 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/conf.h>
 #include <openssl/trace.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* ENGINE config module */
 
 static const char *skip_dot(const char *name)
index 455b258a9a1555c21eddeac3c59d506ddfc3d029..b6f33795a11b8ef45d714ef13a85c1947fc02d8e 100644 (file)
@@ -16,8 +16,6 @@
 #include <openssl/trace.h>
 #include "crypto/evp.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Algorithm configuration module. */
 
 static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
index 5a78d67ca47072ccd58e3b5e3efa4e5457e0e270..1a68228548c1c647f101ab62a2ea4c19dde36971 100644 (file)
@@ -25,8 +25,6 @@
 
 #include "http_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 #define HTTP_PREFIX "HTTP/"
 #define HTTP_VERSION_PATT "1." /* allow 1.x */
 #define HTTP_VERSION_STR_LEN 3
index 5007a726d2dbc1f010905b50aef8457ad78db6a4..a8fd7b278a820a4f982b91cf569da1c4e8d9b14c 100644 (file)
@@ -15,7 +15,6 @@
 #include "internal/provider.h"
 
 DEFINE_STACK_OF(OSSL_PROVIDER)
-DEFINE_STACK_OF(CONF_VALUE)
 
 /* PROVIDER config module */
 
index 9d4011519efbfafe6ee9542729a436d6059c2f54..5418bc8bbf4b706c5aca1de646a90a83f1e5c063 100644 (file)
@@ -18,8 +18,6 @@
 #include <openssl/engine.h>
 #include <openssl/ts.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Macro definitions for the configuration file. */
 #define BASE_SECTION                    "tsa"
 #define ENV_DEFAULT_TSA                 "default_tsa"
index e74ef452cca9b7d7dcab1c356b78cccacdd882c6..ca2d8a6dc1541dc78320e1e61600d267d1439f35 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/ts.h>
 #include "ts_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 struct status_map_st {
     int bit;
     const char *text;
index f281267b079e3a92eb9eba731d5d43db30d9cb5c..64127cff6ba7879696f1ace7217fdbf49539d614 100644 (file)
@@ -26,8 +26,6 @@
 
 #ifndef OPENSSL_NO_RFC3779
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /*
  * OpenSSL ASN.1 template translation of RFC 3779 2.2.3.
  */
index 50dca6ce5df3248daff781b8875929a5840d4bdd..a3061c9a8fed106c98c9d53b69d5725ddbfc0fd3 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
                                                  AUTHORITY_KEYID *akeyid,
                                                  STACK_OF(CONF_VALUE)
index f810fc6c428426f97e11ff496474711dbda0640e..caa2f232208b1b7bd2db925e1c553a1dec2bbc57 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/bio.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
                                       X509V3_CTX *ctx,
                                       STACK_OF(CONF_VALUE) *nval);
index 67160aac2655ed39651a641ed95e07fb9e1d1af6..93b345a0b8060d273ebe1f8fd59eef7011cd4a80 100644 (file)
@@ -56,8 +56,6 @@ IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /*
  * i2r method for an ASIdentifierChoice.
  */
index 01d38473a32db2a47052182387a81ca6ad1efa75..7a06a9d0ff91d354d14d2c5690d9e4270944a17d 100644 (file)
@@ -16,8 +16,6 @@
 #include "ext_dat.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
                                                    BASIC_CONSTRAINTS *bcons,
                                                    STACK_OF(CONF_VALUE)
index 02d40863a634fdde676894e8328a238b2e1dbddd..21511603c2c5fab28892afdf1ef7c98acaf86704 100644 (file)
@@ -13,8 +13,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static BIT_STRING_BITNAME ns_cert_type_table[] = {
     {0, "SSL Client", "client"},
     {1, "SSL Server", "server"},
index 3471ce098fceedfd6c133407403939fb3faea5d6..918e96e7090f2aca255a9a1e6e212809a8ff640f 100644 (file)
@@ -17,8 +17,6 @@
 #include "crypto/x509.h"
 #include <openssl/x509v3.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static int v3_check_critical(const char **value);
 static int v3_check_generic(const char **value);
 static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid,
index f7dcfb5dce58c564413929f673261139ff18bb0f..9a227e4058367feec2f33a9c00639d9d9e276f77 100644 (file)
@@ -18,8 +18,6 @@
 #include "pcy_local.h"
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Certificate policies extension support: this one is a bit complex... */
 
 static int i2r_certpol(X509V3_EXT_METHOD *method, STACK_OF(POLICYINFO) *pol,
index 19b016227f214121ddc60e6d2f858d423af948d4..81ea31b16fcaa76e40d2a3c45b90b7dc4c199259 100644 (file)
@@ -18,8 +18,6 @@
 #include "ext_dat.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static void *v2i_crld(const X509V3_EXT_METHOD *method,
                       X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
 static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
index b96fb58ac81175874ced11f7cb48fb32279667cd..b9a1447b82aae1c0ac1d195c47c53981d7bd6758 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
                                     X509V3_CTX *ctx,
                                     STACK_OF(CONF_VALUE) *nval);
index 2c788d89ec56c162e3e7174748c2fdeb9d92efe6..3711b51e18d479cda40c6c7160d10e8be7262f79 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
                                                        *method, AUTHORITY_INFO_ACCESS
                                                        *ainfo, STACK_OF(CONF_VALUE)
index ceb127f63777e16103261e40e14ba1a09429efd4..6db4f19913d713c70eaecef84b62bbfe3e3b49e3 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /*
  * Issuer Sign Tool (1.2.643.100.112) The name of the tool used to signs the subject (ASN1_SEQUENCE)
  * This extention is required to obtain the status of a qualified certificate at Russian Federation.
index 6c7374590495bbf52c4d4247f23e92ed2387e32e..6af8edecdb3c621f27698bd092ca05e41ef0f7b0 100644 (file)
@@ -20,8 +20,6 @@
 #include "crypto/punycode.h"
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
                                   X509V3_CTX *ctx,
                                   STACK_OF(CONF_VALUE) *nval);
index 714733684bfe0a55783d45d4a5ef62ea9e6d69c6..febb07f7d4b2f7698870349836e1e73c19f0d379 100644 (file)
@@ -49,8 +49,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext,
                    BIO *out, int indent);
 static PROXY_CERT_INFO_EXTENSION *r2i_pci(X509V3_EXT_METHOD *method,
index 88a94975043aab4ae551a17322a759a2561c6dfa..e61a14e2549a4acad494cde187c50f4cc8bb59d6 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD
                                                     *method, void *bcons, STACK_OF(CONF_VALUE)
                                                     *extlist);
index c63a0e4cb9b76a070c44818441695aad3fa230c2..a2b95c48e40916ce579a5cea6412b2f652377055 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
                                  X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
 static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(const X509V3_EXT_METHOD
index de39a0f0b0db351e73a33db5cac0e084c1414a97..1e4516a713c2424bbf8eff6bfd20c234e9dec29f 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Extension printing routines */
 
 static int unknown_ext_print(BIO *out, const unsigned char *ext, int extlen,
index ce878c37794a9796024181571b1461edb1b2fbfb..b7623b10513af1874bdec6efda1406add09d7742 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 /* Support for Thawte strong extranet extension */
 
 #define SXNET_TEST
index 1ccf7dab108efca9196306c3ee56ea1d118ae2f6..bc0a463decb400df148f141696ecb1a18a0a8b73 100644 (file)
@@ -16,8 +16,6 @@
 #include "ext_dat.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(CONF_VALUE) *i2v_TLS_FEATURE(const X509V3_EXT_METHOD *method,
                                              TLS_FEATURE *tls_feature,
                                              STACK_OF(CONF_VALUE) *ext_list);
index 8acdfd3296d6757a8f2e6a165f21ae73b9a35902..001c5f2296e7a263a12ad23afa4e052ebe815132 100644 (file)
@@ -21,8 +21,6 @@
 #include "ext_dat.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static char *strip_spaces(char *name);
 static int sk_strcmp(const char *const *a, const char *const *b);
 static STACK_OF(OPENSSL_STRING) *get_email(const X509_NAME *name,
similarity index 97%
rename from include/openssl/conf.h
rename to include/openssl/conf.h.in
index 24cdcbb1cfbf3fa0e7cef93f51a7d8742c606259..2f1fceb2fbfea6ea177ac91903150add0e12db3c 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * {- join("\n * ", @autowarntext) -}
+ *
  * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -7,6 +9,10 @@
  * https://www.openssl.org/source/license.html
  */
 
+{-
+use OpenSSL::stackhash qw(generate_stack_macros);
+-}
+
 #ifndef  OPENSSL_CONF_H
 # define OPENSSL_CONF_H
 # pragma once
@@ -33,7 +39,9 @@ typedef struct {
     char *value;
 } CONF_VALUE;
 
-DEFINE_OR_DECLARE_STACK_OF(CONF_VALUE)
+{-
+    generate_stack_macros("CONF_VALUE");
+-}
 
 DEFINE_LHASH_OF(CONF_VALUE);
 
index 2a72f5b45446388efdfd6c088bbf55b637f1e556..ba760f04a869a7f482d6db10231cc5730d19a8c8 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/safestack.h>
 #include <openssl/err.h>
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
 
 static void collect_section_name(CONF_VALUE *v)
index f073dcd7ff42de6eba9b7ac6c88d7dda07d4af43..437fca97dc723df0ed4639c3b65ca7cc12c6943e 100644 (file)
@@ -15,8 +15,6 @@
 
 #include "testutil.h"
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static const ASN1_ITEM *x509_it = NULL;
 static X509 *x509 = NULL;
 #define SERVER "mock.server"
index c3adb505810fd16a71f24697d73aa0c5031dc389..f44060179999dd4c32a28e5fdeddabea3192c87b 100644 (file)
@@ -20,8 +20,6 @@
 # define strcasecmp _stricmp
 #endif
 
-DEFINE_STACK_OF(CONF_VALUE)
-
 static const int default_app_data_size = 256;
 /* Default set to be as small as possible to exercise fragmentation. */
 static const int default_max_fragment_size = 512;