Crypto++
8.3
Free C++ class library of cryptographic schemes
config_os.h
Go to the documentation of this file.
1
// config_os.h - written and placed in public domain by Jeffrey Walton
2
// the bits that make up this source file are from the
3
// library's monolithic config.h.
4
5
/// \file config_os.h
6
/// \brief Library configuration file
7
/// \details <tt>config.h</tt> was split into components in May 2019 to better
8
/// integrate with Autoconf and its feature tests. The splitting occurred so
9
/// users could continue to include <tt>config.h</tt> while allowing Autoconf
10
/// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
11
/// its feature tests.
12
/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835</A>
13
/// \since Crypto++ 8.3
14
15
#ifndef CRYPTOPP_CONFIG_OS_H
16
#define CRYPTOPP_CONFIG_OS_H
17
18
#include "
config_ver.h
"
19
20
// It is OK to remove the hard stop below, but you are on your own.
21
// After building the library be sure to run self tests described
22
// https://www.cryptopp.com/wiki/Release_Process#Self_Tests
23
// Some relevant bug reports can be found at:
24
// * Clang: http://github.com/weidai11/cryptopp/issues/147
25
#if (defined(_MSC_VER) && defined(__clang__) && !(defined( __clang_analyzer__)))
26
# error: "Unsupported configuration"
27
#endif
28
29
// Windows platform
30
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
31
#define CRYPTOPP_WIN32_AVAILABLE
32
#endif
33
34
// Unix and Linux platforms
35
#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
36
#define CRYPTOPP_UNIX_AVAILABLE
37
#endif
38
39
// BSD platforms
40
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
41
#define CRYPTOPP_BSD_AVAILABLE
42
#endif
43
44
// Microsoft compilers
45
#if defined(_MSC_VER) || defined(__fastcall)
46
#define CRYPTOPP_FASTCALL __fastcall
47
#else
48
#define CRYPTOPP_FASTCALL
49
#endif
50
51
// Microsoft compilers
52
#if defined(_MSC_VER)
53
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
54
#else
55
#define CRYPTOPP_NO_VTABLE
56
#endif
57
58
// Define this if you want to disable all OS-dependent features,
59
// such as sockets and OS-provided random number generators
60
// #define NO_OS_DEPENDENCE
61
62
// Define this to use features provided by Microsoft's CryptoAPI.
63
// Currently the only feature used is Windows random number generation.
64
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
65
// #define USE_MS_CRYPTOAPI
66
67
// Define this to use features provided by Microsoft's CryptoNG API.
68
// CryptoNG API is available in Vista and above and its cross platform,
69
// including desktop apps and store apps. Currently the only feature
70
// used is Windows random number generation.
71
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
72
// #define USE_MS_CNGAPI
73
74
// If the user did not make a choice, then select CryptoNG if
75
// targeting Windows 8 or above.
76
#if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
77
# if !defined(_USING_V110_SDK71_) && ((WINVER >= 0x0602
/*_WIN32_WINNT_WIN8*/
) || \
78
(_WIN32_WINNT >= 0x0602
/*_WIN32_WINNT_WIN8*/
))
79
# define USE_MS_CNGAPI
80
# else
81
# define USE_MS_CRYPTOAPI
82
# endif
83
#endif
84
85
// Begin OS features, like init priorities and random numbers
86
#ifndef NO_OS_DEPENDENCE
87
88
// CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
89
// Under GCC, the library uses init_priority attribute in the range
90
// [CRYPTOPP_INIT_PRIORITY, CRYPTOPP_INIT_PRIORITY+100]. Under Windows,
91
// CRYPTOPP_INIT_PRIORITY enlists "#pragma init_seg(lib)". The platforms
92
// with gaps are Apple and Sun because they require linker scripts. Apple and
93
// Sun will use the library's Singletons to initialize and acquire resources.
94
// Also see http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
95
#ifndef CRYPTOPP_INIT_PRIORITY
96
# define CRYPTOPP_INIT_PRIORITY 250
97
#endif
98
99
// CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
100
// and managing C++ static object creation. It is guaranteed not to conflict with
101
// values used by (or would be used by) the Crypto++ library.
102
#ifndef CRYPTOPP_USER_PRIORITY
103
# define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY+101)
104
#endif
105
106
// Most platforms allow us to specify when to create C++ objects. Apple and Sun do not.
107
#if (CRYPTOPP_INIT_PRIORITY > 0) && !(defined(NO_OS_DEPENDENCE) || defined(__APPLE__) || defined(__sun__))
108
# if (CRYPTOPP_GCC_VERSION >= 30000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 800)
109
# define HAVE_GCC_INIT_PRIORITY 1
110
# elif (CRYPTOPP_MSC_VERSION >= 1310)
111
# define HAVE_MSC_INIT_PRIORITY 1
112
# elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
113
# define HAVE_XLC_INIT_PRIORITY 1
114
# endif
115
#endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun
116
117
#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
118
# define HIGHRES_TIMER_AVAILABLE
119
#endif
120
121
#ifdef CRYPTOPP_WIN32_AVAILABLE
122
# if !defined(WINAPI_FAMILY)
123
# define THREAD_TIMER_AVAILABLE
124
# elif defined(WINAPI_FAMILY)
125
# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
126
# define THREAD_TIMER_AVAILABLE
127
# endif
128
# endif
129
#endif
130
131
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
132
# define NONBLOCKING_RNG_AVAILABLE
133
# define BLOCKING_RNG_AVAILABLE
134
# define OS_RNG_AVAILABLE
135
#endif
136
137
// Cygwin/Newlib requires _XOPEN_SOURCE=600
138
#if defined(CRYPTOPP_UNIX_AVAILABLE)
139
# define UNIX_SIGNALS_AVAILABLE 1
140
#endif
141
142
#ifdef CRYPTOPP_WIN32_AVAILABLE
143
# if !defined(WINAPI_FAMILY)
144
# define NONBLOCKING_RNG_AVAILABLE
145
# define OS_RNG_AVAILABLE
146
# elif defined(WINAPI_FAMILY)
147
# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
148
# define NONBLOCKING_RNG_AVAILABLE
149
# define OS_RNG_AVAILABLE
150
# elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
151
# if ((WINVER >= 0x0A00
/*_WIN32_WINNT_WIN10*/
) || (_WIN32_WINNT >= 0x0A00
/*_WIN32_WINNT_WIN10*/
))
152
# define NONBLOCKING_RNG_AVAILABLE
153
# define OS_RNG_AVAILABLE
154
# endif
155
# endif
156
# endif
157
#endif
158
159
#endif // NO_OS_DEPENDENCE
160
161
#endif // CRYPTOPP_CONFIG_OS_H
config_ver.h
Library configuration file.
Generated on Fri Dec 25 2020 17:16:54 for Crypto++ by
1.8.20