diff options
author | Rich Salz <rsalz@akamai.com> | 2019-12-19 23:30:24 +0100 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-04-24 16:42:46 +0200 |
commit | 852c2ed260860b6b85c84f9fe96fb4d23d49c9f2 (patch) | |
tree | d8104686e0a02217c13f51e5d10d7434fa13e3dc /apps | |
parent | Fix typo from #10631 (diff) | |
download | openssl-852c2ed260860b6b85c84f9fe96fb4d23d49c9f2.tar.xz openssl-852c2ed260860b6b85c84f9fe96fb4d23d49c9f2.zip |
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 'apps')
-rw-r--r-- | apps/asn1pars.c | 3 | ||||
-rw-r--r-- | apps/ca.c | 5 | ||||
-rw-r--r-- | apps/ciphers.c | 2 | ||||
-rw-r--r-- | apps/cmp_mock_srv.c | 4 | ||||
-rw-r--r-- | apps/cms.c | 6 | ||||
-rw-r--r-- | apps/crl2p7.c | 5 | ||||
-rw-r--r-- | apps/dgst.c | 2 | ||||
-rw-r--r-- | apps/engine.c | 3 | ||||
-rw-r--r-- | apps/fipsinstall.c | 2 | ||||
-rw-r--r-- | apps/kdf.c | 2 | ||||
-rw-r--r-- | apps/lib/apps.c | 11 | ||||
-rw-r--r-- | apps/lib/names.c | 2 | ||||
-rw-r--r-- | apps/lib/s_cb.c | 5 | ||||
-rw-r--r-- | apps/list.c | 2 | ||||
-rw-r--r-- | apps/mac.c | 2 | ||||
-rw-r--r-- | apps/nseq.c | 2 | ||||
-rw-r--r-- | apps/ocsp.c | 5 | ||||
-rw-r--r-- | apps/pkcs12.c | 6 | ||||
-rw-r--r-- | apps/pkcs7.c | 3 | ||||
-rw-r--r-- | apps/pkeyutl.c | 2 | ||||
-rw-r--r-- | apps/provider.c | 2 | ||||
-rw-r--r-- | apps/rehash.c | 2 | ||||
-rw-r--r-- | apps/req.c | 2 | ||||
-rw-r--r-- | apps/s_client.c | 6 | ||||
-rw-r--r-- | apps/s_server.c | 6 | ||||
-rw-r--r-- | apps/smime.c | 3 | ||||
-rw-r--r-- | apps/verify.c | 4 | ||||
-rw-r--r-- | apps/x509.c | 4 |
28 files changed, 103 insertions, 0 deletions
diff --git a/apps/asn1pars.c b/apps/asn1pars.c index 342e12d9b2..4b34e7e622 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -18,6 +18,9 @@ #include <openssl/pem.h> #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, OPT_INFORM, OPT_IN, OPT_OUT, OPT_INDENT, OPT_NOOUT, @@ -34,6 +34,11 @@ #include "apps.h" #include "progs.h" +DEFINE_STACK_OF(X509) +DEFINE_STACK_OF(X509_EXTENSION) +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_STACK_OF_STRING() + #ifndef W_OK # define F_OK 0 # define W_OK 2 diff --git a/apps/ciphers.c b/apps/ciphers.c index 500b416046..380091f16f 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -15,6 +15,8 @@ #include <openssl/err.h> #include <openssl/ssl.h> +DEFINE_STACK_OF_CONST(SSL_CIPHER) + typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_STDNAME, diff --git a/apps/cmp_mock_srv.c b/apps/cmp_mock_srv.c index 8ffe4ca5a8..b45f98551c 100644 --- a/apps/cmp_mock_srv.c +++ b/apps/cmp_mock_srv.c @@ -15,6 +15,10 @@ #include <openssl/err.h> #include <openssl/cmperr.h> +DEFINE_STACK_OF(X509) +DEFINE_STACK_OF(OSSL_CMP_ITAV) +DEFINE_STACK_OF(ASN1_UTF8STRING) + /* the context for the CMP mock server */ typedef struct { diff --git a/apps/cms.c b/apps/cms.c index 0d89085cc7..0c8af3dab7 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -23,6 +23,12 @@ # 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) +DEFINE_STACK_OF_STRING() + static int save_certs(char *signerfile, STACK_OF(X509) *signers); static int cms_cb(int ok, X509_STORE_CTX *ctx); static void receipt_request_print(CMS_ContentInfo *cms); diff --git a/apps/crl2p7.c b/apps/crl2p7.c index 9137f87239..e0de95a12a 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -19,6 +19,11 @@ #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); typedef enum OPTION_choice { diff --git a/apps/dgst.c b/apps/dgst.c index 23faa340b2..90aaf982ae 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -21,6 +21,8 @@ #include <openssl/hmac.h> #include <ctype.h> +DEFINE_STACK_OF_STRING() + #undef BUFSIZE #define BUFSIZE 1024*8 diff --git a/apps/engine.c b/apps/engine.c index 2b295fde67..6d788ac852 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -19,6 +19,9 @@ #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, diff --git a/apps/fipsinstall.c b/apps/fipsinstall.c index 157f08b11f..1eb183f361 100644 --- a/apps/fipsinstall.c +++ b/apps/fipsinstall.c @@ -18,6 +18,8 @@ #include "apps.h" #include "progs.h" +DEFINE_STACK_OF_STRING() + #define BUFSIZE 4096 #define DEFAULT_MAC_NAME "HMAC" #define DEFAULT_FIPS_SECTION "fips_check_section" diff --git a/apps/kdf.c b/apps/kdf.c index 0b577b2bcd..9a69682b57 100644 --- a/apps/kdf.c +++ b/apps/kdf.c @@ -17,6 +17,8 @@ #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, diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 13ca7a12f1..5395d842eb 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -57,6 +57,17 @@ 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) +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) +DEFINE_STACK_OF_STRING() + typedef struct { const char *name; unsigned long flag; diff --git a/apps/lib/names.c b/apps/lib/names.c index 09ee16fd37..a1116d68f8 100644 --- a/apps/lib/names.c +++ b/apps/lib/names.c @@ -12,6 +12,8 @@ #include <openssl/safestack.h> #include "names.h" +DEFINE_STACK_OF_CSTRING() + #ifdef _WIN32 # define strcasecmp _stricmp #endif diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c index 16ce65d448..5f2f2792fa 100644 --- a/apps/lib/s_cb.c +++ b/apps/lib/s_cb.c @@ -26,6 +26,11 @@ #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 }; #ifndef OPENSSL_NO_SOCK diff --git a/apps/list.c b/apps/list.c index b30632a65a..a28f6b673e 100644 --- a/apps/list.c +++ b/apps/list.c @@ -19,6 +19,8 @@ #include "opt.h" #include "names.h" +DEFINE_STACK_OF_CSTRING() + static int verbose = 0; static void legacy_cipher_fn(const EVP_CIPHER *c, diff --git a/apps/mac.c b/apps/mac.c index 6e322fd2fe..07a6e915e3 100644 --- a/apps/mac.c +++ b/apps/mac.c @@ -16,6 +16,8 @@ #include <openssl/evp.h> #include <openssl/params.h> +DEFINE_STACK_OF_STRING() + #undef BUFSIZE #define BUFSIZE 1024*8 diff --git a/apps/nseq.c b/apps/nseq.c index 92ae7bd34d..de189632b2 100644 --- a/apps/nseq.c +++ b/apps/nseq.c @@ -14,6 +14,8 @@ #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 7bd1765b30..d85892202a 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -33,6 +33,11 @@ #include <openssl/x509v3.h> #include <openssl/rand.h> +DEFINE_STACK_OF(OCSP_CERTID) +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_STACK_OF(X509) +DEFINE_STACK_OF_STRING() + #ifndef HAVE_FORK # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) # define HAVE_FORK 0 diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 69bbe94cf9..18f9550ded 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -19,6 +19,12 @@ #include <openssl/pem.h> #include <openssl/pkcs12.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 #define NOCERTS 0x2 #define INFO 0x4 diff --git a/apps/pkcs7.c b/apps/pkcs7.c index dba9751e9b..2416584dd6 100644 --- a/apps/pkcs7.c +++ b/apps/pkcs7.c @@ -20,6 +20,9 @@ #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/pkeyutl.c b/apps/pkeyutl.c index 34251d5aeb..1e3802045f 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -15,6 +15,8 @@ #include <openssl/evp.h> #include <sys/stat.h> +DEFINE_STACK_OF_STRING() + #define KEY_NONE 0 #define KEY_PRIVKEY 1 #define KEY_PUBKEY 2 diff --git a/apps/provider.c b/apps/provider.c index 87231cd2df..de8fd34cf3 100644 --- a/apps/provider.c +++ b/apps/provider.c @@ -20,6 +20,8 @@ #include <openssl/core.h> #include <openssl/core_numbers.h> +DEFINE_STACK_OF_CSTRING() + typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_V = 100, OPT_VV, OPT_VVV diff --git a/apps/rehash.c b/apps/rehash.c index e21b1b84ae..866b8cfe20 100644 --- a/apps/rehash.c +++ b/apps/rehash.c @@ -42,6 +42,8 @@ # include <openssl/pem.h> # include <openssl/x509.h> +DEFINE_STACK_OF(X509_INFO) +DEFINE_STACK_OF_STRING() # ifndef PATH_MAX # define PATH_MAX 4096 diff --git a/apps/req.c b/apps/req.c index 3d40f0c80b..9ab120c34f 100644 --- a/apps/req.c +++ b/apps/req.c @@ -32,6 +32,8 @@ # include <openssl/dsa.h> #endif +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_STACK_OF_STRING() #define BITS "default_bits" #define KEYFILE "default_keyfile" diff --git a/apps/s_client.c b/apps/s_client.c index ff06f4ee4c..a28b2867a3 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -56,6 +56,12 @@ 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() + #undef BUFSIZZ #define BUFSIZZ 1024*8 #define S_CLIENT_IRC_READ_TIMEOUT 8 diff --git a/apps/s_server.c b/apps/s_server.c index dd661ee4eb..14550aebc2 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -60,6 +60,12 @@ 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(SSL_CIPHER) +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); diff --git a/apps/smime.c b/apps/smime.c index 27fc7905c0..50f03fdc04 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -19,6 +19,9 @@ #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); static int smime_cb(int ok, X509_STORE_CTX *ctx); diff --git a/apps/verify.c b/apps/verify.c index 0e423ca80b..558866806f 100644 --- a/apps/verify.c +++ b/apps/verify.c @@ -18,6 +18,10 @@ #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); static int check(X509_STORE *ctx, const char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, diff --git a/apps/x509.c b/apps/x509.c index bff698f97d..16c1f95754 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -28,6 +28,10 @@ # include <openssl/dsa.h> #endif +DEFINE_STACK_OF(ASN1_OBJECT) +DEFINE_STACK_OF(X509_EXTENSION) +DEFINE_STACK_OF_STRING() + #undef POSTFIX #define POSTFIX ".srl" #define DEF_DAYS 30 |