[openssl-commits] [openssl] master update

Ben Laurie ben at openssl.org
Fri Sep 11 03:56:31 UTC 2015


The branch master has been updated
       via  df2ee0e27d2db02660c1d15fe6a3e38be9df0a60 (commit)
      from  4c7103a5eee1dc472e256ac8818610c6e98a9a39 (commit)


- Log -----------------------------------------------------------------
commit df2ee0e27d2db02660c1d15fe6a3e38be9df0a60
Author: Ben Laurie <ben at links.org>
Date:   Sat Sep 5 13:32:58 2015 +0100

    Enable -Wmissing-variable-declarations and
    -Wincompatible-pointer-types-discards-qualifiers (the latter did not require
    any code changes).
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configure                          |   5 +-
 apps/apps.h                        |   6 +
 apps/cms.c                         |   2 +-
 apps/ecparam.c                     |   4 +-
 apps/openssl.c                     |   2 +-
 apps/progs.h                       |   5 +-
 apps/progs.pl                      |   6 +-
 apps/s_cb.c                        |   4 +-
 apps/s_client.c                    |   2 +-
 apps/s_server.c                    |  10 +-
 apps/speed.c                       |   2 +-
 crypto/asn1/ameth_lib.c            |   8 --
 crypto/asn1/evp_asn1.c             |   2 +-
 crypto/asn1/n_pkey.c               |   4 +-
 crypto/asn1/p5_scrypt.c            |   2 +-
 crypto/asn1/tasn_prn.c             |   2 +-
 crypto/bn/Makefile                 |   8 +-
 crypto/bn/bn_dh.c                  |   1 +
 crypto/bn/bn_srp.c                 |   2 +
 crypto/cms/cms_asn1.c              |  28 ++---
 crypto/cms/cms_dd.c                |   2 -
 crypto/cms/cms_enc.c               |   2 -
 crypto/cms/cms_env.c               |   5 -
 crypto/cms/cms_ess.c               |   3 -
 crypto/cms/cms_kari.c              |   5 -
 crypto/cms/cms_lcl.h               |  16 +++
 crypto/cms/cms_lib.c               |   2 -
 crypto/cms/cms_sd.c                |   2 -
 crypto/dh/dh_ameth.c               |   2 -
 crypto/dh/dh_asn1.c                |   6 +-
 crypto/dh/dh_rfc5114.c             |   9 --
 crypto/dsa/dsa_asn1.c              |   8 +-
 crypto/ec/ec_asn1.c                |  14 +--
 crypto/ecdsa/ecs_asn1.c            |   2 +-
 crypto/engine/Makefile             |  15 +--
 crypto/engine/eng_cryptodev.c      |  16 +--
 crypto/evp/Makefile                |  23 ++--
 crypto/evp/pmeth_lib.c             |  13 ++-
 crypto/include/internal/asn1_int.h |   8 ++
 crypto/ocsp/Makefile               |   2 +-
 crypto/ocsp/v3_ocsp.c              |   1 +
 crypto/sec_mem.c                   |   2 +-
 crypto/ts/ts_asn1.c                |  18 +--
 crypto/x509/by_dir.c               |   2 +-
 crypto/x509/by_file.c              |   2 +-
 crypto/x509/x_name.c               |   6 +-
 crypto/x509v3/Makefile             |  42 +++----
 crypto/x509v3/ext_dat.h            |  24 ++--
 crypto/x509v3/v3_addr.c            |   3 +-
 crypto/x509v3/v3_akey.c            |   1 +
 crypto/x509v3/v3_alt.c             |   1 +
 crypto/x509v3/v3_asid.c            |   1 +
 crypto/x509v3/v3_bcons.c           |   1 +
 crypto/x509v3/v3_bitst.c           |   1 +
 crypto/x509v3/v3_cpols.c           |   1 +
 crypto/x509v3/v3_crld.c            |   1 +
 crypto/x509v3/v3_enum.c            |   1 +
 crypto/x509v3/v3_extku.c           |   1 +
 crypto/x509v3/v3_ia5.c             |   1 +
 crypto/x509v3/v3_info.c            |   1 +
 crypto/x509v3/v3_int.c             |   1 +
 crypto/x509v3/v3_ncons.c           |   1 +
 crypto/x509v3/v3_pci.c             |   1 +
 crypto/x509v3/v3_pcons.c           |   1 +
 crypto/x509v3/v3_pku.c             |   1 +
 crypto/x509v3/v3_pmaps.c           |   1 +
 crypto/x509v3/v3_scts.c            |   1 +
 crypto/x509v3/v3_skey.c            |   1 +
 crypto/x509v3/v3_sxnet.c           |   1 +
 include/openssl/asn1t.h            |  71 +++++++++++-
 include/openssl/cmac.h             |   2 +
 include/openssl/dh.h               |  14 +++
 include/openssl/dsa.h              |   2 +
 include/openssl/ec.h               |   2 +
 include/openssl/hmac.h             |   2 +
 include/openssl/rsa.h              |   2 +
 include/openssl/ssl.h              |   2 +
 ssl/Makefile                       | 224 +++++++++++++++++++------------------
 ssl/ssl_asn1.c                     |   2 +-
 ssl/ssl_lib.c                      |   2 +-
 test/Makefile                      |   6 +-
 test/bntest.c                      |   6 +-
 test/ecdsatest.c                   |   4 +-
 test/gost2814789test.c             |   2 +-
 test/ideatest.c                    |  22 ++--
 test/sha256t.c                     |  12 +-
 test/sha512t.c                     |  12 +-
 test/ssltest.c                     |  26 ++---
 test/wp_test.c                     |  18 +--
 89 files changed, 467 insertions(+), 346 deletions(-)

diff --git a/Configure b/Configure
index 2fc1e59..d7b8190 100755
--- a/Configure
+++ b/Configure
@@ -103,11 +103,10 @@ my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare
 # TODO(openssl-team): fix problems and investigate if (at least) the
 # following warnings can also be enabled:
 # -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers,
-# -Wmissing-variable-declarations,
-# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
+# -Wcast-align,
 # -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
 # -Wextended-offsetof
-my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Qunused-arguments";
+my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Qunused-arguments -Wincompatible-pointer-types-discards-qualifiers -Wmissing-variable-declarations";
 
 my $strict_warnings = 0;
 
diff --git a/apps/apps.h b/apps/apps.h
index 0901c7d..328f8fb 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -573,6 +573,12 @@ int raw_write_stdout(const void *, int);
 # define TM_STOP         1
 double app_tminterval(int stop, int usertime);
 
+/* this is an accident waiting to happen (-Wshadow is your friend) */
+extern int verify_depth;
+extern int verify_quiet;
+extern int verify_error;
+extern int verify_return_error;
+
 # include "progs.h"
 
 #endif
diff --git a/apps/cms.c b/apps/cms.c
index 2331ea2..ae47341 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -95,7 +95,7 @@ static int cms_set_pkey_param(EVP_PKEY_CTX *pctx,
 # define SMIME_SIGN_RECEIPT      (15 | SMIME_IP | SMIME_OP)
 # define SMIME_VERIFY_RECEIPT    (16 | SMIME_IP)
 
-int verify_err = 0;
+static int verify_err = 0;
 
 typedef struct cms_key_param_st cms_key_param;
 
diff --git a/apps/ecparam.c b/apps/ecparam.c
index 145f55c..5a98f45 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -116,14 +116,14 @@ OPTIONS ecparam_options[] = {
     {NULL}
 };
 
-OPT_PAIR forms[] = {
+static OPT_PAIR forms[] = {
     {"compressed", POINT_CONVERSION_COMPRESSED},
     {"uncompressed", POINT_CONVERSION_UNCOMPRESSED},
     {"hybrid", POINT_CONVERSION_HYBRID},
     {NULL}
 };
 
-OPT_PAIR encodings[] = {
+static OPT_PAIR encodings[] = {
     {"named_curve", OPENSSL_EC_NAMED_CURVE},
     {"explicit", 0},
     {NULL}
diff --git a/apps/openssl.c b/apps/openssl.c
index 39ae64d..58a2d0f 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -160,7 +160,7 @@ static void list_pkey(void);
 static void list_type(FUNC_TYPE ft);
 char *default_config_file = NULL;
 
-CONF *config = NULL;
+static CONF *config = NULL;
 BIO *bio_in = NULL;
 BIO *bio_out = NULL;
 BIO *bio_err = NULL;
diff --git a/apps/progs.h b/apps/progs.h
index 4b9bcb4..4a59b64 100644
--- a/apps/progs.h
+++ b/apps/progs.h
@@ -65,7 +65,6 @@ extern int list_main(int argc, char *argv[]);
 extern int help_main(int argc, char *argv[]);
 extern int exit_main(int argc, char *argv[]);
 
-#ifdef INCLUDE_FUNCTION_TABLE
 extern OPTIONS asn1parse_options[];
 extern OPTIONS ca_options[];
 extern OPTIONS ciphers_options[];
@@ -114,7 +113,9 @@ extern OPTIONS rehash_options[];
 extern OPTIONS list_options[];
 extern OPTIONS help_options[];
 extern OPTIONS exit_options[];
-FUNCTION functions[] = {
+
+#ifdef INCLUDE_FUNCTION_TABLE
+static FUNCTION functions[] = {
     { FT_general, "asn1parse", asn1parse_main, asn1parse_options },
     { FT_general, "ca", ca_main, ca_options },
 #if !defined(OPENSSL_NO_SOCK)
diff --git a/apps/progs.pl b/apps/progs.pl
index 38e091e..065d954 100644
--- a/apps/progs.pl
+++ b/apps/progs.pl
@@ -33,11 +33,13 @@ foreach (@ARGV) {
 	printf "extern int %s_main(int argc, char *argv[]);\n", $_;
 }
 
-printf "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
+print "\n";
+
 foreach (@ARGV) {
 	printf "extern OPTIONS %s_options[];\n", $_;
 }
-printf "FUNCTION functions[] = {\n";
+print "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
+print "static FUNCTION functions[] = {\n";
 foreach (@ARGV) {
 	$str="    { FT_general, \"$_\", ${_}_main, ${_}_options },\n";
 	if (/^s_/ || /^ciphers$/) {
diff --git a/apps/s_cb.c b/apps/s_cb.c
index a1305d3..0c1dfc5 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -131,8 +131,8 @@ int verify_depth = 0;
 int verify_quiet = 0;
 int verify_error = X509_V_OK;
 int verify_return_error = 0;
-unsigned char cookie_secret[COOKIE_SECRET_LENGTH];
-int cookie_initialized = 0;
+static unsigned char cookie_secret[COOKIE_SECRET_LENGTH];
+static int cookie_initialized = 0;
 
 static const char *lookup(int val, const STRINT_PAIR* list, const char* def)
 {
diff --git a/apps/s_client.c b/apps/s_client.c
index 3eb495a..65e3bb8 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -395,7 +395,7 @@ static char *ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
 
 #endif
 
-char *srtp_profiles = NULL;
+static char *srtp_profiles = NULL;
 
 #ifndef OPENSSL_NO_NEXTPROTONEG
 /* This the context that we pass to next_proto_cb */
diff --git a/apps/s_server.c b/apps/s_server.c
index 8fe1ebe..9e4a186 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -232,7 +232,7 @@ static char *s_dcert_file = NULL, *s_dkey_file = NULL, *s_dchain_file = NULL;
 static int s_nbio = 0;
 #endif
 static int s_nbio_test = 0;
-int s_crlf = 0;
+static int s_crlf = 0;
 static SSL_CTX *ctx = NULL;
 static SSL_CTX *ctx2 = NULL;
 static int www = 0;
@@ -2366,7 +2366,7 @@ static int init_ssl_connection(SSL *con)
     int i;
     const char *str;
     X509 *peer;
-    long verify_error;
+    long verify_err;
     char buf[BUFSIZ];
 #if !defined(OPENSSL_NO_NEXTPROTONEG)
     const unsigned char *next_proto_neg;
@@ -2409,10 +2409,10 @@ static int init_ssl_connection(SSL *con)
 
         BIO_printf(bio_err, "ERROR\n");
 
-        verify_error = SSL_get_verify_result(con);
-        if (verify_error != X509_V_OK) {
+        verify_err = SSL_get_verify_result(con);
+        if (verify_err != X509_V_OK) {
             BIO_printf(bio_err, "verify error:%s\n",
-                       X509_verify_cert_error_string(verify_error));
+                       X509_verify_cert_error_string(verify_err));
         }
         /* Always print any error messages */
         ERR_print_errors(bio_err);
diff --git a/apps/speed.c b/apps/speed.c
index 297ea52..1508076 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -405,7 +405,7 @@ OPTIONS speed_options[] = {
 #define D_IGE_192_AES   27
 #define D_IGE_256_AES   28
 #define D_GHASH         29
-OPT_PAIR doit_choices[] = {
+static OPT_PAIR doit_choices[] = {
 #ifndef OPENSSL_NO_MD2
     {"md2", D_MD2},
 #endif
diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c
index feef015..2deb679 100644
--- a/crypto/asn1/ameth_lib.c
+++ b/crypto/asn1/ameth_lib.c
@@ -65,14 +65,6 @@
 #endif
 #include "internal/asn1_int.h"
 
-extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[];
-extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[];
-extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
-
 /* Keep this sorted in type order !! */
 static const EVP_PKEY_ASN1_METHOD *standard_methods[] = {
 #ifndef OPENSSL_NO_RSA
diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c
index 4c3f3e0..b7e5620 100644
--- a/crypto/asn1/evp_asn1.c
+++ b/crypto/asn1/evp_asn1.c
@@ -103,7 +103,7 @@ typedef struct {
 ASN1_SEQUENCE(asn1_int_oct) = {
         ASN1_SIMPLE(asn1_int_oct, num, LONG),
         ASN1_SIMPLE(asn1_int_oct, oct, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(asn1_int_oct)
+} static_ASN1_SEQUENCE_END(asn1_int_oct)
 
 DECLARE_ASN1_ITEM(asn1_int_oct)
 
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
index 0c9c4c4..c42422c 100644
--- a/crypto/asn1/n_pkey.c
+++ b/crypto/asn1/n_pkey.c
@@ -86,7 +86,7 @@ typedef struct netscape_encrypted_pkey_st {
 ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = {
         ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, os, ASN1_OCTET_STRING),
         ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG)
-} ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
+} static_ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
 
 DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY,NETSCAPE_ENCRYPTED_PKEY)
@@ -96,7 +96,7 @@ ASN1_SEQUENCE(NETSCAPE_PKEY) = {
         ASN1_SIMPLE(NETSCAPE_PKEY, version, LONG),
         ASN1_SIMPLE(NETSCAPE_PKEY, algor, X509_ALGOR),
         ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(NETSCAPE_PKEY)
+} static_ASN1_SEQUENCE_END(NETSCAPE_PKEY)
 
 DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY)
diff --git a/crypto/asn1/p5_scrypt.c b/crypto/asn1/p5_scrypt.c
index 35ff396..3667546 100644
--- a/crypto/asn1/p5_scrypt.c
+++ b/crypto/asn1/p5_scrypt.c
@@ -82,7 +82,7 @@ ASN1_SEQUENCE(SCRYPT_PARAMS) = {
         ASN1_SIMPLE(SCRYPT_PARAMS, blockSize, ASN1_INTEGER),
         ASN1_SIMPLE(SCRYPT_PARAMS, parallelizationParameter, ASN1_INTEGER),
         ASN1_OPT(SCRYPT_PARAMS, keyLength, ASN1_INTEGER),
-} ASN1_SEQUENCE_END(SCRYPT_PARAMS)
+} static_ASN1_SEQUENCE_END(SCRYPT_PARAMS)
 
 DECLARE_ASN1_ALLOC_FUNCTIONS(SCRYPT_PARAMS)
 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(SCRYPT_PARAMS)
diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c
index 5314c61..329ef94 100644
--- a/crypto/asn1/tasn_prn.c
+++ b/crypto/asn1/tasn_prn.c
@@ -74,7 +74,7 @@
 
 /* ASN1_PCTX routines */
 
-ASN1_PCTX default_pctx = {
+static ASN1_PCTX default_pctx = {
     ASN1_PCTX_FLAGS_SHOW_ABSENT, /* flags */
     0,                          /* nm_flags */
     0,                          /* cert_flags */
diff --git a/crypto/bn/Makefile b/crypto/bn/Makefile
index 7d55778..5d05e1b 100644
--- a/crypto/bn/Makefile
+++ b/crypto/bn/Makefile
@@ -219,7 +219,8 @@ bn_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
 bn_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 bn_depr.o: ../include/internal/bn_int.h ../include/internal/cryptlib.h
 bn_depr.o: bn_depr.c bn_lcl.h
-bn_dh.o: ../../e_os.h ../../include/openssl/bn.h ../../include/openssl/crypto.h
+bn_dh.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
+bn_dh.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 bn_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
 bn_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 bn_dh.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
@@ -399,8 +400,9 @@ bn_srp.o: ../../e_os.h ../../include/openssl/bn.h
 bn_srp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 bn_srp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 bn_srp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
-bn_srp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bn_srp.o: ../include/internal/bn_int.h bn_lcl.h bn_srp.c
+bn_srp.o: ../../include/openssl/srp.h ../../include/openssl/stack.h
+bn_srp.o: ../../include/openssl/symhacks.h ../include/internal/bn_int.h
+bn_srp.o: ../include/internal/bn_srp.h bn_lcl.h bn_srp.c
 bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
 bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
diff --git a/crypto/bn/bn_dh.c b/crypto/bn/bn_dh.c
index cfd8c06..3a7282f 100644
--- a/crypto/bn/bn_dh.c
+++ b/crypto/bn/bn_dh.c
@@ -56,6 +56,7 @@
  *
  */
 
+#include <openssl/dh.h>
 #include "bn_lcl.h"
 #include "e_os.h"
 
diff --git a/crypto/bn/bn_srp.c b/crypto/bn/bn_srp.c
index 5dd31fc..c575e6a 100644
--- a/crypto/bn/bn_srp.c
+++ b/crypto/bn/bn_srp.c
@@ -1,5 +1,7 @@
 #include "bn_lcl.h"
 #include "e_os.h"
+#include <openssl/srp.h>
+#include <internal/bn_srp.h>
 
 #ifndef OPENSSL_NO_SRP
 
diff --git a/crypto/cms/cms_asn1.c b/crypto/cms/cms_asn1.c
index 893ad46..2bd3954 100644
--- a/crypto/cms/cms_asn1.c
+++ b/crypto/cms/cms_asn1.c
@@ -67,7 +67,7 @@ ASN1_SEQUENCE(CMS_IssuerAndSerialNumber) = {
 ASN1_SEQUENCE(CMS_OtherCertificateFormat) = {
         ASN1_SIMPLE(CMS_OtherCertificateFormat, otherCertFormat, ASN1_OBJECT),
         ASN1_OPT(CMS_OtherCertificateFormat, otherCert, ASN1_ANY)
-} ASN1_SEQUENCE_END(CMS_OtherCertificateFormat)
+} static_ASN1_SEQUENCE_END(CMS_OtherCertificateFormat)
 
 ASN1_CHOICE(CMS_CertificateChoices) = {
         ASN1_SIMPLE(CMS_CertificateChoices, d.certificate, X509),
@@ -80,12 +80,12 @@ ASN1_CHOICE(CMS_CertificateChoices) = {
 ASN1_CHOICE(CMS_SignerIdentifier) = {
         ASN1_SIMPLE(CMS_SignerIdentifier, d.issuerAndSerialNumber, CMS_IssuerAndSerialNumber),
         ASN1_IMP(CMS_SignerIdentifier, d.subjectKeyIdentifier, ASN1_OCTET_STRING, 0)
-} ASN1_CHOICE_END(CMS_SignerIdentifier)
+} static_ASN1_CHOICE_END(CMS_SignerIdentifier)
 
 ASN1_NDEF_SEQUENCE(CMS_EncapsulatedContentInfo) = {
         ASN1_SIMPLE(CMS_EncapsulatedContentInfo, eContentType, ASN1_OBJECT),
         ASN1_NDEF_EXP_OPT(CMS_EncapsulatedContentInfo, eContent, ASN1_OCTET_STRING_NDEF, 0)
-} ASN1_NDEF_SEQUENCE_END(CMS_EncapsulatedContentInfo)
+} static_ASN1_NDEF_SEQUENCE_END(CMS_EncapsulatedContentInfo)
 
 /* Minor tweak to operation: free up signer key, cert */
 static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
@@ -114,7 +114,7 @@ ASN1_SEQUENCE_cb(CMS_SignerInfo, cms_si_cb) = {
 ASN1_SEQUENCE(CMS_OtherRevocationInfoFormat) = {
         ASN1_SIMPLE(CMS_OtherRevocationInfoFormat, otherRevInfoFormat, ASN1_OBJECT),
         ASN1_OPT(CMS_OtherRevocationInfoFormat, otherRevInfo, ASN1_ANY)
-} ASN1_SEQUENCE_END(CMS_OtherRevocationInfoFormat)
+} static_ASN1_SEQUENCE_END(CMS_OtherRevocationInfoFormat)
 
 ASN1_CHOICE(CMS_RevocationInfoChoice) = {
         ASN1_SIMPLE(CMS_RevocationInfoChoice, d.crl, X509_CRL),
@@ -133,13 +133,13 @@ ASN1_NDEF_SEQUENCE(CMS_SignedData) = {
 ASN1_SEQUENCE(CMS_OriginatorInfo) = {
         ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, certificates, CMS_CertificateChoices, 0),
         ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, crls, CMS_RevocationInfoChoice, 1)
-} ASN1_SEQUENCE_END(CMS_OriginatorInfo)
+} static_ASN1_SEQUENCE_END(CMS_OriginatorInfo)
 
 ASN1_NDEF_SEQUENCE(CMS_EncryptedContentInfo) = {
         ASN1_SIMPLE(CMS_EncryptedContentInfo, contentType, ASN1_OBJECT),
         ASN1_SIMPLE(CMS_EncryptedContentInfo, contentEncryptionAlgorithm, X509_ALGOR),
         ASN1_IMP_OPT(CMS_EncryptedContentInfo, encryptedContent, ASN1_OCTET_STRING_NDEF, 0)
-} ASN1_NDEF_SEQUENCE_END(CMS_EncryptedContentInfo)
+} static_ASN1_NDEF_SEQUENCE_END(CMS_EncryptedContentInfo)
 
 ASN1_SEQUENCE(CMS_KeyTransRecipientInfo) = {
         ASN1_SIMPLE(CMS_KeyTransRecipientInfo, version, LONG),
@@ -162,7 +162,7 @@ ASN1_SEQUENCE(CMS_RecipientKeyIdentifier) = {
 ASN1_CHOICE(CMS_KeyAgreeRecipientIdentifier) = {
   ASN1_SIMPLE(CMS_KeyAgreeRecipientIdentifier, d.issuerAndSerialNumber, CMS_IssuerAndSerialNumber),
   ASN1_IMP(CMS_KeyAgreeRecipientIdentifier, d.rKeyId, CMS_RecipientKeyIdentifier, 0)
-} ASN1_CHOICE_END(CMS_KeyAgreeRecipientIdentifier)
+} static_ASN1_CHOICE_END(CMS_KeyAgreeRecipientIdentifier)
 
 static int cms_rek_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                       void *exarg)
@@ -188,7 +188,7 @@ ASN1_CHOICE(CMS_OriginatorIdentifierOrKey) = {
   ASN1_SIMPLE(CMS_OriginatorIdentifierOrKey, d.issuerAndSerialNumber, CMS_IssuerAndSerialNumber),
   ASN1_IMP(CMS_OriginatorIdentifierOrKey, d.subjectKeyIdentifier, ASN1_OCTET_STRING, 0),
   ASN1_IMP(CMS_OriginatorIdentifierOrKey, d.originatorKey, CMS_OriginatorPublicKey, 1)
-} ASN1_CHOICE_END(CMS_OriginatorIdentifierOrKey)
+} static_ASN1_CHOICE_END(CMS_OriginatorIdentifierOrKey)
 
 static int cms_kari_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                        void *exarg)
@@ -217,7 +217,7 @@ ASN1_SEQUENCE(CMS_KEKIdentifier) = {
         ASN1_SIMPLE(CMS_KEKIdentifier, keyIdentifier, ASN1_OCTET_STRING),
         ASN1_OPT(CMS_KEKIdentifier, date, ASN1_GENERALIZEDTIME),
         ASN1_OPT(CMS_KEKIdentifier, other, CMS_OtherKeyAttribute)
-} ASN1_SEQUENCE_END(CMS_KEKIdentifier)
+} static_ASN1_SEQUENCE_END(CMS_KEKIdentifier)
 
 ASN1_SEQUENCE(CMS_KEKRecipientInfo) = {
         ASN1_SIMPLE(CMS_KEKRecipientInfo, version, LONG),
@@ -236,7 +236,7 @@ ASN1_SEQUENCE(CMS_PasswordRecipientInfo) = {
 ASN1_SEQUENCE(CMS_OtherRecipientInfo) = {
   ASN1_SIMPLE(CMS_OtherRecipientInfo, oriType, ASN1_OBJECT),
   ASN1_OPT(CMS_OtherRecipientInfo, oriValue, ASN1_ANY)
-} ASN1_SEQUENCE_END(CMS_OtherRecipientInfo)
+} static_ASN1_SEQUENCE_END(CMS_OtherRecipientInfo)
 
 /* Free up RecipientInfo additional data */
 static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
@@ -299,13 +299,13 @@ ASN1_NDEF_SEQUENCE(CMS_AuthenticatedData) = {
         ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, authAttrs, X509_ALGOR, 2),
         ASN1_SIMPLE(CMS_AuthenticatedData, mac, ASN1_OCTET_STRING),
         ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, unauthAttrs, X509_ALGOR, 3)
-} ASN1_NDEF_SEQUENCE_END(CMS_AuthenticatedData)
+} static_ASN1_NDEF_SEQUENCE_END(CMS_AuthenticatedData)
 
 ASN1_NDEF_SEQUENCE(CMS_CompressedData) = {
         ASN1_SIMPLE(CMS_CompressedData, version, LONG),
         ASN1_SIMPLE(CMS_CompressedData, compressionAlgorithm, X509_ALGOR),
         ASN1_SIMPLE(CMS_CompressedData, encapContentInfo, CMS_EncapsulatedContentInfo),
-} ASN1_NDEF_SEQUENCE_END(CMS_CompressedData)
+} static_ASN1_NDEF_SEQUENCE_END(CMS_CompressedData)
 
 /* This is the ANY DEFINED BY table for the top level ContentInfo structure */
 
@@ -383,7 +383,7 @@ ASN1_ITEM_TEMPLATE_END(CMS_Attributes_Verify)
 ASN1_CHOICE(CMS_ReceiptsFrom) = {
   ASN1_IMP(CMS_ReceiptsFrom, d.allOrFirstTier, LONG, 0),
   ASN1_IMP_SEQUENCE_OF(CMS_ReceiptsFrom, d.receiptList, GENERAL_NAMES, 1)
-} ASN1_CHOICE_END(CMS_ReceiptsFrom)
+} static_ASN1_CHOICE_END(CMS_ReceiptsFrom)
 
 ASN1_SEQUENCE(CMS_ReceiptRequest) = {
   ASN1_SIMPLE(CMS_ReceiptRequest, signedContentIdentifier, ASN1_OCTET_STRING),
@@ -413,7 +413,7 @@ ASN1_SEQUENCE(CMS_SharedInfo) = {
   ASN1_SIMPLE(CMS_SharedInfo, keyInfo, X509_ALGOR),
   ASN1_EXP_OPT(CMS_SharedInfo, entityUInfo, ASN1_OCTET_STRING, 0),
   ASN1_EXP_OPT(CMS_SharedInfo, suppPubInfo, ASN1_OCTET_STRING, 2),
-} ASN1_SEQUENCE_END(CMS_SharedInfo)
+} static_ASN1_SEQUENCE_END(CMS_SharedInfo)
 
 int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
                           ASN1_OCTET_STRING *ukm, int keylen)
diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c
index d406785..7609b6f 100644
--- a/crypto/cms/cms_dd.c
+++ b/crypto/cms/cms_dd.c
@@ -60,8 +60,6 @@
 #include <openssl/cms.h>
 #include "cms_lcl.h"
 
-DECLARE_ASN1_ITEM(CMS_DigestedData)
-
 /* CMS DigestedData Utilities */
 
 CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md)
diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c
index 16b4225..fc66f60 100644
--- a/crypto/cms/cms_enc.c
+++ b/crypto/cms/cms_enc.c
@@ -63,8 +63,6 @@
 
 /* CMS EncryptedData Utilities */
 
-DECLARE_ASN1_ITEM(CMS_EncryptedData)
-
 /* Return BIO based on EncryptedContentInfo and key */
 
 BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c
index f677a9b..e133bcc 100644
--- a/crypto/cms/cms_env.c
+++ b/crypto/cms/cms_env.c
@@ -65,11 +65,6 @@
 
 /* CMS EnvelopedData Utilities */
 
-DECLARE_ASN1_ITEM(CMS_EnvelopedData)
-DECLARE_ASN1_ITEM(CMS_KeyTransRecipientInfo)
-DECLARE_ASN1_ITEM(CMS_KEKRecipientInfo)
-DECLARE_ASN1_ITEM(CMS_OtherKeyAttribute)
-
 DECLARE_STACK_OF(CMS_RecipientInfo)
 
 CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms)
diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c
index d75ea16..2149749 100644
--- a/crypto/cms/cms_ess.c
+++ b/crypto/cms/cms_ess.c
@@ -61,9 +61,6 @@
 #include <openssl/cms.h>
 #include "cms_lcl.h"
 
-DECLARE_ASN1_ITEM(CMS_ReceiptRequest)
-DECLARE_ASN1_ITEM(CMS_Receipt)
-
 IMPLEMENT_ASN1_FUNCTIONS(CMS_ReceiptRequest)
 
 /* ESS services: for now just Signed Receipt related */
diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c
index d56dd9b..77181bc 100644
--- a/crypto/cms/cms_kari.c
+++ b/crypto/cms/cms_kari.c
@@ -63,11 +63,6 @@
 #include "cms_lcl.h"
 #include "internal/asn1_int.h"
 
-DECLARE_ASN1_ITEM(CMS_KeyAgreeRecipientInfo)
-DECLARE_ASN1_ITEM(CMS_RecipientEncryptedKey)
-DECLARE_ASN1_ITEM(CMS_OriginatorPublicKey)
-DECLARE_ASN1_ITEM(CMS_RecipientKeyIdentifier)
-
 /* Key Agreement Recipient Info (KARI) routines */
 
 int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
diff --git a/crypto/cms/cms_lcl.h b/crypto/cms/cms_lcl.h
index 1f27b0c..5b0551c 100644
--- a/crypto/cms/cms_lcl.h
+++ b/crypto/cms/cms_lcl.h
@@ -464,6 +464,22 @@ int cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms,
 int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
                                  int en_de);
 
+DECLARE_ASN1_ITEM(CMS_CertificateChoices)
+DECLARE_ASN1_ITEM(CMS_DigestedData)
+DECLARE_ASN1_ITEM(CMS_EncryptedData)
+DECLARE_ASN1_ITEM(CMS_EnvelopedData)
+DECLARE_ASN1_ITEM(CMS_KEKRecipientInfo)
+DECLARE_ASN1_ITEM(CMS_KeyAgreeRecipientInfo)
+DECLARE_ASN1_ITEM(CMS_KeyTransRecipientInfo)
+DECLARE_ASN1_ITEM(CMS_OriginatorPublicKey)
+DECLARE_ASN1_ITEM(CMS_OtherKeyAttribute)
+DECLARE_ASN1_ITEM(CMS_Receipt)
+DECLARE_ASN1_ITEM(CMS_ReceiptRequest)
+DECLARE_ASN1_ITEM(CMS_RecipientEncryptedKey)
+DECLARE_ASN1_ITEM(CMS_RecipientKeyIdentifier)
+DECLARE_ASN1_ITEM(CMS_RevocationInfoChoice)
+DECLARE_ASN1_ITEM(CMS_SignedData)
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 0bfad69..ef18418 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -64,8 +64,6 @@
 IMPLEMENT_ASN1_FUNCTIONS(CMS_ContentInfo)
 IMPLEMENT_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
 
-DECLARE_ASN1_ITEM(CMS_CertificateChoices)
-DECLARE_ASN1_ITEM(CMS_RevocationInfoChoice)
 DECLARE_STACK_OF(CMS_CertificateChoices)
 DECLARE_STACK_OF(CMS_RevocationInfoChoice)
 
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 338e515..8fc407e 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -64,8 +64,6 @@
 
 /* CMS SignedData Utilities */
 
-DECLARE_ASN1_ITEM(CMS_SignedData)
-
 static CMS_SignedData *cms_get0_signed(CMS_ContentInfo *cms)
 {
     if (OBJ_obj2nid(cms->contentType) != NID_pkcs7_signed) {
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index efb3d80..f0fcd83 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -67,8 +67,6 @@
 # include <openssl/cms.h>
 #endif
 
-extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth;
-
 /*
  * i2d/d2i like DH parameter functions which use the appropriate routine for
  * PKCS#3 DH or X9.42 DH.
diff --git a/crypto/dh/dh_asn1.c b/crypto/dh/dh_asn1.c
index 0c6a1de..cc307dc 100644
--- a/crypto/dh/dh_asn1.c
+++ b/crypto/dh/dh_asn1.c
@@ -85,7 +85,7 @@ ASN1_SEQUENCE_cb(DHparams, dh_cb) = {
         ASN1_SIMPLE(DH, p, BIGNUM),
         ASN1_SIMPLE(DH, g, BIGNUM),
         ASN1_OPT(DH, length, ZLONG),
-} ASN1_SEQUENCE_END_cb(DH, DHparams)
+} static_ASN1_SEQUENCE_END_cb(DH, DHparams)
 
 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams)
 
@@ -110,7 +110,7 @@ typedef struct {
 ASN1_SEQUENCE(DHvparams) = {
         ASN1_SIMPLE(int_dhvparams, seed, ASN1_BIT_STRING),
         ASN1_SIMPLE(int_dhvparams, counter, BIGNUM)
-} ASN1_SEQUENCE_END_name(int_dhvparams, DHvparams)
+} static_ASN1_SEQUENCE_END_name(int_dhvparams, DHvparams)
 
 ASN1_SEQUENCE(DHxparams) = {
         ASN1_SIMPLE(int_dhx942_dh, p, BIGNUM),
@@ -118,7 +118,7 @@ ASN1_SEQUENCE(DHxparams) = {
         ASN1_SIMPLE(int_dhx942_dh, q, BIGNUM),
         ASN1_OPT(int_dhx942_dh, j, BIGNUM),
         ASN1_OPT(int_dhx942_dh, vparams, DHvparams),
-} ASN1_SEQUENCE_END_name(int_dhx942_dh, DHxparams)
+} static_ASN1_SEQUENCE_END_name(int_dhx942_dh, DHxparams)
 
 int_dhx942_dh *d2i_int_dhx(int_dhx942_dh **a,
                            const unsigned char **pp, long length);
diff --git a/crypto/dh/dh_rfc5114.c b/crypto/dh/dh_rfc5114.c
index 752bf2c..61cd9ad 100644
--- a/crypto/dh/dh_rfc5114.c
+++ b/crypto/dh/dh_rfc5114.c
@@ -61,11 +61,6 @@
 #include <openssl/dh.h>
 #include <openssl/bn.h>
 
-#define make_dh_bn(x) \
-        const extern BIGNUM _bignum_dh##x##_p;\
-        const extern BIGNUM _bignum_dh##x##_g;\
-        const extern BIGNUM _bignum_dh##x##_q;
-
 /*
  * Macro to make a DH structure from BIGNUM data. NB: although just copying
  * the BIGNUM static pointers would be more efficient we can't as they get
@@ -90,10 +85,6 @@ DH * DH_get_##x(void) \
         return dh; \
         }
 
-make_dh_bn(1024_160)
-make_dh_bn(2048_224)
-make_dh_bn(2048_256)
-
 make_dh(1024_160)
 make_dh(2048_224)
 make_dh(2048_256)
diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c
index 85db147..99bca3b 100644
--- a/crypto/dsa/dsa_asn1.c
+++ b/crypto/dsa/dsa_asn1.c
@@ -86,7 +86,7 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = {
         ASN1_SIMPLE(DSA_SIG, r, CBIGNUM),
         ASN1_SIMPLE(DSA_SIG, s, CBIGNUM)
-} ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG)
+} static_ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG)
 
@@ -114,7 +114,7 @@ ASN1_SEQUENCE_cb(DSAPrivateKey, dsa_cb) = {
         ASN1_SIMPLE(DSA, g, BIGNUM),
         ASN1_SIMPLE(DSA, pub_key, BIGNUM),
         ASN1_SIMPLE(DSA, priv_key, CBIGNUM)
-} ASN1_SEQUENCE_END_cb(DSA, DSAPrivateKey)
+} static_ASN1_SEQUENCE_END_cb(DSA, DSAPrivateKey)
 
 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPrivateKey, DSAPrivateKey)
 
@@ -122,7 +122,7 @@ ASN1_SEQUENCE_cb(DSAparams, dsa_cb) = {
         ASN1_SIMPLE(DSA, p, BIGNUM),
         ASN1_SIMPLE(DSA, q, BIGNUM),
         ASN1_SIMPLE(DSA, g, BIGNUM),
-} ASN1_SEQUENCE_END_cb(DSA, DSAparams)
+} static_ASN1_SEQUENCE_END_cb(DSA, DSAparams)
 
 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAparams, DSAparams)
 
@@ -137,7 +137,7 @@ ASN1_SEQUENCE(DSAPublicKey) = {
         ASN1_SIMPLE(DSA, p, BIGNUM),
         ASN1_SIMPLE(DSA, q, BIGNUM),
         ASN1_SIMPLE(DSA, g, BIGNUM)
-} ASN1_SEQUENCE_END_name(DSA, DSAPublicKey)
+} static_ASN1_SEQUENCE_END_name(DSA, DSAPublicKey)
 
 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPublicKey, DSAPublicKey)
 
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 3f971aa..4e1566d 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -204,7 +204,7 @@ ASN1_SEQUENCE(X9_62_PENTANOMIAL) = {
         ASN1_SIMPLE(X9_62_PENTANOMIAL, k1, LONG),
         ASN1_SIMPLE(X9_62_PENTANOMIAL, k2, LONG),
         ASN1_SIMPLE(X9_62_PENTANOMIAL, k3, LONG)
-} ASN1_SEQUENCE_END(X9_62_PENTANOMIAL)
+} static_ASN1_SEQUENCE_END(X9_62_PENTANOMIAL)
 
 DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_PENTANOMIAL)
 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(X9_62_PENTANOMIAL)
@@ -221,7 +221,7 @@ ASN1_SEQUENCE(X9_62_CHARACTERISTIC_TWO) = {
         ASN1_SIMPLE(X9_62_CHARACTERISTIC_TWO, m, LONG),
         ASN1_SIMPLE(X9_62_CHARACTERISTIC_TWO, type, ASN1_OBJECT),
         ASN1_ADB_OBJECT(X9_62_CHARACTERISTIC_TWO)
-} ASN1_SEQUENCE_END(X9_62_CHARACTERISTIC_TWO)
+} static_ASN1_SEQUENCE_END(X9_62_CHARACTERISTIC_TWO)
 
 DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_CHARACTERISTIC_TWO)
 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(X9_62_CHARACTERISTIC_TWO)
@@ -236,13 +236,13 @@ ASN1_ADB(X9_62_FIELDID) = {
 ASN1_SEQUENCE(X9_62_FIELDID) = {
         ASN1_SIMPLE(X9_62_FIELDID, fieldType, ASN1_OBJECT),
         ASN1_ADB_OBJECT(X9_62_FIELDID)
-} ASN1_SEQUENCE_END(X9_62_FIELDID)
+} static_ASN1_SEQUENCE_END(X9_62_FIELDID)
 
 ASN1_SEQUENCE(X9_62_CURVE) = {
         ASN1_SIMPLE(X9_62_CURVE, a, ASN1_OCTET_STRING),
         ASN1_SIMPLE(X9_62_CURVE, b, ASN1_OCTET_STRING),
         ASN1_OPT(X9_62_CURVE, seed, ASN1_BIT_STRING)
-} ASN1_SEQUENCE_END(X9_62_CURVE)
+} static_ASN1_SEQUENCE_END(X9_62_CURVE)
 
 ASN1_SEQUENCE(ECPARAMETERS) = {
         ASN1_SIMPLE(ECPARAMETERS, version, LONG),
@@ -251,7 +251,7 @@ ASN1_SEQUENCE(ECPARAMETERS) = {
         ASN1_SIMPLE(ECPARAMETERS, base, ASN1_OCTET_STRING),
         ASN1_SIMPLE(ECPARAMETERS, order, ASN1_INTEGER),
         ASN1_OPT(ECPARAMETERS, cofactor, ASN1_INTEGER)
-} ASN1_SEQUENCE_END(ECPARAMETERS)
+} static_ASN1_SEQUENCE_END(ECPARAMETERS)
 
 DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS)
 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS)
@@ -260,7 +260,7 @@ ASN1_CHOICE(ECPKPARAMETERS) = {
         ASN1_SIMPLE(ECPKPARAMETERS, value.named_curve, ASN1_OBJECT),
         ASN1_SIMPLE(ECPKPARAMETERS, value.parameters, ECPARAMETERS),
         ASN1_SIMPLE(ECPKPARAMETERS, value.implicitlyCA, ASN1_NULL)
-} ASN1_CHOICE_END(ECPKPARAMETERS)
+} static_ASN1_CHOICE_END(ECPKPARAMETERS)
 
 DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS)
@@ -271,7 +271,7 @@ ASN1_SEQUENCE(EC_PRIVATEKEY) = {
         ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
         ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),
         ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)
-} ASN1_SEQUENCE_END(EC_PRIVATEKEY)
+} static_ASN1_SEQUENCE_END(EC_PRIVATEKEY)
 
 DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(EC_PRIVATEKEY, EC_PRIVATEKEY)
diff --git a/crypto/ecdsa/ecs_asn1.c b/crypto/ecdsa/ecs_asn1.c
index 508b079..0767d3e 100644
--- a/crypto/ecdsa/ecs_asn1.c
+++ b/crypto/ecdsa/ecs_asn1.c
@@ -60,7 +60,7 @@
 ASN1_SEQUENCE(ECDSA_SIG) = {
         ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
         ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM)
-} ASN1_SEQUENCE_END(ECDSA_SIG)
+} static_ASN1_SEQUENCE_END(ECDSA_SIG)
 
 DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECDSA_SIG, ECDSA_SIG)
diff --git a/crypto/engine/Makefile b/crypto/engine/Makefile
index 532fadd..dae2926 100644
--- a/crypto/engine/Makefile
+++ b/crypto/engine/Makefile
@@ -100,19 +100,20 @@ eng_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 eng_cnf.o: ../include/internal/cryptlib.h eng_cnf.c eng_int.h
 eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+eng_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-eng_cryptodev.o: ../../include/openssl/obj_mac.h
+eng_cryptodev.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+eng_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 eng_cryptodev.o: ../../include/openssl/objects.h
 eng_cryptodev.o: ../../include/openssl/opensslconf.h
 eng_cryptodev.o: ../../include/openssl/opensslv.h
 eng_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-eng_cryptodev.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-eng_cryptodev.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-eng_cryptodev.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-eng_cryptodev.o: eng_cryptodev.c
+eng_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+eng_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+eng_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+eng_cryptodev.o: ../../include/openssl/x509_vfy.h eng_cryptodev.c
 eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
 eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 eng_ctrl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index ca567dc..65fc29e 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -535,7 +535,7 @@ static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
  */
 
 /* RC4 */
-const EVP_CIPHER cryptodev_rc4 = {
+static const EVP_CIPHER cryptodev_rc4 = {
     NID_rc4,
     1, 16, 0,
     EVP_CIPH_VARIABLE_LENGTH,
@@ -549,7 +549,7 @@ const EVP_CIPHER cryptodev_rc4 = {
 };
 
 /* DES CBC EVP */
-const EVP_CIPHER cryptodev_des_cbc = {
+static const EVP_CIPHER cryptodev_des_cbc = {
     NID_des_cbc,
     8, 8, 8,
     EVP_CIPH_CBC_MODE,
@@ -563,7 +563,7 @@ const EVP_CIPHER cryptodev_des_cbc = {
 };
 
 /* 3DES CBC EVP */
-const EVP_CIPHER cryptodev_3des_cbc = {
+static const EVP_CIPHER cryptodev_3des_cbc = {
     NID_des_ede3_cbc,
     8, 24, 8,
     EVP_CIPH_CBC_MODE,
@@ -576,7 +576,7 @@ const EVP_CIPHER cryptodev_3des_cbc = {
     NULL
 };
 
-const EVP_CIPHER cryptodev_bf_cbc = {
+static const EVP_CIPHER cryptodev_bf_cbc = {
     NID_bf_cbc,
     8, 16, 8,
     EVP_CIPH_CBC_MODE,
@@ -589,7 +589,7 @@ const EVP_CIPHER cryptodev_bf_cbc = {
     NULL
 };
 
-const EVP_CIPHER cryptodev_cast_cbc = {
+static const EVP_CIPHER cryptodev_cast_cbc = {
     NID_cast5_cbc,
     8, 16, 8,
     EVP_CIPH_CBC_MODE,
@@ -602,7 +602,7 @@ const EVP_CIPHER cryptodev_cast_cbc = {
     NULL
 };
 
-const EVP_CIPHER cryptodev_aes_cbc = {
+static const EVP_CIPHER cryptodev_aes_cbc = {
     NID_aes_128_cbc,
     16, 16, 16,
     EVP_CIPH_CBC_MODE,
@@ -615,7 +615,7 @@ const EVP_CIPHER cryptodev_aes_cbc = {
     NULL
 };
 
-const EVP_CIPHER cryptodev_aes_192_cbc = {
+static const EVP_CIPHER cryptodev_aes_192_cbc = {
     NID_aes_192_cbc,
     16, 24, 16,
     EVP_CIPH_CBC_MODE,
@@ -628,7 +628,7 @@ const EVP_CIPHER cryptodev_aes_192_cbc = {
     NULL
 };
 
-const EVP_CIPHER cryptodev_aes_256_cbc = {
+static const EVP_CIPHER cryptodev_aes_256_cbc = {
     NID_aes_256_cbc,
     16, 32, 16,
     EVP_CIPH_CBC_MODE,
diff --git a/crypto/evp/Makefile b/crypto/evp/Makefile
index 1a65b46..6164f84 100644
--- a/crypto/evp/Makefile
+++ b/crypto/evp/Makefile
@@ -290,7 +290,6 @@ e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 e_null.o: ../include/internal/cryptlib.h e_null.c
-e_old.o: e_old.c
 e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -756,20 +755,22 @@ pmeth_gn.o: ../include/internal/cryptlib.h ../include/internal/evp_int.h
 pmeth_gn.o: pmeth_gn.c
 pmeth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
 pmeth_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-pmeth_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-pmeth_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-pmeth_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-pmeth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+pmeth_lib.o: ../../include/openssl/cmac.h ../../include/openssl/crypto.h
+pmeth_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+pmeth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+pmeth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+pmeth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+pmeth_lib.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
 pmeth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 pmeth_lib.o: ../../include/openssl/objects.h
 pmeth_lib.o: ../../include/openssl/opensslconf.h
 pmeth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-pmeth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-pmeth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-pmeth_lib.o: ../../include/openssl/x509_vfy.h ../include/internal/asn1_int.h
-pmeth_lib.o: ../include/internal/cryptlib.h ../include/internal/evp_int.h
-pmeth_lib.o: pmeth_lib.c
+pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+pmeth_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+pmeth_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+pmeth_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+pmeth_lib.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
+pmeth_lib.o: ../include/internal/evp_int.h pmeth_lib.c
 scrypt.o: ../../include/internal/numbers.h ../../include/openssl/asn1.h
 scrypt.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
 scrypt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index ac0767c..72a8c1a 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -60,8 +60,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "internal/cryptlib.h"
-#include <openssl/objects.h>
+#include <openssl/cmac.h>
+#include <openssl/dh.h>
+#include <openssl/dsa.h>
 #include <openssl/evp.h>
+#include <openssl/hmac.h>
+#include <openssl/objects.h>
+#include <openssl/rsa.h>
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
@@ -71,11 +76,7 @@
 typedef int sk_cmp_fn_type(const char *const *a, const char *const *b);
 
 DECLARE_STACK_OF(EVP_PKEY_METHOD)
-STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;
-
-extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth;
-extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth, cmac_pkey_meth;
-extern const EVP_PKEY_METHOD dhx_pkey_meth;
+static STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;
 
 static const EVP_PKEY_METHOD *standard_methods[] = {
 #ifndef OPENSSL_NO_RSA
diff --git a/crypto/include/internal/asn1_int.h b/crypto/include/internal/asn1_int.h
index 9e74f47..966f3aa 100644
--- a/crypto/include/internal/asn1_int.h
+++ b/crypto/include/internal/asn1_int.h
@@ -104,6 +104,14 @@ struct evp_pkey_asn1_method_st {
                       ASN1_BIT_STRING *sig);
 } /* 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;
+extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[];
+extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[];
+
 /*
  * These are used internally in the ASN1_OBJECT to keep track of whether the
  * names and data need to be free()ed
diff --git a/crypto/ocsp/Makefile b/crypto/ocsp/Makefile
index ea5f728..20437cc 100644
--- a/crypto/ocsp/Makefile
+++ b/crypto/ocsp/Makefile
@@ -214,4 +214,4 @@ v3_ocsp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_ocsp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_ocsp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_ocsp.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_ocsp.o: ocsp_lcl.h v3_ocsp.c
+v3_ocsp.o: ../x509v3/ext_dat.h ocsp_lcl.h v3_ocsp.c
diff --git a/crypto/ocsp/v3_ocsp.c b/crypto/ocsp/v3_ocsp.c
index 30ed7d5..ab8c437 100644
--- a/crypto/ocsp/v3_ocsp.c
+++ b/crypto/ocsp/v3_ocsp.c
@@ -64,6 +64,7 @@
 # include <openssl/ocsp.h>
 # include "ocsp_lcl.h"
 # include <openssl/x509v3.h>
+# include "../x509v3/ext_dat.h"
 
 /*
  * OCSP extensions and a couple of CRL entry extensions
diff --git a/crypto/sec_mem.c b/crypto/sec_mem.c
index fbed8b4..b7a9d3b 100644
--- a/crypto/sec_mem.c
+++ b/crypto/sec_mem.c
@@ -31,7 +31,7 @@
 #endif
 
 #ifdef IMPLEMENTED
-size_t secure_mem_used;
+static size_t secure_mem_used;
 
 static int secure_mem_initialized;
 static int too_late;
diff --git a/crypto/ts/ts_asn1.c b/crypto/ts/ts_asn1.c
index f4884a2..59cc8b2 100644
--- a/crypto/ts/ts_asn1.c
+++ b/crypto/ts/ts_asn1.c
@@ -64,7 +64,7 @@
 ASN1_SEQUENCE(TS_MSG_IMPRINT) = {
         ASN1_SIMPLE(TS_MSG_IMPRINT, hash_algo, X509_ALGOR),
         ASN1_SIMPLE(TS_MSG_IMPRINT, hashed_msg, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(TS_MSG_IMPRINT)
+} static_ASN1_SEQUENCE_END(TS_MSG_IMPRINT)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_MSG_IMPRINT)
 IMPLEMENT_ASN1_DUP_FUNCTION(TS_MSG_IMPRINT)
@@ -98,7 +98,7 @@ ASN1_SEQUENCE(TS_REQ) = {
         ASN1_OPT(TS_REQ, nonce, ASN1_INTEGER),
         ASN1_OPT(TS_REQ, cert_req, ASN1_FBOOLEAN),
         ASN1_IMP_SEQUENCE_OF_OPT(TS_REQ, extensions, X509_EXTENSION, 0)
-} ASN1_SEQUENCE_END(TS_REQ)
+} static_ASN1_SEQUENCE_END(TS_REQ)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_REQ)
 IMPLEMENT_ASN1_DUP_FUNCTION(TS_REQ)
@@ -127,7 +127,7 @@ ASN1_SEQUENCE(TS_ACCURACY) = {
         ASN1_OPT(TS_ACCURACY, seconds, ASN1_INTEGER),
         ASN1_IMP_OPT(TS_ACCURACY, millis, ASN1_INTEGER, 0),
         ASN1_IMP_OPT(TS_ACCURACY, micros, ASN1_INTEGER, 1)
-} ASN1_SEQUENCE_END(TS_ACCURACY)
+} static_ASN1_SEQUENCE_END(TS_ACCURACY)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_ACCURACY)
 IMPLEMENT_ASN1_DUP_FUNCTION(TS_ACCURACY)
@@ -143,7 +143,7 @@ ASN1_SEQUENCE(TS_TST_INFO) = {
         ASN1_OPT(TS_TST_INFO, nonce, ASN1_INTEGER),
         ASN1_EXP_OPT(TS_TST_INFO, tsa, GENERAL_NAME, 0),
         ASN1_IMP_SEQUENCE_OF_OPT(TS_TST_INFO, extensions, X509_EXTENSION, 1)
-} ASN1_SEQUENCE_END(TS_TST_INFO)
+} static_ASN1_SEQUENCE_END(TS_TST_INFO)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_TST_INFO)
 IMPLEMENT_ASN1_DUP_FUNCTION(TS_TST_INFO)
@@ -174,7 +174,7 @@ ASN1_SEQUENCE(TS_STATUS_INFO) = {
         ASN1_SIMPLE(TS_STATUS_INFO, status, ASN1_INTEGER),
         ASN1_SEQUENCE_OF_OPT(TS_STATUS_INFO, text, ASN1_UTF8STRING),
         ASN1_OPT(TS_STATUS_INFO, failure_info, ASN1_BIT_STRING)
-} ASN1_SEQUENCE_END(TS_STATUS_INFO)
+} static_ASN1_SEQUENCE_END(TS_STATUS_INFO)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_STATUS_INFO)
 IMPLEMENT_ASN1_DUP_FUNCTION(TS_STATUS_INFO)
@@ -223,7 +223,7 @@ static int ts_resp_cb(int op, ASN1_VALUE **pval, const ASN1_ITEM *it,
 ASN1_SEQUENCE_cb(TS_RESP, ts_resp_cb) = {
         ASN1_SIMPLE(TS_RESP, status_info, TS_STATUS_INFO),
         ASN1_OPT(TS_RESP, token, PKCS7),
-} ASN1_SEQUENCE_END_cb(TS_RESP, TS_RESP)
+} static_ASN1_SEQUENCE_END_cb(TS_RESP, TS_RESP)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(TS_RESP)
 
@@ -253,7 +253,7 @@ int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a)
 ASN1_SEQUENCE(ESS_ISSUER_SERIAL) = {
         ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
         ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
-} ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
+} static_ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(ESS_ISSUER_SERIAL)
 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
@@ -261,7 +261,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
 ASN1_SEQUENCE(ESS_CERT_ID) = {
         ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
         ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
-} ASN1_SEQUENCE_END(ESS_CERT_ID)
+} static_ASN1_SEQUENCE_END(ESS_CERT_ID)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(ESS_CERT_ID)
 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
@@ -269,7 +269,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
 ASN1_SEQUENCE(ESS_SIGNING_CERT) = {
         ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
         ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
-} ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
+} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
 
 IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index bd6c3c8..f55e235 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -99,7 +99,7 @@ static void free_dir(X509_LOOKUP *lu);
 static int add_cert_dir(BY_DIR *ctx, const char *dir, int type);
 static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
                                X509_OBJECT *ret);
-X509_LOOKUP_METHOD x509_dir_lookup = {
+static X509_LOOKUP_METHOD x509_dir_lookup = {
     "Load certs from files in a directory",
     new_dir,                    /* new */
     free_dir,                   /* free */
diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
index 9b06b34..6fbffe1 100644
--- a/crypto/x509/by_file.c
+++ b/crypto/x509/by_file.c
@@ -70,7 +70,7 @@
 
 static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
                         long argl, char **ret);
-X509_LOOKUP_METHOD x509_file_lookup = {
+static X509_LOOKUP_METHOD x509_file_lookup = {
     "Load file into cache",
     NULL,                       /* new */
     NULL,                       /* free */
diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c
index 9bf1523..4c8d57b 100644
--- a/crypto/x509/x_name.c
+++ b/crypto/x509/x_name.c
@@ -102,11 +102,11 @@ IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME_ENTRY)
 
 ASN1_ITEM_TEMPLATE(X509_NAME_ENTRIES) =
         ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, RDNS, X509_NAME_ENTRY)
-ASN1_ITEM_TEMPLATE_END(X509_NAME_ENTRIES)
+static_ASN1_ITEM_TEMPLATE_END(X509_NAME_ENTRIES)
 
 ASN1_ITEM_TEMPLATE(X509_NAME_INTERNAL) =
         ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, Name, X509_NAME_ENTRIES)
-ASN1_ITEM_TEMPLATE_END(X509_NAME_INTERNAL)
+static_ASN1_ITEM_TEMPLATE_END(X509_NAME_INTERNAL)
 
 /*
  * Normally that's where it would end: we'd have two nested STACK structures
@@ -115,7 +115,7 @@ ASN1_ITEM_TEMPLATE_END(X509_NAME_INTERNAL)
  * convert to the external form.
  */
 
-const ASN1_EXTERN_FUNCS x509_name_ff = {
+static const ASN1_EXTERN_FUNCS x509_name_ff = {
     NULL,
     x509_name_ex_new,
     x509_name_ex_free,
diff --git a/crypto/x509v3/Makefile b/crypto/x509v3/Makefile
index 5c47467..a80ec98 100644
--- a/crypto/x509v3/Makefile
+++ b/crypto/x509v3/Makefile
@@ -168,7 +168,7 @@ v3_addr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_addr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_addr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_addr.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_addr.o: v3_addr.c
+v3_addr.o: ext_dat.h v3_addr.c
 v3_akey.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_akey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_akey.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -183,7 +183,7 @@ v3_akey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_akey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_akey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_akey.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_akey.o: v3_akey.c
+v3_akey.o: ext_dat.h v3_akey.c
 v3_akeya.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_akeya.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_akeya.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -212,7 +212,7 @@ v3_alt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_alt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_alt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_alt.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_alt.o: v3_alt.c
+v3_alt.o: ext_dat.h v3_alt.c
 v3_asid.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_asid.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_asid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -227,7 +227,7 @@ v3_asid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_asid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_asid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_asid.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_asid.o: ../include/internal/cryptlib.h v3_asid.c
+v3_asid.o: ../include/internal/cryptlib.h ext_dat.h v3_asid.c
 v3_bcons.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_bcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_bcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -242,7 +242,7 @@ v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_bcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_bcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_bcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_bcons.o: ../include/internal/cryptlib.h v3_bcons.c
+v3_bcons.o: ../include/internal/cryptlib.h ext_dat.h v3_bcons.c
 v3_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
@@ -256,7 +256,7 @@ v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_bitst.o: ../include/internal/cryptlib.h v3_bitst.c
+v3_bitst.o: ../include/internal/cryptlib.h ext_dat.h v3_bitst.c
 v3_conf.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
@@ -286,7 +286,7 @@ v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_cpols.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_cpols.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_cpols.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_cpols.o: ../include/internal/cryptlib.h pcy_int.h v3_cpols.c
+v3_cpols.o: ../include/internal/cryptlib.h ext_dat.h pcy_int.h v3_cpols.c
 v3_crld.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_crld.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_crld.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -301,7 +301,7 @@ v3_crld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_crld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_crld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_crld.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_crld.o: ../include/internal/x509_int.h v3_crld.c
+v3_crld.o: ../include/internal/x509_int.h ext_dat.h v3_crld.c
 v3_enum.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_enum.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
@@ -315,7 +315,7 @@ v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_enum.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_enum.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_enum.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_enum.o: ../include/internal/cryptlib.h v3_enum.c
+v3_enum.o: ../include/internal/cryptlib.h ext_dat.h v3_enum.c
 v3_extku.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_extku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_extku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -330,7 +330,7 @@ v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_extku.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_extku.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_extku.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_extku.o: ../include/internal/cryptlib.h v3_extku.c
+v3_extku.o: ../include/internal/cryptlib.h ext_dat.h v3_extku.c
 v3_genn.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_genn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_genn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -359,7 +359,7 @@ v3_ia5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_ia5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_ia5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_ia5.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_ia5.o: v3_ia5.c
+v3_ia5.o: ext_dat.h v3_ia5.c
 v3_info.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_info.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_info.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -374,7 +374,7 @@ v3_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_info.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_info.o: v3_info.c
+v3_info.o: ext_dat.h v3_info.c
 v3_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 v3_int.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -388,7 +388,7 @@ v3_int.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_int.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_int.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_int.o: v3_int.c
+v3_int.o: ext_dat.h v3_int.c
 v3_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 v3_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -418,7 +418,7 @@ v3_ncons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_ncons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_ncons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 v3_ncons.o: ../include/internal/cryptlib.h ../include/internal/x509_int.h
-v3_ncons.o: v3_ncons.c
+v3_ncons.o: ext_dat.h v3_ncons.c
 v3_pci.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 v3_pci.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 v3_pci.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -432,7 +432,7 @@ v3_pci.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_pci.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_pci.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_pci.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_pci.o: v3_pci.c
+v3_pci.o: ext_dat.h v3_pci.c
 v3_pcia.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 v3_pcia.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 v3_pcia.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
@@ -460,7 +460,7 @@ v3_pcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_pcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_pcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_pcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_pcons.o: ../include/internal/cryptlib.h v3_pcons.c
+v3_pcons.o: ../include/internal/cryptlib.h ext_dat.h v3_pcons.c
 v3_pku.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -475,7 +475,7 @@ v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 v3_pku.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
-v3_pku.o: v3_pku.c
+v3_pku.o: ext_dat.h v3_pku.c
 v3_pmaps.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_pmaps.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_pmaps.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -490,7 +490,7 @@ v3_pmaps.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_pmaps.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_pmaps.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_pmaps.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_pmaps.o: ../include/internal/cryptlib.h v3_pmaps.c
+v3_pmaps.o: ../include/internal/cryptlib.h ext_dat.h v3_pmaps.c
 v3_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 v3_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -533,7 +533,7 @@ v3_scts.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_scts.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_scts.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_scts.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_scts.o: ../include/internal/cryptlib.h v3_scts.c
+v3_scts.o: ../include/internal/cryptlib.h ext_dat.h v3_scts.c
 v3_skey.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_skey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
@@ -548,7 +548,7 @@ v3_skey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_skey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_skey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 v3_skey.o: ../include/internal/cryptlib.h ../include/internal/x509_int.h
-v3_skey.o: v3_skey.c
+v3_skey.o: ext_dat.h v3_skey.c
 v3_sxnet.o: ../../e_os.h ../../include/openssl/asn1.h
 v3_sxnet.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 v3_sxnet.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
@@ -563,7 +563,7 @@ v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 v3_sxnet.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 v3_sxnet.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 v3_sxnet.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
-v3_sxnet.o: ../include/internal/cryptlib.h v3_sxnet.c
+v3_sxnet.o: ../include/internal/cryptlib.h ext_dat.h v3_sxnet.c
 v3_utl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 v3_utl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
index 76be621..0e93d82 100644
--- a/crypto/x509v3/ext_dat.h
+++ b/crypto/x509v3/ext_dat.h
@@ -58,18 +58,18 @@
  */
 /* This file contains a table of "standard" extensions */
 
-extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku;
-extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo;
-extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id;
-extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate;
-extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld, v3_freshest_crl;
-extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff;
-extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc;
-extern X509V3_EXT_METHOD v3_crl_hold, v3_pci;
-extern X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints;
-extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp;
-extern X509V3_EXT_METHOD v3_addr, v3_asid;
-extern X509V3_EXT_METHOD v3_ct_scts[];
+extern const X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku;
+extern const X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo;
+extern const X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id;
+extern const X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate;
+extern const X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld, v3_freshest_crl;
+extern const X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff;
+extern const X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc;
+extern const X509V3_EXT_METHOD v3_crl_hold, v3_pci;
+extern const X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints;
+extern const X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp;
+extern const X509V3_EXT_METHOD v3_addr, v3_asid;
+extern const X509V3_EXT_METHOD v3_ct_scts[];
 
 /*
  * This table will be searched using OBJ_bsearch so it *must* kept in order
diff --git a/crypto/x509v3/v3_addr.c b/crypto/x509v3/v3_addr.c
index c1c38a0..ff6fb32 100644
--- a/crypto/x509v3/v3_addr.c
+++ b/crypto/x509v3/v3_addr.c
@@ -68,6 +68,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/buffer.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 #ifndef OPENSSL_NO_RFC3779
 
@@ -98,7 +99,7 @@ ASN1_SEQUENCE(IPAddressFamily) = {
 ASN1_ITEM_TEMPLATE(IPAddrBlocks) =
   ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0,
                         IPAddrBlocks, IPAddressFamily)
-ASN1_ITEM_TEMPLATE_END(IPAddrBlocks)
+static_ASN1_ITEM_TEMPLATE_END(IPAddrBlocks)
 
 IMPLEMENT_ASN1_FUNCTIONS(IPAddressRange)
 IMPLEMENT_ASN1_FUNCTIONS(IPAddressOrRange)
diff --git a/crypto/x509v3/v3_akey.c b/crypto/x509v3/v3_akey.c
index abad217..1aa6268 100644
--- a/crypto/x509v3/v3_akey.c
+++ b/crypto/x509v3/v3_akey.c
@@ -63,6 +63,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
                                                  AUTHORITY_KEYID *akeyid,
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index b3c3644..08614ea 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -61,6 +61,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
                                       X509V3_CTX *ctx,
diff --git a/crypto/x509v3/v3_asid.c b/crypto/x509v3/v3_asid.c
index d40279a..e1cde64 100644
--- a/crypto/x509v3/v3_asid.c
+++ b/crypto/x509v3/v3_asid.c
@@ -68,6 +68,7 @@
 #include <openssl/x509v3.h>
 #include <openssl/x509.h>
 #include <openssl/bn.h>
+#include "ext_dat.h"
 
 #ifndef OPENSSL_NO_RFC3779
 
diff --git a/crypto/x509v3/v3_bcons.c b/crypto/x509v3/v3_bcons.c
index d49a010..53a8565 100644
--- a/crypto/x509v3/v3_bcons.c
+++ b/crypto/x509v3/v3_bcons.c
@@ -63,6 +63,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
                                                    BASIC_CONSTRAINTS *bcons,
diff --git a/crypto/x509v3/v3_bitst.c b/crypto/x509v3/v3_bitst.c
index b2f6392..e0787fd 100644
--- a/crypto/x509v3/v3_bitst.c
+++ b/crypto/x509v3/v3_bitst.c
@@ -61,6 +61,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static BIT_STRING_BITNAME ns_cert_type_table[] = {
     {0, "SSL Client", "client"},
diff --git a/crypto/x509v3/v3_cpols.c b/crypto/x509v3/v3_cpols.c
index a326876..9331a49 100644
--- a/crypto/x509v3/v3_cpols.c
+++ b/crypto/x509v3/v3_cpols.c
@@ -65,6 +65,7 @@
 #include <openssl/x509v3.h>
 
 #include "pcy_int.h"
+#include "ext_dat.h"
 
 /* Certificate policies extension support: this one is a bit complex... */
 
diff --git a/crypto/x509v3/v3_crld.c b/crypto/x509v3/v3_crld.c
index 9b0d21f..49d282e 100644
--- a/crypto/x509v3/v3_crld.c
+++ b/crypto/x509v3/v3_crld.c
@@ -65,6 +65,7 @@
 #include <openssl/x509v3.h>
 
 #include "internal/x509_int.h"
+#include "ext_dat.h"
 
 static void *v2i_crld(const X509V3_EXT_METHOD *method,
                       X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
diff --git a/crypto/x509v3/v3_enum.c b/crypto/x509v3/v3_enum.c
index 774eb34..d2f895d 100644
--- a/crypto/x509v3/v3_enum.c
+++ b/crypto/x509v3/v3_enum.c
@@ -60,6 +60,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static ENUMERATED_NAMES crl_reasons[] = {
     {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"},
diff --git a/crypto/x509v3/v3_extku.c b/crypto/x509v3/v3_extku.c
index d5da551..fddcdff 100644
--- a/crypto/x509v3/v3_extku.c
+++ b/crypto/x509v3/v3_extku.c
@@ -62,6 +62,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
                                     X509V3_CTX *ctx,
diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c
index ca15447..ed94a3e 100644
--- a/crypto/x509v3/v3_ia5.c
+++ b/crypto/x509v3/v3_ia5.c
@@ -62,6 +62,7 @@
 #include <openssl/asn1.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 const X509V3_EXT_METHOD v3_ns_ia5_list[] = {
     EXT_IA5STRING(NID_netscape_base_url),
diff --git a/crypto/x509v3/v3_info.c b/crypto/x509v3/v3_info.c
index 277609e..d1a2455 100644
--- a/crypto/x509v3/v3_info.c
+++ b/crypto/x509v3/v3_info.c
@@ -63,6 +63,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
                                                        *method, AUTHORITY_INFO_ACCESS
diff --git a/crypto/x509v3/v3_int.c b/crypto/x509v3/v3_int.c
index 9895ac5..2cab28c 100644
--- a/crypto/x509v3/v3_int.c
+++ b/crypto/x509v3/v3_int.c
@@ -60,6 +60,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 const X509V3_EXT_METHOD v3_crl_num = {
     NID_crl_number, 0, ASN1_ITEM_ref(ASN1_INTEGER),
diff --git a/crypto/x509v3/v3_ncons.c b/crypto/x509v3/v3_ncons.c
index 315bd3c..3fe20cc 100644
--- a/crypto/x509v3/v3_ncons.c
+++ b/crypto/x509v3/v3_ncons.c
@@ -64,6 +64,7 @@
 #include <openssl/x509v3.h>
 
 #include "internal/x509_int.h"
+#include "ext_dat.h"
 
 static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
                                   X509V3_CTX *ctx,
diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
index ef105dc..ad49724 100644
--- a/crypto/x509v3/v3_pci.c
+++ b/crypto/x509v3/v3_pci.c
@@ -39,6 +39,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext,
                    BIO *out, int indent);
diff --git a/crypto/x509v3/v3_pcons.c b/crypto/x509v3/v3_pcons.c
index e170b80..18de9e8 100644
--- a/crypto/x509v3/v3_pcons.c
+++ b/crypto/x509v3/v3_pcons.c
@@ -63,6 +63,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD
                                                     *method, void *bcons, STACK_OF(CONF_VALUE)
diff --git a/crypto/x509v3/v3_pku.c b/crypto/x509v3/v3_pku.c
index 5056fb3..5b048a3 100644
--- a/crypto/x509v3/v3_pku.c
+++ b/crypto/x509v3/v3_pku.c
@@ -62,6 +62,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
                                  PKEY_USAGE_PERIOD *usage, BIO *out,
diff --git a/crypto/x509v3/v3_pmaps.c b/crypto/x509v3/v3_pmaps.c
index b862e3e..bd80a12 100644
--- a/crypto/x509v3/v3_pmaps.c
+++ b/crypto/x509v3/v3_pmaps.c
@@ -62,6 +62,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
                                  X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
index 0ffdfb8..f93fdfc 100644
--- a/crypto/x509v3/v3_scts.c
+++ b/crypto/x509v3/v3_scts.c
@@ -60,6 +60,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 #ifndef OPENSSL_NO_SCT
 /* Signature and hash algorithms from RFC 5246 */
diff --git a/crypto/x509v3/v3_skey.c b/crypto/x509v3/v3_skey.c
index a1167cc..4b55fd8 100644
--- a/crypto/x509v3/v3_skey.c
+++ b/crypto/x509v3/v3_skey.c
@@ -61,6 +61,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/x509v3.h>
 #include "internal/x509_int.h"
+#include "ext_dat.h"
 
 static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
                                       X509V3_CTX *ctx, char *str);
diff --git a/crypto/x509v3/v3_sxnet.c b/crypto/x509v3/v3_sxnet.c
index 13d7286..941566b 100644
--- a/crypto/x509v3/v3_sxnet.c
+++ b/crypto/x509v3/v3_sxnet.c
@@ -63,6 +63,7 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 /* Support for Thawte strong extranet extension */
 
diff --git a/include/openssl/asn1t.h b/include/openssl/asn1t.h
index dfd9dac..6467e4a 100644
--- a/include/openssl/asn1t.h
+++ b/include/openssl/asn1t.h
@@ -84,7 +84,10 @@ extern "C" {
 #  define ASN1_ITEM_start(itname) \
         OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
 
-#  define ASN1_ITEM_end(itname) \
+#  define static_ASN1_ITEM_start(itname) \
+        static const ASN1_ITEM itname##_it = {
+
+#  define ASN1_ITEM_end(itname)                 \
                 };
 
 # else
@@ -122,6 +125,17 @@ extern "C" {
                 0,\
                 #tname \
         ASN1_ITEM_end(tname)
+# define static_ASN1_ITEM_TEMPLATE_END(tname) \
+        ;\
+        static_ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_PRIMITIVE,\
+                -1,\
+                &tname##_item_tt,\
+                0,\
+                NULL,\
+                0,\
+                #tname \
+        ASN1_ITEM_end(tname)
 
 /* This is a ASN1 type which just embeds a template */
 
@@ -151,6 +165,8 @@ extern "C" {
 
 # define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
 
+# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
+
 # define ASN1_SEQUENCE_END_name(stname, tname) \
         ;\
         ASN1_ITEM_start(tname) \
@@ -163,6 +179,18 @@ extern "C" {
                 #stname \
         ASN1_ITEM_end(tname)
 
+# define static_ASN1_SEQUENCE_END_name(stname, tname) \
+        ;\
+        static_ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
 # define ASN1_NDEF_SEQUENCE(tname) \
         ASN1_SEQUENCE(tname)
 
@@ -196,12 +224,26 @@ extern "C" {
                 sizeof(tname),\
                 #tname \
         ASN1_ITEM_end(tname)
+# define static_ASN1_NDEF_SEQUENCE_END(tname) \
+        ;\
+        static_ASN1_ITEM_start(tname)			\
+                ASN1_ITYPE_NDEF_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(tname),\
+                #tname \
+        ASN1_ITEM_end(tname)
 
 # define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
+# define static_ASN1_BROKEN_SEQUENCE_END(stname) \
+	static_ASN1_SEQUENCE_END_ref(stname, stname)
 
 # define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
 
 # define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
+# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
 
 # define ASN1_SEQUENCE_END_ref(stname, tname) \
         ;\
@@ -214,6 +256,17 @@ extern "C" {
                 sizeof(stname),\
                 #stname \
         ASN1_ITEM_end(tname)
+# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
+        ;\
+        static_ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                &tname##_aux,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
 
 # define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
         ;\
@@ -259,8 +312,12 @@ extern "C" {
 
 # define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
 
+# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
+
 # define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
 
+# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
+
 # define ASN1_CHOICE_END_selector(stname, tname, selname) \
         ;\
         ASN1_ITEM_start(tname) \
@@ -273,6 +330,18 @@ extern "C" {
                 #stname \
         ASN1_ITEM_end(tname)
 
+# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
+        ;\
+        static_ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_CHOICE,\
+                offsetof(stname,selname) ,\
+                tname##_ch_tt,\
+                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
 # define ASN1_CHOICE_END_cb(stname, tname, selname) \
         ;\
         ASN1_ITEM_start(tname) \
diff --git a/include/openssl/cmac.h b/include/openssl/cmac.h
index 175be83..cc729c4 100644
--- a/include/openssl/cmac.h
+++ b/include/openssl/cmac.h
@@ -76,6 +76,8 @@ int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
 int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
 int CMAC_resume(CMAC_CTX *ctx);
 
+extern const EVP_PKEY_METHOD cmac_pkey_meth;
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/include/openssl/dh.h b/include/openssl/dh.h
index f5b03d3..6e928ed 100644
--- a/include/openssl/dh.h
+++ b/include/openssl/dh.h
@@ -342,6 +342,20 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
 # define EVP_PKEY_DH_KDF_X9_42                           2
 # endif
 
+extern const EVP_PKEY_METHOD dh_pkey_meth;
+extern const EVP_PKEY_METHOD dhx_pkey_meth;
+
+#define declare_dh_bn(x) \
+        const extern BIGNUM _bignum_dh##x##_p;\
+        const extern BIGNUM _bignum_dh##x##_g;\
+        const extern BIGNUM _bignum_dh##x##_q;
+
+declare_dh_bn(1024_160)
+declare_dh_bn(2048_224)
+declare_dh_bn(2048_256)
+
+#undef declare_dh_bn
+
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h
index 8fd5596..589216e 100644
--- a/include/openssl/dsa.h
+++ b/include/openssl/dsa.h
@@ -276,6 +276,8 @@ DH *DSA_dup_DH(const DSA *r);
 # define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS       (EVP_PKEY_ALG_CTRL + 2)
 # define EVP_PKEY_CTRL_DSA_PARAMGEN_MD           (EVP_PKEY_ALG_CTRL + 3)
 
+extern const EVP_PKEY_METHOD dsa_pkey_meth;
+
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index 6ea4e41..c3cd8ed 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -1067,6 +1067,8 @@ int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
 # define EVP_PKEY_ECDH_KDF_NONE                          1
 # define EVP_PKEY_ECDH_KDF_X9_62                         2
 
+extern const EVP_PKEY_METHOD ec_pkey_meth;
+
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/include/openssl/hmac.h b/include/openssl/hmac.h
index 81aa49d..d7ecf54 100644
--- a/include/openssl/hmac.h
+++ b/include/openssl/hmac.h
@@ -104,6 +104,8 @@ __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
 
 void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
 
+extern const EVP_PKEY_METHOD hmac_pkey_meth;
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index 9abb2a1..536a78e 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -508,6 +508,8 @@ RSA *RSAPrivateKey_dup(RSA *rsa);
  */
 # define RSA_FLAG_CHECKED                        0x0800
 
+extern const EVP_PKEY_METHOD rsa_pkey_meth;
+
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 10f8041..1334eb6 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -1884,6 +1884,8 @@ __owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);
 __owur const struct openssl_ssl_test_functions *SSL_test_functions(void);
 # endif
 
+extern const char SSL_version_str[];
+
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/ssl/Makefile b/ssl/Makefile
index b8ae9c3..760ceae 100644
--- a/ssl/Makefile
+++ b/ssl/Makefile
@@ -256,71 +256,121 @@ d1_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 d1_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 d1_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srvr.c
 d1_srvr.o: packet_locl.h record/record.h ssl_locl.h
-dtls1_bitmap.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-dtls1_bitmap.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-dtls1_bitmap.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-dtls1_bitmap.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-dtls1_bitmap.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-dtls1_bitmap.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-dtls1_bitmap.o: ../include/openssl/err.h ../include/openssl/evp.h
-dtls1_bitmap.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-dtls1_bitmap.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dtls1_bitmap.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dtls1_bitmap.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dtls1_bitmap.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dtls1_bitmap.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-dtls1_bitmap.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-dtls1_bitmap.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-dtls1_bitmap.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-dtls1_bitmap.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-dtls1_bitmap.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-dtls1_bitmap.o: ../include/openssl/x509_vfy.h dtls1_bitmap.c
-dtls1_bitmap.o: record/../packet_locl.h record/../record/record.h
-dtls1_bitmap.o: record/../ssl_locl.h record/dtls1_bitmap.c record/record_locl.h
-rec_layer_d1.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rec_layer_d1.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-rec_layer_d1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-rec_layer_d1.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-rec_layer_d1.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-rec_layer_d1.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-rec_layer_d1.o: ../include/openssl/err.h ../include/openssl/evp.h
-rec_layer_d1.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-rec_layer_d1.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rec_layer_d1.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rec_layer_d1.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-rec_layer_d1.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-rec_layer_d1.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-rec_layer_d1.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-rec_layer_d1.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-rec_layer_d1.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-rec_layer_d1.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-rec_layer_d1.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-rec_layer_d1.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-rec_layer_d1.o: rec_layer_d1.c record/../packet_locl.h
-rec_layer_d1.o: record/../record/record.h record/../ssl_locl.h
-rec_layer_d1.o: record/rec_layer_d1.c record/record_locl.h
-rec_layer_s3.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rec_layer_s3.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-rec_layer_s3.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-rec_layer_s3.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-rec_layer_s3.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-rec_layer_s3.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-rec_layer_s3.o: ../include/openssl/err.h ../include/openssl/evp.h
-rec_layer_s3.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-rec_layer_s3.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rec_layer_s3.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rec_layer_s3.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-rec_layer_s3.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-rec_layer_s3.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-rec_layer_s3.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-rec_layer_s3.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-rec_layer_s3.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-rec_layer_s3.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-rec_layer_s3.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-rec_layer_s3.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-rec_layer_s3.o: rec_layer_s3.c record/../packet_locl.h
-rec_layer_s3.o: record/../record/record.h record/../ssl_locl.h
-rec_layer_s3.o: record/rec_layer_s3.c record/record_locl.h
+record/dtls1_bitmap.o: ../e_os.h ../include/openssl/asn1.h
+record/dtls1_bitmap.o: ../include/openssl/bio.h ../include/openssl/bn.h
+record/dtls1_bitmap.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+record/dtls1_bitmap.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+record/dtls1_bitmap.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+record/dtls1_bitmap.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+record/dtls1_bitmap.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+record/dtls1_bitmap.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+record/dtls1_bitmap.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/dtls1_bitmap.o: ../include/openssl/objects.h
+record/dtls1_bitmap.o: ../include/openssl/opensslconf.h
+record/dtls1_bitmap.o: ../include/openssl/opensslv.h
+record/dtls1_bitmap.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+record/dtls1_bitmap.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+record/dtls1_bitmap.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+record/dtls1_bitmap.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+record/dtls1_bitmap.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+record/dtls1_bitmap.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+record/dtls1_bitmap.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+record/dtls1_bitmap.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+record/dtls1_bitmap.o: ../include/openssl/x509_vfy.h packet_locl.h
+record/dtls1_bitmap.o: record/dtls1_bitmap.c record/record.h
+record/dtls1_bitmap.o: record/record_locl.h ssl_locl.h
+record/rec_layer_d1.o: ../e_os.h ../include/openssl/asn1.h
+record/rec_layer_d1.o: ../include/openssl/bio.h ../include/openssl/bn.h
+record/rec_layer_d1.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+record/rec_layer_d1.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+record/rec_layer_d1.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+record/rec_layer_d1.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+record/rec_layer_d1.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+record/rec_layer_d1.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+record/rec_layer_d1.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/rec_layer_d1.o: ../include/openssl/objects.h
+record/rec_layer_d1.o: ../include/openssl/opensslconf.h
+record/rec_layer_d1.o: ../include/openssl/opensslv.h
+record/rec_layer_d1.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+record/rec_layer_d1.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+record/rec_layer_d1.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+record/rec_layer_d1.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+record/rec_layer_d1.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+record/rec_layer_d1.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+record/rec_layer_d1.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+record/rec_layer_d1.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+record/rec_layer_d1.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+record/rec_layer_d1.o: packet_locl.h record/rec_layer_d1.c record/record.h
+record/rec_layer_d1.o: record/record_locl.h ssl_locl.h
+record/rec_layer_s3.o: ../e_os.h ../include/openssl/asn1.h
+record/rec_layer_s3.o: ../include/openssl/bio.h ../include/openssl/bn.h
+record/rec_layer_s3.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+record/rec_layer_s3.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+record/rec_layer_s3.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+record/rec_layer_s3.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+record/rec_layer_s3.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+record/rec_layer_s3.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+record/rec_layer_s3.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/rec_layer_s3.o: ../include/openssl/objects.h
+record/rec_layer_s3.o: ../include/openssl/opensslconf.h
+record/rec_layer_s3.o: ../include/openssl/opensslv.h
+record/rec_layer_s3.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+record/rec_layer_s3.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+record/rec_layer_s3.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+record/rec_layer_s3.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+record/rec_layer_s3.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+record/rec_layer_s3.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+record/rec_layer_s3.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+record/rec_layer_s3.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+record/rec_layer_s3.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+record/rec_layer_s3.o: packet_locl.h record/rec_layer_s3.c record/record.h
+record/rec_layer_s3.o: record/record_locl.h ssl_locl.h
+record/ssl3_buffer.o: ../e_os.h ../include/openssl/asn1.h
+record/ssl3_buffer.o: ../include/openssl/bio.h ../include/openssl/bn.h
+record/ssl3_buffer.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+record/ssl3_buffer.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+record/ssl3_buffer.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+record/ssl3_buffer.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+record/ssl3_buffer.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+record/ssl3_buffer.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+record/ssl3_buffer.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/ssl3_buffer.o: ../include/openssl/objects.h
+record/ssl3_buffer.o: ../include/openssl/opensslconf.h
+record/ssl3_buffer.o: ../include/openssl/opensslv.h
+record/ssl3_buffer.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+record/ssl3_buffer.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+record/ssl3_buffer.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+record/ssl3_buffer.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+record/ssl3_buffer.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+record/ssl3_buffer.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+record/ssl3_buffer.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+record/ssl3_buffer.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+record/ssl3_buffer.o: ../include/openssl/x509_vfy.h packet_locl.h
+record/ssl3_buffer.o: record/record.h record/record_locl.h record/ssl3_buffer.c
+record/ssl3_buffer.o: ssl_locl.h
+record/ssl3_record.o: ../e_os.h ../include/internal/constant_time_locl.h
+record/ssl3_record.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+record/ssl3_record.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+record/ssl3_record.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+record/ssl3_record.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+record/ssl3_record.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+record/ssl3_record.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+record/ssl3_record.o: ../include/openssl/err.h ../include/openssl/evp.h
+record/ssl3_record.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+record/ssl3_record.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+record/ssl3_record.o: ../include/openssl/opensslconf.h
+record/ssl3_record.o: ../include/openssl/opensslv.h
+record/ssl3_record.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+record/ssl3_record.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+record/ssl3_record.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+record/ssl3_record.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+record/ssl3_record.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+record/ssl3_record.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+record/ssl3_record.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+record/ssl3_record.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+record/ssl3_record.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+record/ssl3_record.o: packet_locl.h record/record.h record/record_locl.h
+record/ssl3_record.o: record/ssl3_record.c ssl_locl.h
 s3_both.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 s3_both.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 s3_both.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -467,50 +517,6 @@ s3_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 s3_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 s3_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 s3_srvr.o: packet_locl.h record/record.h s3_srvr.c ssl_locl.h
-ssl3_buffer.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl3_buffer.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl3_buffer.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl3_buffer.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl3_buffer.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl3_buffer.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl3_buffer.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl3_buffer.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl3_buffer.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl3_buffer.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl3_buffer.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl3_buffer.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl3_buffer.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl3_buffer.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl3_buffer.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl3_buffer.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl3_buffer.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl3_buffer.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl3_buffer.o: ../include/openssl/x509_vfy.h record/../packet_locl.h
-ssl3_buffer.o: record/../record/record.h record/../ssl_locl.h
-ssl3_buffer.o: record/record_locl.h record/ssl3_buffer.c ssl3_buffer.c
-ssl3_record.o: ../e_os.h ../include/internal/constant_time_locl.h
-ssl3_record.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl3_record.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl3_record.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl3_record.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl3_record.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl3_record.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl3_record.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl3_record.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl3_record.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl3_record.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl3_record.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl3_record.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl3_record.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-ssl3_record.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl3_record.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-ssl3_record.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl3_record.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl3_record.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl3_record.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssl3_record.o: record/../packet_locl.h record/../record/record.h
-ssl3_record.o: record/../ssl_locl.h record/record_locl.h record/ssl3_record.c
-ssl3_record.o: ssl3_record.c
 ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 ssl_algs.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 ssl_algs.o: ../include/openssl/comp.h ../include/openssl/crypto.h
diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
index 7b58518..1d11b21 100644
--- a/ssl/ssl_asn1.c
+++ b/ssl/ssl_asn1.c
@@ -138,7 +138,7 @@ ASN1_SEQUENCE(SSL_SESSION_ASN1) = {
     ASN1_EXP_OPT(SSL_SESSION_ASN1, srp_username, ASN1_OCTET_STRING, 12),
 #endif
     ASN1_EXP_OPT(SSL_SESSION_ASN1, flags, ZLONG, 13)
-} ASN1_SEQUENCE_END(SSL_SESSION_ASN1)
+} static_ASN1_SEQUENCE_END(SSL_SESSION_ASN1)
 
 IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(SSL_SESSION_ASN1)
 
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index c84ea15..c5d4a8e 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -159,7 +159,7 @@
 # include <openssl/engine.h>
 #endif
 
-const char *SSL_version_str = OPENSSL_VERSION_TEXT;
+const char SSL_version_str[] = OPENSSL_VERSION_TEXT;
 
 SSL3_ENC_METHOD ssl3_undef_enc_method = {
     /*
diff --git a/test/Makefile b/test/Makefile
index 9ead38e..779d23a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -414,8 +414,7 @@ clienthellotest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 clienthellotest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 clienthellotest.o: clienthellotest.c
 constant_time_test.o: ../e_os.h ../include/internal/constant_time_locl.h
-constant_time_test.o: ../include/openssl/e_os2.h
-constant_time_test.o: ../include/openssl/opensslconf.h constant_time_test.c
+constant_time_test.o: constant_time_test.c
 destest.o: ../include/openssl/des.h ../include/openssl/e_os2.h
 destest.o: ../include/openssl/opensslconf.h destest.c
 dhtest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
@@ -680,8 +679,7 @@ ssltest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssltest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssltest.o: ../include/openssl/x509v3.h ../ssl/packet_locl.h
 ssltest.o: ../ssl/record/record.h ../ssl/ssl_locl.h ssltest.c
-testutil.o: ../e_os.h ../include/openssl/e_os2.h
-testutil.o: ../include/openssl/opensslconf.h testutil.c testutil.h
+testutil.o: ../e_os.h testutil.c testutil.h
 v3nametest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 v3nametest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
 v3nametest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
diff --git a/test/bntest.c b/test/bntest.c
index be358c8..9caa2c9 100644
--- a/test/bntest.c
+++ b/test/bntest.c
@@ -83,9 +83,9 @@
 
 #include "../crypto/bn/bn_lcl.h"
 
-const int num0 = 100;           /* number of tests */
-const int num1 = 50;            /* additional tests for some functions */
-const int num2 = 5;             /* number of tests for slow functions */
+static const int num0 = 100;           /* number of tests */
+static const int num1 = 50;            /* additional tests for some functions */
+static const int num2 = 5;             /* number of tests for slow functions */
 
 int test_add(BIO *bp);
 int test_sub(BIO *bp);
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index 2cf1725..9754869 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -107,8 +107,8 @@ int change_rand(void);
 int restore_rand(void);
 int fbytes(unsigned char *buf, int num);
 
-RAND_METHOD fake_rand;
-const RAND_METHOD *old_rand;
+static RAND_METHOD fake_rand;
+static const RAND_METHOD *old_rand;
 
 int change_rand(void)
 {
diff --git a/test/gost2814789test.c b/test/gost2814789test.c
index 953e1e1..56a8ae3 100644
--- a/test/gost2814789test.c
+++ b/test/gost2814789test.c
@@ -79,7 +79,7 @@ typedef struct g89_tc_ {
      */
 } g89_tc;
 
-const g89_tc tcs[] = {
+static const g89_tc tcs[] = {
     /*
      * GOST R 34.11-94 Test cases
      */
diff --git a/test/ideatest.c b/test/ideatest.c
index dd5d9ff..b522013 100644
--- a/test/ideatest.c
+++ b/test/ideatest.c
@@ -71,34 +71,34 @@ int main(int argc, char *argv[])
 #else
 # include <openssl/idea.h>
 
-unsigned char k[16] = {
+static const unsigned char k[16] = {
     0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04,
     0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08
 };
 
-unsigned char in[8] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03 };
-unsigned char c[8] = { 0x11, 0xFB, 0xED, 0x2B, 0x01, 0x98, 0x6D, 0xE5 };
+static const  unsigned char in[8] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03 };
+static const unsigned char c[8] = { 0x11, 0xFB, 0xED, 0x2B, 0x01, 0x98, 0x6D, 0xE5 };
 
-unsigned char out[80];
+static unsigned char out[80];
 
-char *text = "Hello to all people out there";
+static const char text[] = "Hello to all people out there";
 
-static unsigned char cfb_key[16] = {
+static const unsigned char cfb_key[16] = {
     0xe1, 0xf0, 0xc3, 0xd2, 0xa5, 0xb4, 0x87, 0x96,
     0x69, 0x78, 0x4b, 0x5a, 0x2d, 0x3c, 0x0f, 0x1e,
 };
-static unsigned char cfb_iv[80] =
+static const unsigned char cfb_iv[80] =
     { 0x34, 0x12, 0x78, 0x56, 0xab, 0x90, 0xef, 0xcd };
 static unsigned char cfb_buf1[40], cfb_buf2[40], cfb_tmp[8];
 # define CFB_TEST_SIZE 24
-static unsigned char plain[CFB_TEST_SIZE] = {
+static const unsigned char plain[CFB_TEST_SIZE] = {
     0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73,
     0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
     0x69, 0x6d, 0x65, 0x20, 0x66, 0x6f,
     0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20
 };
 
-static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
+static const unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
     0x59, 0xD8, 0xE2, 0x65, 0x00, 0x58, 0x6C, 0x3F,
     0x2C, 0x17, 0x25, 0xD0, 0x1A, 0x38, 0xB7, 0x2A,
     0x39, 0x61, 0x37, 0xDC, 0x79, 0xFB, 0x9F, 0x45
@@ -107,7 +107,7 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
     0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
 };
 
-static int cfb64_test(unsigned char *cfb_cipher);
+static int cfb64_test(const unsigned char *cfb_cipher);
 static char *pt(unsigned char *p);
 int main(int argc, char *argv[])
 {
@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
     EXIT(err);
 }
 
-static int cfb64_test(unsigned char *cfb_cipher)
+static int cfb64_test(const unsigned char *cfb_cipher)
 {
     IDEA_KEY_SCHEDULE eks, dks;
     int err = 0, i, n;
diff --git a/test/sha256t.c b/test/sha256t.c
index 0872f34..11f3684 100644
--- a/test/sha256t.c
+++ b/test/sha256t.c
@@ -10,42 +10,42 @@
 #include <openssl/sha.h>
 #include <openssl/evp.h>
 
-unsigned char app_b1[SHA256_DIGEST_LENGTH] = {
+static const unsigned char app_b1[SHA256_DIGEST_LENGTH] = {
     0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
     0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
     0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
     0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad
 };
 
-unsigned char app_b2[SHA256_DIGEST_LENGTH] = {
+static const unsigned char app_b2[SHA256_DIGEST_LENGTH] = {
     0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
     0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
     0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
     0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1
 };
 
-unsigned char app_b3[SHA256_DIGEST_LENGTH] = {
+static const unsigned char app_b3[SHA256_DIGEST_LENGTH] = {
     0xcd, 0xc7, 0x6e, 0x5c, 0x99, 0x14, 0xfb, 0x92,
     0x81, 0xa1, 0xc7, 0xe2, 0x84, 0xd7, 0x3e, 0x67,
     0xf1, 0x80, 0x9a, 0x48, 0xa4, 0x97, 0x20, 0x0e,
     0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0
 };
 
-unsigned char addenum_1[SHA224_DIGEST_LENGTH] = {
+static const unsigned char addenum_1[SHA224_DIGEST_LENGTH] = {
     0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
     0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
     0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
     0xe3, 0x6c, 0x9d, 0xa7
 };
 
-unsigned char addenum_2[SHA224_DIGEST_LENGTH] = {
+static const unsigned char addenum_2[SHA224_DIGEST_LENGTH] = {
     0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
     0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
     0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
     0x52, 0x52, 0x25, 0x25
 };
 
-unsigned char addenum_3[SHA224_DIGEST_LENGTH] = {
+static const unsigned char addenum_3[SHA224_DIGEST_LENGTH] = {
     0x20, 0x79, 0x46, 0x55, 0x98, 0x0c, 0x91, 0xd8,
     0xbb, 0xb4, 0xc1, 0xea, 0x97, 0x61, 0x8a, 0x4b,
     0xf0, 0x3f, 0x42, 0x58, 0x19, 0x48, 0xb2, 0xee,
diff --git a/test/sha512t.c b/test/sha512t.c
index a4d4b5e..f60d319 100644
--- a/test/sha512t.c
+++ b/test/sha512t.c
@@ -11,7 +11,7 @@
 #include <openssl/evp.h>
 #include <openssl/crypto.h>
 
-unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
+static const unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
     0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
     0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
     0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
@@ -22,7 +22,7 @@ unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
     0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f
 };
 
-unsigned char app_c2[SHA512_DIGEST_LENGTH] = {
+static const unsigned char app_c2[SHA512_DIGEST_LENGTH] = {
     0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
     0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
     0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
@@ -33,7 +33,7 @@ unsigned char app_c2[SHA512_DIGEST_LENGTH] = {
     0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09
 };
 
-unsigned char app_c3[SHA512_DIGEST_LENGTH] = {
+static const unsigned char app_c3[SHA512_DIGEST_LENGTH] = {
     0xe7, 0x18, 0x48, 0x3d, 0x0c, 0xe7, 0x69, 0x64,
     0x4e, 0x2e, 0x42, 0xc7, 0xbc, 0x15, 0xb4, 0x63,
     0x8e, 0x1f, 0x98, 0xb1, 0x3b, 0x20, 0x44, 0x28,
@@ -44,7 +44,7 @@ unsigned char app_c3[SHA512_DIGEST_LENGTH] = {
     0x4e, 0xad, 0xb2, 0x17, 0xad, 0x8c, 0xc0, 0x9b
 };
 
-unsigned char app_d1[SHA384_DIGEST_LENGTH] = {
+static const unsigned char app_d1[SHA384_DIGEST_LENGTH] = {
     0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
     0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
     0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
@@ -53,7 +53,7 @@ unsigned char app_d1[SHA384_DIGEST_LENGTH] = {
     0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7
 };
 
-unsigned char app_d2[SHA384_DIGEST_LENGTH] = {
+static const unsigned char app_d2[SHA384_DIGEST_LENGTH] = {
     0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
     0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
     0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
@@ -62,7 +62,7 @@ unsigned char app_d2[SHA384_DIGEST_LENGTH] = {
     0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39
 };
 
-unsigned char app_d3[SHA384_DIGEST_LENGTH] = {
+static const unsigned char app_d3[SHA384_DIGEST_LENGTH] = {
     0x9d, 0x0e, 0x18, 0x09, 0x71, 0x64, 0x74, 0xcb,
     0x08, 0x6e, 0x83, 0x4e, 0x31, 0x0a, 0x4a, 0x1c,
     0xed, 0x14, 0x9e, 0x9c, 0x00, 0xf2, 0x48, 0x52,
diff --git a/test/ssltest.c b/test/ssltest.c
index 4959aed..e951788 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -288,9 +288,9 @@ static BIO *bio_stdout = NULL;
 #ifndef OPENSSL_NO_NEXTPROTONEG
 /* Note that this code assumes that this is only a one element list: */
 static const char NEXT_PROTO_STRING[] = "\x09testproto";
-int npn_client = 0;
-int npn_server = 0;
-int npn_server_reject = 0;
+static int npn_client = 0;
+static int npn_server = 0;
+static int npn_server_reject = 0;
 
 static int cb_client_npn(SSL *s, unsigned char **out, unsigned char *outlen,
                          const unsigned char *in, unsigned int inlen,
@@ -500,24 +500,24 @@ static int verify_alpn(SSL *client, SSL *server)
 #define CUSTOM_EXT_TYPE_2 1002
 #define CUSTOM_EXT_TYPE_3 1003
 
-const char custom_ext_cli_string[] = "abc";
-const char custom_ext_srv_string[] = "defg";
+static const char custom_ext_cli_string[] = "abc";
+static const char custom_ext_srv_string[] = "defg";
 
 /* These set from cmdline */
-char *serverinfo_file = NULL;
-int serverinfo_sct = 0;
-int serverinfo_tack = 0;
+static char *serverinfo_file = NULL;
+static int serverinfo_sct = 0;
+static int serverinfo_tack = 0;
 
 /* These set based on extension callbacks */
-int serverinfo_sct_seen = 0;
-int serverinfo_tack_seen = 0;
-int serverinfo_other_seen = 0;
+static int serverinfo_sct_seen = 0;
+static int serverinfo_tack_seen = 0;
+static int serverinfo_other_seen = 0;
 
 /* This set from cmdline */
-int custom_ext = 0;
+static int custom_ext = 0;
 
 /* This set based on extension callbacks */
-int custom_ext_error = 0;
+static int custom_ext_error = 0;
 
 static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type,
                                    const unsigned char *in, size_t inlen,
diff --git a/test/wp_test.c b/test/wp_test.c
index 2ea6251..de7aa3d 100644
--- a/test/wp_test.c
+++ b/test/wp_test.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
 #else
 
 /* ISO/IEC 10118-3 test vector set */
-unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
     0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
     0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
     0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
@@ -29,7 +29,7 @@ unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
     0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3
 };
 
-unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
     0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
     0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
     0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
@@ -40,7 +40,7 @@ unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
     0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A
 };
 
-unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
     0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
     0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
     0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
@@ -51,7 +51,7 @@ unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
     0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5
 };
 
-unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
     0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
     0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
     0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
@@ -62,7 +62,7 @@ unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
     0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E
 };
 
-unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
     0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
     0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
     0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
@@ -73,7 +73,7 @@ unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
     0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B
 };
 
-unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
     0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
     0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
     0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
@@ -84,7 +84,7 @@ unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
     0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67
 };
 
-unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
     0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
     0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
     0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
@@ -95,7 +95,7 @@ unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
     0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B
 };
 
-unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
     0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
     0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
     0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
@@ -106,7 +106,7 @@ unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
     0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD
 };
 
-unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = {
+static const unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = {
     0x0C, 0x99, 0x00, 0x5B, 0xEB, 0x57, 0xEF, 0xF5,
     0x0A, 0x7C, 0xF0, 0x05, 0x56, 0x0D, 0xDF, 0x5D,
     0x29, 0x05, 0x7F, 0xD8, 0x6B, 0x20, 0xBF, 0xD6,


More information about the openssl-commits mailing list