Move the REF_PRINT support from e_os.h to internal/refcount.h.
authorPauli <paul.dale@oracle.com>
Mon, 21 Aug 2017 21:17:35 +0000 (07:17 +1000)
committerPauli <paul.dale@oracle.com>
Tue, 29 Aug 2017 21:20:44 +0000 (07:20 +1000)
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4188)

17 files changed:
crypto/asn1/tasn_utl.c
crypto/dh/dh_lib.c
crypto/dsa/dsa_lib.c
crypto/dso/dso_lib.c
crypto/ec/ec_key.c
crypto/ec/ec_mult.c
crypto/ec/ecp_nistz256.c
crypto/evp/p_lib.c
crypto/rsa/rsa_lib.c
crypto/x509/x509_lu.c
crypto/x509/x509_set.c
crypto/x509/x509cset.c
e_os.h
include/internal/refcount.h
ssl/ssl_cert.c
ssl/ssl_lib.c
ssl/ssl_sess.c

index 5f7e4fbde2e22f08cd00e95901d7d78042d1cd88..cf434aa23cd4680f05c1ddec73014e141045df98 100644 (file)
@@ -10,7 +10,7 @@
 #include <stddef.h>
 #include <string.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
index 9e8877e2d7a66602588f0dad5dd63c1b24760199..4530ce734535c229601ccaa8f4483af24b686085 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include "dh_locl.h"
 #include <openssl/engine.h>
index efd98c21cf43ddea3f5f58658d8891f9585771d5..caaa65c1f53bb40b95b5d4818042827cd8690067 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include "dsa_locl.h"
 #include <openssl/asn1.h>
index 3645c8d603ae21e20c2ee0d151b517fdc1f2847d..3c83ab8e91481d63caf4d6b24f65791287387a4d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "dso_locl.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 
 static DSO_METHOD *default_DSO_meth = NULL;
 
index 882c88229694b9fcc36a95c8c3ac875746c5e453..387455317910dfb1dd0ad9aea000250d877f3c2b 100644 (file)
@@ -11,7 +11,7 @@
 #include "internal/cryptlib.h"
 #include <string.h>
 #include "ec_lcl.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/err.h>
 #include <openssl/engine.h>
 
index 6f75416425240549cdf834b62312450c0994a963..c7557882facb3da527bdeaae9c78cd9d1daa5e44 100644 (file)
@@ -14,7 +14,7 @@
 #include "internal/cryptlib.h"
 #include "internal/bn_int.h"
 #include "ec_lcl.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 
 /*
  * This file implements the wNAF-based interleaving multi-exponentiation method
index edea1f8810c30d1abd87944621ca18ba4ddad1b9..3863a61b02027c56d67b1e49d50b6839b63f79ed 100644 (file)
@@ -21,7 +21,7 @@
 #include "internal/cryptlib.h"
 #include "internal/bn_int.h"
 #include "ec_lcl.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 
 #if BN_BITS2 != 64
 # define TOBN(hi,lo)    lo,hi
index 266d8ca47b9f6205d9d431deaf7a53eb2865b8a5..74539375be9a833ef6b99e217fb8485d4ed9078b 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/bn.h>
 #include <openssl/err.h>
 #include <openssl/objects.h>
index 92d872886b2076ebd1af978f024a2ffe7621ecae..45ec81337663538cfb287521f2adb9babb81b6c3 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/lhash.h>
 #include "internal/bn_int.h"
 #include <openssl/engine.h>
index 7d915aa76245c42ccd7b23cf222a35537114f39f..f45b06112d3dd7ea77219a8fca71d82c830dbec6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/lhash.h>
 #include <openssl/x509.h>
 #include "internal/x509_int.h"
index 49f8651e9a6acbc94427931917dcabe266d2df8b..c634670fa6ee0e2b21b8f2b4e4da0f9f44c757bd 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 63ad319181d9e4246641df0c68d453c637dadb44..c870f3924915145fa22f73a84deae0b7b7182bd8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdio.h>
 #include "internal/cryptlib.h"
-#include "e_os.h"
+#include "internal/refcount.h"
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
diff --git a/e_os.h b/e_os.h
index 2310e32c84b6c5d418e1dca23e741e1d3e73ff2e..14089f5655441cf757ce328406562bca64f062ea 100644 (file)
--- a/e_os.h
+++ b/e_os.h
 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,19 +52,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
index 591561ffeeb7e4a4ebe7ee8f1b005b7c378cf15a..c1663a0f8390116f6fb53f2ffef44a0961958eb1 100644 (file)
@@ -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
index ad78545f8c99ffe6795cd3d6ae7d7a0d8305948a..bbffce0f93f3e5fb52a93c0943834307640b69ea 100644 (file)
@@ -24,7 +24,7 @@
 #include <openssl/dh.h>
 #include <openssl/bn.h>
 #include <openssl/crypto.h>
-#include "e_os.h"
+#include "internal/refcount.h"
 #include "ssl_locl.h"
 #include "ssl_cert_table.h"
 #include "internal/thread_once.h"
index eb8603da1e80fdeba1473ddf4cde9a033d339519..cac8820013c4ae628923a899a39c30899d7b48ac 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include <stdio.h>
-#include "e_os.h"
 #include "ssl_locl.h"
 #include <openssl/objects.h>
 #include <openssl/lhash.h>
@@ -23,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;
 
index ea5309e8195bdb75f77346558ee3c66010f0dfcd..575cd70ef036340bf6ef0e05884421a5884455dc 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/lhash.h>
 #include <openssl/rand.h>
 #include <openssl/engine.h>
-#include "e_os.h"
+#include "internal/refcount.h"
 #include "ssl_locl.h"
 #include "statem/statem_locl.h"