xref: /libevent-2.1.12/openssl-compat.h (revision 921bdcdd)
13e9e0a0dSKurt Roeckx #ifndef OPENSSL_COMPAT_H
23e9e0a0dSKurt Roeckx #define OPENSSL_COMPAT_H
33e9e0a0dSKurt Roeckx 
401bc36c1SAzat Khuzhin #include <openssl/bio.h>
501bc36c1SAzat Khuzhin #include "util-internal.h"
601bc36c1SAzat Khuzhin 
7894ca48aSBernard Spil #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
8894ca48aSBernard Spil 	(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
93e9e0a0dSKurt Roeckx 
BIO_meth_new(int type,const char * name)10fa58cb1dSAzat Khuzhin static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
113e9e0a0dSKurt Roeckx {
123e9e0a0dSKurt Roeckx 	BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD));
133e9e0a0dSKurt Roeckx 
143e9e0a0dSKurt Roeckx 	if (biom != NULL) {
153e9e0a0dSKurt Roeckx 		biom->type = type;
163e9e0a0dSKurt Roeckx 		biom->name = name;
173e9e0a0dSKurt Roeckx 	}
183e9e0a0dSKurt Roeckx 	return biom;
193e9e0a0dSKurt Roeckx }
203e9e0a0dSKurt Roeckx 
213e9e0a0dSKurt Roeckx #define BIO_meth_set_write(b, f) (b)->bwrite = (f)
223e9e0a0dSKurt Roeckx #define BIO_meth_set_read(b, f) (b)->bread = (f)
233e9e0a0dSKurt Roeckx #define BIO_meth_set_puts(b, f) (b)->bputs = (f)
243e9e0a0dSKurt Roeckx #define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f)
253e9e0a0dSKurt Roeckx #define BIO_meth_set_create(b, f) (b)->create = (f)
263e9e0a0dSKurt Roeckx #define BIO_meth_set_destroy(b, f) (b)->destroy = (f)
273e9e0a0dSKurt Roeckx 
283e9e0a0dSKurt Roeckx #define BIO_set_init(b, val) (b)->init = (val)
293e9e0a0dSKurt Roeckx #define BIO_set_data(b, val) (b)->ptr = (val)
303e9e0a0dSKurt Roeckx #define BIO_set_shutdown(b, val) (b)->shutdown = (val)
313e9e0a0dSKurt Roeckx #define BIO_get_init(b) (b)->init
323e9e0a0dSKurt Roeckx #define BIO_get_data(b) (b)->ptr
333e9e0a0dSKurt Roeckx #define BIO_get_shutdown(b) (b)->shutdown
343e9e0a0dSKurt Roeckx 
35fa58cb1dSAzat Khuzhin #define TLS_method SSLv23_method
36fa58cb1dSAzat Khuzhin 
37*921bdcddSAzat Khuzhin #define X509_getm_notBefore X509_get_notBefore
38*921bdcddSAzat Khuzhin #define X509_getm_notAfter X509_get_notAfter
39*921bdcddSAzat Khuzhin 
40894ca48aSBernard Spil #endif /* (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
41894ca48aSBernard Spil 	(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) */
42894ca48aSBernard Spil 
43894ca48aSBernard Spil #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
44894ca48aSBernard Spil #define BIO_get_init(b) (b)->init
45894ca48aSBernard Spil #endif
463e9e0a0dSKurt Roeckx 
473e9e0a0dSKurt Roeckx #endif /* OPENSSL_COMPAT_H */
48