diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-01-06 02:54:18 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-01-07 18:00:51 +0000 |
commit | 4a1f3f274108e25b97bd9870170fe2970892e155 (patch) | |
tree | 45e10bfbd19cec70d44d079d677b9852f12a501e /crypto | |
parent | 858857157290dd35145b14044ae96be9cd8eb0df (diff) |
Only declare stacks in headers
Don't define stacks in C source files: it causes warnings
about unused functions in some compilers.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/ameth_lib.c | 1 | ||||
-rw-r--r-- | crypto/asn1/asn1_locl.h | 5 | ||||
-rw-r--r-- | crypto/asn1/asn_mime.c | 12 | ||||
-rw-r--r-- | crypto/evp/evp_locl.h | 3 | ||||
-rw-r--r-- | crypto/evp/evp_pbe.c | 5 | ||||
-rw-r--r-- | crypto/evp/pmeth_lib.c | 1 | ||||
-rw-r--r-- | crypto/ex_data.c | 8 | ||||
-rw-r--r-- | crypto/include/internal/asn1_int.h | 2 | ||||
-rw-r--r-- | crypto/include/internal/cryptlib.h | 7 | ||||
-rw-r--r-- | crypto/include/internal/evp_int.h | 2 | ||||
-rw-r--r-- | crypto/lock.c | 2 | ||||
-rw-r--r-- | crypto/objects/Makefile | 2 | ||||
-rw-r--r-- | crypto/objects/o_names.c | 7 | ||||
-rw-r--r-- | crypto/objects/o_names.h | 4 | ||||
-rw-r--r-- | crypto/objects/obj_xref.c | 2 | ||||
-rw-r--r-- | crypto/objects/obj_xref.h | 2 | ||||
-rw-r--r-- | crypto/objects/objxref.pl | 2 | ||||
-rw-r--r-- | crypto/x509/by_dir.c | 12 | ||||
-rw-r--r-- | crypto/x509/x509_lcl.h | 7 | ||||
-rw-r--r-- | crypto/x509/x_name.c | 4 |
20 files changed, 52 insertions, 38 deletions
diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 1febfe91ba..a932028911 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -92,7 +92,6 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = { }; typedef int sk_cmp_fn_type(const char *const *a, const char *const *b); -DEFINE_CONST_STACK_OF(EVP_PKEY_ASN1_METHOD) static STACK_OF(EVP_PKEY_ASN1_METHOD) *app_methods = NULL; #ifdef TEST diff --git a/crypto/asn1/asn1_locl.h b/crypto/asn1/asn1_locl.h index d076fa071c..c47eb44938 100644 --- a/crypto/asn1/asn1_locl.h +++ b/crypto/asn1/asn1_locl.h @@ -87,6 +87,11 @@ struct asn1_sctx_st { void *app_data; } /* ASN1_SCTX */ ; +typedef struct mime_param_st MIME_PARAM; +DEFINE_STACK_OF(MIME_PARAM) +typedef struct mime_header_st MIME_HEADER; +DEFINE_STACK_OF(MIME_HEADER) + /* Month values for printing out times */ extern const char *_asn1_mon[12]; diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index f138db9c81..58d53240af 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -73,20 +73,16 @@ * from parameter values. Quotes are stripped off */ -typedef struct { +struct mime_param_st { char *param_name; /* Param name e.g. "micalg" */ char *param_value; /* Param value e.g. "sha1" */ -} MIME_PARAM; +}; -DEFINE_STACK_OF(MIME_PARAM) - -typedef struct { +struct mime_header_st { char *name; /* Name of line e.g. "content-type" */ char *value; /* Value of line e.g. "text/plain" */ STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */ -} MIME_HEADER; - -DEFINE_STACK_OF(MIME_HEADER) +}; static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, const ASN1_ITEM *it); diff --git a/crypto/evp/evp_locl.h b/crypto/evp/evp_locl.h index 89ac37ed63..1c879b4624 100644 --- a/crypto/evp/evp_locl.h +++ b/crypto/evp/evp_locl.h @@ -295,3 +295,6 @@ struct evp_Encode_Ctx_st { int line_num; int expect_nl; }; + +typedef struct evp_pbe_st EVP_PBE_CTL; +DEFINE_STACK_OF(EVP_PBE_CTL) diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index 731ae91a7a..da7c7d335f 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -68,15 +68,14 @@ /* Setup a cipher context from a PBE algorithm */ -typedef struct { +struct evp_pbe_st { int pbe_type; int pbe_nid; int cipher_nid; int md_nid; EVP_PBE_KEYGEN *keygen; -} EVP_PBE_CTL; +}; -DEFINE_STACK_OF(EVP_PBE_CTL) static STACK_OF(EVP_PBE_CTL) *pbe_algs; static const EVP_PBE_CTL builtin_pbe[] = { diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index aaba42aa1f..f5d558feca 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -69,7 +69,6 @@ typedef int sk_cmp_fn_type(const char *const *a, const char *const *b); -DEFINE_CONST_STACK_OF(EVP_PKEY_METHOD) static STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL; static const EVP_PKEY_METHOD *standard_methods[] = { diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 76e4b3b6a2..fcdc83f9d1 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -111,21 +111,17 @@ #include "internal/cryptlib.h" #include <openssl/lhash.h> - - /* * Each structure type (sometimes called a class), that supports * exdata has a stack of callbacks for each instance. */ -typedef struct ex_callback_st { +struct ex_callback_st { long argl; /* Arbitary long */ void *argp; /* Arbitary void * */ CRYPTO_EX_new *new_func; CRYPTO_EX_free *free_func; CRYPTO_EX_dup *dup_func; -} EX_CALLBACK; - -DEFINE_STACK_OF(EX_CALLBACK) +}; /* * The state for each class. This could just be a typedef, but diff --git a/crypto/include/internal/asn1_int.h b/crypto/include/internal/asn1_int.h index 966f3aa8c6..c227224e59 100644 --- a/crypto/include/internal/asn1_int.h +++ b/crypto/include/internal/asn1_int.h @@ -104,6 +104,8 @@ struct evp_pkey_asn1_method_st { ASN1_BIT_STRING *sig); } /* EVP_PKEY_ASN1_METHOD */ ; +DEFINE_CONST_STACK_OF(EVP_PKEY_ASN1_METHOD) + extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth; extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth; diff --git a/crypto/include/internal/cryptlib.h b/crypto/include/internal/cryptlib.h index d7018b61e7..1265a042f2 100644 --- a/crypto/include/internal/cryptlib.h +++ b/crypto/include/internal/cryptlib.h @@ -79,6 +79,13 @@ extern "C" { #endif +typedef struct ex_callback_st EX_CALLBACK; + +DEFINE_STACK_OF(EX_CALLBACK) + +DEFINE_STACK_OF(CRYPTO_dynlock) + + # ifndef OPENSSL_SYS_VMS # define X509_CERT_AREA OPENSSLDIR # define X509_CERT_DIR OPENSSLDIR "/certs" diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h index 4372d4bae0..831d9684ad 100644 --- a/crypto/include/internal/evp_int.h +++ b/crypto/include/internal/evp_int.h @@ -120,6 +120,8 @@ struct evp_pkey_method_st { int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value); } /* EVP_PKEY_METHOD */ ; +DEFINE_CONST_STACK_OF(EVP_PKEY_METHOD) + void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); extern const EVP_PKEY_METHOD cmac_pkey_meth; diff --git a/crypto/lock.c b/crypto/lock.c index ec01a815ba..12210da96b 100644 --- a/crypto/lock.c +++ b/crypto/lock.c @@ -121,8 +121,6 @@ static double OpenSSL_MSVC5_hack = 0.0; /* and for VC1.5 */ #endif -DEFINE_STACK_OF(CRYPTO_dynlock) - /* real #defines in crypto.h, keep these upto date */ static const char *const lock_names[CRYPTO_NUM_LOCKS] = { "<<ERROR>>", diff --git a/crypto/objects/Makefile b/crypto/objects/Makefile index 7bc0aac3cf..d6ccb8a235 100644 --- a/crypto/objects/Makefile +++ b/crypto/objects/Makefile @@ -21,7 +21,7 @@ LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o SRC= $(LIBSRC) -HEADER= obj_dat.h obj_xref.h +HEADER= obj_dat.h obj_xref.h o_names.h ALL= $(GENERAL) $(SRC) $(HEADER) diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 0839feeee6..aa9b400ef8 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -7,6 +7,7 @@ #include <openssl/objects.h> #include <openssl/safestack.h> #include <openssl/e_os2.h> +#include "o_names.h" /* * Later versions of DEC C has started to add lnkage information to certain @@ -28,13 +29,11 @@ DECLARE_LHASH_OF(OBJ_NAME); static LHASH_OF(OBJ_NAME) *names_lh = NULL; static int names_type_num = OBJ_NAME_TYPE_NUM; -typedef struct name_funcs_st { +struct name_funcs_st { unsigned long (*hash_func) (const char *name); int (*cmp_func) (const char *a, const char *b); void (*free_func) (const char *, int, const char *); -} NAME_FUNCS; - -DEFINE_STACK_OF(NAME_FUNCS) +}; static STACK_OF(NAME_FUNCS) *name_funcs_stack; diff --git a/crypto/objects/o_names.h b/crypto/objects/o_names.h new file mode 100644 index 0000000000..914ed33086 --- /dev/null +++ b/crypto/objects/o_names.h @@ -0,0 +1,4 @@ + + +typedef struct name_funcs_st NAME_FUNCS; +DEFINE_STACK_OF(NAME_FUNCS) diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index 15426fe342..62ff882125 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -61,8 +61,6 @@ #include "obj_xref.h" #include "e_os.h" -DEFINE_STACK_OF(nid_triple) - static STACK_OF(nid_triple) *sig_app, *sigx_app; static int sig_cmp(const nid_triple *a, const nid_triple *b) diff --git a/crypto/objects/obj_xref.h b/crypto/objects/obj_xref.h index c07adee4f2..7096ca5442 100644 --- a/crypto/objects/obj_xref.h +++ b/crypto/objects/obj_xref.h @@ -6,6 +6,8 @@ typedef struct { int pkey_id; } nid_triple; +DEFINE_STACK_OF(nid_triple) + static const nid_triple sigoid_srt[] = { {NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption}, {NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption}, diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl index a1900cab5c..05b987ad16 100644 --- a/crypto/objects/objxref.pl +++ b/crypto/objects/objxref.pl @@ -68,6 +68,8 @@ typedef struct { int pkey_id; } nid_triple; +DEFINE_STACK_OF(nid_triple) + static const nid_triple sigoid_srt[] = { EOF diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 7e49daadfd..717d258c34 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -73,26 +73,24 @@ #include <openssl/lhash.h> #include <openssl/x509.h> #include "internal/x509_int.h" +#include "x509_lcl.h" -typedef struct lookup_dir_hashes_st { +struct lookup_dir_hashes_st { unsigned long hash; int suffix; -} BY_DIR_HASH; +}; -typedef struct lookup_dir_entry_st { +struct lookup_dir_entry_st { char *dir; int dir_type; STACK_OF(BY_DIR_HASH) *hashes; -} BY_DIR_ENTRY; +}; typedef struct lookup_dir_st { BUF_MEM *buffer; STACK_OF(BY_DIR_ENTRY) *dirs; } BY_DIR; -DEFINE_STACK_OF(BY_DIR_HASH) -DEFINE_STACK_OF(BY_DIR_ENTRY) - static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **ret); static int new_dir(X509_LOOKUP *lu); diff --git a/crypto/x509/x509_lcl.h b/crypto/x509/x509_lcl.h index e5c05ed252..724c241e69 100644 --- a/crypto/x509/x509_lcl.h +++ b/crypto/x509/x509_lcl.h @@ -113,3 +113,10 @@ struct x509_crl_method_st { ASN1_INTEGER *ser, X509_NAME *issuer); int (*crl_verify) (X509_CRL *crl, EVP_PKEY *pk); }; + +typedef struct lookup_dir_hashes_st BY_DIR_HASH; +typedef struct lookup_dir_entry_st BY_DIR_ENTRY; +DEFINE_STACK_OF(BY_DIR_HASH) +DEFINE_STACK_OF(BY_DIR_ENTRY) +typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; +DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c index c12b248f3a..f151da4b9a 100644 --- a/crypto/x509/x_name.c +++ b/crypto/x509/x_name.c @@ -63,9 +63,7 @@ #include <openssl/x509.h> #include "internal/x509_int.h" #include "internal/asn1_int.h" - -typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; -DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) +#include "x509_lcl.h" static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, |