]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix stacks of OPENSSL_STRING, OPENSSL_CSTRING and OPENSSL_BLOCK
authorMatt Caswell <matt@openssl.org>
Thu, 3 Sep 2020 13:10:41 +0000 (14:10 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 13 Sep 2020 10:10:39 +0000 (11:10 +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)

39 files changed:
.gitignore
apps/asn1pars.c
apps/ca.c
apps/cms.c
apps/crl2p7.c
apps/dgst.c
apps/engine.c
apps/fipsinstall.c
apps/kdf.c
apps/lib/apps.c
apps/lib/names.c
apps/lib/s_cb.c
apps/list.c
apps/mac.c
apps/ocsp.c
apps/pkcs12.c
apps/pkeyutl.c
apps/provider.c
apps/rehash.c
apps/req.c
apps/s_client.c
apps/s_server.c
apps/smime.c
apps/verify.c
apps/x509.c
build.info
crypto/encode_decode/decoder_pkey.c
crypto/encode_decode/encoder_pkey.c
crypto/engine/eng_dyn.c
crypto/x509/by_store.c
crypto/x509/v3_utl.c
crypto/x509/x509_vfy.c
crypto/x509/x509_vpm.c
include/openssl/safestack.h.in [moved from include/openssl/safestack.h with 96% similarity]
test/confdump.c
test/evp_libctx_test.c
test/evp_test.c
test/ssltest_old.c
util/perl/OpenSSL/stackhash.pm

index 72ad111f9eff428da08c71b3fc10d5eb3a1c1b4c..0ab5c085571ddc3c0f75280330f50e6bf01b6d2b 100644 (file)
@@ -25,6 +25,7 @@
 /include/openssl/configuration.h
 /include/openssl/opensslv.h
 /include/openssl/fipskey.h
+/include/openssl/safestack.h
 /include/openssl/ssl.h
 /include/openssl/x509.h
 /include/openssl/x509v3.h
index 9f21f0c7309cc91a67f77ef15e714083ef380d84..9acc3c0080376398cad1ce430282fd0080ea12aa 100644 (file)
@@ -19,7 +19,6 @@
 #include <openssl/asn1t.h>
 
 DEFINE_STACK_OF(ASN1_OBJECT)
-DEFINE_STACK_OF_STRING()
 
 typedef enum OPTION_choice {
     OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
index cb1c90991c19be5a26c47d0c72ad0520d0ae34c4..9ddd464534973c41dacc197ee7fc4d1a6fa9ead2 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -35,7 +35,6 @@
 #include "progs.h"
 
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_STRING()
 
 #ifndef W_OK
 # define F_OK 0
index 350f9ed75bfbed496cdf46c2cbef44d4128d7bb3..2706e5af86ba10443778bfa3d5f519cdf1f31270 100644 (file)
@@ -24,7 +24,6 @@
 # include <openssl/cms.h>
 
 DEFINE_STACK_OF(CMS_SignerInfo)
-DEFINE_STACK_OF_STRING()
 
 static int save_certs(char *signerfile, STACK_OF(X509) *signers);
 static int cms_cb(int ok, X509_STORE_CTX *ctx);
index 545fe0a53b8d883445c5493ade07671040873889..9137f8723959ff89d2f5c430be18ebea09c279a8 100644 (file)
@@ -19,8 +19,6 @@
 #include <openssl/pem.h>
 #include <openssl/objects.h>
 
-DEFINE_STACK_OF_STRING()
-
 static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
 
 typedef enum OPTION_choice {
index 0654d4c8b98fd74aed52578a201010e55f1eb08c..0bbde71d4b6713efdd45946bf24a673a069ba8fd 100644 (file)
@@ -21,8 +21,6 @@
 #include <openssl/hmac.h>
 #include <ctype.h>
 
-DEFINE_STACK_OF_STRING()
-
 #undef BUFSIZE
 #define BUFSIZE 1024*8
 
index d51586d85507440bb72e6243dd3613ad39439eb5..393008d5ce0c75676598a76fe973c7db03c71a0f 100644 (file)
@@ -22,9 +22,6 @@
 #include <openssl/ssl.h>
 #include <openssl/store.h>
 
-DEFINE_STACK_OF_STRING()
-DEFINE_STACK_OF_CSTRING()
-
 typedef enum OPTION_choice {
     OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
     OPT_C, OPT_T, OPT_TT, OPT_PRE, OPT_POST,
index 2df7d0f02492b6161748fc7cfaf73cc5b36e0fa7..832f560b5a1867b33b240c3f6e82ed79810053c8 100644 (file)
@@ -19,8 +19,6 @@
 #include "apps.h"
 #include "progs.h"
 
-DEFINE_STACK_OF_STRING()
-
 #define BUFSIZE 4096
 
 /* Configuration file values */
index 8d11807f5f405089cc7ae24faeb2e3ea102fd23b..ba14cfdc765283bf6c56a25c054f4348a0bbfe23 100644 (file)
@@ -17,8 +17,6 @@
 #include <openssl/kdf.h>
 #include <openssl/params.h>
 
-DEFINE_STACK_OF_STRING()
-
 typedef enum OPTION_choice {
     OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
     OPT_KDFOPT, OPT_BIN, OPT_KEYLEN, OPT_OUT,
index d69ded2a5cac05c3f24eab74b28d97a498b3425a..9bc976317d4c0a170d62b539f8baa2b07d270106 100644 (file)
@@ -63,7 +63,6 @@ static int WIN32_rename(const char *from, const char *to);
 
 DEFINE_STACK_OF(CONF)
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_STRING()
 
 typedef struct {
     const char *name;
index 42b9e9065cb644cec47028c5abc24855bbfbc88f..5e2e7e147c7fd09db0cd158e096f15b57e24f750 100644 (file)
@@ -12,8 +12,6 @@
 #include <openssl/safestack.h>
 #include "names.h"
 
-DEFINE_STACK_OF_CSTRING()
-
 #ifdef _WIN32
 # define strcasecmp _stricmp
 #endif
index b53d4cbd408e810ea772aa3344dc07b9089a6114..ec52cef15809d315c4e94364e23d11ccf32b573d 100644 (file)
@@ -26,8 +26,6 @@
 
 #define COOKIE_SECRET_LENGTH    16
 
-DEFINE_STACK_OF_STRING()
-
 VERIFY_CB_ARGS verify_args = { -1, 0, X509_V_OK, 0 };
 
 #ifndef OPENSSL_NO_SOCK
index c891bf721398b9463ad21fa7eaf95dfe969282ea..fd018991e12c150c573c589414e241bbcb1224da 100644 (file)
@@ -25,8 +25,6 @@
 #include "opt.h"
 #include "names.h"
 
-DEFINE_STACK_OF_CSTRING()
-
 static int verbose = 0;
 
 static void legacy_cipher_fn(const EVP_CIPHER *c,
index 30f0daabcc003769ec68e56a29835d4f6eb0a0ce..e751dcf0b1049b61528268eb49fa5167843f3758 100644 (file)
@@ -16,8 +16,6 @@
 #include <openssl/evp.h>
 #include <openssl/params.h>
 
-DEFINE_STACK_OF_STRING()
-
 #undef BUFSIZE
 #define BUFSIZE 1024*8
 
index ad699629f62eff2b0f9f16a6d23954dc31d34063..6943267bdeb93f2180593dae439e54c79eec7c23 100644 (file)
@@ -35,7 +35,6 @@
 
 DEFINE_STACK_OF(OCSP_CERTID)
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_STRING()
 
 #if defined(__TANDEM)
 # if defined(OPENSSL_TANDEM_FLOSS)
index fddfdbca3699f96090332c0feb272d8698e1f005..dd08b96ff83a8ed37531347546a3f15564457384 100644 (file)
@@ -22,7 +22,6 @@
 
 DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
-DEFINE_STACK_OF_STRING()
 
 #define NOKEYS          0x1
 #define NOCERTS         0x2
index 9bfef87311261af57fa43593020fea64ec8f325a..5f53867790358aee854206099d753eae7254da57 100644 (file)
@@ -15,8 +15,6 @@
 #include <openssl/evp.h>
 #include <sys/stat.h>
 
-DEFINE_STACK_OF_STRING()
-
 #define KEY_NONE        0
 #define KEY_PRIVKEY     1
 #define KEY_PUBKEY      2
index 748b95023e8a7c8479fcaa96ba58e11143c424a2..f1374a365ccbca2c43d7edc82a69d5cca8b9196e 100644 (file)
@@ -24,8 +24,6 @@
 # include <string.h> /* memset */
 #endif
 
-DEFINE_STACK_OF_CSTRING()
-
 typedef enum OPTION_choice {
     OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
     OPT_V = 100, OPT_VV, OPT_VVV
index efa0b654972f6299425b03989d1541bbbb94d56f..3cbd65c8608d002239480d5ff8c41d237eec91bc 100644 (file)
@@ -42,8 +42,6 @@
 # include <openssl/pem.h>
 # include <openssl/x509.h>
 
-DEFINE_STACK_OF_STRING()
-
 # ifndef PATH_MAX
 #  define PATH_MAX 4096
 # endif
index 2cc9ebf43d8cc254d67c135d7259d5b8dfedf825..5f3c7b5fc834740e9d49198619f4ed35b20c2939 100644 (file)
@@ -36,7 +36,6 @@
 #endif
 
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_STRING()
 
 #define BITS            "default_bits"
 #define KEYFILE         "default_keyfile"
index 32aa6fafcbd42b4d283d81acafd7c1ea92387e8d..ecd737ef691944cac85d3e25cc9ef4e64db8943c 100644 (file)
@@ -60,7 +60,6 @@ typedef unsigned int u_int;
 #endif
 
 DEFINE_STACK_OF(SCT)
-DEFINE_STACK_OF_STRING()
 
 #undef BUFSIZZ
 #define BUFSIZZ 1024*8
index c970080d83170a02221584285f5e540faad3f032..dde0ee60c003d3d1b9eacd29ac06d8218699b6eb 100644 (file)
@@ -60,8 +60,6 @@ typedef unsigned int u_int;
 #endif
 #include "internal/sockets.h"
 
-DEFINE_STACK_OF_STRING()
-
 static int not_resumable_sess_cb(SSL *s, int is_forward_secure);
 static int sv_body(int s, int stype, int prot, unsigned char *context);
 static int www_body(int s, int stype, int prot, unsigned char *context);
index ed3d63af6ca123712dcec35765dd61b48d7d4c03..9113038db7a986c3278828a8a11108d8e80fd128 100644 (file)
@@ -19,8 +19,6 @@
 #include <openssl/x509_vfy.h>
 #include <openssl/x509v3.h>
 
-DEFINE_STACK_OF_STRING()
-
 static int save_certs(char *signerfile, STACK_OF(X509) *signers);
 static int smime_cb(int ok, X509_STORE_CTX *ctx);
 
index c43a4e69a47a2fbbda6749b014eecb3920e9f3c7..3d4e7d40600eb010d781badf94f518c3501c4548 100644 (file)
@@ -18,8 +18,6 @@
 #include <openssl/x509v3.h>
 #include <openssl/pem.h>
 
-DEFINE_STACK_OF_STRING()
-
 static int cb(int ok, X509_STORE_CTX *ctx);
 static int check(X509_STORE *ctx, const char *file,
                  STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
index 4b2200c35b6efc191238f442b3814a09e5b9c0f0..a8f515a90ba9fb19105ea6cd9be772cad441e426 100644 (file)
@@ -29,7 +29,6 @@
 #endif
 
 DEFINE_STACK_OF(ASN1_OBJECT)
-DEFINE_STACK_OF_STRING()
 
 #undef POSTFIX
 #define POSTFIX ".srl"
index bec55770ae997925c7d597bfeb4f1a9e0414aaea..9dc37a1b7eedefcb810daca7abd99809ee7fa890 100644 (file)
@@ -15,6 +15,7 @@ DEPEND[libssl]=libcrypto
 # unconditionally before anything else.
 DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
          include/openssl/fipskey.h \
+         include/openssl/safestack.h \
          include/openssl/ssl.h \
          include/openssl/x509.h \
          include/openssl/x509v3.h \
@@ -24,6 +25,7 @@ DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
 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/safestack.h]=include/openssl/safestack.h.in
 GENERATE[include/openssl/ssl.h]=include/openssl/ssl.h.in
 GENERATE[include/openssl/x509.h]=include/openssl/x509.h.in
 GENERATE[include/openssl/x509v3.h]=include/openssl/x509v3.h.in
index 64ea4e2c3f204f81073437e62bb0dd2f16bb4c98..dfc7cccab1f5dd5e5d9d5cf15289d88fcaa884c1 100644 (file)
@@ -187,8 +187,6 @@ static void decoder_clean_EVP_PKEY_construct_arg(void *construct_data)
     }
 }
 
-DEFINE_STACK_OF_CSTRING()
-
 struct collected_data_st {
     struct decoder_EVP_PKEY_data_st *process_data;
     STACK_OF(OPENSSL_CSTRING) *names;
index 76b8386e0c5215eae0d79263a4a795ca69d57450..7c63a76adbb85344b18ec09574a7df6bf5cb32f5 100644 (file)
@@ -18,8 +18,6 @@
 #include "crypto/evp.h"
 #include "encoder_local.h"
 
-DEFINE_STACK_OF_CSTRING()
-
 int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,
                                 const char *cipher_name,
                                 const char *propquery)
index 73d7b14ae6944bbd9f1b1802ba1f14796b58aa03..01935578c26ad1d068644123a952cf6e48cc6258 100644 (file)
@@ -20,8 +20,6 @@
  * prototypes.
  */
 
-DEFINE_STACK_OF_STRING()
-
 /* Our ENGINE handlers */
 static int dynamic_init(ENGINE *e);
 static int dynamic_finish(ENGINE *e);
index debb76150d2d2f568df9744f3a7c552468213cf8..7822da8cd58c203171fc472b368063f96fd768cd 100644 (file)
@@ -12,8 +12,6 @@
 #include "crypto/x509.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF_STRING()
-
 /* Generic object loader, given expected type and criterion */
 static int cache_objects(X509_LOOKUP *lctx, const char *uri,
                          const OSSL_STORE_SEARCH *criterion,
index 7e813af3e9b16d95f088176cc50e4c753592ce75..8acdfd3296d6757a8f2e6a165f21ae73b9a35902 100644 (file)
@@ -22,7 +22,6 @@
 #include "x509_local.h"
 
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_STRING()
 
 static char *strip_spaces(char *name);
 static int sk_strcmp(const char *const *a, const char *const *b);
index ce31975f8ba0df289450e4fe042a8d83efcb7d0a..d4a085ddb068fe3d5f9d1b1feddde788763e2dec 100644 (file)
@@ -25,8 +25,6 @@
 #include "crypto/x509.h"
 #include "x509_local.h"
 
-DEFINE_STACK_OF_STRING()
-
 /* CRL score values */
 
 /* No unhandled critical extensions */
index f87dfd07267d497e0feadc5940870bef07a6add1..8fe09fd61aa84c92a618e83367d623d52e2f69ec 100644 (file)
@@ -20,7 +20,6 @@
 
 DEFINE_STACK_OF(ASN1_OBJECT)
 DEFINE_STACK_OF(X509_VERIFY_PARAM)
-DEFINE_STACK_OF_STRING()
 
 /* X509_VERIFY_PARAM functions */
 
similarity index 96%
rename from include/openssl/safestack.h
rename to include/openssl/safestack.h.in
index c94ce78cf90b2132fa0c85f8ff3811c042237d27..943aa5861ec4dad1c3447ebdef82a8d8c260a0c2 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * {- join("\n * ", @autowarntext) -}
+ *
  * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -7,6 +9,12 @@
  * https://www.openssl.org/source/license.html
  */
 
+{-
+use OpenSSL::stackhash qw(generate_stack_string_macros
+                          generate_stack_const_string_macros
+                          generate_stack_block_macros);
+-}
+
 #ifndef OPENSSL_SAFESTACK_H
 # define OPENSSL_SAFESTACK_H
 # pragma once
@@ -184,8 +192,10 @@ typedef const char *OPENSSL_CSTRING;
  * chars. So, we have to implement STRING specially for STACK_OF. This is
  * dealt with in the autogenerated macros below.
  */
-DEFINE_OR_DECLARE_STACK_OF_STRING()
-DEFINE_OR_DECLARE_STACK_OF_CSTRING()
+{-
+    generate_stack_string_macros()
+    .generate_stack_const_string_macros();
+-}
 
 #if !defined(OPENSSL_NO_DEPRECATED_3_0)
 /*
@@ -193,7 +203,9 @@ DEFINE_OR_DECLARE_STACK_OF_CSTRING()
  * These should also be distinguished from "normal" stacks.
  */
 typedef void *OPENSSL_BLOCK;
-DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
+{-
+    generate_stack_block_macros();
+-}
 #endif
 
 /*
index 3750d2cc8c80add0f9895ee558cb6f20eb5c9175..2a72f5b45446388efdfd6c088bbf55b637f1e556 100644 (file)
@@ -15,7 +15,6 @@
 #include <openssl/err.h>
 
 DEFINE_STACK_OF(CONF_VALUE)
-DEFINE_STACK_OF_CSTRING()
 
 static STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
 
index 3b20dad74b383bd9dc752484935c4f11e1b6ad48..823cdec8e0f911f4fff2fc9de3ed6d01647c1583 100644 (file)
@@ -31,8 +31,6 @@
 #include "crypto/bn_dh.h"   /* _bignum_ffdhe2048_p */
 #include "../e_os.h"        /* strcasecmp */
 
-DEFINE_STACK_OF_CSTRING()
-
 static OPENSSL_CTX *libctx = NULL;
 static OSSL_PROVIDER *nullprov = NULL;
 static OSSL_PROVIDER *libprov = NULL;
index 52e1dd2e51b304e2ddd1739b106b3674d546648b..0b58d1f97eadc93553658c58cc87f6f5fee3a699 100644 (file)
@@ -27,8 +27,6 @@
 #include "testutil.h"
 #include "evp_test.h"
 
-DEFINE_STACK_OF_STRING()
-
 #define AAD_NUM 4
 
 typedef struct evp_test_method_st EVP_TEST_METHOD;
index 88aef5e8963d6983abcfe7ba5b20b87cd77010cd..d1733912bc5a7127d66f0f084ecafd9c00d21306 100644 (file)
@@ -81,8 +81,6 @@
 # include <unistd.h>
 #endif
 
-DEFINE_STACK_OF_STRING()
-
 static SSL_CTX *s_ctx = NULL;
 static SSL_CTX *s_ctx2 = NULL;
 
index d8ca76aa91a79ca28898d2d284bc9e7371f2f8f3..21d852eae00932ee8f59e188041850b605201f69 100644 (file)
@@ -13,7 +13,10 @@ use warnings;
 
 require Exporter;
 our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros);
+our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros
+                    generate_stack_string_macros
+                    generate_stack_const_string_macros
+                    generate_stack_block_macros);
 
 sub generate_stack_macros_int {
     my $nametype = shift;
@@ -89,4 +92,16 @@ sub generate_const_stack_macros {
 
     return generate_stack_macros_int($type, "const $type", $type);
 }
+
+sub generate_stack_string_macros {
+    return generate_stack_macros_int("OPENSSL_STRING", "char", "char");
+}
+
+sub generate_stack_const_string_macros {
+    return generate_stack_macros_int("OPENSSL_CSTRING", "const char", "char");
+}
+
+sub generate_stack_block_macros {
+    return generate_stack_macros_int("OPENSSL_BLOCK", "void", "void");
+}
 1;