Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:30:04

0001 /*
0002  * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_E_OS2_H
0011 #define OPENSSL_E_OS2_H
0012 #pragma once
0013 
0014 #include <openssl/macros.h>
0015 #ifndef OPENSSL_NO_DEPRECATED_3_0
0016 #define HEADER_E_OS2_H
0017 #endif
0018 
0019 #include <openssl/opensslconf.h>
0020 
0021 #ifdef __cplusplus
0022 extern "C" {
0023 #endif
0024 
0025 /******************************************************************************
0026  * Detect operating systems.  This probably needs completing.
0027  * The result is that at least one OPENSSL_SYS_os macro should be defined.
0028  * However, if none is defined, Unix is assumed.
0029  **/
0030 
0031 #define OPENSSL_SYS_UNIX
0032 
0033 /* --------------------- Microsoft operating systems ---------------------- */
0034 
0035 /*
0036  * Note that MSDOS actually denotes 32-bit environments running on top of
0037  * MS-DOS, such as DJGPP one.
0038  */
0039 #if defined(OPENSSL_SYS_MSDOS)
0040 #undef OPENSSL_SYS_UNIX
0041 #endif
0042 
0043 /*
0044  * For 32 bit environment, there seems to be the CygWin environment and then
0045  * all the others that try to do the same thing Microsoft does...
0046  */
0047 /*
0048  * UEFI lives here because it might be built with a Microsoft toolchain and
0049  * we need to avoid the false positive match on Windows.
0050  */
0051 #if defined(OPENSSL_SYS_UEFI)
0052 #undef OPENSSL_SYS_UNIX
0053 #elif defined(OPENSSL_SYS_UWIN)
0054 #undef OPENSSL_SYS_UNIX
0055 #define OPENSSL_SYS_WIN32_UWIN
0056 #else
0057 #if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN)
0058 #define OPENSSL_SYS_WIN32_CYGWIN
0059 #else
0060 #if defined(_WIN32) || defined(OPENSSL_SYS_WIN32)
0061 #undef OPENSSL_SYS_UNIX
0062 #if !defined(OPENSSL_SYS_WIN32)
0063 #define OPENSSL_SYS_WIN32
0064 #endif
0065 #endif
0066 #if defined(_WIN64) || defined(OPENSSL_SYS_WIN64)
0067 #undef OPENSSL_SYS_UNIX
0068 #if !defined(OPENSSL_SYS_WIN64)
0069 #define OPENSSL_SYS_WIN64
0070 #endif
0071 #endif
0072 #if defined(OPENSSL_SYS_WINNT)
0073 #undef OPENSSL_SYS_UNIX
0074 #endif
0075 #if defined(OPENSSL_SYS_WINCE)
0076 #undef OPENSSL_SYS_UNIX
0077 #endif
0078 #endif
0079 #endif
0080 
0081 /* Anything that tries to look like Microsoft is "Windows" */
0082 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
0083 #undef OPENSSL_SYS_UNIX
0084 #define OPENSSL_SYS_WINDOWS
0085 #ifndef OPENSSL_SYS_MSDOS
0086 #define OPENSSL_SYS_MSDOS
0087 #endif
0088 #endif
0089 
0090 /*
0091  * DLL settings.  This part is a bit tough, because it's up to the
0092  * application implementer how he or she will link the application, so it
0093  * requires some macro to be used.
0094  */
0095 #ifdef OPENSSL_SYS_WINDOWS
0096 #ifndef OPENSSL_OPT_WINDLL
0097 #if defined(_WINDLL) /* This is used when building OpenSSL to \
0098                       * indicate that DLL linkage should be used */
0099 #define OPENSSL_OPT_WINDLL
0100 #endif
0101 #endif
0102 #endif
0103 
0104 /* ------------------------------- OpenVMS -------------------------------- */
0105 #if defined(__VMS) || defined(VMS)
0106 #if !defined(OPENSSL_SYS_VMS)
0107 #undef OPENSSL_SYS_UNIX
0108 #define OPENSSL_SYS_VMS
0109 #endif
0110 #if defined(__DECC)
0111 #define OPENSSL_SYS_VMS_DECC
0112 #elif defined(__DECCXX)
0113 #define OPENSSL_SYS_VMS_DECC
0114 #define OPENSSL_SYS_VMS_DECCXX
0115 #else
0116 #define OPENSSL_SYS_VMS_NODECC
0117 #endif
0118 #endif
0119 
0120 /* -------------------------------- Unix ---------------------------------- */
0121 #ifdef OPENSSL_SYS_UNIX
0122 #if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX)
0123 #define OPENSSL_SYS_LINUX
0124 #endif
0125 #if defined(_AIX) && !defined(OPENSSL_SYS_AIX)
0126 #define OPENSSL_SYS_AIX
0127 #endif
0128 #endif
0129 
0130 /* -------------------------------- VOS ----------------------------------- */
0131 #if defined(__VOS__) && !defined(OPENSSL_SYS_VOS)
0132 #define OPENSSL_SYS_VOS
0133 #ifdef __HPPA__
0134 #define OPENSSL_SYS_VOS_HPPA
0135 #endif
0136 #ifdef __IA32__
0137 #define OPENSSL_SYS_VOS_IA32
0138 #endif
0139 #endif
0140 
0141 /* ---------------------------- HP NonStop -------------------------------- */
0142 #ifdef __TANDEM
0143 #ifdef _STRING
0144 #include <strings.h>
0145 #endif
0146 #define OPENSSL_USE_BUILD_DATE
0147 #if defined(OPENSSL_THREADS) && defined(_SPT_MODEL_)
0148 #define SPT_THREAD_SIGNAL 1
0149 #define SPT_THREAD_AWARE 1
0150 #include <spthread.h>
0151 #elif defined(OPENSSL_THREADS) && defined(_PUT_MODEL_)
0152 #include <pthread.h>
0153 #endif
0154 #endif
0155 
0156 /**
0157  * That's it for OS-specific stuff
0158  *****************************************************************************/
0159 
0160 /*-
0161  * OPENSSL_EXTERN is normally used to declare a symbol with possible extra
0162  * attributes to handle its presence in a shared library.
0163  * OPENSSL_EXPORT is used to define a symbol with extra possible attributes
0164  * to make it visible in a shared library.
0165  * Care needs to be taken when a header file is used both to declare and
0166  * define symbols.  Basically, for any library that exports some global
0167  * variables, the following code must be present in the header file that
0168  * declares them, before OPENSSL_EXTERN is used:
0169  *
0170  * #ifdef SOME_BUILD_FLAG_MACRO
0171  * # undef OPENSSL_EXTERN
0172  * # define OPENSSL_EXTERN OPENSSL_EXPORT
0173  * #endif
0174  *
0175  * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN
0176  * have some generally sensible values.
0177  */
0178 
0179 #if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
0180 #define OPENSSL_EXPORT extern __declspec(dllexport)
0181 #define OPENSSL_EXTERN extern __declspec(dllimport)
0182 #else
0183 #define OPENSSL_EXPORT extern
0184 #define OPENSSL_EXTERN extern
0185 #endif
0186 
0187 #ifdef _WIN32
0188 #ifdef _WIN64
0189 #define ossl_ssize_t __int64
0190 #define OSSL_SSIZE_MAX _I64_MAX
0191 #else
0192 #define ossl_ssize_t int
0193 #define OSSL_SSIZE_MAX INT_MAX
0194 #endif
0195 #endif
0196 
0197 #if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t)
0198 #define ossl_ssize_t INTN
0199 #define OSSL_SSIZE_MAX MAX_INTN
0200 #endif
0201 
0202 #ifndef ossl_ssize_t
0203 #include <sys/types.h>
0204 #define ossl_ssize_t ssize_t
0205 #if defined(SSIZE_MAX)
0206 #define OSSL_SSIZE_MAX SSIZE_MAX
0207 #elif defined(_POSIX_SSIZE_MAX)
0208 #define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
0209 #else
0210 #define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
0211 #endif
0212 #endif
0213 
0214 #if defined(UNUSEDRESULT_DEBUG)
0215 #define __owur __attribute__((__warn_unused_result__))
0216 #else
0217 #define __owur
0218 #endif
0219 
0220 /* Standard integer types */
0221 #define OPENSSL_NO_INTTYPES_H
0222 #define OPENSSL_NO_STDINT_H
0223 #if defined(OPENSSL_SYS_UEFI)
0224 typedef INT8 int8_t;
0225 typedef UINT8 uint8_t;
0226 typedef INT16 int16_t;
0227 typedef UINT16 uint16_t;
0228 typedef INT32 int32_t;
0229 typedef UINT32 uint32_t;
0230 typedef INT64 int64_t;
0231 typedef UINT64 uint64_t;
0232 typedef UINTN uintptr_t;
0233 #elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__osf__) || defined(__sgi) || defined(__hpux) || defined(OPENSSL_SYS_VMS) || defined(__OpenBSD__)
0234 #include <inttypes.h>
0235 #undef OPENSSL_NO_INTTYPES_H
0236 /* Because the specs say that inttypes.h includes stdint.h if present */
0237 #undef OPENSSL_NO_STDINT_H
0238 #elif defined(_MSC_VER) && _MSC_VER < 1600
0239 /*
0240  * minimally required typdefs for systems not supporting inttypes.h or
0241  * stdint.h: currently just older VC++
0242  */
0243 typedef signed char int8_t;
0244 typedef unsigned char uint8_t;
0245 typedef short int16_t;
0246 typedef unsigned short uint16_t;
0247 typedef int int32_t;
0248 typedef unsigned int uint32_t;
0249 typedef __int64 int64_t;
0250 typedef unsigned __int64 uint64_t;
0251 #elif defined(OPENSSL_SYS_TANDEM)
0252 #include <stdint.h>
0253 #include <sys/types.h>
0254 #else
0255 #include <stdint.h>
0256 #undef OPENSSL_NO_STDINT_H
0257 #endif
0258 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && defined(INTMAX_MAX) && defined(UINTMAX_MAX)
0259 typedef intmax_t ossl_intmax_t;
0260 typedef uintmax_t ossl_uintmax_t;
0261 #else
0262 /* Fall back to the largest we know we require and can handle */
0263 typedef int64_t ossl_intmax_t;
0264 typedef uint64_t ossl_uintmax_t;
0265 #endif
0266 
0267 /* ossl_inline: portable inline definition usable in public headers */
0268 #if !defined(inline) && !defined(__cplusplus)
0269 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
0270 /* just use inline */
0271 #define ossl_inline inline
0272 #elif defined(__GNUC__) && __GNUC__ >= 2
0273 #define ossl_inline __inline__
0274 #elif defined(_MSC_VER)
0275 /*
0276  * Visual Studio: inline is available in C++ only, however
0277  * __inline is available for C, see
0278  * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
0279  */
0280 #define ossl_inline __inline
0281 #else
0282 #define ossl_inline
0283 #endif
0284 #else
0285 #define ossl_inline inline
0286 #endif
0287 
0288 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
0289 #define ossl_noreturn _Noreturn
0290 #elif defined(__GNUC__) && __GNUC__ >= 2
0291 #define ossl_noreturn __attribute__((noreturn))
0292 #else
0293 #define ossl_noreturn
0294 #endif
0295 
0296 /* ossl_unused: portable unused attribute for use in public headers */
0297 #if defined(__GNUC__)
0298 #define ossl_unused __attribute__((unused))
0299 #else
0300 #define ossl_unused
0301 #endif
0302 
0303 #ifdef __cplusplus
0304 }
0305 #endif
0306 #endif