[openssl-commits] [openssl] master update

paul.dale at oracle.com paul.dale at oracle.com
Tue Aug 29 21:22:07 UTC 2017


The branch master has been updated
       via  198c42f5af0d2cc0eb4789c7597b68b6b10cc97a (commit)
       via  07016a8a3174db5caf07182930533cf88ad9b0ad (commit)
       via  9590da2cd67ae23588568c57556d6140fb86f892 (commit)
       via  cd420b0b1f2336972e386eba1cccf23b47d99538 (commit)
       via  677963e5a428739062ab5d46d5baed5eadd0195d (commit)
      from  58891025eff2fb42a6a5cf2fa861d46308826d07 (commit)


- Log -----------------------------------------------------------------
commit 198c42f5af0d2cc0eb4789c7597b68b6b10cc97a
Author: Pauli <paul.dale at oracle.com>
Date:   Thu Aug 24 09:14:10 2017 +1000

    Move OPENSSL_CONF from e_os.h to cryptlib.h
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4188)

commit 07016a8a3174db5caf07182930533cf88ad9b0ad
Author: Pauli <paul.dale at oracle.com>
Date:   Thu Aug 24 09:05:07 2017 +1000

    Move e_os.h to be the very first include.
    cryptilib.h is the second.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4188)

commit 9590da2cd67ae23588568c57556d6140fb86f892
Author: Pauli <paul.dale at oracle.com>
Date:   Tue Aug 22 07:29:41 2017 +1000

    Remove the X_OK define, it is unused.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4188)

commit cd420b0b1f2336972e386eba1cccf23b47d99538
Author: Pauli <paul.dale at oracle.com>
Date:   Tue Aug 22 07:17:35 2017 +1000

    Move the REF_PRINT support from e_os.h to internal/refcount.h.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4188)

commit 677963e5a428739062ab5d46d5baed5eadd0195d
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Aug 18 13:52:46 2017 +1000

    e_os.h removal from other headers and source files.
    
    Removed e_os.h from all bar three headers (apps/apps.h crypto/bio/bio_lcl.h and
    ssl/ssl_locl.h).
    
    Added e_os.h into the files that need it now.
    
    Directly reference internal/nelem.h when required.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4188)

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

Summary of changes:
 apps/apps.h                     |  3 ++-
 apps/ca.c                       |  1 -
 apps/openssl.c                  |  1 +
 apps/s_client.c                 |  2 +-
 crypto/asn1/ameth_lib.c         |  5 +++--
 crypto/asn1/tasn_utl.c          |  3 ++-
 crypto/async/arch/async_posix.h |  1 -
 crypto/bio/bss_bio.c            |  5 ++---
 crypto/blake2/blake2_impl.h     |  3 +--
 crypto/blake2/blake2_locl.h     |  3 +--
 crypto/blake2/blake2b.c         |  3 +--
 crypto/blake2/blake2s.c         |  3 +--
 crypto/bn/bn_dh.c               |  4 ++--
 crypto/bn/bn_srp.c              |  4 ++--
 crypto/cast/cast_lcl.h          |  4 +---
 crypto/conf/conf_api.c          |  2 +-
 crypto/conf/conf_lib.c          |  2 +-
 crypto/conf/conf_mod.c          |  2 +-
 crypto/cryptlib.c               |  3 ++-
 crypto/des/cfb64ede.c           |  3 +--
 crypto/dh/dh_lib.c              |  1 +
 crypto/dllmain.c                |  3 ++-
 crypto/dsa/dsa_lib.c            |  3 ++-
 crypto/dso/dso_lib.c            |  3 ++-
 crypto/dso/dso_win32.c          |  3 ++-
 crypto/ec/ec_asn1.c             |  1 +
 crypto/ec/ec_curve.c            |  2 +-
 crypto/ec/ec_key.c              |  3 ++-
 crypto/ec/ec_lcl.h              |  4 +---
 crypto/ec/ec_mult.c             |  3 ++-
 crypto/ec/ecp_nistz256.c        |  3 ++-
 crypto/engine/eng_devcrypto.c   |  3 +--
 crypto/engine/eng_init.c        |  3 ++-
 crypto/engine/eng_lib.c         |  1 +
 crypto/engine/tb_asnmth.c       |  3 ++-
 crypto/evp/p_lib.c              |  1 +
 crypto/init.c                   |  1 +
 crypto/mem.c                    |  5 +++--
 crypto/mem_sec.c                |  2 +-
 crypto/o_dir.c                  |  2 +-
 crypto/o_str.c                  |  2 +-
 crypto/objects/obj_xref.c       |  4 ++--
 crypto/ocsp/ocsp_ht.c           |  2 +-
 crypto/rand/rand_unix.c         |  3 +--
 crypto/rsa/rsa_lib.c            |  1 +
 crypto/store/loader_file.c      |  3 +--
 crypto/store/store_lib.c        |  4 +---
 crypto/ui/ui_openssl.c          |  3 ++-
 crypto/x509/by_dir.c            |  4 ++--
 crypto/x509/x509_lu.c           |  1 +
 crypto/x509/x509_set.c          |  3 ++-
 crypto/x509/x509cset.c          |  3 ++-
 crypto/x509v3/v3_ncons.c        |  5 +++--
 crypto/x509v3/v3_tlsf.c         |  5 +++--
 crypto/x509v3/v3_utl.c          |  3 ++-
 e_os.h                          | 23 +----------------------
 include/internal/cryptlib.h     |  7 ++++---
 include/internal/refcount.h     | 22 ++++++++++++++++++++++
 ssl/d1_lib.c                    |  3 ++-
 ssl/record/rec_layer_s3.c       |  2 +-
 ssl/s3_lib.c                    |  1 +
 ssl/ssl_cert.c                  |  3 ++-
 ssl/ssl_ciph.c                  |  1 +
 ssl/ssl_conf.c                  |  3 ++-
 ssl/ssl_lib.c                   |  3 ++-
 ssl/ssl_locl.h                  |  2 +-
 ssl/ssl_sess.c                  |  3 ++-
 ssl/statem/extensions.c         |  1 +
 ssl/statem/statem.c             |  3 ++-
 ssl/t1_lib.c                    |  3 ++-
 test/bftest.c                   |  1 +
 test/bntest.c                   |  2 +-
 test/ctype_internal_test.c      |  2 +-
 test/ssl_test_ctx.c             |  2 +-
 test/ssltest_old.c              |  4 ++--
 test/tls13encryptiontest.c      |  1 +
 test/v3nametest.c               |  2 +-
 77 files changed, 136 insertions(+), 111 deletions(-)

diff --git a/apps/apps.h b/apps/apps.h
index fdf316a..c208c19 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -11,6 +11,7 @@
 # define HEADER_APPS_H
 
 # include "e_os.h"
+# include "internal/nelem.h"
 # if defined(__unix) || defined(__unix__)
 #  include <sys/time.h> /* struct timeval for DTLS */
 # endif
diff --git a/apps/ca.c b/apps/ca.c
index 436aa85..976f6bb 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -38,7 +38,6 @@
 
 #ifndef W_OK
 # define F_OK 0
-# define X_OK 1
 # define W_OK 2
 # define R_OK 4
 #endif
diff --git a/apps/openssl.c b/apps/openssl.c
index c23cd4b..3b347ba 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include <internal/cryptlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/apps/s_client.c b/apps/s_client.c
index 5f7b31c..5a4a2f6 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -8,12 +8,12 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include "e_os.h"
 #include <openssl/e_os2.h>
 
 #ifndef OPENSSL_NO_SOCK
diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c
index c677917..82868e1 100644
--- a/crypto/asn1/ameth_lib.c
+++ b/crypto/asn1/ameth_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,8 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
+#include "e_os.h"               /* for strncasecmp */
 #include "internal/cryptlib.h"
+#include <stdio.h>
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/engine.h>
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c
index 9fc4cc2..cf434aa 100644
--- a/crypto/asn1/tasn_utl.c
+++ b/crypto/asn1/tasn_utl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -10,6 +10,7 @@
 #include <stddef.h>
 #include <string.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
diff --git a/crypto/async/arch/async_posix.h b/crypto/async/arch/async_posix.h
index 3c61f7f..4d88bd1 100644
--- a/crypto/async/arch/async_posix.h
+++ b/crypto/async/arch/async_posix.h
@@ -26,7 +26,6 @@
 
 #  include <ucontext.h>
 #  include <setjmp.h>
-#  include "e_os.h"
 
 typedef struct async_fibre_st {
     ucontext_t fibre;
diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c
index 9fa4760..e34382c 100644
--- a/crypto/bio/bss_bio.c
+++ b/crypto/bio/bss_bio.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -15,6 +15,7 @@
  * See ssl/ssltest.c for some hints on how this can be used.
  */
 
+#include "e_os.h"
 #include <assert.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -24,8 +25,6 @@
 #include <openssl/err.h>
 #include <openssl/crypto.h>
 
-#include "e_os.h"
-
 static int bio_new(BIO *bio);
 static int bio_free(BIO *bio);
 static int bio_read(BIO *bio, char *buf, int size);
diff --git a/crypto/blake2/blake2_impl.h b/crypto/blake2/blake2_impl.h
index 8fe5c95..80b717e 100644
--- a/crypto/blake2/blake2_impl.h
+++ b/crypto/blake2/blake2_impl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -15,7 +15,6 @@
  */
 
 #include <string.h>
-#include "e_os.h"
 
 static ossl_inline uint32_t load32(const uint8_t *src)
 {
diff --git a/crypto/blake2/blake2_locl.h b/crypto/blake2/blake2_locl.h
index fb7beb9..926bae9 100644
--- a/crypto/blake2/blake2_locl.h
+++ b/crypto/blake2/blake2_locl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -15,7 +15,6 @@
  */
 
 #include <stddef.h>
-#include "e_os.h"
 
 #define BLAKE2S_BLOCKBYTES    64
 #define BLAKE2S_OUTBYTES      32
diff --git a/crypto/blake2/blake2b.c b/crypto/blake2/blake2b.c
index e77bd9a..829ba5b 100644
--- a/crypto/blake2/blake2b.c
+++ b/crypto/blake2/blake2b.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -17,7 +17,6 @@
 #include <assert.h>
 #include <string.h>
 #include <openssl/crypto.h>
-#include "e_os.h"
 
 #include "blake2_locl.h"
 #include "blake2_impl.h"
diff --git a/crypto/blake2/blake2s.c b/crypto/blake2/blake2s.c
index 7451b14..8211374 100644
--- a/crypto/blake2/blake2s.c
+++ b/crypto/blake2/blake2s.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -17,7 +17,6 @@
 #include <assert.h>
 #include <string.h>
 #include <openssl/crypto.h>
-#include "e_os.h"
 
 #include "blake2_locl.h"
 #include "blake2_impl.h"
diff --git a/crypto/bn/bn_dh.c b/crypto/bn/bn_dh.c
index 17d0559..75d6915 100644
--- a/crypto/bn/bn_dh.c
+++ b/crypto/bn/bn_dh.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -8,7 +8,7 @@
  */
 
 #include "bn_lcl.h"
-#include "e_os.h"
+#include "internal/nelem.h"
 
 #ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
diff --git a/crypto/bn/bn_srp.c b/crypto/bn/bn_srp.c
index a68a4ac..27b6ebe 100644
--- a/crypto/bn/bn_srp.c
+++ b/crypto/bn/bn_srp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -8,7 +8,7 @@
  */
 
 #include "bn_lcl.h"
-#include "e_os.h"
+#include "internal/nelem.h"
 
 #ifndef OPENSSL_NO_SRP
 
diff --git a/crypto/cast/cast_lcl.h b/crypto/cast/cast_lcl.h
index e8cf322..35e8993 100644
--- a/crypto/cast/cast_lcl.h
+++ b/crypto/cast/cast_lcl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,8 +7,6 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "e_os.h"
-
 #ifdef OPENSSL_SYS_WIN32
 # include <stdlib.h>
 #endif
diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c
index 6026dca..6f8947d 100644
--- a/crypto/conf/conf_api.c
+++ b/crypto/conf/conf_api.c
@@ -9,11 +9,11 @@
 
 /* Part of the code in here was originally in conf.c, which is now removed */
 
+#include "e_os.h"
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/conf.h>
 #include <openssl/conf_api.h>
-#include "e_os.h"
 
 static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf);
 static void value_free_stack_doall(CONF_VALUE *a);
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
index 74759c5..06bb3f7 100644
--- a/crypto/conf/conf_lib.c
+++ b/crypto/conf/conf_lib.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <stdio.h>
 #include <string.h>
 #include "internal/conf.h"
@@ -15,7 +16,6 @@
 #include <openssl/conf.h>
 #include <openssl/conf_api.h>
 #include <openssl/lhash.h>
-#include "e_os.h"
 
 static CONF_METHOD *default_CONF_method = NULL;
 
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index 932c69d..7622d8e 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -7,10 +7,10 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "internal/cryptlib.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <openssl/crypto.h>
-#include "internal/cryptlib.h"
 #include "internal/conf.h"
 #include "internal/dso.h"
 #include <openssl/x509.h>
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 4fe6a45..6e45b0d 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1998-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -8,6 +8,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "internal/cryptlib_int.h"
 #include <openssl/safestack.h>
 
diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c
index 5edb979..21943f6 100644
--- a/crypto/des/cfb64ede.c
+++ b/crypto/des/cfb64ede.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -8,7 +8,6 @@
  */
 
 #include "des_locl.h"
-#include "e_os.h"
 
 /*
  * The input and output encrypted as though 64bit cfb mode is being used.
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index f22bcf0..4530ce7 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -9,6 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include "dh_locl.h"
 #include <openssl/engine.h>
diff --git a/crypto/dllmain.c b/crypto/dllmain.c
index 91904aa..b0459c2 100644
--- a/crypto/dllmain.c
+++ b/crypto/dllmain.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "internal/cryptlib_int.h"
 
 #if defined(_WIN32) || defined(__CYGWIN__)
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index c90d09b..caaa65c 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include "dsa_locl.h"
 #include <openssl/asn1.h>
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index ec3c59a..3c83ab8 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -8,6 +8,7 @@
  */
 
 #include "dso_locl.h"
+#include "internal/refcount.h"
 
 static DSO_METHOD *default_DSO_meth = NULL;
 
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index 829f1b8..635974b 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "dso_locl.h"
 
 #if defined(DSO_WIN32)
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index d57f3b4..5e3fbe8 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -12,6 +12,7 @@
 #include <openssl/err.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
+#include "internal/nelem.h"
 
 int EC_GROUP_get_basis_type(const EC_GROUP *group)
 {
diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c
index b9eb993..99288fe 100644
--- a/crypto/ec/ec_curve.c
+++ b/crypto/ec/ec_curve.c
@@ -13,7 +13,7 @@
 #include <openssl/err.h>
 #include <openssl/obj_mac.h>
 #include <openssl/opensslconf.h>
-#include "e_os.h"
+#include "internal/nelem.h"
 
 typedef struct {
     int field_type,             /* either NID_X9_62_prime_field or
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 6aa204e..3874553 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -11,6 +11,7 @@
 #include "internal/cryptlib.h"
 #include <string.h>
 #include "ec_lcl.h"
+#include "internal/refcount.h"
 #include <openssl/err.h>
 #include <openssl/engine.h>
 
diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h
index 4b65c32..6cc0190 100644
--- a/crypto/ec/ec_lcl.h
+++ b/crypto/ec/ec_lcl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -15,8 +15,6 @@
 #include <openssl/bn.h>
 #include "internal/refcount.h"
 
-#include "e_os.h"
-
 #if defined(__SUNPRO_C)
 # if __SUNPRO_C >= 0x520
 #  pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c
index 308cb52..c755788 100644
--- a/crypto/ec/ec_mult.c
+++ b/crypto/ec/ec_mult.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -14,6 +14,7 @@
 #include "internal/cryptlib.h"
 #include "internal/bn_int.h"
 #include "ec_lcl.h"
+#include "internal/refcount.h"
 
 /*
  * This file implements the wNAF-based interleaving multi-exponentiation method
diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c
index 16557d7..3863a61 100644
--- a/crypto/ec/ecp_nistz256.c
+++ b/crypto/ec/ecp_nistz256.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2014, Intel Corporation. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -21,6 +21,7 @@
 #include "internal/cryptlib.h"
 #include "internal/bn_int.h"
 #include "ec_lcl.h"
+#include "internal/refcount.h"
 
 #if BN_BITS2 != 64
 # define TOBN(hi,lo)    lo,hi
diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c
index 19781b8..f2196b4 100644
--- a/crypto/engine/eng_devcrypto.c
+++ b/crypto/engine/eng_devcrypto.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -15,8 +16,6 @@
 #include <unistd.h>
 #include <assert.h>
 
-#include "e_os.h"
-
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include <openssl/engine.h>
diff --git a/crypto/engine/eng_init.c b/crypto/engine/eng_init.c
index 8be7c6f..7c235fc 100644
--- a/crypto/engine/eng_init.c
+++ b/crypto/engine/eng_init.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "eng_int.h"
 
 /*
diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c
index 6f422bd..c060a5d 100644
--- a/crypto/engine/eng_lib.c
+++ b/crypto/engine/eng_lib.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "eng_int.h"
 #include <openssl/rand.h>
 #include "internal/refcount.h"
diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c
index 480267d..bc6e91c 100644
--- a/crypto/engine/tb_asnmth.c
+++ b/crypto/engine/tb_asnmth.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "eng_int.h"
 #include <openssl/evp.h>
 #include "internal/asn1_int.h"
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index b5e5206..7453937 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -9,6 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include <openssl/err.h>
 #include <openssl/objects.h>
diff --git a/crypto/init.c b/crypto/init.c
index ccfd003..074e683 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include "internal/cryptlib_int.h"
 #include <openssl/err.h>
 #include "internal/rand_int.h"
diff --git a/crypto/mem.c b/crypto/mem.c
index 947c50e..c171ae4 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -7,12 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
+#include "internal/cryptlib.h"
+#include "internal/cryptlib_int.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <openssl/crypto.h>
-#include "internal/cryptlib.h"
-#include "internal/cryptlib_int.h"
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
 # include <execinfo.h>
 #endif
diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c
index 703ddad..f847024 100644
--- a/crypto/mem_sec.c
+++ b/crypto/mem_sec.c
@@ -15,8 +15,8 @@
  * For details on that implementation, see below (look for uppercase
  * "SECURE HEAP IMPLEMENTATION").
  */
-#include <openssl/crypto.h>
 #include "e_os.h"
+#include <openssl/crypto.h>
 
 #include <string.h>
 
diff --git a/crypto/o_dir.c b/crypto/o_dir.c
index 459ce9c..fca9c75 100644
--- a/crypto/o_dir.c
+++ b/crypto/o_dir.c
@@ -7,8 +7,8 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <errno.h>
 #include "e_os.h"
+#include <errno.h>
 
 /*
  * The routines really come from the Levitte Programming, so to make life
diff --git a/crypto/o_str.c b/crypto/o_str.c
index be130ce..cf098fc 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -7,8 +7,8 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <limits.h>
 #include "e_os.h"
+#include <limits.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
 #include "internal/o_str.h"
diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c
index 9a558a2..05a5c86 100644
--- a/crypto/objects/obj_xref.c
+++ b/crypto/objects/obj_xref.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -9,7 +9,7 @@
 
 #include <openssl/objects.h>
 #include "obj_xref.h"
-#include "e_os.h"
+#include "internal/nelem.h"
 
 static STACK_OF(nid_triple) *sig_app, *sigx_app;
 
diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c
index ef84a2d..42c3686 100644
--- a/crypto/ocsp/ocsp_ht.c
+++ b/crypto/ocsp/ocsp_ht.c
@@ -7,11 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "internal/ctype.h"
 #include <string.h>
-#include "e_os.h"
 #include <openssl/asn1.h>
 #include <openssl/ocsp.h>
 #include <openssl/err.h>
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 4f01e8a..08ea55f 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -7,9 +7,8 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-
 #include "e_os.h"
+#include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include "rand_lcl.h"
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 7a1d81c..45ec813 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/lhash.h>
 #include "internal/bn_int.h"
 #include <openssl/engine.h>
diff --git a/crypto/store/loader_file.c b/crypto/store/loader_file.c
index f6cb928..1c794ef 100644
--- a/crypto/store/loader_file.c
+++ b/crypto/store/loader_file.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <string.h>
 #include <sys/stat.h>
 #include <assert.h>
@@ -29,8 +30,6 @@
 #include "internal/store_int.h"
 #include "store_locl.h"
 
-#include "e_os.h"
-
 #ifdef _WIN32
 # define stat    _stat
 #endif
diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c
index 6f789eb..2cc247d 100644
--- a/crypto/store/store_lib.c
+++ b/crypto/store/store_lib.c
@@ -7,11 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <stdlib.h>
 #include <string.h>
-
-#include "e_os.h"
-
 #include <openssl/crypto.h>
 #include <openssl/err.h>
 #include <openssl/store.h>
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index 977c7ad..3b74e6b 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <openssl/e_os2.h>
 #include <openssl/err.h>
 #include <openssl/ui.h>
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index d814297..8476f00 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -7,13 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
+#include "internal/cryptlib.h"
 #include <stdio.h>
 #include <time.h>
 #include <errno.h>
 #include <sys/types.h>
 
-#include "internal/cryptlib.h"
-
 #ifndef OPENSSL_NO_POSIX_IO
 # include <sys/stat.h>
 #endif
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index e64fda2..f45b061 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -9,6 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/lhash.h>
 #include <openssl/x509.h>
 #include "internal/x509_int.h"
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c
index 08b71ff..c634670 100644
--- a/crypto/x509/x509_set.c
+++ b/crypto/x509/x509_set.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -9,6 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c
index 3c9c322..c870f39 100644
--- a/crypto/x509/x509cset.c
+++ b/crypto/x509/x509cset.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -9,6 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
diff --git a/crypto/x509v3/v3_ncons.c b/crypto/x509v3/v3_ncons.c
index 36ff966..7731bac 100644
--- a/crypto/x509v3/v3_ncons.c
+++ b/crypto/x509v3/v3_ncons.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2003-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,8 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
+#include "e_os.h"               /* for strncasecmp */
 #include "internal/cryptlib.h"
+#include <stdio.h>
 #include "internal/asn1_int.h"
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
diff --git a/crypto/x509v3/v3_tlsf.c b/crypto/x509v3/v3_tlsf.c
index fec6724..5f2d5d2 100644
--- a/crypto/x509v3/v3_tlsf.c
+++ b/crypto/x509v3/v3_tlsf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,8 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
+#include "e_os.h"
 #include "internal/cryptlib.h"
+#include <stdio.h>
 #include "internal/o_str.h"
 #include <openssl/asn1t.h>
 #include <openssl/conf.h>
diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c
index a10722c..8bba5a6 100644
--- a/crypto/x509v3/v3_utl.c
+++ b/crypto/x509v3/v3_utl.c
@@ -9,9 +9,10 @@
 
 /* X509 v3 extension utilities */
 
+#include "e_os.h"
+#include "internal/cryptlib.h"
 #include <stdio.h>
 #include "internal/ctype.h"
-#include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
 #include "internal/x509_int.h"
diff --git a/e_os.h b/e_os.h
index 2310e32..c1b9350 100644
--- a/e_os.h
+++ b/e_os.h
@@ -10,6 +10,7 @@
 #ifndef HEADER_E_OS_H
 # define HEADER_E_OS_H
 
+# include <limits.h>
 # include <openssl/opensslconf.h>
 
 # include <openssl/e_os2.h>
@@ -25,13 +26,6 @@
 extern "C" {
 #endif
 
-/* Used to checking reference counts, most while doing perl5 stuff :-) */
-# if defined(OPENSSL_NO_STDIO)
-#  if defined(REF_PRINT)
-#   error "REF_PRINT requires stdio"
-#  endif
-# endif
-
 /*
  * Format specifier for printing size_t. Original conundrum was to
  * get it working with -Wformat [-Werror], which can be considered
@@ -59,21 +53,6 @@ extern "C" {
                              * stand for in ILP32 and LP64 */
 # endif
 
-# if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO)
-#  define REF_ASSERT_ISNT(test) \
-    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
-# else
-#  define REF_ASSERT_ISNT(i)
-# endif
-# ifdef REF_PRINT
-#  define REF_PRINT_COUNT(a, b) \
-        fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
-# else
-#  define REF_PRINT_COUNT(a, b)
-# endif
-
-# define OPENSSL_CONF        "openssl.cnf"
-
 # ifndef DEVRANDOM
 /*
  * set this to a comma-separated list of 'random' device files to try out. By
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index c73c754..5f2cb44 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -13,8 +13,6 @@
 # include <stdlib.h>
 # include <string.h>
 
-# include "e_os.h"
-
 # ifdef OPENSSL_USE_APPLINK
 #  undef BIO_FLAGS_UPLINK
 #  define BIO_FLAGS_UPLINK 0x8000
@@ -25,6 +23,7 @@
 # include <openssl/buffer.h>
 # include <openssl/bio.h>
 # include <openssl/err.h>
+# include "internal/nelem.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -56,6 +55,8 @@ typedef struct app_mem_info_st APP_INFO;
 typedef struct mem_st MEM;
 DEFINE_LHASH_OF(MEM);
 
+# define OPENSSL_CONF             "openssl.cnf"
+
 # ifndef OPENSSL_SYS_VMS
 #  define X509_CERT_AREA          OPENSSLDIR
 #  define X509_CERT_DIR           OPENSSLDIR "/certs"
diff --git a/include/internal/refcount.h b/include/internal/refcount.h
index 591561f..c1663a0 100644
--- a/include/internal/refcount.h
+++ b/include/internal/refcount.h
@@ -9,6 +9,13 @@
 #ifndef HEADER_INTERNAL_REFCOUNT_H
 # define HEADER_INTERNAL_REFCOUNT_H
 
+/* Used to checking reference counts, most while doing perl5 stuff :-) */
+# if defined(OPENSSL_NO_STDIO)
+#  if defined(REF_PRINT)
+#   error "REF_PRINT requires stdio"
+#  endif
+# endif
+
 # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
      && !defined(__STDC_NO_ATOMICS__)
 # include <stdatomic.h>
@@ -64,4 +71,19 @@ typedef int CRYPTO_REF_COUNT;
 # define CRYPTO_DOWN_REF(val, ret, lock) CRYPTO_atomic_add(val, -1, ret, lock)
 
 # endif
+
+# if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO)
+#  define REF_ASSERT_ISNT(test) \
+    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
+# else
+#  define REF_ASSERT_ISNT(i)
+# endif
+
+# ifdef REF_PRINT
+#  define REF_PRINT_COUNT(a, b) \
+        fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
+# else
+#  define REF_PRINT_COUNT(a, b)
+# endif
+
 #endif
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c
index dd62e0c..6c594a2 100644
--- a/ssl/d1_lib.c
+++ b/ssl/d1_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2005-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
 #include <stdio.h>
 #include <openssl/objects.h>
 #include <openssl/rand.h>
diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
index d1dfb92..aec5687 100644
--- a/ssl/record/rec_layer_s3.c
+++ b/ssl/record/rec_layer_s3.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index fdccdb7..c9371af 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <openssl/objects.h>
+#include "internal/nelem.h"
 #include "ssl_locl.h"
 #include <openssl/md5.h>
 #include <openssl/dh.h>
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index a0dd878..ba5fb65 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 
-#include "e_os.h"
+#include "internal/nelem.h"
 #include "internal/o_dir.h"
 #include <openssl/lhash.h>
 #include <openssl/bio.h>
@@ -20,6 +20,7 @@
 #include <openssl/dh.h>
 #include <openssl/bn.h>
 #include <openssl/crypto.h>
+#include "internal/refcount.h"
 #include "ssl_locl.h"
 #include "ssl_cert_table.h"
 #include "internal/thread_once.h"
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 60e1308..17bd939 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -15,6 +15,7 @@
 #include <openssl/comp.h>
 #include <openssl/engine.h>
 #include <openssl/crypto.h>
+#include "internal/nelem.h"
 #include "ssl_locl.h"
 #include "internal/thread_once.h"
 #include "internal/cryptlib.h"
diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
index 6dd5922..1a8dc15 100644
--- a/ssl/ssl_conf.c
+++ b/ssl/ssl_conf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2012-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -12,6 +12,7 @@
 #include <openssl/conf.h>
 #include <openssl/objects.h>
 #include <openssl/dh.h>
+#include "internal/nelem.h"
 
 /*
  * structure holding name tables. This is used for permitted elements in lists
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 501a12c..cac8820 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  * Copyright 2005 Nokia. All rights reserved.
  *
@@ -22,6 +22,7 @@
 #include <openssl/ct.h>
 #include "internal/cryptlib.h"
 #include "internal/rand.h"
+#include "internal/refcount.h"
 
 const char SSL_version_str[] = OPENSSL_VERSION_TEXT;
 
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index f14148a..f3fc5bc 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -11,12 +11,12 @@
 
 #ifndef HEADER_SSL_LOCL_H
 # define HEADER_SSL_LOCL_H
+# include "e_os.h"              /* struct timeval for Windows */
 # include <stdlib.h>
 # include <time.h>
 # include <string.h>
 # include <errno.h>
 
-# include "e_os.h"
 # if defined(__unix) || defined(__unix__)
 #  include <sys/time.h>         /* struct timeval for DTLS */
 # endif
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index efba707..575cd70 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2005 Nokia. All rights reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
@@ -12,6 +12,7 @@
 #include <openssl/lhash.h>
 #include <openssl/rand.h>
 #include <openssl/engine.h>
+#include "internal/refcount.h"
 #include "ssl_locl.h"
 #include "statem/statem_locl.h"
 
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c
index d569f6c..c435405 100644
--- a/ssl/statem/extensions.c
+++ b/ssl/statem/extensions.c
@@ -8,6 +8,7 @@
  */
 
 #include <string.h>
+#include "internal/nelem.h"
 #include "../ssl_locl.h"
 #include "statem_locl.h"
 
diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c
index 4f259fd..0f34522 100644
--- a/ssl/statem/statem.c
+++ b/ssl/statem/statem.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include "../ssl_locl.h"
 #include "statem_locl.h"
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 02ed680..48c33de 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -17,6 +17,7 @@
 #include <openssl/x509v3.h>
 #include <openssl/dh.h>
 #include <openssl/bn.h>
+#include "internal/nelem.h"
 #include "ssl_locl.h"
 #include <openssl/ct.h>
 
diff --git a/test/bftest.c b/test/bftest.c
index 36029c2..7ab3d51 100644
--- a/test/bftest.c
+++ b/test/bftest.c
@@ -19,6 +19,7 @@
 #include "testutil.h"
 
 #include "internal/nelem.h"
+
 #ifndef OPENSSL_NO_BF
 # include <openssl/blowfish.h>
 
diff --git a/test/bntest.c b/test/bntest.c
index 667cba6..6f1f5d7 100644
--- a/test/bntest.c
+++ b/test/bntest.c
@@ -6,6 +6,7 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
+#include "../e_os.h"
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
@@ -13,7 +14,6 @@
 #include <ctype.h>
 
 #include "internal/nelem.h"
-#include "../e_os.h"
 #include "internal/numbers.h"
 #include <openssl/bn.h>
 #include <openssl/crypto.h>
diff --git a/test/ctype_internal_test.c b/test/ctype_internal_test.c
index ce3cbfe..9cb2321 100644
--- a/test/ctype_internal_test.c
+++ b/test/ctype_internal_test.c
@@ -9,7 +9,7 @@
 
 #include "testutil.h"
 #include "internal/ctype.h"
-#include "../e_os.h"
+#include "internal/nelem.h"
 #include <ctype.h>
 #include <stdio.h>
 
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c
index d4642e7..0be68c7 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -7,13 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "../e_os.h"
 #include <string.h>
 
 #include <openssl/e_os2.h>
 #include <openssl/crypto.h>
 
 #include "internal/nelem.h"
-#include "../e_os.h"
 #include "ssl_test_ctx.h"
 #include "testutil.h"
 
diff --git a/test/ssltest_old.c b/test/ssltest_old.c
index faabc2d..ebe052f 100644
--- a/test/ssltest_old.c
+++ b/test/ssltest_old.c
@@ -9,6 +9,8 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "e_os.h"
+
 /* Or gethostname won't be declared properly on Linux and GNU platforms. */
 #ifndef _BSD_SOURCE
 # define _BSD_SOURCE 1
@@ -27,8 +29,6 @@
 
 #include "internal/nelem.h"
 
-#include "e_os.h"
-
 #ifdef OPENSSL_SYS_VMS
 /*
  * Or isascii won't be declared properly on VMS (at least with DECompHP C).
diff --git a/test/tls13encryptiontest.c b/test/tls13encryptiontest.c
index 667f953..6e4b889 100644
--- a/test/tls13encryptiontest.c
+++ b/test/tls13encryptiontest.c
@@ -22,6 +22,7 @@
 # pragma names restore
 #endif
 
+#include "internal/nelem.h"
 #include "testutil.h"
 
 /*
diff --git a/test/v3nametest.c b/test/v3nametest.c
index a4ba775..0d55f81 100644
--- a/test/v3nametest.c
+++ b/test/v3nametest.c
@@ -7,9 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "../e_os.h"
 #include <string.h>
 #include "internal/nelem.h"
-#include "../e_os.h"
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 #include "testutil.h"


More information about the openssl-commits mailing list