mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Upgrade openssl from 1.1.0e to 1.1.1b, with source code. 4.0.78
This commit is contained in:
parent
8f1c992379
commit
96dbd7bced
1476 changed files with 616554 additions and 4 deletions
16
trunk/3rdparty/openssl-1.1-fit/include/internal/__DECC_INCLUDE_EPILOGUE.H
vendored
Normal file
16
trunk/3rdparty/openssl-1.1-fit/include/internal/__DECC_INCLUDE_EPILOGUE.H
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/* restore state. Must correspond to the save in __decc_include_prologue.h */
|
||||
#pragma names restore
|
20
trunk/3rdparty/openssl-1.1-fit/include/internal/__DECC_INCLUDE_PROLOGUE.H
vendored
Normal file
20
trunk/3rdparty/openssl-1.1-fit/include/internal/__DECC_INCLUDE_PROLOGUE.H
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/* save state */
|
||||
#pragma names save
|
||||
/* have the compiler shorten symbols larger than 31 chars to 23 chars
|
||||
* followed by a 8 hex char CRC
|
||||
*/
|
||||
#pragma names as_is,shortened
|
33
trunk/3rdparty/openssl-1.1-fit/include/internal/bio.h
vendored
Normal file
33
trunk/3rdparty/openssl-1.1-fit/include/internal/bio.h
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/bio.h>
|
||||
|
||||
struct bio_method_st {
|
||||
int type;
|
||||
char *name;
|
||||
int (*bwrite) (BIO *, const char *, size_t, size_t *);
|
||||
int (*bwrite_old) (BIO *, const char *, int);
|
||||
int (*bread) (BIO *, char *, size_t, size_t *);
|
||||
int (*bread_old) (BIO *, char *, int);
|
||||
int (*bputs) (BIO *, const char *);
|
||||
int (*bgets) (BIO *, char *, int);
|
||||
long (*ctrl) (BIO *, int, long, void *);
|
||||
int (*create) (BIO *);
|
||||
int (*destroy) (BIO *);
|
||||
long (*callback_ctrl) (BIO *, int, BIO_info_cb *);
|
||||
};
|
||||
|
||||
void bio_free_ex_data(BIO *bio);
|
||||
void bio_cleanup(void);
|
||||
|
||||
|
||||
/* Old style to new style BIO_METHOD conversion functions */
|
||||
int bwrite_conv(BIO *bio, const char *data, size_t datal, size_t *written);
|
||||
int bread_conv(BIO *bio, char *data, size_t datal, size_t *read);
|
12
trunk/3rdparty/openssl-1.1-fit/include/internal/comp.h
vendored
Normal file
12
trunk/3rdparty/openssl-1.1-fit/include/internal/comp.h
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/comp.h>
|
||||
|
||||
void comp_zlib_cleanup_int(void);
|
30
trunk/3rdparty/openssl-1.1-fit/include/internal/conf.h
vendored
Normal file
30
trunk/3rdparty/openssl-1.1-fit/include/internal/conf.h
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_INTERNAL_CONF_H
|
||||
# define HEADER_INTERNAL_CONF_H
|
||||
|
||||
#include <openssl/conf.h>
|
||||
|
||||
#define DEFAULT_CONF_MFLAGS \
|
||||
(CONF_MFLAGS_DEFAULT_SECTION | \
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE | \
|
||||
CONF_MFLAGS_IGNORE_RETURN_CODES)
|
||||
|
||||
struct ossl_init_settings_st {
|
||||
char *filename;
|
||||
char *appname;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
int openssl_config_int(const OPENSSL_INIT_SETTINGS *);
|
||||
void openssl_no_config_int(void);
|
||||
void conf_modules_free_int(void);
|
||||
|
||||
#endif
|
333
trunk/3rdparty/openssl-1.1-fit/include/internal/constant_time_locl.h
vendored
Normal file
333
trunk/3rdparty/openssl-1.1-fit/include/internal/constant_time_locl.h
vendored
Normal file
|
@ -0,0 +1,333 @@
|
|||
/*
|
||||
* Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONSTANT_TIME_LOCL_H
|
||||
# define HEADER_CONSTANT_TIME_LOCL_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <openssl/e_os2.h> /* For 'ossl_inline' */
|
||||
|
||||
/*-
|
||||
* The boolean methods return a bitmask of all ones (0xff...f) for true
|
||||
* and 0 for false. This is useful for choosing a value based on the result
|
||||
* of a conditional in constant time. For example,
|
||||
* if (a < b) {
|
||||
* c = a;
|
||||
* } else {
|
||||
* c = b;
|
||||
* }
|
||||
* can be written as
|
||||
* unsigned int lt = constant_time_lt(a, b);
|
||||
* c = constant_time_select(lt, a, b);
|
||||
*/
|
||||
|
||||
/* Returns the given value with the MSB copied to all the other bits. */
|
||||
static ossl_inline unsigned int constant_time_msb(unsigned int a);
|
||||
/* Convenience method for uint32_t. */
|
||||
static ossl_inline uint32_t constant_time_msb_32(uint32_t a);
|
||||
/* Convenience method for uint64_t. */
|
||||
static ossl_inline uint64_t constant_time_msb_64(uint64_t a);
|
||||
|
||||
/* Returns 0xff..f if a < b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_lt(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for uint64_t. */
|
||||
static ossl_inline uint64_t constant_time_lt_64(uint64_t a, uint64_t b);
|
||||
|
||||
/* Returns 0xff..f if a >= b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_ge(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a,
|
||||
unsigned int b);
|
||||
|
||||
/* Returns 0xff..f if a == 0 and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_is_zero(unsigned int a);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a);
|
||||
/* Convenience method for getting a 32-bit mask. */
|
||||
static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a);
|
||||
|
||||
/* Returns 0xff..f if a == b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_eq(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Signed integers. */
|
||||
static ossl_inline unsigned int constant_time_eq_int(int a, int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_eq_int_8(int a, int b);
|
||||
|
||||
/*-
|
||||
* Returns (mask & a) | (~mask & b).
|
||||
*
|
||||
* When |mask| is all 1s or all 0s (as returned by the methods above),
|
||||
* the select methods return either |a| (if |mask| is nonzero) or |b|
|
||||
* (if |mask| is zero).
|
||||
*/
|
||||
static ossl_inline unsigned int constant_time_select(unsigned int mask,
|
||||
unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for unsigned chars. */
|
||||
static ossl_inline unsigned char constant_time_select_8(unsigned char mask,
|
||||
unsigned char a,
|
||||
unsigned char b);
|
||||
|
||||
/* Convenience method for uint32_t. */
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a,
|
||||
uint32_t b);
|
||||
|
||||
/* Convenience method for uint64_t. */
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a,
|
||||
uint64_t b);
|
||||
/* Convenience method for signed integers. */
|
||||
static ossl_inline int constant_time_select_int(unsigned int mask, int a,
|
||||
int b);
|
||||
|
||||
|
||||
static ossl_inline unsigned int constant_time_msb(unsigned int a)
|
||||
{
|
||||
return 0 - (a >> (sizeof(a) * 8 - 1));
|
||||
}
|
||||
|
||||
|
||||
static ossl_inline uint32_t constant_time_msb_32(uint32_t a)
|
||||
{
|
||||
return 0 - (a >> 31);
|
||||
}
|
||||
|
||||
static ossl_inline uint64_t constant_time_msb_64(uint64_t a)
|
||||
{
|
||||
return 0 - (a >> 63);
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_msb_s(size_t a)
|
||||
{
|
||||
return 0 - (a >> (sizeof(a) * 8 - 1));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_lt(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b)));
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_lt_s(size_t a, size_t b)
|
||||
{
|
||||
return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b)));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_lt(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline uint64_t constant_time_lt_64(uint64_t a, uint64_t b)
|
||||
{
|
||||
return constant_time_msb_64(a ^ ((a ^ b) | ((a - b) ^ b)));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_ge(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return ~constant_time_lt(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_ge_s(size_t a, size_t b)
|
||||
{
|
||||
return ~constant_time_lt_s(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_ge(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_ge_8_s(size_t a, size_t b)
|
||||
{
|
||||
return (unsigned char)constant_time_ge_s(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
|
||||
{
|
||||
return constant_time_msb(~a & (a - 1));
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_is_zero_s(size_t a)
|
||||
{
|
||||
return constant_time_msb_s(~a & (a - 1));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a)
|
||||
{
|
||||
return (unsigned char)constant_time_is_zero(a);
|
||||
}
|
||||
|
||||
static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a)
|
||||
{
|
||||
return constant_time_msb_32(~a & (a - 1));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_eq(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return constant_time_is_zero(a ^ b);
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_eq_s(size_t a, size_t b)
|
||||
{
|
||||
return constant_time_is_zero_s(a ^ b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_eq(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_eq_8_s(size_t a, size_t b)
|
||||
{
|
||||
return (unsigned char)constant_time_eq_s(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_eq_int(int a, int b)
|
||||
{
|
||||
return constant_time_eq((unsigned)(a), (unsigned)(b));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_eq_int_8(int a, int b)
|
||||
{
|
||||
return constant_time_eq_8((unsigned)(a), (unsigned)(b));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_select(unsigned int mask,
|
||||
unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (mask & a) | (~mask & b);
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_select_s(size_t mask,
|
||||
size_t a,
|
||||
size_t b)
|
||||
{
|
||||
return (mask & a) | (~mask & b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_select_8(unsigned char mask,
|
||||
unsigned char a,
|
||||
unsigned char b)
|
||||
{
|
||||
return (unsigned char)constant_time_select(mask, a, b);
|
||||
}
|
||||
|
||||
static ossl_inline int constant_time_select_int(unsigned int mask, int a,
|
||||
int b)
|
||||
{
|
||||
return (int)constant_time_select(mask, (unsigned)(a), (unsigned)(b));
|
||||
}
|
||||
|
||||
static ossl_inline int constant_time_select_int_s(size_t mask, int a, int b)
|
||||
{
|
||||
return (int)constant_time_select((unsigned)mask, (unsigned)(a),
|
||||
(unsigned)(b));
|
||||
}
|
||||
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a,
|
||||
uint32_t b)
|
||||
{
|
||||
return (mask & a) | (~mask & b);
|
||||
}
|
||||
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a,
|
||||
uint64_t b)
|
||||
{
|
||||
return (mask & a) | (~mask & b);
|
||||
}
|
||||
|
||||
/*
|
||||
* mask must be 0xFFFFFFFF or 0x00000000.
|
||||
*
|
||||
* if (mask) {
|
||||
* uint32_t tmp = *a;
|
||||
*
|
||||
* *a = *b;
|
||||
* *b = tmp;
|
||||
* }
|
||||
*/
|
||||
static ossl_inline void constant_time_cond_swap_32(uint32_t mask, uint32_t *a,
|
||||
uint32_t *b)
|
||||
{
|
||||
uint32_t xor = *a ^ *b;
|
||||
|
||||
xor &= mask;
|
||||
*a ^= xor;
|
||||
*b ^= xor;
|
||||
}
|
||||
|
||||
/*
|
||||
* mask must be 0xFFFFFFFF or 0x00000000.
|
||||
*
|
||||
* if (mask) {
|
||||
* uint64_t tmp = *a;
|
||||
*
|
||||
* *a = *b;
|
||||
* *b = tmp;
|
||||
* }
|
||||
*/
|
||||
static ossl_inline void constant_time_cond_swap_64(uint64_t mask, uint64_t *a,
|
||||
uint64_t *b)
|
||||
{
|
||||
uint64_t xor = *a ^ *b;
|
||||
|
||||
xor &= mask;
|
||||
*a ^= xor;
|
||||
*b ^= xor;
|
||||
}
|
||||
|
||||
/*
|
||||
* table is a two dimensional array of bytes. Each row has rowsize elements.
|
||||
* Copies row number idx into out. rowsize and numrows are not considered
|
||||
* private.
|
||||
*/
|
||||
static ossl_inline void constant_time_lookup(void *out,
|
||||
const void *table,
|
||||
size_t rowsize,
|
||||
size_t numrows,
|
||||
size_t idx)
|
||||
{
|
||||
size_t i, j;
|
||||
const unsigned char *tablec = (const unsigned char *)table;
|
||||
unsigned char *outc = (unsigned char *)out;
|
||||
unsigned char mask;
|
||||
|
||||
memset(out, 0, rowsize);
|
||||
|
||||
/* Note idx may underflow - but that is well defined */
|
||||
for (i = 0; i < numrows; i++, idx--) {
|
||||
mask = (unsigned char)constant_time_is_zero_s(idx);
|
||||
for (j = 0; j < rowsize; j++)
|
||||
*(outc + j) |= constant_time_select_8(mask, *(tablec++), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Expected usage pattern is to unconditionally set error and then
|
||||
* wipe it if there was no actual error. |clear| is 1 or 0.
|
||||
*/
|
||||
void err_clear_last_constant_time(int clear);
|
||||
|
||||
#endif /* HEADER_CONSTANT_TIME_LOCL_H */
|
98
trunk/3rdparty/openssl-1.1-fit/include/internal/cryptlib.h
vendored
Normal file
98
trunk/3rdparty/openssl-1.1-fit/include/internal/cryptlib.h
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTLIB_H
|
||||
# define HEADER_CRYPTLIB_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
# ifdef OPENSSL_USE_APPLINK
|
||||
# undef BIO_FLAGS_UPLINK
|
||||
# define BIO_FLAGS_UPLINK 0x8000
|
||||
# include "ms/uplink.h"
|
||||
# endif
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/buffer.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include "internal/nelem.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
# define ossl_assert(x) ((x) != 0)
|
||||
#else
|
||||
__owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!expr)
|
||||
OPENSSL_die(exprstr, file, line);
|
||||
|
||||
return expr;
|
||||
}
|
||||
|
||||
# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct ex_callback_st EX_CALLBACK;
|
||||
|
||||
DEFINE_STACK_OF(EX_CALLBACK)
|
||||
|
||||
typedef struct app_mem_info_st APP_INFO;
|
||||
|
||||
typedef struct mem_st MEM;
|
||||
DEFINE_LHASH_OF(MEM);
|
||||
|
||||
# define OPENSSL_CONF "openssl.cnf"
|
||||
|
||||
# ifndef OPENSSL_SYS_VMS
|
||||
# define X509_CERT_AREA OPENSSLDIR
|
||||
# define X509_CERT_DIR OPENSSLDIR "/certs"
|
||||
# define X509_CERT_FILE OPENSSLDIR "/cert.pem"
|
||||
# define X509_PRIVATE_DIR OPENSSLDIR "/private"
|
||||
# define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
|
||||
# else
|
||||
# define X509_CERT_AREA "OSSL$DATAROOT:[000000]"
|
||||
# define X509_CERT_DIR "OSSL$DATAROOT:[CERTS]"
|
||||
# define X509_CERT_FILE "OSSL$DATAROOT:[000000]cert.pem"
|
||||
# define X509_PRIVATE_DIR "OSSL$DATAROOT:[PRIVATE]"
|
||||
# define CTLOG_FILE "OSSL$DATAROOT:[000000]ct_log_list.cnf"
|
||||
# endif
|
||||
|
||||
# define X509_CERT_DIR_EVP "SSL_CERT_DIR"
|
||||
# define X509_CERT_FILE_EVP "SSL_CERT_FILE"
|
||||
# define CTLOG_FILE_EVP "CTLOG_FILE"
|
||||
|
||||
/* size of string representations */
|
||||
# define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
|
||||
# define HEX_SIZE(type) (sizeof(type)*2)
|
||||
|
||||
void OPENSSL_cpuid_setup(void);
|
||||
extern unsigned int OPENSSL_ia32cap_P[];
|
||||
void OPENSSL_showfatal(const char *fmta, ...);
|
||||
void crypto_cleanup_all_ex_data_int(void);
|
||||
int openssl_init_fork_handlers(void);
|
||||
|
||||
char *ossl_safe_getenv(const char *name);
|
||||
|
||||
extern CRYPTO_RWLOCK *memdbg_lock;
|
||||
int openssl_strerror_r(int errnum, char *buf, size_t buflen);
|
||||
# if !defined(OPENSSL_NO_STDIO)
|
||||
FILE *openssl_fopen(const char *filename, const char *mode);
|
||||
# else
|
||||
void *openssl_fopen(const char *filename, const char *mode);
|
||||
# endif
|
||||
|
||||
uint32_t OPENSSL_rdtsc(void);
|
||||
size_t OPENSSL_instrument_bus(unsigned int *, size_t);
|
||||
size_t OPENSSL_instrument_bus2(unsigned int *, size_t, size_t);
|
||||
|
||||
#endif
|
103
trunk/3rdparty/openssl-1.1-fit/include/internal/dane.h
vendored
Normal file
103
trunk/3rdparty/openssl-1.1-fit/include/internal/dane.h
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_INTERNAL_DANE_H
|
||||
#define HEADER_INTERNAL_DANE_H
|
||||
|
||||
#include <openssl/safestack.h>
|
||||
|
||||
/*-
|
||||
* Certificate usages:
|
||||
* https://tools.ietf.org/html/rfc6698#section-2.1.1
|
||||
*/
|
||||
#define DANETLS_USAGE_PKIX_TA 0
|
||||
#define DANETLS_USAGE_PKIX_EE 1
|
||||
#define DANETLS_USAGE_DANE_TA 2
|
||||
#define DANETLS_USAGE_DANE_EE 3
|
||||
#define DANETLS_USAGE_LAST DANETLS_USAGE_DANE_EE
|
||||
|
||||
/*-
|
||||
* Selectors:
|
||||
* https://tools.ietf.org/html/rfc6698#section-2.1.2
|
||||
*/
|
||||
#define DANETLS_SELECTOR_CERT 0
|
||||
#define DANETLS_SELECTOR_SPKI 1
|
||||
#define DANETLS_SELECTOR_LAST DANETLS_SELECTOR_SPKI
|
||||
|
||||
/*-
|
||||
* Matching types:
|
||||
* https://tools.ietf.org/html/rfc6698#section-2.1.3
|
||||
*/
|
||||
#define DANETLS_MATCHING_FULL 0
|
||||
#define DANETLS_MATCHING_2256 1
|
||||
#define DANETLS_MATCHING_2512 2
|
||||
#define DANETLS_MATCHING_LAST DANETLS_MATCHING_2512
|
||||
|
||||
typedef struct danetls_record_st {
|
||||
uint8_t usage;
|
||||
uint8_t selector;
|
||||
uint8_t mtype;
|
||||
unsigned char *data;
|
||||
size_t dlen;
|
||||
EVP_PKEY *spki;
|
||||
} danetls_record;
|
||||
|
||||
DEFINE_STACK_OF(danetls_record)
|
||||
|
||||
/*
|
||||
* Shared DANE context
|
||||
*/
|
||||
struct dane_ctx_st {
|
||||
const EVP_MD **mdevp; /* mtype -> digest */
|
||||
uint8_t *mdord; /* mtype -> preference */
|
||||
uint8_t mdmax; /* highest supported mtype */
|
||||
unsigned long flags; /* feature bitmask */
|
||||
};
|
||||
|
||||
/*
|
||||
* Per connection DANE state
|
||||
*/
|
||||
struct ssl_dane_st {
|
||||
struct dane_ctx_st *dctx;
|
||||
STACK_OF(danetls_record) *trecs;
|
||||
STACK_OF(X509) *certs; /* DANE-TA(2) Cert(0) Full(0) certs */
|
||||
danetls_record *mtlsa; /* Matching TLSA record */
|
||||
X509 *mcert; /* DANE matched cert */
|
||||
uint32_t umask; /* Usages present */
|
||||
int mdpth; /* Depth of matched cert */
|
||||
int pdpth; /* Depth of PKIX trust */
|
||||
unsigned long flags; /* feature bitmask */
|
||||
};
|
||||
|
||||
#define DANETLS_ENABLED(dane) \
|
||||
((dane) != NULL && sk_danetls_record_num((dane)->trecs) > 0)
|
||||
|
||||
#define DANETLS_USAGE_BIT(u) (((uint32_t)1) << u)
|
||||
|
||||
#define DANETLS_PKIX_TA_MASK (DANETLS_USAGE_BIT(DANETLS_USAGE_PKIX_TA))
|
||||
#define DANETLS_PKIX_EE_MASK (DANETLS_USAGE_BIT(DANETLS_USAGE_PKIX_EE))
|
||||
#define DANETLS_DANE_TA_MASK (DANETLS_USAGE_BIT(DANETLS_USAGE_DANE_TA))
|
||||
#define DANETLS_DANE_EE_MASK (DANETLS_USAGE_BIT(DANETLS_USAGE_DANE_EE))
|
||||
|
||||
#define DANETLS_PKIX_MASK (DANETLS_PKIX_TA_MASK | DANETLS_PKIX_EE_MASK)
|
||||
#define DANETLS_DANE_MASK (DANETLS_DANE_TA_MASK | DANETLS_DANE_EE_MASK)
|
||||
#define DANETLS_TA_MASK (DANETLS_PKIX_TA_MASK | DANETLS_DANE_TA_MASK)
|
||||
#define DANETLS_EE_MASK (DANETLS_PKIX_EE_MASK | DANETLS_DANE_EE_MASK)
|
||||
|
||||
#define DANETLS_HAS_PKIX(dane) ((dane) && ((dane)->umask & DANETLS_PKIX_MASK))
|
||||
#define DANETLS_HAS_DANE(dane) ((dane) && ((dane)->umask & DANETLS_DANE_MASK))
|
||||
#define DANETLS_HAS_TA(dane) ((dane) && ((dane)->umask & DANETLS_TA_MASK))
|
||||
#define DANETLS_HAS_EE(dane) ((dane) && ((dane)->umask & DANETLS_EE_MASK))
|
||||
|
||||
#define DANETLS_HAS_PKIX_TA(dane) ((dane)&&((dane)->umask & DANETLS_PKIX_TA_MASK))
|
||||
#define DANETLS_HAS_PKIX_EE(dane) ((dane)&&((dane)->umask & DANETLS_PKIX_EE_MASK))
|
||||
#define DANETLS_HAS_DANE_TA(dane) ((dane)&&((dane)->umask & DANETLS_DANE_TA_MASK))
|
||||
#define DANETLS_HAS_DANE_EE(dane) ((dane)&&((dane)->umask & DANETLS_DANE_EE_MASK))
|
||||
|
||||
#endif /* HEADER_INTERNAL_DANE_H */
|
165
trunk/3rdparty/openssl-1.1-fit/include/internal/dso.h
vendored
Normal file
165
trunk/3rdparty/openssl-1.1-fit/include/internal/dso.h
vendored
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSO_H
|
||||
# define HEADER_DSO_H
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
# include "internal/dsoerr.h"
|
||||
|
||||
/* These values are used as commands to DSO_ctrl() */
|
||||
# define DSO_CTRL_GET_FLAGS 1
|
||||
# define DSO_CTRL_SET_FLAGS 2
|
||||
# define DSO_CTRL_OR_FLAGS 3
|
||||
|
||||
/*
|
||||
* By default, DSO_load() will translate the provided filename into a form
|
||||
* typical for the platform using the dso_name_converter function of the
|
||||
* method. Eg. win32 will transform "blah" into "blah.dll", and dlfcn will
|
||||
* transform it into "libblah.so". This callback could even utilise the
|
||||
* DSO_METHOD's converter too if it only wants to override behaviour for
|
||||
* one or two possible DSO methods. However, the following flag can be
|
||||
* set in a DSO to prevent *any* native name-translation at all - eg. if
|
||||
* the caller has prompted the user for a path to a driver library so the
|
||||
* filename should be interpreted as-is.
|
||||
*/
|
||||
# define DSO_FLAG_NO_NAME_TRANSLATION 0x01
|
||||
/*
|
||||
* An extra flag to give if only the extension should be added as
|
||||
* translation. This is obviously only of importance on Unix and other
|
||||
* operating systems where the translation also may prefix the name with
|
||||
* something, like 'lib', and ignored everywhere else. This flag is also
|
||||
* ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time.
|
||||
*/
|
||||
# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02
|
||||
|
||||
/*
|
||||
* Don't unload the DSO when we call DSO_free()
|
||||
*/
|
||||
# define DSO_FLAG_NO_UNLOAD_ON_FREE 0x04
|
||||
|
||||
/*
|
||||
* This flag loads the library with public symbols. Meaning: The exported
|
||||
* symbols of this library are public to all libraries loaded after this
|
||||
* library. At the moment only implemented in unix.
|
||||
*/
|
||||
# define DSO_FLAG_GLOBAL_SYMBOLS 0x20
|
||||
|
||||
typedef void (*DSO_FUNC_TYPE) (void);
|
||||
|
||||
typedef struct dso_st DSO;
|
||||
typedef struct dso_meth_st DSO_METHOD;
|
||||
|
||||
/*
|
||||
* The function prototype used for method functions (or caller-provided
|
||||
* callbacks) that transform filenames. They are passed a DSO structure
|
||||
* pointer (or NULL if they are to be used independently of a DSO object) and
|
||||
* a filename to transform. They should either return NULL (if there is an
|
||||
* error condition) or a newly allocated string containing the transformed
|
||||
* form that the caller will need to free with OPENSSL_free() when done.
|
||||
*/
|
||||
typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
|
||||
/*
|
||||
* The function prototype used for method functions (or caller-provided
|
||||
* callbacks) that merge two file specifications. They are passed a DSO
|
||||
* structure pointer (or NULL if they are to be used independently of a DSO
|
||||
* object) and two file specifications to merge. They should either return
|
||||
* NULL (if there is an error condition) or a newly allocated string
|
||||
* containing the result of merging that the caller will need to free with
|
||||
* OPENSSL_free() when done. Here, merging means that bits and pieces are
|
||||
* taken from each of the file specifications and added together in whatever
|
||||
* fashion that is sensible for the DSO method in question. The only rule
|
||||
* that really applies is that if the two specification contain pieces of the
|
||||
* same type, the copy from the first string takes priority. One could see
|
||||
* it as the first specification is the one given by the user and the second
|
||||
* being a bunch of defaults to add on if they're missing in the first.
|
||||
*/
|
||||
typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
|
||||
|
||||
DSO *DSO_new(void);
|
||||
int DSO_free(DSO *dso);
|
||||
int DSO_flags(DSO *dso);
|
||||
int DSO_up_ref(DSO *dso);
|
||||
long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
|
||||
|
||||
/*
|
||||
* These functions can be used to get/set the platform-independent filename
|
||||
* used for a DSO. NB: set will fail if the DSO is already loaded.
|
||||
*/
|
||||
const char *DSO_get_filename(DSO *dso);
|
||||
int DSO_set_filename(DSO *dso, const char *filename);
|
||||
/*
|
||||
* This function will invoke the DSO's name_converter callback to translate a
|
||||
* filename, or if the callback isn't set it will instead use the DSO_METHOD's
|
||||
* converter. If "filename" is NULL, the "filename" in the DSO itself will be
|
||||
* used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is
|
||||
* simply duplicated. NB: This function is usually called from within a
|
||||
* DSO_METHOD during the processing of a DSO_load() call, and is exposed so
|
||||
* that caller-created DSO_METHODs can do the same thing. A non-NULL return
|
||||
* value will need to be OPENSSL_free()'d.
|
||||
*/
|
||||
char *DSO_convert_filename(DSO *dso, const char *filename);
|
||||
/*
|
||||
* This function will invoke the DSO's merger callback to merge two file
|
||||
* specifications, or if the callback isn't set it will instead use the
|
||||
* DSO_METHOD's merger. A non-NULL return value will need to be
|
||||
* OPENSSL_free()'d.
|
||||
*/
|
||||
char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
|
||||
|
||||
/*
|
||||
* The all-singing all-dancing load function, you normally pass NULL for the
|
||||
* first and third parameters. Use DSO_up_ref and DSO_free for subsequent
|
||||
* reference count handling. Any flags passed in will be set in the
|
||||
* constructed DSO after its init() function but before the load operation.
|
||||
* If 'dso' is non-NULL, 'flags' is ignored.
|
||||
*/
|
||||
DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);
|
||||
|
||||
/* This function binds to a function inside a shared library. */
|
||||
DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
|
||||
|
||||
/*
|
||||
* This method is the default, but will beg, borrow, or steal whatever method
|
||||
* should be the default on any particular platform (including
|
||||
* DSO_METH_null() if necessary).
|
||||
*/
|
||||
DSO_METHOD *DSO_METHOD_openssl(void);
|
||||
|
||||
/*
|
||||
* This function writes null-terminated pathname of DSO module containing
|
||||
* 'addr' into 'sz' large caller-provided 'path' and returns the number of
|
||||
* characters [including trailing zero] written to it. If 'sz' is 0 or
|
||||
* negative, 'path' is ignored and required amount of characters [including
|
||||
* trailing zero] to accommodate pathname is returned. If 'addr' is NULL, then
|
||||
* pathname of cryptolib itself is returned. Negative or zero return value
|
||||
* denotes error.
|
||||
*/
|
||||
int DSO_pathbyaddr(void *addr, char *path, int sz);
|
||||
|
||||
/*
|
||||
* Like DSO_pathbyaddr() but instead returns a handle to the DSO for the symbol
|
||||
* or NULL on error.
|
||||
*/
|
||||
DSO *DSO_dsobyaddr(void *addr, int flags);
|
||||
|
||||
/*
|
||||
* This function should be used with caution! It looks up symbols in *all*
|
||||
* loaded modules and if module gets unloaded by somebody else attempt to
|
||||
* dereference the pointer is doomed to have fatal consequences. Primary
|
||||
* usage for this function is to probe *core* system functionality, e.g.
|
||||
* check if getnameinfo(3) is available at run-time without bothering about
|
||||
* OS-specific details such as libc.so.versioning or where does it actually
|
||||
* reside: in libc itself or libsocket.
|
||||
*/
|
||||
void *DSO_global_lookup(const char *name);
|
||||
|
||||
int ERR_load_DSO_strings(void);
|
||||
|
||||
#endif
|
83
trunk/3rdparty/openssl-1.1-fit/include/internal/dsoerr.h
vendored
Normal file
83
trunk/3rdparty/openssl-1.1-fit/include/internal/dsoerr.h
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSOERR_H
|
||||
# define HEADER_DSOERR_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DSO
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_DSO_strings(void);
|
||||
|
||||
/*
|
||||
* DSO function codes.
|
||||
*/
|
||||
# define DSO_F_DLFCN_BIND_FUNC 100
|
||||
# define DSO_F_DLFCN_LOAD 102
|
||||
# define DSO_F_DLFCN_MERGER 130
|
||||
# define DSO_F_DLFCN_NAME_CONVERTER 123
|
||||
# define DSO_F_DLFCN_UNLOAD 103
|
||||
# define DSO_F_DL_BIND_FUNC 104
|
||||
# define DSO_F_DL_LOAD 106
|
||||
# define DSO_F_DL_MERGER 131
|
||||
# define DSO_F_DL_NAME_CONVERTER 124
|
||||
# define DSO_F_DL_UNLOAD 107
|
||||
# define DSO_F_DSO_BIND_FUNC 108
|
||||
# define DSO_F_DSO_CONVERT_FILENAME 126
|
||||
# define DSO_F_DSO_CTRL 110
|
||||
# define DSO_F_DSO_FREE 111
|
||||
# define DSO_F_DSO_GET_FILENAME 127
|
||||
# define DSO_F_DSO_GLOBAL_LOOKUP 139
|
||||
# define DSO_F_DSO_LOAD 112
|
||||
# define DSO_F_DSO_MERGE 132
|
||||
# define DSO_F_DSO_NEW_METHOD 113
|
||||
# define DSO_F_DSO_PATHBYADDR 105
|
||||
# define DSO_F_DSO_SET_FILENAME 129
|
||||
# define DSO_F_DSO_UP_REF 114
|
||||
# define DSO_F_VMS_BIND_SYM 115
|
||||
# define DSO_F_VMS_LOAD 116
|
||||
# define DSO_F_VMS_MERGER 133
|
||||
# define DSO_F_VMS_UNLOAD 117
|
||||
# define DSO_F_WIN32_BIND_FUNC 101
|
||||
# define DSO_F_WIN32_GLOBALLOOKUP 142
|
||||
# define DSO_F_WIN32_JOINER 135
|
||||
# define DSO_F_WIN32_LOAD 120
|
||||
# define DSO_F_WIN32_MERGER 134
|
||||
# define DSO_F_WIN32_NAME_CONVERTER 125
|
||||
# define DSO_F_WIN32_PATHBYADDR 109
|
||||
# define DSO_F_WIN32_SPLITTER 136
|
||||
# define DSO_F_WIN32_UNLOAD 121
|
||||
|
||||
/*
|
||||
* DSO reason codes.
|
||||
*/
|
||||
# define DSO_R_CTRL_FAILED 100
|
||||
# define DSO_R_DSO_ALREADY_LOADED 110
|
||||
# define DSO_R_EMPTY_FILE_STRUCTURE 113
|
||||
# define DSO_R_FAILURE 114
|
||||
# define DSO_R_FILENAME_TOO_BIG 101
|
||||
# define DSO_R_FINISH_FAILED 102
|
||||
# define DSO_R_INCORRECT_FILE_SYNTAX 115
|
||||
# define DSO_R_LOAD_FAILED 103
|
||||
# define DSO_R_NAME_TRANSLATION_FAILED 109
|
||||
# define DSO_R_NO_FILENAME 111
|
||||
# define DSO_R_NULL_HANDLE 104
|
||||
# define DSO_R_SET_FILENAME_FAILED 112
|
||||
# define DSO_R_STACK_ERROR 105
|
||||
# define DSO_R_SYM_FAILURE 106
|
||||
# define DSO_R_UNLOAD_FAILED 107
|
||||
# define DSO_R_UNSUPPORTED 108
|
||||
|
||||
# endif
|
||||
#endif
|
15
trunk/3rdparty/openssl-1.1-fit/include/internal/err.h
vendored
Normal file
15
trunk/3rdparty/openssl-1.1-fit/include/internal/err.h
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef INTERNAL_ERR_H
|
||||
# define INTERNAL_ERR_H
|
||||
|
||||
void err_free_strings_int(void);
|
||||
|
||||
#endif
|
14
trunk/3rdparty/openssl-1.1-fit/include/internal/nelem.h
vendored
Normal file
14
trunk/3rdparty/openssl-1.1-fit/include/internal/nelem.h
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_NELEM_H
|
||||
# define HEADER_NELEM_H
|
||||
|
||||
# define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#endif
|
68
trunk/3rdparty/openssl-1.1-fit/include/internal/numbers.h
vendored
Normal file
68
trunk/3rdparty/openssl-1.1-fit/include/internal/numbers.h
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_NUMBERS_H
|
||||
# define HEADER_NUMBERS_H
|
||||
|
||||
# include <limits.h>
|
||||
|
||||
# if (-1 & 3) == 0x03 /* Two's complement */
|
||||
|
||||
# define __MAXUINT__(T) ((T) -1)
|
||||
# define __MAXINT__(T) ((T) ((((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MININT__(T) (-__MAXINT__(T) - 1)
|
||||
|
||||
# elif (-1 & 3) == 0x02 /* One's complement */
|
||||
|
||||
# define __MAXUINT__(T) (((T) -1) + 1)
|
||||
# define __MAXINT__(T) ((T) ((((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MININT__(T) (-__MAXINT__(T))
|
||||
|
||||
# elif (-1 & 3) == 0x01 /* Sign/magnitude */
|
||||
|
||||
# define __MAXINT__(T) ((T) (((((T) 1) << ((sizeof(T) * CHAR_BIT) - 2)) - 1) | (((T) 1) << ((sizeof(T) * CHAR_BIT) - 2))))
|
||||
# define __MAXUINT__(T) ((T) (__MAXINT__(T) | (((T) 1) << ((sizeof(T) * CHAR_BIT) - 1))))
|
||||
# define __MININT__(T) (-__MAXINT__(T))
|
||||
|
||||
# else
|
||||
|
||||
# error "do not know the integer encoding on this architecture"
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef INT8_MAX
|
||||
# define INT8_MIN __MININT__(int8_t)
|
||||
# define INT8_MAX __MAXINT__(int8_t)
|
||||
# define UINT8_MAX __MAXUINT__(uint8_t)
|
||||
# endif
|
||||
|
||||
# ifndef INT16_MAX
|
||||
# define INT16_MIN __MININT__(int16_t)
|
||||
# define INT16_MAX __MAXINT__(int16_t)
|
||||
# define UINT16_MAX __MAXUINT__(uint16_t)
|
||||
# endif
|
||||
|
||||
# ifndef INT32_MAX
|
||||
# define INT32_MIN __MININT__(int32_t)
|
||||
# define INT32_MAX __MAXINT__(int32_t)
|
||||
# define UINT32_MAX __MAXUINT__(uint32_t)
|
||||
# endif
|
||||
|
||||
# ifndef INT64_MAX
|
||||
# define INT64_MIN __MININT__(int64_t)
|
||||
# define INT64_MAX __MAXINT__(int64_t)
|
||||
# define UINT64_MAX __MAXUINT__(uint64_t)
|
||||
# endif
|
||||
|
||||
# ifndef SIZE_MAX
|
||||
# define SIZE_MAX __MAXUINT__(size_t)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
52
trunk/3rdparty/openssl-1.1-fit/include/internal/o_dir.h
vendored
Normal file
52
trunk/3rdparty/openssl-1.1-fit/include/internal/o_dir.h
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is dual-licensed and is also available under the following
|
||||
* terms:
|
||||
*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef O_DIR_H
|
||||
# define O_DIR_H
|
||||
|
||||
typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX;
|
||||
|
||||
/*
|
||||
* returns NULL on error or end-of-directory. If it is end-of-directory,
|
||||
* errno will be zero
|
||||
*/
|
||||
const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory);
|
||||
/* returns 1 on success, 0 on error */
|
||||
int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx);
|
||||
|
||||
#endif /* LPDIR_H */
|
17
trunk/3rdparty/openssl-1.1-fit/include/internal/o_str.h
vendored
Normal file
17
trunk/3rdparty/openssl-1.1-fit/include/internal/o_str.h
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_O_STR_H
|
||||
# define HEADER_O_STR_H
|
||||
|
||||
# include <stddef.h> /* to get size_t */
|
||||
|
||||
int OPENSSL_memcmp(const void *p1, const void *p2, size_t n);
|
||||
|
||||
#endif
|
140
trunk/3rdparty/openssl-1.1-fit/include/internal/refcount.h
vendored
Normal file
140
trunk/3rdparty/openssl-1.1-fit/include/internal/refcount.h
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
#ifndef HEADER_INTERNAL_REFCOUNT_H
|
||||
# define HEADER_INTERNAL_REFCOUNT_H
|
||||
|
||||
/* Used to checking reference counts, most while doing perl5 stuff :-) */
|
||||
# if defined(OPENSSL_NO_STDIO)
|
||||
# if defined(REF_PRINT)
|
||||
# error "REF_PRINT requires stdio"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
|
||||
&& !defined(__STDC_NO_ATOMICS__)
|
||||
# include <stdatomic.h>
|
||||
# define HAVE_C11_ATOMICS
|
||||
# endif
|
||||
|
||||
# if defined(HAVE_C11_ATOMICS) && defined(ATOMIC_INT_LOCK_FREE) \
|
||||
&& ATOMIC_INT_LOCK_FREE > 0
|
||||
|
||||
# define HAVE_ATOMICS 1
|
||||
|
||||
typedef _Atomic int CRYPTO_REF_COUNT;
|
||||
|
||||
static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes to shared structure other than reference counter have to be
|
||||
* serialized. And any kind of serialization implies a release fence. This
|
||||
* means that by the time reference counter is decremented all other
|
||||
* changes are visible on all processors. Hence decrement itself can be
|
||||
* relaxed. In case it hits zero, object will be destructed. Since it's
|
||||
* last use of the object, destructor programmer might reason that access
|
||||
* to mutable members doesn't have to be serialized anymore, which would
|
||||
* otherwise imply an acquire fence. Hence conditional acquire fence...
|
||||
*/
|
||||
static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
|
||||
if (*ret == 0)
|
||||
atomic_thread_fence(memory_order_acquire);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0
|
||||
|
||||
# define HAVE_ATOMICS 1
|
||||
|
||||
typedef int CRYPTO_REF_COUNT;
|
||||
|
||||
static __inline__ int CRYPTO_UP_REF(int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = __atomic_fetch_add(val, 1, __ATOMIC_RELAXED) + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ int CRYPTO_DOWN_REF(int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = __atomic_fetch_sub(val, 1, __ATOMIC_RELAXED) - 1;
|
||||
if (*ret == 0)
|
||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# elif defined(_MSC_VER) && _MSC_VER>=1200
|
||||
|
||||
# define HAVE_ATOMICS 1
|
||||
|
||||
typedef volatile int CRYPTO_REF_COUNT;
|
||||
|
||||
# if (defined(_M_ARM) && _M_ARM>=7) || defined(_M_ARM64)
|
||||
# include <intrin.h>
|
||||
# if defined(_M_ARM64) && !defined(_ARM_BARRIER_ISH)
|
||||
# define _ARM_BARRIER_ISH _ARM64_BARRIER_ISH
|
||||
# endif
|
||||
|
||||
static __inline int CRYPTO_UP_REF(volatile int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = _InterlockedExchangeAdd_nf(val, 1) + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline int CRYPTO_DOWN_REF(volatile int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = _InterlockedExchangeAdd_nf(val, -1) - 1;
|
||||
if (*ret == 0)
|
||||
__dmb(_ARM_BARRIER_ISH);
|
||||
return 1;
|
||||
}
|
||||
# else
|
||||
# pragma intrinsic(_InterlockedExchangeAdd)
|
||||
|
||||
static __inline int CRYPTO_UP_REF(volatile int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = _InterlockedExchangeAdd(val, 1) + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline int CRYPTO_DOWN_REF(volatile int *val, int *ret, void *lock)
|
||||
{
|
||||
*ret = _InterlockedExchangeAdd(val, -1) - 1;
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
typedef int CRYPTO_REF_COUNT;
|
||||
|
||||
# define CRYPTO_UP_REF(val, ret, lock) CRYPTO_atomic_add(val, 1, ret, lock)
|
||||
# define CRYPTO_DOWN_REF(val, ret, lock) CRYPTO_atomic_add(val, -1, ret, lock)
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO)
|
||||
# define REF_ASSERT_ISNT(test) \
|
||||
(void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
|
||||
# else
|
||||
# define REF_ASSERT_ISNT(i)
|
||||
# endif
|
||||
|
||||
# ifdef REF_PRINT
|
||||
# define REF_PRINT_COUNT(a, b) \
|
||||
fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
|
||||
# else
|
||||
# define REF_PRINT_COUNT(a, b)
|
||||
# endif
|
||||
|
||||
#endif
|
155
trunk/3rdparty/openssl-1.1-fit/include/internal/sockets.h
vendored
Normal file
155
trunk/3rdparty/openssl-1.1-fit/include/internal/sockets.h
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HEADER_INTERNAL_SOCKETS
|
||||
# define HEADER_INTERNAL_SOCKETS
|
||||
|
||||
# if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
|
||||
# define NO_SYS_PARAM_H
|
||||
# endif
|
||||
# ifdef WIN32
|
||||
# define NO_SYS_UN_H
|
||||
# endif
|
||||
# ifdef OPENSSL_SYS_VMS
|
||||
# define NO_SYS_PARAM_H
|
||||
# define NO_SYS_UN_H
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_NO_SOCK
|
||||
|
||||
# elif defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
|
||||
# if defined(__DJGPP__)
|
||||
# include <sys/socket.h>
|
||||
# include <sys/un.h>
|
||||
# include <tcp.h>
|
||||
# include <netdb.h>
|
||||
# elif defined(_WIN32_WCE) && _WIN32_WCE<410
|
||||
# define getservbyname _masked_declaration_getservbyname
|
||||
# endif
|
||||
# if !defined(IPPROTO_IP)
|
||||
/* winsock[2].h was included already? */
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# ifdef getservbyname
|
||||
/* this is used to be wcecompat/include/winsock_extras.h */
|
||||
# undef getservbyname
|
||||
struct servent *PASCAL getservbyname(const char *, const char *);
|
||||
# endif
|
||||
|
||||
# ifdef _WIN64
|
||||
/*
|
||||
* Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because
|
||||
* the value constitutes an index in per-process table of limited size
|
||||
* and not a real pointer. And we also depend on fact that all processors
|
||||
* Windows run on happen to be two's-complement, which allows to
|
||||
* interchange INVALID_SOCKET and -1.
|
||||
*/
|
||||
# define socket(d,t,p) ((int)socket(d,t,p))
|
||||
# define accept(s,f,l) ((int)accept(s,f,l))
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# ifndef NO_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
# ifdef OPENSSL_SYS_VXWORKS
|
||||
# include <time.h>
|
||||
# endif
|
||||
|
||||
# include <netdb.h>
|
||||
# if defined(OPENSSL_SYS_VMS_NODECC)
|
||||
# include <socket.h>
|
||||
# include <in.h>
|
||||
# include <inet.h>
|
||||
# else
|
||||
# include <sys/socket.h>
|
||||
# ifndef NO_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
# ifndef UNIX_PATH_MAX
|
||||
# define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path)
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FILIO_H
|
||||
# include <sys/filio.h> /* FIONBIO in some SVR4, e.g. unixware, solaris */
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netinet/tcp.h>
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_SYS_AIX
|
||||
# include <sys/select.h>
|
||||
# endif
|
||||
|
||||
# ifndef VMS
|
||||
# include <sys/ioctl.h>
|
||||
# else
|
||||
# if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000)
|
||||
/* ioctl is only in VMS > 7.0 and when socketshr is not used */
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
# include <unixio.h>
|
||||
# if defined(TCPIP_TYPE_SOCKETSHR)
|
||||
# include <socketshr.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef INVALID_SOCKET
|
||||
# define INVALID_SOCKET (-1)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Some IPv6 implementations are broken, you can disable them in known
|
||||
* bad versions.
|
||||
*/
|
||||
# if !defined(OPENSSL_USE_IPV6)
|
||||
# if defined(AF_INET6)
|
||||
# define OPENSSL_USE_IPV6 1
|
||||
# else
|
||||
# define OPENSSL_USE_IPV6 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define get_last_socket_error() errno
|
||||
# define clear_socket_error() errno=0
|
||||
|
||||
# if defined(OPENSSL_SYS_WINDOWS)
|
||||
# undef get_last_socket_error
|
||||
# undef clear_socket_error
|
||||
# define get_last_socket_error() WSAGetLastError()
|
||||
# define clear_socket_error() WSASetLastError(0)
|
||||
# define readsocket(s,b,n) recv((s),(b),(n),0)
|
||||
# define writesocket(s,b,n) send((s),(b),(n),0)
|
||||
# elif defined(__DJGPP__)
|
||||
# define WATT32
|
||||
# define WATT32_NO_OLDIES
|
||||
# define closesocket(s) close_s(s)
|
||||
# define readsocket(s,b,n) read_s(s,b,n)
|
||||
# define writesocket(s,b,n) send(s,b,n,0)
|
||||
# elif defined(OPENSSL_SYS_VMS)
|
||||
# define ioctlsocket(a,b,c) ioctl(a,b,c)
|
||||
# define closesocket(s) close(s)
|
||||
# define readsocket(s,b,n) recv((s),(b),(n),0)
|
||||
# define writesocket(s,b,n) send((s),(b),(n),0)
|
||||
# elif defined(OPENSSL_SYS_VXWORKS)
|
||||
# define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c))
|
||||
# define closesocket(s) close(s)
|
||||
# define readsocket(s,b,n) read((s),(b),(n))
|
||||
# define writesocket(s,b,n) write((s),(char *)(b),(n))
|
||||
# else
|
||||
# define ioctlsocket(a,b,c) ioctl(a,b,c)
|
||||
# define closesocket(s) close(s)
|
||||
# define readsocket(s,b,n) read((s),(b),(n))
|
||||
# define writesocket(s,b,n) write((s),(b),(n))
|
||||
# endif
|
||||
|
||||
#endif
|
20
trunk/3rdparty/openssl-1.1-fit/include/internal/sslconf.h
vendored
Normal file
20
trunk/3rdparty/openssl-1.1-fit/include/internal/sslconf.h
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SSLCONF_H
|
||||
# define HEADER_SSLCONF_H
|
||||
|
||||
typedef struct ssl_conf_cmd_st SSL_CONF_CMD;
|
||||
|
||||
const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt);
|
||||
int conf_ssl_name_find(const char *name, size_t *idx);
|
||||
void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr,
|
||||
char **arg);
|
||||
|
||||
#endif
|
137
trunk/3rdparty/openssl-1.1-fit/include/internal/thread_once.h
vendored
Normal file
137
trunk/3rdparty/openssl-1.1-fit/include/internal/thread_once.h
vendored
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
/*
|
||||
* DEFINE_RUN_ONCE: Define an initialiser function that should be run exactly
|
||||
* once. It takes no arguments and returns and int result (1 for success or
|
||||
* 0 for failure). Typical usage might be:
|
||||
*
|
||||
* DEFINE_RUN_ONCE(myinitfunc)
|
||||
* {
|
||||
* do_some_initialisation();
|
||||
* if (init_is_successful())
|
||||
* return 1;
|
||||
*
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
#define DEFINE_RUN_ONCE(init) \
|
||||
static int init(void); \
|
||||
int init##_ossl_ret_ = 0; \
|
||||
void init##_ossl_(void) \
|
||||
{ \
|
||||
init##_ossl_ret_ = init(); \
|
||||
} \
|
||||
static int init(void)
|
||||
|
||||
/*
|
||||
* DECLARE_RUN_ONCE: Declare an initialiser function that should be run exactly
|
||||
* once that has been defined in another file via DEFINE_RUN_ONCE().
|
||||
*/
|
||||
#define DECLARE_RUN_ONCE(init) \
|
||||
extern int init##_ossl_ret_; \
|
||||
void init##_ossl_(void);
|
||||
|
||||
/*
|
||||
* DEFINE_RUN_ONCE_STATIC: Define an initialiser function that should be run
|
||||
* exactly once. This function will be declared as static within the file. It
|
||||
* takes no arguments and returns and int result (1 for success or 0 for
|
||||
* failure). Typical usage might be:
|
||||
*
|
||||
* DEFINE_RUN_ONCE_STATIC(myinitfunc)
|
||||
* {
|
||||
* do_some_initialisation();
|
||||
* if (init_is_successful())
|
||||
* return 1;
|
||||
*
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
#define DEFINE_RUN_ONCE_STATIC(init) \
|
||||
static int init(void); \
|
||||
static int init##_ossl_ret_ = 0; \
|
||||
static void init##_ossl_(void) \
|
||||
{ \
|
||||
init##_ossl_ret_ = init(); \
|
||||
} \
|
||||
static int init(void)
|
||||
|
||||
/*
|
||||
* DEFINE_RUN_ONCE_STATIC_ALT: Define an alternative initialiser function. This
|
||||
* function will be declared as static within the file. It takes no arguments
|
||||
* and returns an int result (1 for success or 0 for failure). An alternative
|
||||
* initialiser function is expected to be associated with a primary initialiser
|
||||
* function defined via DEFINE_ONCE_STATIC where both functions use the same
|
||||
* CRYPTO_ONCE object to synchronise. Where an alternative initialiser function
|
||||
* is used only one of the primary or the alternative initialiser function will
|
||||
* ever be called - and that function will be called exactly once. Definitition
|
||||
* of an alternative initialiser function MUST occur AFTER the definition of the
|
||||
* primary initialiser function.
|
||||
*
|
||||
* Typical usage might be:
|
||||
*
|
||||
* DEFINE_RUN_ONCE_STATIC(myinitfunc)
|
||||
* {
|
||||
* do_some_initialisation();
|
||||
* if (init_is_successful())
|
||||
* return 1;
|
||||
*
|
||||
* return 0;
|
||||
* }
|
||||
*
|
||||
* DEFINE_RUN_ONCE_STATIC_ALT(myaltinitfunc, myinitfunc)
|
||||
* {
|
||||
* do_some_alternative_initialisation();
|
||||
* if (init_is_successful())
|
||||
* return 1;
|
||||
*
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
#define DEFINE_RUN_ONCE_STATIC_ALT(initalt, init) \
|
||||
static int initalt(void); \
|
||||
static void initalt##_ossl_(void) \
|
||||
{ \
|
||||
init##_ossl_ret_ = initalt(); \
|
||||
} \
|
||||
static int initalt(void)
|
||||
|
||||
/*
|
||||
* RUN_ONCE - use CRYPTO_THREAD_run_once, and check if the init succeeded
|
||||
* @once: pointer to static object of type CRYPTO_ONCE
|
||||
* @init: function name that was previously given to DEFINE_RUN_ONCE,
|
||||
* DEFINE_RUN_ONCE_STATIC or DECLARE_RUN_ONCE. This function
|
||||
* must return 1 for success or 0 for failure.
|
||||
*
|
||||
* The return value is 1 on success (*) or 0 in case of error.
|
||||
*
|
||||
* (*) by convention, since the init function must return 1 on success.
|
||||
*/
|
||||
#define RUN_ONCE(once, init) \
|
||||
(CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
|
||||
|
||||
/*
|
||||
* RUN_ONCE_ALT - use CRYPTO_THREAD_run_once, to run an alternative initialiser
|
||||
* function and check if that initialisation succeeded
|
||||
* @once: pointer to static object of type CRYPTO_ONCE
|
||||
* @initalt: alternative initialiser function name that was previously given to
|
||||
* DEFINE_RUN_ONCE_STATIC_ALT. This function must return 1 for
|
||||
* success or 0 for failure.
|
||||
* @init: primary initialiser function name that was previously given to
|
||||
* DEFINE_RUN_ONCE_STATIC. This function must return 1 for success or
|
||||
* 0 for failure.
|
||||
*
|
||||
* The return value is 1 on success (*) or 0 in case of error.
|
||||
*
|
||||
* (*) by convention, since the init function must return 1 on success.
|
||||
*/
|
||||
#define RUN_ONCE_ALT(once, initalt, init) \
|
||||
(CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
|
144
trunk/3rdparty/openssl-1.1-fit/include/internal/tsan_assist.h
vendored
Normal file
144
trunk/3rdparty/openssl-1.1-fit/include/internal/tsan_assist.h
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* Contemporary compilers implement lock-free atomic memory access
|
||||
* primitives that facilitate writing "thread-opportunistic" or even real
|
||||
* multi-threading low-overhead code. "Thread-opportunistic" is when
|
||||
* exact result is not required, e.g. some statistics, or execution flow
|
||||
* doesn't have to be unambiguous. Simplest example is lazy "constant"
|
||||
* initialization when one can synchronize on variable itself, e.g.
|
||||
*
|
||||
* if (var == NOT_YET_INITIALIZED)
|
||||
* var = function_returning_same_value();
|
||||
*
|
||||
* This does work provided that loads and stores are single-instuction
|
||||
* operations (and integer ones are on *all* supported platforms), but
|
||||
* it upsets Thread Sanitizer. Suggested solution is
|
||||
*
|
||||
* if (tsan_load(&var) == NOT_YET_INITIALIZED)
|
||||
* tsan_store(&var, function_returning_same_value());
|
||||
*
|
||||
* Production machine code would be the same, so one can wonder why
|
||||
* bother. Having Thread Sanitizer accept "thread-opportunistic" code
|
||||
* allows to move on trouble-shooting real bugs.
|
||||
*
|
||||
* Resolving Thread Sanitizer nits was the initial purpose for this module,
|
||||
* but it was later extended with more nuanced primitives that are useful
|
||||
* even in "non-opportunistic" scenarios. Most notably verifying if a shared
|
||||
* structure is fully initialized and bypassing the initialization lock.
|
||||
* It's suggested to view macros defined in this module as "annotations" for
|
||||
* thread-safe lock-free code, "Thread-Safe ANnotations"...
|
||||
*
|
||||
* It's assumed that ATOMIC_{LONG|INT}_LOCK_FREE are assigned same value as
|
||||
* ATOMIC_POINTER_LOCK_FREE. And check for >= 2 ensures that corresponding
|
||||
* code is inlined. It should be noted that statistics counters become
|
||||
* accurate in such case.
|
||||
*
|
||||
* Special note about TSAN_QUALIFIER. It might be undesired to use it in
|
||||
* a shared header. Because whether operation on specific variable or member
|
||||
* is atomic or not might be irrelevant in other modules. In such case one
|
||||
* can use TSAN_QUALIFIER in cast specifically when it has to count.
|
||||
*/
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
|
||||
&& !defined(__STDC_NO_ATOMICS__)
|
||||
# include <stdatomic.h>
|
||||
|
||||
# if defined(ATOMIC_POINTER_LOCK_FREE) \
|
||||
&& ATOMIC_POINTER_LOCK_FREE >= 2
|
||||
# define TSAN_QUALIFIER _Atomic
|
||||
# define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
|
||||
# define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed)
|
||||
# define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
|
||||
# define tsan_decr(ptr) atomic_fetch_add_explicit((ptr), -1, memory_order_relaxed)
|
||||
# define tsan_ld_acq(ptr) atomic_load_explicit((ptr), memory_order_acquire)
|
||||
# define tsan_st_rel(ptr, val) atomic_store_explicit((ptr), (val), memory_order_release)
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__) && defined(__ATOMIC_RELAXED)
|
||||
|
||||
# if defined(__GCC_ATOMIC_POINTER_LOCK_FREE) \
|
||||
&& __GCC_ATOMIC_POINTER_LOCK_FREE >= 2
|
||||
# define TSAN_QUALIFIER volatile
|
||||
# define tsan_load(ptr) __atomic_load_n((ptr), __ATOMIC_RELAXED)
|
||||
# define tsan_store(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELAXED)
|
||||
# define tsan_counter(ptr) __atomic_fetch_add((ptr), 1, __ATOMIC_RELAXED)
|
||||
# define tsan_decr(ptr) __atomic_fetch_add((ptr), -1, __ATOMIC_RELAXED)
|
||||
# define tsan_ld_acq(ptr) __atomic_load_n((ptr), __ATOMIC_ACQUIRE)
|
||||
# define tsan_st_rel(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELEASE)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER>=1200 \
|
||||
&& (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
|
||||
defined(_M_ARM64) || (defined(_M_ARM) && _M_ARM >= 7))
|
||||
/*
|
||||
* There is subtle dependency on /volatile:<iso|ms> command-line option.
|
||||
* "ms" implies same semantic as memory_order_acquire for loads and
|
||||
* memory_order_release for stores, while "iso" - memory_order_relaxed for
|
||||
* either. Real complication is that defaults are different on x86 and ARM.
|
||||
* There is explanation for that, "ms" is backward compatible with earlier
|
||||
* compiler versions, while multi-processor ARM can be viewed as brand new
|
||||
* platform to MSC and its users, and with non-relaxed semantic taking toll
|
||||
* with additional instructions and penalties, it kind of makes sense to
|
||||
* default to "iso"...
|
||||
*/
|
||||
# define TSAN_QUALIFIER volatile
|
||||
# if defined(_M_ARM) || defined(_M_ARM64)
|
||||
# define _InterlockedExchangeAdd _InterlockedExchangeAdd_nf
|
||||
# pragma intrinsic(_InterlockedExchangeAdd_nf)
|
||||
# pragma intrinsic(__iso_volatile_load32, __iso_volatile_store32)
|
||||
# ifdef _WIN64
|
||||
# define _InterlockedExchangeAdd64 _InterlockedExchangeAdd64_nf
|
||||
# pragma intrinsic(_InterlockedExchangeAdd64_nf)
|
||||
# pragma intrinsic(__iso_volatile_load64, __iso_volatile_store64)
|
||||
# define tsan_load(ptr) (sizeof(*(ptr)) == 8 ? __iso_volatile_load64(ptr) \
|
||||
: __iso_volatile_load32(ptr))
|
||||
# define tsan_store(ptr, val) (sizeof(*(ptr)) == 8 ? __iso_volatile_store64((ptr), (val)) \
|
||||
: __iso_volatile_store32((ptr), (val)))
|
||||
# else
|
||||
# define tsan_load(ptr) __iso_volatile_load32(ptr)
|
||||
# define tsan_store(ptr, val) __iso_volatile_store32((ptr), (val))
|
||||
# endif
|
||||
# else
|
||||
# define tsan_load(ptr) (*(ptr))
|
||||
# define tsan_store(ptr, val) (*(ptr) = (val))
|
||||
# endif
|
||||
# pragma intrinsic(_InterlockedExchangeAdd)
|
||||
# ifdef _WIN64
|
||||
# pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
# define tsan_counter(ptr) (sizeof(*(ptr)) == 8 ? _InterlockedExchangeAdd64((ptr), 1) \
|
||||
: _InterlockedExchangeAdd((ptr), 1))
|
||||
# define tsan_decr(ptr) (sizeof(*(ptr)) == 8 ? _InterlockedExchangeAdd64((ptr), -1) \
|
||||
: _InterlockedExchangeAdd((ptr), -1))
|
||||
# else
|
||||
# define tsan_counter(ptr) _InterlockedExchangeAdd((ptr), 1)
|
||||
# define tsan_decr(ptr) _InterlockedExchangeAdd((ptr), -1)
|
||||
# endif
|
||||
# if !defined(_ISO_VOLATILE)
|
||||
# define tsan_ld_acq(ptr) (*(ptr))
|
||||
# define tsan_st_rel(ptr, val) (*(ptr) = (val))
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef TSAN_QUALIFIER
|
||||
|
||||
# define TSAN_QUALIFIER volatile
|
||||
# define tsan_load(ptr) (*(ptr))
|
||||
# define tsan_store(ptr, val) (*(ptr) = (val))
|
||||
# define tsan_counter(ptr) ((*(ptr))++)
|
||||
# define tsan_decr(ptr) ((*(ptr))--)
|
||||
/*
|
||||
* Lack of tsan_ld_acq and tsan_ld_rel means that compiler support is not
|
||||
* sophisticated enough to support them. Code that relies on them should be
|
||||
* protected with #ifdef tsan_ld_acq with locked fallback.
|
||||
*/
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue