File indexing completed on 2025-01-18 10:05:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef OPENSSL_CRYPTO_H
0017 # define OPENSSL_CRYPTO_H
0018 # pragma once
0019
0020 # include <openssl/macros.h>
0021 # ifndef OPENSSL_NO_DEPRECATED_3_0
0022 # define HEADER_CRYPTO_H
0023 # endif
0024
0025 # include <stdlib.h>
0026 # include <time.h>
0027
0028 # include <openssl/e_os2.h>
0029
0030 # ifndef OPENSSL_NO_STDIO
0031 # include <stdio.h>
0032 # endif
0033
0034 # include <openssl/safestack.h>
0035 # include <openssl/opensslv.h>
0036 # include <openssl/types.h>
0037 # include <openssl/opensslconf.h>
0038 # include <openssl/cryptoerr.h>
0039 # include <openssl/core.h>
0040
0041 # ifdef CHARSET_EBCDIC
0042 # include <openssl/ebcdic.h>
0043 # endif
0044
0045
0046
0047
0048
0049 # include <openssl/symhacks.h>
0050
0051 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0052 # include <openssl/opensslv.h>
0053 # endif
0054
0055 #ifdef __cplusplus
0056 extern "C" {
0057 #endif
0058
0059 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0060 # define SSLeay OpenSSL_version_num
0061 # define SSLeay_version OpenSSL_version
0062 # define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
0063 # define SSLEAY_VERSION OPENSSL_VERSION
0064 # define SSLEAY_CFLAGS OPENSSL_CFLAGS
0065 # define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
0066 # define SSLEAY_PLATFORM OPENSSL_PLATFORM
0067 # define SSLEAY_DIR OPENSSL_DIR
0068
0069
0070
0071
0072
0073 typedef struct {
0074 int dummy;
0075 } CRYPTO_dynlock;
0076
0077 # endif
0078
0079 typedef void CRYPTO_RWLOCK;
0080
0081 CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
0082 __owur int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
0083 __owur int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
0084 int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
0085 void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
0086
0087 int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
0088 int CRYPTO_atomic_add64(uint64_t *val, uint64_t op, uint64_t *ret,
0089 CRYPTO_RWLOCK *lock);
0090 int CRYPTO_atomic_and(uint64_t *val, uint64_t op, uint64_t *ret,
0091 CRYPTO_RWLOCK *lock);
0092 int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,
0093 CRYPTO_RWLOCK *lock);
0094 int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock);
0095 int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock);
0096 int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock);
0097
0098
0099 #define OPENSSL_malloc_init() while(0) continue
0100
0101 # define OPENSSL_malloc(num) \
0102 CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
0103 # define OPENSSL_zalloc(num) \
0104 CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
0105 # define OPENSSL_aligned_alloc(num, alignment, freeptr) \
0106 CRYPTO_aligned_alloc(num, alignment, freeptr, \
0107 OPENSSL_FILE, OPENSSL_LINE)
0108 # define OPENSSL_realloc(addr, num) \
0109 CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
0110 # define OPENSSL_clear_realloc(addr, old_num, num) \
0111 CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
0112 # define OPENSSL_clear_free(addr, num) \
0113 CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
0114 # define OPENSSL_free(addr) \
0115 CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
0116 # define OPENSSL_memdup(str, s) \
0117 CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
0118 # define OPENSSL_strdup(str) \
0119 CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
0120 # define OPENSSL_strndup(str, n) \
0121 CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
0122 # define OPENSSL_secure_malloc(num) \
0123 CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
0124 # define OPENSSL_secure_zalloc(num) \
0125 CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
0126 # define OPENSSL_secure_free(addr) \
0127 CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
0128 # define OPENSSL_secure_clear_free(addr, num) \
0129 CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
0130 # define OPENSSL_secure_actual_size(ptr) \
0131 CRYPTO_secure_actual_size(ptr)
0132
0133 size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
0134 size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
0135 size_t OPENSSL_strnlen(const char *str, size_t maxlen);
0136 int OPENSSL_strtoul(const char *str, char **endptr, int base, unsigned long *num);
0137 int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,
0138 const unsigned char *buf, size_t buflen,
0139 const char sep);
0140 char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
0141 int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen,
0142 const char *str, const char sep);
0143 unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
0144 int OPENSSL_hexchar2int(unsigned char c);
0145 int OPENSSL_strcasecmp(const char *s1, const char *s2);
0146 int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
0147
0148 # define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
0149
0150
0151
0152
0153
0154
0155 unsigned int OPENSSL_version_major(void);
0156 unsigned int OPENSSL_version_minor(void);
0157 unsigned int OPENSSL_version_patch(void);
0158 const char *OPENSSL_version_pre_release(void);
0159 const char *OPENSSL_version_build_metadata(void);
0160
0161 unsigned long OpenSSL_version_num(void);
0162 const char *OpenSSL_version(int type);
0163 # define OPENSSL_VERSION 0
0164 # define OPENSSL_CFLAGS 1
0165 # define OPENSSL_BUILT_ON 2
0166 # define OPENSSL_PLATFORM 3
0167 # define OPENSSL_DIR 4
0168 # define OPENSSL_ENGINES_DIR 5
0169 # define OPENSSL_VERSION_STRING 6
0170 # define OPENSSL_FULL_VERSION_STRING 7
0171 # define OPENSSL_MODULES_DIR 8
0172 # define OPENSSL_CPU_INFO 9
0173 # define OPENSSL_WINCTX 10
0174
0175 const char *OPENSSL_info(int type);
0176
0177
0178
0179
0180 # define OPENSSL_INFO_CONFIG_DIR 1001
0181 # define OPENSSL_INFO_ENGINES_DIR 1002
0182 # define OPENSSL_INFO_MODULES_DIR 1003
0183 # define OPENSSL_INFO_DSO_EXTENSION 1004
0184 # define OPENSSL_INFO_DIR_FILENAME_SEPARATOR 1005
0185 # define OPENSSL_INFO_LIST_SEPARATOR 1006
0186 # define OPENSSL_INFO_SEED_SOURCE 1007
0187 # define OPENSSL_INFO_CPU_SETTINGS 1008
0188 # define OPENSSL_INFO_WINDOWS_CONTEXT 1009
0189
0190 int OPENSSL_issetugid(void);
0191
0192 struct crypto_ex_data_st {
0193 OSSL_LIB_CTX *ctx;
0194 STACK_OF(void) *sk;
0195 };
0196
0197 SKM_DEFINE_STACK_OF_INTERNAL(void, void, void)
0198 #define sk_void_num(sk) OPENSSL_sk_num(ossl_check_const_void_sk_type(sk))
0199 #define sk_void_value(sk, idx) ((void *)OPENSSL_sk_value(ossl_check_const_void_sk_type(sk), (idx)))
0200 #define sk_void_new(cmp) ((STACK_OF(void) *)OPENSSL_sk_new(ossl_check_void_compfunc_type(cmp)))
0201 #define sk_void_new_null() ((STACK_OF(void) *)OPENSSL_sk_new_null())
0202 #define sk_void_new_reserve(cmp, n) ((STACK_OF(void) *)OPENSSL_sk_new_reserve(ossl_check_void_compfunc_type(cmp), (n)))
0203 #define sk_void_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_void_sk_type(sk), (n))
0204 #define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
0205 #define sk_void_zero(sk) OPENSSL_sk_zero(ossl_check_void_sk_type(sk))
0206 #define sk_void_delete(sk, i) ((void *)OPENSSL_sk_delete(ossl_check_void_sk_type(sk), (i)))
0207 #define sk_void_delete_ptr(sk, ptr) ((void *)OPENSSL_sk_delete_ptr(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)))
0208 #define sk_void_push(sk, ptr) OPENSSL_sk_push(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
0209 #define sk_void_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
0210 #define sk_void_pop(sk) ((void *)OPENSSL_sk_pop(ossl_check_void_sk_type(sk)))
0211 #define sk_void_shift(sk) ((void *)OPENSSL_sk_shift(ossl_check_void_sk_type(sk)))
0212 #define sk_void_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_void_sk_type(sk),ossl_check_void_freefunc_type(freefunc))
0213 #define sk_void_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), (idx))
0214 #define sk_void_set(sk, idx, ptr) ((void *)OPENSSL_sk_set(ossl_check_void_sk_type(sk), (idx), ossl_check_void_type(ptr)))
0215 #define sk_void_find(sk, ptr) OPENSSL_sk_find(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
0216 #define sk_void_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
0217 #define sk_void_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), pnum)
0218 #define sk_void_sort(sk) OPENSSL_sk_sort(ossl_check_void_sk_type(sk))
0219 #define sk_void_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_void_sk_type(sk))
0220 #define sk_void_dup(sk) ((STACK_OF(void) *)OPENSSL_sk_dup(ossl_check_const_void_sk_type(sk)))
0221 #define sk_void_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(void) *)OPENSSL_sk_deep_copy(ossl_check_const_void_sk_type(sk), ossl_check_void_copyfunc_type(copyfunc), ossl_check_void_freefunc_type(freefunc)))
0222 #define sk_void_set_cmp_func(sk, cmp) ((sk_void_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_void_sk_type(sk), ossl_check_void_compfunc_type(cmp)))
0223
0224
0225
0226
0227
0228
0229 # define CRYPTO_EX_INDEX_SSL 0
0230 # define CRYPTO_EX_INDEX_SSL_CTX 1
0231 # define CRYPTO_EX_INDEX_SSL_SESSION 2
0232 # define CRYPTO_EX_INDEX_X509 3
0233 # define CRYPTO_EX_INDEX_X509_STORE 4
0234 # define CRYPTO_EX_INDEX_X509_STORE_CTX 5
0235 # define CRYPTO_EX_INDEX_DH 6
0236 # define CRYPTO_EX_INDEX_DSA 7
0237 # define CRYPTO_EX_INDEX_EC_KEY 8
0238 # define CRYPTO_EX_INDEX_RSA 9
0239 # define CRYPTO_EX_INDEX_ENGINE 10
0240 # define CRYPTO_EX_INDEX_UI 11
0241 # define CRYPTO_EX_INDEX_BIO 12
0242 # define CRYPTO_EX_INDEX_APP 13
0243 # define CRYPTO_EX_INDEX_UI_METHOD 14
0244 # define CRYPTO_EX_INDEX_RAND_DRBG 15
0245 # define CRYPTO_EX_INDEX_DRBG CRYPTO_EX_INDEX_RAND_DRBG
0246 # define CRYPTO_EX_INDEX_OSSL_LIB_CTX 16
0247 # define CRYPTO_EX_INDEX_EVP_PKEY 17
0248 # define CRYPTO_EX_INDEX__COUNT 18
0249
0250 typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
0251 int idx, long argl, void *argp);
0252 typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
0253 int idx, long argl, void *argp);
0254 typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
0255 void **from_d, int idx, long argl, void *argp);
0256 __owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
0257 CRYPTO_EX_new *new_func,
0258 CRYPTO_EX_dup *dup_func,
0259 CRYPTO_EX_free *free_func);
0260
0261 int CRYPTO_free_ex_index(int class_index, int idx);
0262
0263
0264
0265
0266
0267 int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
0268 int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
0269 const CRYPTO_EX_DATA *from);
0270
0271 void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
0272
0273
0274 int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
0275 int idx);
0276
0277
0278
0279
0280
0281 int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
0282 void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
0283
0284 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0285
0286
0287
0288
0289 # define CRYPTO_cleanup_all_ex_data() while(0) continue
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301 # define CRYPTO_num_locks() (1)
0302 # define CRYPTO_set_locking_callback(func)
0303 # define CRYPTO_get_locking_callback() (NULL)
0304 # define CRYPTO_set_add_lock_callback(func)
0305 # define CRYPTO_get_add_lock_callback() (NULL)
0306
0307
0308
0309
0310
0311
0312 # define CRYPTO_LOCK 1
0313 # define CRYPTO_UNLOCK 2
0314 # define CRYPTO_READ 4
0315 # define CRYPTO_WRITE 8
0316
0317
0318 typedef struct crypto_threadid_st {
0319 int dummy;
0320 } CRYPTO_THREADID;
0321
0322 # define CRYPTO_THREADID_set_numeric(id, val)
0323 # define CRYPTO_THREADID_set_pointer(id, ptr)
0324 # define CRYPTO_THREADID_set_callback(threadid_func) (0)
0325 # define CRYPTO_THREADID_get_callback() (NULL)
0326 # define CRYPTO_THREADID_current(id)
0327 # define CRYPTO_THREADID_cmp(a, b) (-1)
0328 # define CRYPTO_THREADID_cpy(dest, src)
0329 # define CRYPTO_THREADID_hash(id) (0UL)
0330
0331 # ifndef OPENSSL_NO_DEPRECATED_1_0_0
0332 # define CRYPTO_set_id_callback(func)
0333 # define CRYPTO_get_id_callback() (NULL)
0334 # define CRYPTO_thread_id() (0UL)
0335 # endif
0336
0337 # define CRYPTO_set_dynlock_create_callback(dyn_create_function)
0338 # define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
0339 # define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
0340 # define CRYPTO_get_dynlock_create_callback() (NULL)
0341 # define CRYPTO_get_dynlock_lock_callback() (NULL)
0342 # define CRYPTO_get_dynlock_destroy_callback() (NULL)
0343 # endif
0344
0345 typedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line);
0346 typedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file,
0347 int line);
0348 typedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line);
0349 int CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn,
0350 CRYPTO_realloc_fn realloc_fn,
0351 CRYPTO_free_fn free_fn);
0352 void CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,
0353 CRYPTO_realloc_fn *realloc_fn,
0354 CRYPTO_free_fn *free_fn);
0355
0356 OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);
0357 OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, const char *file, int line);
0358 OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc(size_t num, size_t align,
0359 void **freeptr, const char *file,
0360 int line);
0361 OSSL_CRYPTO_ALLOC void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
0362 OSSL_CRYPTO_ALLOC char *CRYPTO_strdup(const char *str, const char *file, int line);
0363 OSSL_CRYPTO_ALLOC char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
0364 void CRYPTO_free(void *ptr, const char *file, int line);
0365 void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
0366 void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
0367 void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
0368 const char *file, int line);
0369
0370 int CRYPTO_secure_malloc_init(size_t sz, size_t minsize);
0371 int CRYPTO_secure_malloc_done(void);
0372 OSSL_CRYPTO_ALLOC void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
0373 OSSL_CRYPTO_ALLOC void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
0374 void CRYPTO_secure_free(void *ptr, const char *file, int line);
0375 void CRYPTO_secure_clear_free(void *ptr, size_t num,
0376 const char *file, int line);
0377 int CRYPTO_secure_allocated(const void *ptr);
0378 int CRYPTO_secure_malloc_initialized(void);
0379 size_t CRYPTO_secure_actual_size(void *ptr);
0380 size_t CRYPTO_secure_used(void);
0381
0382 void OPENSSL_cleanse(void *ptr, size_t len);
0383
0384 # ifndef OPENSSL_NO_CRYPTO_MDEBUG
0385
0386
0387
0388
0389 # define CRYPTO_MEM_CHECK_OFF 0x0
0390 # define CRYPTO_MEM_CHECK_ON 0x1
0391 # define CRYPTO_MEM_CHECK_ENABLE 0x2
0392 # define CRYPTO_MEM_CHECK_DISABLE 0x3
0393
0394 void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);
0395 # ifndef OPENSSL_NO_DEPRECATED_3_0
0396 # define OPENSSL_mem_debug_push(info) \
0397 CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
0398 # define OPENSSL_mem_debug_pop() \
0399 CRYPTO_mem_debug_pop()
0400 # endif
0401 # ifndef OPENSSL_NO_DEPRECATED_3_0
0402 OSSL_DEPRECATEDIN_3_0 int CRYPTO_set_mem_debug(int flag);
0403 OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_ctrl(int mode);
0404 OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_push(const char *info,
0405 const char *file, int line);
0406 OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_pop(void);
0407 OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_malloc(void *addr, size_t num,
0408 int flag,
0409 const char *file, int line);
0410 OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_realloc(void *addr1, void *addr2,
0411 size_t num, int flag,
0412 const char *file, int line);
0413 OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_free(void *addr, int flag,
0414 const char *file, int line);
0415 OSSL_DEPRECATEDIN_3_0
0416 int CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u),
0417 void *u);
0418 # endif
0419 # ifndef OPENSSL_NO_STDIO
0420 # ifndef OPENSSL_NO_DEPRECATED_3_0
0421 OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks_fp(FILE *);
0422 # endif
0423 # endif
0424 # ifndef OPENSSL_NO_DEPRECATED_3_0
0425 OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks(BIO *bio);
0426 # endif
0427 # endif
0428
0429
0430 ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
0431 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0432 # define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
0433 # endif
0434 # define OPENSSL_assert(e) \
0435 (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
0436
0437 int OPENSSL_isservice(void);
0438
0439 void OPENSSL_init(void);
0440 # ifdef OPENSSL_SYS_UNIX
0441 # ifndef OPENSSL_NO_DEPRECATED_3_0
0442 OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_prepare(void);
0443 OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_parent(void);
0444 OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_child(void);
0445 # endif
0446 # endif
0447
0448 struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
0449 int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
0450 int OPENSSL_gmtime_diff(int *pday, int *psec,
0451 const struct tm *from, const struct tm *to);
0452
0453
0454
0455
0456
0457
0458
0459
0460 int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
0461
0462
0463 # define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
0464 # define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
0465 # define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
0466 # define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
0467 # define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
0468 # define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
0469 # define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
0470 # define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
0471 # define OPENSSL_INIT_ASYNC 0x00000100L
0472 # define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
0473 # define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
0474 # define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
0475 # define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
0476 # define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
0477 # define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
0478 # define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
0479
0480 # define OPENSSL_INIT_ATFORK 0x00020000L
0481
0482 # define OPENSSL_INIT_NO_ATEXIT 0x00080000L
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493 # define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
0494 (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
0495 | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
0496 OPENSSL_INIT_ENGINE_PADLOCK)
0497
0498
0499 void OPENSSL_cleanup(void);
0500 int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
0501 int OPENSSL_atexit(void (*handler)(void));
0502 void OPENSSL_thread_stop(void);
0503 void OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx);
0504
0505
0506 OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
0507 # ifndef OPENSSL_NO_STDIO
0508 int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
0509 const char *config_filename);
0510 void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings,
0511 unsigned long flags);
0512 int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
0513 const char *config_appname);
0514 # endif
0515 void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
0516
0517 # if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
0518 # if defined(_WIN32)
0519 # if defined(BASETYPES) || defined(_WINDEF_H)
0520
0521 typedef DWORD CRYPTO_THREAD_LOCAL;
0522 typedef DWORD CRYPTO_THREAD_ID;
0523
0524 typedef LONG CRYPTO_ONCE;
0525 # define CRYPTO_ONCE_STATIC_INIT 0
0526 # endif
0527 # else
0528 # if defined(__TANDEM) && defined(_SPT_MODEL_)
0529 # define SPT_THREAD_SIGNAL 1
0530 # define SPT_THREAD_AWARE 1
0531 # include <spthread.h>
0532 # else
0533 # include <pthread.h>
0534 # endif
0535 typedef pthread_once_t CRYPTO_ONCE;
0536 typedef pthread_key_t CRYPTO_THREAD_LOCAL;
0537 typedef pthread_t CRYPTO_THREAD_ID;
0538
0539 # define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
0540 # endif
0541 # endif
0542
0543 # if !defined(CRYPTO_ONCE_STATIC_INIT)
0544 typedef unsigned int CRYPTO_ONCE;
0545 typedef unsigned int CRYPTO_THREAD_LOCAL;
0546 typedef unsigned int CRYPTO_THREAD_ID;
0547 # define CRYPTO_ONCE_STATIC_INIT 0
0548 # endif
0549
0550 int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
0551
0552 int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
0553 void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
0554 int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
0555 int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
0556
0557 CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
0558 int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
0559
0560 OSSL_LIB_CTX *OSSL_LIB_CTX_new(void);
0561 OSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle,
0562 const OSSL_DISPATCH *in);
0563 OSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle,
0564 const OSSL_DISPATCH *in);
0565 int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);
0566 void OSSL_LIB_CTX_free(OSSL_LIB_CTX *);
0567 OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);
0568 OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx);
0569 int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *ctx);
0570 void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value);
0571
0572 void OSSL_sleep(uint64_t millis);
0573
0574
0575 void *OSSL_LIB_CTX_get_data(OSSL_LIB_CTX *ctx, int index);
0576
0577 # ifdef __cplusplus
0578 }
0579 # endif
0580 #endif