summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2019-12-19 17:30:24 -0500
committerTomas Mraz <tmraz@fedoraproject.org>2020-04-24 16:42:46 +0200
commit852c2ed260860b6b85c84f9fe96fb4d23d49c9f2 (patch)
treed8104686e0a02217c13f51e5d10d7434fa13e3dc /test
parent4692e98bdbaebb6f078e89a75c54395839e68b24 (diff)
In OpenSSL builds, declare STACK for datatypes ...
... and only *define* them in the source files that need them. Use DEFINE_OR_DECLARE which is set appropriately for internal builds and not non-deprecated builds. Deprecate stack-of-block Better documentation Move some ASN1 struct typedefs to types.h Update ParseC to handle this. Most of all, ParseC needed to be more consistent. The handlers are "recursive", in so far that they are called again and again until they terminate, which depends entirely on what the "massager" returns. There's a comment at the beginning of ParseC that explains how that works. {Richard Levtte} Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10669)
Diffstat (limited to 'test')
-rw-r--r--test/cipherbytes_test.c2
-rw-r--r--test/cipherlist_test.c2
-rw-r--r--test/ciphername_test.c2
-rw-r--r--test/cmp_client_test.c3
-rw-r--r--test/cmp_ctx_test.c6
-rw-r--r--test/cmp_hdr_test.c3
-rw-r--r--test/cmp_msg_test.c2
-rw-r--r--test/cmp_protect_test.c2
-rw-r--r--test/cmp_status_test.c2
-rw-r--r--test/cmp_testlib.c2
-rw-r--r--test/cmp_vfy_test.c1
-rw-r--r--test/cmsapitest.c2
-rw-r--r--test/confdump.c3
-rw-r--r--test/crltest.c3
-rw-r--r--test/ct_test.c3
-rw-r--r--test/danetest.c2
-rw-r--r--test/dtls_mtu_test.c2
-rw-r--r--test/evp_test.c2
-rw-r--r--test/handshake_helper.c2
-rw-r--r--test/http_test.c2
-rw-r--r--test/ocspapitest.c2
-rw-r--r--test/ssl_test.c2
-rw-r--r--test/ssl_test_ctx.c3
-rw-r--r--test/sslapitest.c6
-rw-r--r--test/sslcorrupttest.c2
-rw-r--r--test/ssltest_old.c3
-rw-r--r--test/v3nametest.c2
-rw-r--r--test/verify_extra_test.c2
28 files changed, 70 insertions, 0 deletions
diff --git a/test/cipherbytes_test.c b/test/cipherbytes_test.c
index 370d033a4d..9e2c5eaaea 100644
--- a/test/cipherbytes_test.c
+++ b/test/cipherbytes_test.c
@@ -21,6 +21,8 @@
#include "internal/nelem.h"
#include "testutil.h"
+DEFINE_STACK_OF(SSL_CIPHER)
+
static SSL_CTX *ctx;
static SSL *s;
diff --git a/test/cipherlist_test.c b/test/cipherlist_test.c
index b950411c38..3bc103c737 100644
--- a/test/cipherlist_test.c
+++ b/test/cipherlist_test.c
@@ -21,6 +21,8 @@
#include "internal/nelem.h"
#include "testutil.h"
+DEFINE_STACK_OF_CONST(SSL_CIPHER)
+
typedef struct cipherlist_test_fixture {
const char *test_case_name;
SSL_CTX *server;
diff --git a/test/ciphername_test.c b/test/ciphername_test.c
index c4ec6cadd7..c82a164827 100644
--- a/test/ciphername_test.c
+++ b/test/ciphername_test.c
@@ -22,6 +22,8 @@
#include "internal/nelem.h"
#include "testutil.h"
+DEFINE_STACK_OF(SSL_CIPHER)
+
typedef struct cipher_id_name {
int id;
const char *name;
diff --git a/test/cmp_client_test.c b/test/cmp_client_test.c
index 44d09e0446..b10662349c 100644
--- a/test/cmp_client_test.c
+++ b/test/cmp_client_test.c
@@ -15,6 +15,9 @@
#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;
static const char *server_cert_f;
static const char *client_key_f;
diff --git a/test/cmp_ctx_test.c b/test/cmp_ctx_test.c
index 470ab63b13..a2a8adc856 100644
--- a/test/cmp_ctx_test.c
+++ b/test/cmp_ctx_test.c
@@ -13,6 +13,12 @@
#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)
+
typedef struct test_fixture {
const char *test_case_name;
OSSL_CMP_CTX *ctx;
diff --git a/test/cmp_hdr_test.c b/test/cmp_hdr_test.c
index 6e78432d47..cd30c49762 100644
--- a/test/cmp_hdr_test.c
+++ b/test/cmp_hdr_test.c
@@ -11,6 +11,9 @@
#include "cmp_testlib.h"
+DEFINE_STACK_OF(OSSL_CMP_ITAV)
+DEFINE_STACK_OF(ASN1_UTF8STRING)
+
static unsigned char rand_data[OSSL_CMP_TRANSACTIONID_LENGTH];
typedef struct test_fixture {
diff --git a/test/cmp_msg_test.c b/test/cmp_msg_test.c
index 6aadd439bc..413e284fcc 100644
--- a/test/cmp_msg_test.c
+++ b/test/cmp_msg_test.c
@@ -11,6 +11,8 @@
#include "cmp_testlib.h"
+DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
+
static const char *server_cert_f;
static const char *pkcs10_f;
diff --git a/test/cmp_protect_test.c b/test/cmp_protect_test.c
index fc006ac6ca..ce5a6cb420 100644
--- a/test/cmp_protect_test.c
+++ b/test/cmp_protect_test.c
@@ -11,6 +11,8 @@
#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_status_test.c b/test/cmp_status_test.c
index 7358f1589f..bf6699a2b1 100644
--- a/test/cmp_status_test.c
+++ b/test/cmp_status_test.c
@@ -11,6 +11,8 @@
#include "cmp_testlib.h"
+DEFINE_STACK_OF(ASN1_UTF8STRING)
+
typedef struct test_fixture {
const char *test_case_name;
int pkistatus;
diff --git a/test/cmp_testlib.c b/test/cmp_testlib.c
index bb3351b4b0..d25ab7468b 100644
--- a/test/cmp_testlib.c
+++ b/test/cmp_testlib.c
@@ -12,6 +12,8 @@
#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)
{
EVP_PKEY *key = NULL;
diff --git a/test/cmp_vfy_test.c b/test/cmp_vfy_test.c
index 5f43f1e2ec..c74dd2faec 100644
--- a/test/cmp_vfy_test.c
+++ b/test/cmp_vfy_test.c
@@ -11,6 +11,7 @@
#include "cmp_testlib.h"
#include "../crypto/crmf/crmf_local.h" /* for manipulating POPO signature */
+DEFINE_STACK_OF(OSSL_CRMF_MSG)
static const char *server_f;
static const char *client_f;
diff --git a/test/cmsapitest.c b/test/cmsapitest.c
index ad1cbd1c14..2ac330a8fa 100644
--- a/test/cmsapitest.c
+++ b/test/cmsapitest.c
@@ -16,6 +16,8 @@
#include "testutil.h"
+DEFINE_STACK_OF(X509)
+
static X509 *cert = NULL;
static EVP_PKEY *privkey = NULL;
diff --git a/test/confdump.c b/test/confdump.c
index dbf6244653..48b3779df7 100644
--- a/test/confdump.c
+++ b/test/confdump.c
@@ -14,6 +14,9 @@
#include <openssl/safestack.h>
#include <openssl/err.h>
+DEFINE_STACK_OF(CONF_VALUE)
+DEFINE_STACK_OF_CSTRING()
+
static STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
static void collect_section_name(CONF_VALUE *v)
diff --git a/test/crltest.c b/test/crltest.c
index 6a2ef4e90d..ac2d27b328 100644
--- a/test/crltest.c
+++ b/test/crltest.c
@@ -17,6 +17,9 @@
#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/ct_test.c b/test/ct_test.c
index bd098c5d6a..79ffcbf9a2 100644
--- a/test/ct_test.c
+++ b/test/ct_test.c
@@ -21,6 +21,9 @@
#include <openssl/crypto.h>
#ifndef OPENSSL_NO_CT
+
+DEFINE_STACK_OF(SCT)
+
/* Used when declaring buffers to read text files into */
# define CT_TEST_MAX_FILE_SIZE 8096
diff --git a/test/danetest.c b/test/danetest.c
index b0d6ffe563..96b9579f3c 100644
--- a/test/danetest.c
+++ b/test/danetest.c
@@ -26,6 +26,8 @@
#include "internal/nelem.h"
+DEFINE_STACK_OF(X509)
+
#define _UC(c) ((unsigned char)(c))
static const char *basedomain;
diff --git a/test/dtls_mtu_test.c b/test/dtls_mtu_test.c
index 33603baed6..b45df8a2e9 100644
--- a/test/dtls_mtu_test.c
+++ b/test/dtls_mtu_test.c
@@ -20,6 +20,8 @@
/* for SSL_READ_ETM() */
#include "../ssl/ssl_local.h"
+DEFINE_STACK_OF(SSL_CIPHER)
+
static int debug = 0;
static unsigned int clnt_psk_callback(SSL *ssl, const char *hint,
diff --git a/test/evp_test.c b/test/evp_test.c
index 71e4716292..6727a007a0 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -25,6 +25,8 @@
#include "testutil.h"
#include "evp_test.h"
+DEFINE_STACK_OF_STRING()
+
#define AAD_NUM 4
typedef struct evp_test_method_st EVP_TEST_METHOD;
diff --git a/test/handshake_helper.c b/test/handshake_helper.c
index d46db3f298..32aa12c466 100644
--- a/test/handshake_helper.c
+++ b/test/handshake_helper.c
@@ -26,6 +26,8 @@
#include <netinet/sctp.h>
#endif
+DEFINE_STACK_OF(X509_NAME)
+
HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void)
{
HANDSHAKE_RESULT *ret;
diff --git a/test/http_test.c b/test/http_test.c
index 6449c6f61e..f0b12a7dd0 100644
--- a/test/http_test.c
+++ b/test/http_test.c
@@ -15,6 +15,8 @@
#include "testutil.h"
+DEFINE_STACK_OF(CONF_VALUE)
+
static const ASN1_ITEM *x509_it = NULL;
static X509 *x509 = NULL;
#define SERVER "mock.server"
diff --git a/test/ocspapitest.c b/test/ocspapitest.c
index 9e8c306259..4ea6c636d4 100644
--- a/test/ocspapitest.c
+++ b/test/ocspapitest.c
@@ -18,6 +18,8 @@
#include "testutil.h"
+DEFINE_STACK_OF(X509)
+
static const char *certstr;
static const char *privkeystr;
diff --git a/test/ssl_test.c b/test/ssl_test.c
index c671feaf21..731f569743 100644
--- a/test/ssl_test.c
+++ b/test/ssl_test.c
@@ -19,6 +19,8 @@
#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 6a3b66bcb9..f591adf90b 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -20,6 +20,9 @@
# define strcasecmp _stricmp
#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. */
static const int default_max_fragment_size = 512;
diff --git a/test/sslapitest.c b/test/sslapitest.c
index d1635585e8..f9349bc59b 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -37,6 +37,10 @@
#include "internal/ktls.h"
#include "../ssl/ssl_local.h"
+DEFINE_STACK_OF(OCSP_RESPID)
+DEFINE_STACK_OF(X509)
+DEFINE_STACK_OF(X509_NAME)
+
static OPENSSL_CTX *libctx = NULL;
static OSSL_PROVIDER *defctxnull = NULL;
@@ -5518,6 +5522,8 @@ static int test_pha_key_update(void)
static SRP_VBASE *vbase = NULL;
+DEFINE_STACK_OF(SRP_user_pwd)
+
static int ssl_srp_cb(SSL *s, int *ad, void *arg)
{
int ret = SSL3_AL_FATAL;
diff --git a/test/sslcorrupttest.c b/test/sslcorrupttest.c
index 135fe48509..476a1758ad 100644
--- a/test/sslcorrupttest.c
+++ b/test/sslcorrupttest.c
@@ -11,6 +11,8 @@
#include "ssltestlib.h"
#include "testutil.h"
+DEFINE_STACK_OF(SSL_CIPHER)
+
static int docorrupt = 0;
static void copy_flags(BIO *bio)
diff --git a/test/ssltest_old.c b/test/ssltest_old.c
index dca0694ecf..d45b2786d3 100644
--- a/test/ssltest_old.c
+++ b/test/ssltest_old.c
@@ -81,6 +81,9 @@
# include <unistd.h>
#endif
+DEFINE_STACK_OF(SSL_COMP)
+DEFINE_STACK_OF_STRING()
+
static SSL_CTX *s_ctx = NULL;
static SSL_CTX *s_ctx2 = NULL;
diff --git a/test/v3nametest.c b/test/v3nametest.c
index d17ab7146a..507b0fcf9f 100644
--- a/test/v3nametest.c
+++ b/test/v3nametest.c
@@ -19,6 +19,8 @@
# define strcasecmp _stricmp
#endif
+DEFINE_STACK_OF(GENERAL_NAME)
+
static const char *const names[] = {
"a", "b", ".", "*", "@",
".a", "a.", ".b", "b.", ".*", "*.", "*@", "@*", "a@", "@a", "b@", "..",
diff --git a/test/verify_extra_test.c b/test/verify_extra_test.c
index 3dd4562714..6cce626026 100644
--- a/test/verify_extra_test.c
+++ b/test/verify_extra_test.c
@@ -16,6 +16,8 @@
#include <openssl/err.h>
#include "testutil.h"
+DEFINE_STACK_OF(X509)
+
static const char *roots_f;
static const char *untrusted_f;
static const char *bad_f;