src: Rename OPENSSL_101_API macro as OPENSSL_1_1_API
This commit is contained in:
parent
d9bb3448bf
commit
a3a6b91c5f
|
@ -43,13 +43,13 @@ using namespace nghttp2;
|
|||
|
||||
namespace shrpx {
|
||||
|
||||
#if !OPENSSL_101_API
|
||||
#if !OPENSSL_1_1_API
|
||||
|
||||
void *BIO_get_data(BIO *bio) { return bio->ptr; }
|
||||
void BIO_set_data(BIO *bio, void *ptr) { bio->ptr = ptr; }
|
||||
void BIO_set_init(BIO *bio, int init) { bio->init = init; }
|
||||
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl,
|
||||
MemchunkPool *mcpool, ev_tstamp write_timeout,
|
||||
|
@ -238,14 +238,14 @@ long shrpx_bio_ctrl(BIO *b, int cmd, long num, void *ptr) {
|
|||
|
||||
namespace {
|
||||
int shrpx_bio_create(BIO *b) {
|
||||
#if OPENSSL_101_API
|
||||
#if OPENSSL_1_1_API
|
||||
BIO_set_init(b, 1);
|
||||
#else // !OPENSSL_101_API
|
||||
#else // !OPENSSL_1_1_API
|
||||
b->init = 1;
|
||||
b->num = 0;
|
||||
b->ptr = nullptr;
|
||||
b->flags = 0;
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
return 1;
|
||||
}
|
||||
} // namespace
|
||||
|
@ -256,17 +256,17 @@ int shrpx_bio_destroy(BIO *b) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !OPENSSL_101_API
|
||||
#if !OPENSSL_1_1_API
|
||||
b->ptr = nullptr;
|
||||
b->init = 0;
|
||||
b->flags = 0;
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
return 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#if OPENSSL_101_API
|
||||
#if OPENSSL_1_1_API
|
||||
|
||||
BIO_METHOD *create_bio_method() {
|
||||
auto meth = BIO_meth_new(BIO_TYPE_FD, "nghttpx-bio");
|
||||
|
@ -283,7 +283,7 @@ BIO_METHOD *create_bio_method() {
|
|||
|
||||
void delete_bio_method(BIO_METHOD *bio_method) { BIO_meth_free(bio_method); }
|
||||
|
||||
#else // !OPENSSL_101_API
|
||||
#else // !OPENSSL_1_1_API
|
||||
|
||||
BIO_METHOD *create_bio_method() {
|
||||
static BIO_METHOD shrpx_bio_method = {
|
||||
|
@ -297,7 +297,7 @@ BIO_METHOD *create_bio_method() {
|
|||
|
||||
void delete_bio_method(BIO_METHOD *bio_method) {}
|
||||
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
void Connection::set_ssl(SSL *ssl) {
|
||||
tls.ssl = ssl;
|
||||
|
|
|
@ -72,13 +72,13 @@ namespace shrpx {
|
|||
|
||||
namespace ssl {
|
||||
|
||||
#if !OPENSSL_101_API
|
||||
#if !OPENSSL_1_1_API
|
||||
namespace {
|
||||
const unsigned char *ASN1_STRING_get0_data(ASN1_STRING *x) {
|
||||
return ASN1_STRING_data(x);
|
||||
}
|
||||
} // namespace
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
namespace {
|
||||
int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
||||
|
@ -280,11 +280,11 @@ int tls_session_new_cb(SSL *ssl, SSL_SESSION *session) {
|
|||
|
||||
namespace {
|
||||
SSL_SESSION *tls_session_get_cb(SSL *ssl,
|
||||
#if OPENSSL_101_API
|
||||
#if OPENSSL_1_1_API
|
||||
const unsigned char *id,
|
||||
#else // !OPENSSL_101_API
|
||||
#else // !OPENSSL_1_1_API
|
||||
unsigned char *id,
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
int idlen, int *copy) {
|
||||
auto conn = static_cast<Connection *>(SSL_get_app_data(ssl));
|
||||
auto handler = static_cast<ClientHandler *>(conn->data);
|
||||
|
|
10
src/ssl.cc
10
src/ssl.cc
|
@ -54,13 +54,13 @@ const char *const DEFAULT_CIPHER_LIST =
|
|||
"SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-"
|
||||
"SHA:DES-CBC3-SHA:!DSS";
|
||||
|
||||
#if OPENSSL_101_API
|
||||
#if OPENSSL_1_1_API
|
||||
|
||||
// CRYPTO_LOCK is deprecated as of OpenSSL 1.1.0
|
||||
LibsslGlobalLock::LibsslGlobalLock() {}
|
||||
LibsslGlobalLock::~LibsslGlobalLock() {}
|
||||
|
||||
#else // !OPENSSL_101_API
|
||||
#else // !OPENSSL_1_1_API
|
||||
|
||||
namespace {
|
||||
std::vector<std::mutex> ssl_global_locks;
|
||||
|
@ -91,7 +91,7 @@ LibsslGlobalLock::LibsslGlobalLock() {
|
|||
|
||||
LibsslGlobalLock::~LibsslGlobalLock() { ssl_global_locks.clear(); }
|
||||
|
||||
#endif // !OPENSSL_101_API
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
const char *get_tls_protocol(SSL *ssl) {
|
||||
switch (SSL_version(ssl)) {
|
||||
|
@ -166,9 +166,9 @@ bool check_http2_requirement(SSL *ssl) {
|
|||
void libssl_init() {
|
||||
// OPENSSL_config() is not available in BoringSSL. It is also
|
||||
// deprecated as of OpenSSL 1.1.0.
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_101_API
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API
|
||||
OPENSSL_config(nullptr);
|
||||
#endif // !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_101_API
|
||||
#endif // !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API
|
||||
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#define OPENSSL_101_API \
|
||||
#define OPENSSL_1_1_API \
|
||||
(!defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x1010000fL)
|
||||
|
||||
#endif // OPENSSL_COMPAT_H
|
||||
|
|
|
@ -1351,7 +1351,7 @@ uint32_t hash32(const StringRef &s) {
|
|||
return h;
|
||||
}
|
||||
|
||||
#if !OPENSSL_101_API
|
||||
#if !OPENSSL_1_1_API
|
||||
namespace {
|
||||
EVP_MD_CTX *EVP_MD_CTX_new(void) { return EVP_MD_CTX_create(); }
|
||||
} // namespace
|
||||
|
@ -1359,7 +1359,7 @@ EVP_MD_CTX *EVP_MD_CTX_new(void) { return EVP_MD_CTX_create(); }
|
|||
namespace {
|
||||
void EVP_MD_CTX_free(EVP_MD_CTX *ctx) { EVP_MD_CTX_destroy(ctx); }
|
||||
} // namespace
|
||||
#endif
|
||||
#endif // !OPENSSL_1_1_API
|
||||
|
||||
int sha256(uint8_t *res, const StringRef &s) {
|
||||
int rv;
|
||||
|
|
Loading…
Reference in New Issue