1 /* $NetBSD: openssl-compat.h,v 1.1.1.1 2017/01/31 21:14:53 christos Exp $ */ 2 #ifndef OPENSSL_COMPAT_H 3 #define OPENSSL_COMPAT_H 4 5 #if OPENSSL_VERSION_NUMBER < 0x10100000L 6 7 static inline BIO_METHOD *BIO_meth_new(int type, const char *name) 8 { 9 BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD)); 10 11 if (biom != NULL) { 12 biom->type = type; 13 biom->name = name; 14 } 15 return biom; 16 } 17 18 #define BIO_meth_set_write(b, f) (b)->bwrite = (f) 19 #define BIO_meth_set_read(b, f) (b)->bread = (f) 20 #define BIO_meth_set_puts(b, f) (b)->bputs = (f) 21 #define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f) 22 #define BIO_meth_set_create(b, f) (b)->create = (f) 23 #define BIO_meth_set_destroy(b, f) (b)->destroy = (f) 24 25 #define BIO_set_init(b, val) (b)->init = (val) 26 #define BIO_set_data(b, val) (b)->ptr = (val) 27 #define BIO_set_shutdown(b, val) (b)->shutdown = (val) 28 #define BIO_get_init(b) (b)->init 29 #define BIO_get_data(b) (b)->ptr 30 #define BIO_get_shutdown(b) (b)->shutdown 31 32 #define TLS_method SSLv23_method 33 34 #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ 35 36 #endif /* OPENSSL_COMPAT_H */ 37