1 | /*
|
---|
2 | * Copyright 1995-2019 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 OSSL_INTERNAL_CRYPTLIB_H
|
---|
11 | # define OSSL_INTERNAL_CRYPTLIB_H
|
---|
12 |
|
---|
13 | # include <stdlib.h>
|
---|
14 | # include <string.h>
|
---|
15 |
|
---|
16 | # ifdef OPENSSL_USE_APPLINK
|
---|
17 | # undef BIO_FLAGS_UPLINK
|
---|
18 | # define BIO_FLAGS_UPLINK 0x8000
|
---|
19 | # include "ms/uplink.h"
|
---|
20 | # endif
|
---|
21 |
|
---|
22 | # include <openssl/crypto.h>
|
---|
23 | # include <openssl/buffer.h>
|
---|
24 | # include <openssl/bio.h>
|
---|
25 | # include <openssl/err.h>
|
---|
26 | # include "internal/nelem.h"
|
---|
27 |
|
---|
28 | #ifdef NDEBUG
|
---|
29 | # define ossl_assert(x) ((x) != 0)
|
---|
30 | #else
|
---|
31 | __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
|
---|
32 | const char *file, int line)
|
---|
33 | {
|
---|
34 | if (!expr)
|
---|
35 | OPENSSL_die(exprstr, file, line);
|
---|
36 |
|
---|
37 | return expr;
|
---|
38 | }
|
---|
39 |
|
---|
40 | # define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
|
---|
41 | __FILE__, __LINE__)
|
---|
42 |
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | typedef struct ex_callback_st EX_CALLBACK;
|
---|
46 |
|
---|
47 | DEFINE_STACK_OF(EX_CALLBACK)
|
---|
48 |
|
---|
49 | typedef struct app_mem_info_st APP_INFO;
|
---|
50 |
|
---|
51 | typedef struct mem_st MEM;
|
---|
52 | DEFINE_LHASH_OF(MEM);
|
---|
53 |
|
---|
54 | #define OPENSSLDIR "/usr/local/ssl"
|
---|
55 |
|
---|
56 | # define OPENSSL_CONF "openssl.cnf"
|
---|
57 |
|
---|
58 | # ifndef OPENSSL_SYS_VMS
|
---|
59 | # define X509_CERT_AREA OPENSSLDIR
|
---|
60 | # define X509_CERT_DIR OPENSSLDIR "/certs"
|
---|
61 | # define X509_CERT_FILE OPENSSLDIR "/cert.pem"
|
---|
62 | # define X509_PRIVATE_DIR OPENSSLDIR "/private"
|
---|
63 | # define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
|
---|
64 | # else
|
---|
65 | # define X509_CERT_AREA "OSSL$DATAROOT:[000000]"
|
---|
66 | # define X509_CERT_DIR "OSSL$DATAROOT:[CERTS]"
|
---|
67 | # define X509_CERT_FILE "OSSL$DATAROOT:[000000]cert.pem"
|
---|
68 | # define X509_PRIVATE_DIR "OSSL$DATAROOT:[PRIVATE]"
|
---|
69 | # define CTLOG_FILE "OSSL$DATAROOT:[000000]ct_log_list.cnf"
|
---|
70 | # endif
|
---|
71 |
|
---|
72 | # define X509_CERT_DIR_EVP "SSL_CERT_DIR"
|
---|
73 | # define X509_CERT_FILE_EVP "SSL_CERT_FILE"
|
---|
74 | # define CTLOG_FILE_EVP "CTLOG_FILE"
|
---|
75 |
|
---|
76 | /* size of string representations */
|
---|
77 | # define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
|
---|
78 | # define HEX_SIZE(type) (sizeof(type)*2)
|
---|
79 |
|
---|
80 | void OPENSSL_cpuid_setup(void);
|
---|
81 | extern unsigned int OPENSSL_ia32cap_P[];
|
---|
82 | void OPENSSL_showfatal(const char *fmta, ...);
|
---|
83 | void crypto_cleanup_all_ex_data_int(void);
|
---|
84 | int openssl_init_fork_handlers(void);
|
---|
85 | int openssl_get_fork_id(void);
|
---|
86 |
|
---|
87 | char *ossl_safe_getenv(const char *name);
|
---|
88 |
|
---|
89 | extern CRYPTO_RWLOCK *memdbg_lock;
|
---|
90 | int openssl_strerror_r(int errnum, char *buf, size_t buflen);
|
---|
91 | # if !defined(OPENSSL_NO_STDIO)
|
---|
92 | FILE *openssl_fopen(const char *filename, const char *mode);
|
---|
93 | # else
|
---|
94 | void *openssl_fopen(const char *filename, const char *mode);
|
---|
95 | # endif
|
---|
96 |
|
---|
97 | uint32_t OPENSSL_rdtsc(void);
|
---|
98 | size_t OPENSSL_instrument_bus(unsigned int *, size_t);
|
---|
99 | size_t OPENSSL_instrument_bus2(unsigned int *, size_t, size_t);
|
---|
100 |
|
---|
101 | #endif
|
---|