aports/community/cassandra-cpp-driver/b0830f3168b73be821e564b66d7550d24bec823f.patch

96 lines
3.5 KiB
Diff

From b0830f3168b73be821e564b66d7550d24bec823f Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Thu, 9 Nov 2017 20:53:20 +0000
Subject: [PATCH] Fixing build with LibreSSL
---
src/ssl/ring_buffer_bio.cpp | 6 +++---
src/ssl/ring_buffer_bio.hpp | 4 ++--
src/ssl/ssl_openssl_impl.cpp | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/ssl/ring_buffer_bio.cpp b/src/ssl/ring_buffer_bio.cpp
index 862d1445..fa2e1a9f 100644
--- a/src/ssl/ring_buffer_bio.cpp
+++ b/src/ssl/ring_buffer_bio.cpp
@@ -43,7 +43,7 @@
#include <string.h>
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define BIO_set_data(b, p) ((b)->ptr = p)
#define BIO_get_shutdown(b) ((b)->shutdown)
#define BIO_set_shutdown(b, s) ((b)->shutdown = s)
@@ -53,7 +53,7 @@
namespace cass {
namespace rb {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
const BIO_METHOD RingBufferBio::method_ = {
BIO_TYPE_MEM,
"ring buffer",
@@ -86,7 +86,7 @@ void RingBufferBio::initialize() {
BIO* RingBufferBio::create(RingBufferState* state) {
// The const_cast doesn't violate const correctness. OpenSSL's usage of
// BIO_METHOD is effectively const but BIO_new() takes a non-const argument.
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
BIO* bio = BIO_new(const_cast<BIO_METHOD*>(&method_));
#else
BIO* bio = BIO_new(method_);
diff --git a/src/ssl/ring_buffer_bio.hpp b/src/ssl/ring_buffer_bio.hpp
index dffb6b9e..766320d3 100644
--- a/src/ssl/ring_buffer_bio.hpp
+++ b/src/ssl/ring_buffer_bio.hpp
@@ -47,7 +47,7 @@
#include <assert.h>
#include <openssl/bio.h>
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define BIO_get_data(b) ((b)->ptr)
#endif
@@ -89,7 +89,7 @@ class RingBufferBio {
static int gets(BIO* bio, char* out, int size);
static long ctrl(BIO* bio, int cmd, long num, void* ptr);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static const BIO_METHOD method_;
#else
static BIO_METHOD *method_;
diff --git a/src/ssl/ssl_openssl_impl.cpp b/src/ssl/ssl_openssl_impl.cpp
index 7ead6755..1ec0b60b 100644
--- a/src/ssl/ssl_openssl_impl.cpp
+++ b/src/ssl/ssl_openssl_impl.cpp
@@ -28,7 +28,7 @@
#define DEBUG_SSL 0
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define ASN1_STRING_get0_data ASN1_STRING_data
#else
#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE SSL_F_USE_CERTIFICATE_CHAIN_FILE
@@ -171,7 +171,7 @@ static int SSL_CTX_use_certificate_chain_bio(SSL_CTX* ctx, BIO* in) {
int r;
unsigned long err;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
if (ctx->extra_certs != NULL) {
sk_X509_pop_free(ctx->extra_certs, X509_free);
ctx->extra_certs = NULL;
@@ -181,7 +181,7 @@ static int SSL_CTX_use_certificate_chain_bio(SSL_CTX* ctx, BIO* in) {
#endif
while ((ca = PEM_read_bio_X509(in, NULL, pem_password_callback, NULL)) != NULL) {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
r = SSL_CTX_add_extra_chain_cert(ctx, ca);
#else
r = SSL_CTX_add0_chain_cert(ctx, ca);