remove horrible pragma macro and remove __owur from SSL_CTX_add_session() declaration
[openssl.git] / include / internal / cryptlib.h
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef HEADER_CRYPTLIB_H
11 # define HEADER_CRYPTLIB_H
12
13 # include <stdlib.h>
14 # include <string.h>
15
16 # include "e_os.h"
17
18 # ifdef OPENSSL_USE_APPLINK
19 #  undef BIO_FLAGS_UPLINK
20 #  define BIO_FLAGS_UPLINK 0x8000
21 #  include "ms/uplink.h"
22 # endif
23
24 # include <openssl/crypto.h>
25 # include <openssl/buffer.h>
26 # include <openssl/bio.h>
27 # include <openssl/err.h>
28
29 #ifdef  __cplusplus
30 extern "C" {
31 #endif
32
33 #ifdef NDEBUG
34 # define ossl_assert(x) ((x) != 0)
35 #else
36 __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
37                                               const char *file, int line)
38 {
39     if (!expr)
40         OPENSSL_die(exprstr, file, line);
41
42     return expr;
43 }
44
45 # define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
46                                          __FILE__, __LINE__)
47
48 #endif
49
50 typedef struct ex_callback_st EX_CALLBACK;
51
52 DEFINE_STACK_OF(EX_CALLBACK)
53
54 typedef struct app_mem_info_st APP_INFO;
55
56 typedef struct mem_st MEM;
57 DEFINE_LHASH_OF(MEM);
58
59 # ifndef OPENSSL_SYS_VMS
60 #  define X509_CERT_AREA          OPENSSLDIR
61 #  define X509_CERT_DIR           OPENSSLDIR "/certs"
62 #  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
63 #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
64 #  define CTLOG_FILE              OPENSSLDIR "/ct_log_list.cnf"
65 # else
66 #  define X509_CERT_AREA          "OSSL$DATAROOT:[000000]"
67 #  define X509_CERT_DIR           "OSSL$DATAROOT:[CERTS]"
68 #  define X509_CERT_FILE          "OSSL$DATAROOT:[000000]cert.pem"
69 #  define X509_PRIVATE_DIR        "OSSL$DATAROOT:[PRIVATE]"
70 #  define CTLOG_FILE              "OSSL$DATAROOT:[000000]ct_log_list.cnf"
71 # endif
72
73 # define X509_CERT_DIR_EVP        "SSL_CERT_DIR"
74 # define X509_CERT_FILE_EVP       "SSL_CERT_FILE"
75 # define CTLOG_FILE_EVP           "CTLOG_FILE"
76
77 /* size of string representations */
78 # define DECIMAL_SIZE(type)      ((sizeof(type)*8+2)/3+1)
79 # define HEX_SIZE(type)          (sizeof(type)*2)
80
81 void OPENSSL_cpuid_setup(void);
82 extern unsigned int OPENSSL_ia32cap_P[];
83 void OPENSSL_showfatal(const char *fmta, ...);
84 extern int OPENSSL_NONPIC_relocated;
85 void crypto_cleanup_all_ex_data_int(void);
86 int openssl_init_fork_handlers(void);
87
88 int openssl_strerror_r(int errnum, char *buf, size_t buflen);
89 # if !defined(OPENSSL_NO_STDIO)
90 FILE *openssl_fopen(const char *filename, const char *mode);
91 # else
92 void *openssl_fopen(const char *filename, const char *mode);
93 # endif
94
95 #ifdef  __cplusplus
96 }
97 #endif
98
99 #endif