Move the REF_PRINT support from e_os.h to internal/refcount.h.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4188)
This commit is contained in:
Pauli 2017-08-22 07:17:35 +10:00
parent 677963e5a4
commit cd420b0b1f
17 changed files with 37 additions and 35 deletions

View 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>

View 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>

View 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>

View file

@ -8,7 +8,7 @@
*/
#include "dso_locl.h"
#include "e_os.h"
#include "internal/refcount.h"
static DSO_METHOD *default_DSO_meth = NULL;

View 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>

View 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

View 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

View 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>

View 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>

View 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"

View 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>

View 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>

20
e_os.h
View file

@ -25,13 +25,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,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

View 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

View 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"

View 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;

View 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"