From cbc620a473ce23d882ba3e9f91ec0c6c12dcd239 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 24 Sep 2018 16:32:10 +0000 Subject: Import libevent 2.1.18 This will be used to replace the embedded libevent in ntp, for OpenSSL 1.1.1 compatibility. Sponsored by: The FreeBSD Foundation --- openssl-compat.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 openssl-compat.h (limited to 'openssl-compat.h') diff --git a/openssl-compat.h b/openssl-compat.h new file mode 100644 index 000000000000..69afc716e25e --- /dev/null +++ b/openssl-compat.h @@ -0,0 +1,35 @@ +#ifndef OPENSSL_COMPAT_H +#define OPENSSL_COMPAT_H + +#if OPENSSL_VERSION_NUMBER < 0x10100000L + +static inline BIO_METHOD *BIO_meth_new(int type, const char *name) +{ + BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD)); + + if (biom != NULL) { + biom->type = type; + biom->name = name; + } + return biom; +} + +#define BIO_meth_set_write(b, f) (b)->bwrite = (f) +#define BIO_meth_set_read(b, f) (b)->bread = (f) +#define BIO_meth_set_puts(b, f) (b)->bputs = (f) +#define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f) +#define BIO_meth_set_create(b, f) (b)->create = (f) +#define BIO_meth_set_destroy(b, f) (b)->destroy = (f) + +#define BIO_set_init(b, val) (b)->init = (val) +#define BIO_set_data(b, val) (b)->ptr = (val) +#define BIO_set_shutdown(b, val) (b)->shutdown = (val) +#define BIO_get_init(b) (b)->init +#define BIO_get_data(b) (b)->ptr +#define BIO_get_shutdown(b) (b)->shutdown + +#define TLS_method SSLv23_method + +#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ + +#endif /* OPENSSL_COMPAT_H */ -- cgit v1.2.3