mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUILD/medium: ssl: Fix build with OpenSSL < 1.1.0
Make sure it builds with OpenSSL < 1.1.0, a lot of the BIO_get/set methods were introduced with OpenSSL 1.1.0, so fallback with the old way of doing things if needed.
This commit is contained in:
parent
a8955d57ed
commit
66a7b3302a
@ -261,7 +261,11 @@ static int ha_ssl_write(BIO *h, const char *buf, int num)
|
|||||||
struct ssl_sock_ctx *ctx;
|
struct ssl_sock_ctx *ctx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000
|
||||||
|
ctx = h->ptr;
|
||||||
|
#else
|
||||||
ctx = BIO_get_data(h);
|
ctx = BIO_get_data(h);
|
||||||
|
#endif
|
||||||
tmpbuf.size = num;
|
tmpbuf.size = num;
|
||||||
tmpbuf.area = (void *)(uintptr_t)buf;
|
tmpbuf.area = (void *)(uintptr_t)buf;
|
||||||
tmpbuf.data = num;
|
tmpbuf.data = num;
|
||||||
@ -290,7 +294,11 @@ static int ha_ssl_read(BIO *h, char *buf, int size)
|
|||||||
struct ssl_sock_ctx *ctx;
|
struct ssl_sock_ctx *ctx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000
|
||||||
|
ctx = h->ptr;
|
||||||
|
#else
|
||||||
ctx = BIO_get_data(h);
|
ctx = BIO_get_data(h);
|
||||||
|
#endif
|
||||||
tmpbuf.size = size;
|
tmpbuf.size = size;
|
||||||
tmpbuf.area = buf;
|
tmpbuf.area = buf;
|
||||||
tmpbuf.data = 0;
|
tmpbuf.data = 0;
|
||||||
@ -316,8 +324,13 @@ static long ha_ssl_ctrl(BIO *h, int cmd, long arg1, void *arg2)
|
|||||||
|
|
||||||
static int ha_ssl_new(BIO *h)
|
static int ha_ssl_new(BIO *h)
|
||||||
{
|
{
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
h->init = 1;
|
||||||
|
h->ptr = NULL;
|
||||||
|
#else
|
||||||
BIO_set_init(h, 1);
|
BIO_set_init(h, 1);
|
||||||
BIO_set_data(h, NULL);
|
BIO_set_data(h, NULL);
|
||||||
|
#endif
|
||||||
BIO_clear_flags(h, ~0);
|
BIO_clear_flags(h, ~0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -9840,7 +9853,7 @@ static void __ssl_sock_init(void)
|
|||||||
ERR_load_SSL_strings();
|
ERR_load_SSL_strings();
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
ha_meth = malloc(sizeof(*ha_meth));
|
ha_meth = malloc(sizeof(*ha_meth));
|
||||||
bzero(ha_meth, sizeof(*ha_metho));
|
bzero(ha_meth, sizeof(*ha_meth));
|
||||||
ha_meth->bwrite = ha_ssl_write;
|
ha_meth->bwrite = ha_ssl_write;
|
||||||
ha_meth->bread = ha_ssl_read;
|
ha_meth->bread = ha_ssl_read;
|
||||||
ha_meth->ctrl = ha_ssl_ctrl;
|
ha_meth->ctrl = ha_ssl_ctrl;
|
||||||
|
Loading…
Reference in New Issue
Block a user