On Sat, Jul 24, 2021 at 09:00:47PM +0200, Theo Buehler wrote: > On Sat, Jul 24, 2021 at 07:26:53PM +0100, Stuart Henderson wrote: > > any salt users around who can test this? > > The regress/lib/libssl/tlsfuzzer tests exercise M2Crypto quite well. > They pass. > > ok tb > > with one comment below. > > > Index: patches/patch-src_SWIG__bio_i > > =================================================================== > > RCS file: patches/patch-src_SWIG__bio_i > > diff -N patches/patch-src_SWIG__bio_i > > --- /dev/null 1 Jan 1970 00:00:00 -0000 > > +++ patches/patch-src_SWIG__bio_i 24 Jul 2021 18:25:28 -0000 > > @@ -0,0 +1,34 @@ > > +$OpenBSD: patch-SWIG__bio_i,v 1.4 2018/04/25 16:51:05 jasper Exp $ > > + > > +BIO_meth_new() and BIO_meth_free() are non-static in LibreSSL > > The patch description makes no sense to me. > > Presumably the patch itself is a leftover from before we had BIO_meth > stuff. I think it should be dropped: we should be using libcrypto's > version, not a reimplementation.
Grmbl. I failed to actually remove the patch in my first test... src/SWIG/_m2crypto_wrap.c:5527:32: warning: implicit declaration of function 'BIO_get_init' is invalid in C99 [-Wimplicit-function-declaration] if (BIO_get_shutdown(b) && BIO_get_init(b)) ^ BIO_get_init() is missing from libcrypto. That's a clear oversight. I will add this in the next bump. I suggest using this diff. It only adds a BIO_get_init() define instead of re-doing all manner of BIO_ things. Only patches/patch-src_SWIG__bio_i changed. Index: Makefile =================================================================== RCS file: /cvs/ports/security/py-M2Crypto/Makefile,v retrieving revision 1.31 diff -u -p -r1.31 Makefile --- Makefile 3 May 2021 11:47:33 -0000 1.31 +++ Makefile 24 Jul 2021 19:13:38 -0000 @@ -2,7 +2,7 @@ COMMENT = crypto and ssl toolkit for python -MODPY_EGG_VERSION = 0.37.1 +MODPY_EGG_VERSION = 0.38.0 DISTNAME = M2Crypto-${MODPY_EGG_VERSION} PKGNAME = py-${DISTNAME} @@ -26,5 +26,7 @@ FLAVOR = python3 MAKE_ENV = SWIG_FEATURES=-I/usr/include BUILD_DEPENDS = devel/swig + +# XXX tests need "parameterized", dep was added in 0.37.0 .include <bsd.port.mk> Index: distinfo =================================================================== RCS file: /cvs/ports/security/py-M2Crypto/distinfo,v retrieving revision 1.17 diff -u -p -r1.17 distinfo --- distinfo 3 May 2021 11:47:33 -0000 1.17 +++ distinfo 24 Jul 2021 19:13:38 -0000 @@ -1,2 +1,2 @@ -SHA256 (M2Crypto-0.37.1.tar.gz) = 5OQvBot4zL8RPl0Kcq5fSA9sOs5JQLkeT/9VmM//b7M= -SIZE (M2Crypto-0.37.1.tar.gz) = 1247031 +SHA256 (M2Crypto-0.38.0.tar.gz) = mfImCjCQHJSajcbV+CzVMS/7iryS52YzuvIxu7yy3ss= +SIZE (M2Crypto-0.38.0.tar.gz) = 1241269 Index: patches/patch-M2Crypto_BIO_py =================================================================== RCS file: /cvs/ports/security/py-M2Crypto/patches/patch-M2Crypto_BIO_py,v retrieving revision 1.2 diff -u -p -r1.2 patch-M2Crypto_BIO_py --- patches/patch-M2Crypto_BIO_py 25 Apr 2018 16:49:20 -0000 1.2 +++ patches/patch-M2Crypto_BIO_py 24 Jul 2021 19:13:38 -0000 @@ -1,58 +0,0 @@ -$OpenBSD: patch-M2Crypto_BIO_py,v 1.2 2018/04/25 16:49:20 jasper Exp $ - -Partially revert https://gitlab.com/m2crypto/m2crypto/commit/738cd0bf3dc2ee619f598290d5bf4c2190987f16: - - * Fix BIO.File ... return type of BIO.readline() and close properly. - That is, flush BIO.File() before closing and close also underlying - system file. - -For Python 2 this results in: - -python2 -c "import M2Crypto; M2Crypto.BIO.openfile('/etc/ssl/cert.pem')" -Traceback (most recent call last): - File "<string>", line 1, in <module> - File "/usr/local/lib/python2.7/site-packages/M2Crypto/BIO.py", line 284, in openfile - return File(f) - File "/usr/local/lib/python2.7/site-packages/M2Crypto/BIO.py", line 239, in __init__ - pyfile.flush() -IOError: [Errno 9] Bad file descriptor - -https://gitlab.com/m2crypto/m2crypto/issues/211 - -Index: M2Crypto/BIO.py ---- M2Crypto/BIO.py.orig -+++ M2Crypto/BIO.py -@@ -235,8 +235,9 @@ class File(BIO): - # - # https://docs.python.org/3.3/c-api/file.html - # -- pyfile.flush() -- self.fname = pyfile.name -+ if six.PY3: -+ pyfile.flush() -+ self.fname = pyfile.name - self.pyfile = pyfile - # Be wary of https://github.com/openssl/openssl/pull/1925 - # BIO_new_fd is NEVER to be used before OpenSSL 1.1.1 -@@ -246,7 +247,8 @@ class File(BIO): - self.bio = m2.bio_new_pyfile(pyfile, m2.bio_noclose) - - self.close_pyfile = close_pyfile -- self.closed = False -+ if six.PY3: -+ self.closed = False - - def flush(self): - # type: () -> None -@@ -255,8 +257,9 @@ class File(BIO): - - def close(self): - # type: () -> None -- self.flush() -- super(File, self).close() -+ if six.PY3: -+ self.flush() -+ super(File, self).close() - if self.close_pyfile: - self.pyfile.close() - Index: patches/patch-SWIG__bio_i =================================================================== RCS file: patches/patch-SWIG__bio_i diff -N patches/patch-SWIG__bio_i --- patches/patch-SWIG__bio_i 25 Apr 2018 16:51:05 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,34 +0,0 @@ -$OpenBSD: patch-SWIG__bio_i,v 1.4 2018/04/25 16:51:05 jasper Exp $ - -BIO_meth_new() and BIO_meth_free() are non-static in LibreSSL - -Index: SWIG/_bio.i ---- SWIG/_bio.i.orig -+++ SWIG/_bio.i -@@ -293,8 +293,12 @@ int bio_should_write(BIO* a) { - } - - /* Macros for things not defined before 1.1.0 */ --#if OPENSSL_VERSION_NUMBER < 0x10100000L --static BIO_METHOD * -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ -+#if !defined(LIBRESSL_VERSION_NUMBER) -+static -+#endif -+BIO_METHOD * - BIO_meth_new( int type, const char *name ) - { - BIO_METHOD *method = malloc( sizeof(BIO_METHOD) ); -@@ -306,7 +310,10 @@ BIO_meth_new( int type, const char *name ) - return method; - } - --static void -+#if !defined(LIBRESSL_VERSION_NUMBER) -+static -+#endif -+void - BIO_meth_free( BIO_METHOD *meth ) - { - if ( meth == NULL ) { Index: patches/patch-SWIG__evp_i =================================================================== RCS file: patches/patch-SWIG__evp_i diff -N patches/patch-SWIG__evp_i --- patches/patch-SWIG__evp_i 9 Oct 2017 05:57:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -$OpenBSD: patch-SWIG__evp_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ - -Fix build with LibreSSL - -Index: SWIG/_evp.i ---- SWIG/_evp.i.orig -+++ SWIG/_evp.i -@@ -19,7 +19,7 @@ Copyright (c) 2009-2010 Heikki Toivonen. All rights re - #include <openssl/rsa.h> - #include <openssl/opensslv.h> - --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - - HMAC_CTX *HMAC_CTX_new(void) { - HMAC_CTX *ret = PyMem_Malloc(sizeof(HMAC_CTX)); Index: patches/patch-SWIG__lib11_compat_i =================================================================== RCS file: patches/patch-SWIG__lib11_compat_i diff -N patches/patch-SWIG__lib11_compat_i --- patches/patch-SWIG__lib11_compat_i 9 Oct 2017 05:57:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -$OpenBSD: patch-SWIG__lib11_compat_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ - -Fix build with LibreSSL - -Index: SWIG/_lib11_compat.i ---- SWIG/_lib11_compat.i.orig -+++ SWIG/_lib11_compat.i -@@ -8,7 +8,7 @@ - */ - - %{ --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - - #include <string.h> - #include <openssl/engine.h> Index: patches/patch-SWIG__lib_i =================================================================== RCS file: patches/patch-SWIG__lib_i diff -N patches/patch-SWIG__lib_i --- patches/patch-SWIG__lib_i 3 May 2021 11:47:34 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,25 +0,0 @@ -$OpenBSD: patch-SWIG__lib_i,v 1.5 2021/05/03 11:47:34 jasper Exp $ - -Fix build with LibreSSL - -Index: SWIG/_lib.i ---- SWIG/_lib.i.orig -+++ SWIG/_lib.i -@@ -21,7 +21,7 @@ - - %{ - /* OpenSSL 1.0.2 copmatbility shim */ --#if OPENSSL_VERSION_NUMBER < 0x10002000L -+#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) - typedef void (*OPENSSL_sk_freefunc)(void *); - typedef void *(*OPENSSL_sk_copyfunc)(const void *); - typedef struct stack_st OPENSSL_STACK; -@@ -536,7 +536,7 @@ int passphrase_callback(char *buf, int num, int v, voi - %inline %{ - - void lib_init() { --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - SSLeay_add_all_algorithms(); - ERR_load_ERR_strings(); - #endif Index: patches/patch-SWIG__ssl_i =================================================================== RCS file: patches/patch-SWIG__ssl_i diff -N patches/patch-SWIG__ssl_i --- patches/patch-SWIG__ssl_i 17 Jul 2020 17:47:30 -0000 1.10 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -$OpenBSD: patch-SWIG__ssl_i,v 1.10 2020/07/17 17:47:30 jasper Exp $ - -Fix build with LibreSSL - -Index: SWIG/_ssl.i ---- SWIG/_ssl.i.orig -+++ SWIG/_ssl.i -@@ -265,7 +265,7 @@ void ssl_init(PyObject *ssl_err, PyObject *ssl_timeout - } - - const SSL_METHOD *tlsv1_method(void) { --#if OPENSSL_VERSION_NUMBER >= 0x10100000L -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - PyErr_WarnEx(PyExc_DeprecationWarning, - "Function TLSv1_method has been deprecated.", 1); - #endif Index: patches/patch-SWIG__threads_i =================================================================== RCS file: patches/patch-SWIG__threads_i diff -N patches/patch-SWIG__threads_i --- patches/patch-SWIG__threads_i 9 Oct 2017 05:57:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,52 +0,0 @@ -$OpenBSD: patch-SWIG__threads_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ - -Fix build with LibreSSL - -Index: SWIG/_threads.i ---- SWIG/_threads.i.orig -+++ SWIG/_threads.i -@@ -5,7 +5,7 @@ - #include <pythread.h> - #include <openssl/crypto.h> - --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - #define CRYPTO_num_locks() (CRYPTO_NUM_LOCKS) - static PyThread_type_lock lock_cs[CRYPTO_num_locks()]; - static long lock_count[CRYPTO_num_locks()]; -@@ -13,7 +13,7 @@ static int thread_mode = 0; - #endif - - void threading_locking_callback(int mode, int type, const char *file, int line) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - if (mode & CRYPTO_LOCK) { - PyThread_acquire_lock(lock_cs[type], WAIT_LOCK); - lock_count[type]++; -@@ -25,7 +25,7 @@ void threading_locking_callback(int mode, int type, co - } - - unsigned long threading_id_callback(void) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - return (unsigned long)PyThread_get_thread_ident(); - #else - return (unsigned long)0; -@@ -35,7 +35,7 @@ unsigned long threading_id_callback(void) { - - %inline %{ - void threading_init(void) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - int i; - if (!thread_mode) { - for (i=0; i<CRYPTO_num_locks(); i++) { -@@ -50,7 +50,7 @@ void threading_init(void) { - } - - void threading_cleanup(void) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - int i; - if (thread_mode) { - CRYPTO_set_locking_callback(NULL); Index: patches/patch-SWIG_libcrypto-compat_h =================================================================== RCS file: patches/patch-SWIG_libcrypto-compat_h diff -N patches/patch-SWIG_libcrypto-compat_h --- patches/patch-SWIG_libcrypto-compat_h 9 Oct 2017 05:57:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -$OpenBSD: patch-SWIG_libcrypto-compat_h,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ - -Fix build with LibreSSL - -Index: SWIG/libcrypto-compat.h ---- SWIG/libcrypto-compat.h.orig -+++ SWIG/libcrypto-compat.h -@@ -1,7 +1,7 @@ - #ifndef LIBCRYPTO_COMPAT_H - #define LIBCRYPTO_COMPAT_H - --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - - #include <openssl/rsa.h> - #include <openssl/dsa.h> Index: patches/patch-src_M2Crypto_BIO_py =================================================================== RCS file: patches/patch-src_M2Crypto_BIO_py diff -N patches/patch-src_M2Crypto_BIO_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_M2Crypto_BIO_py 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,58 @@ +$OpenBSD: patch-M2Crypto_BIO_py,v 1.2 2018/04/25 16:49:20 jasper Exp $ + +Partially revert https://gitlab.com/m2crypto/m2crypto/commit/738cd0bf3dc2ee619f598290d5bf4c2190987f16: + + * Fix BIO.File ... return type of BIO.readline() and close properly. + That is, flush BIO.File() before closing and close also underlying + system file. + +For Python 2 this results in: + +python2 -c "import M2Crypto; M2Crypto.BIO.openfile('/etc/ssl/cert.pem')" +Traceback (most recent call last): + File "<string>", line 1, in <module> + File "/usr/local/lib/python2.7/site-packages/M2Crypto/BIO.py", line 284, in openfile + return File(f) + File "/usr/local/lib/python2.7/site-packages/M2Crypto/BIO.py", line 239, in __init__ + pyfile.flush() +IOError: [Errno 9] Bad file descriptor + +https://gitlab.com/m2crypto/m2crypto/issues/211 + +Index: src/M2Crypto/BIO.py +--- src/M2Crypto/BIO.py.orig ++++ src/M2Crypto/BIO.py +@@ -235,8 +235,9 @@ class File(BIO): + # + # https://docs.python.org/3.3/c-api/file.html + # +- pyfile.flush() +- self.fname = pyfile.name ++ if six.PY3: ++ pyfile.flush() ++ self.fname = pyfile.name + self.pyfile = pyfile + # Be wary of https://github.com/openssl/openssl/pull/1925 + # BIO_new_fd is NEVER to be used before OpenSSL 1.1.1 +@@ -246,7 +247,8 @@ class File(BIO): + self.bio = m2.bio_new_pyfile(pyfile, m2.bio_noclose) + + self.close_pyfile = close_pyfile +- self.closed = False ++ if six.PY3: ++ self.closed = False + + def flush(self): + # type: () -> None +@@ -255,8 +257,9 @@ class File(BIO): + + def close(self): + # type: () -> None +- self.flush() +- super(File, self).close() ++ if six.PY3: ++ self.flush() ++ super(File, self).close() + if self.close_pyfile: + self.pyfile.close() + Index: patches/patch-src_SWIG__bio_i =================================================================== RCS file: patches/patch-src_SWIG__bio_i diff -N patches/patch-src_SWIG__bio_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__bio_i 24 Jul 2021 19:20:54 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +LibreSSL doesn't have BIO_get_init() + +Index: src/SWIG/_bio.i +--- src/SWIG/_bio.i.orig ++++ src/SWIG/_bio.i +@@ -330,6 +330,9 @@ BIO_meth_free( BIO_METHOD *meth ) + #define BIO_clear_flags(b, x) b->flags &= ~(x) + #define BIO_get_data(b) b->ptr + #endif ++#if defined(LIBRESSL_VERSION_NUMBER) ++#define BIO_get_init(b) (b)->init ++#endif + + /* implment custom BIO_s_pyfd */ + Index: patches/patch-src_SWIG__evp_i =================================================================== RCS file: patches/patch-src_SWIG__evp_i diff -N patches/patch-src_SWIG__evp_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__evp_i 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,16 @@ +$OpenBSD: patch-SWIG__evp_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/_evp.i +--- src/SWIG/_evp.i.orig ++++ src/SWIG/_evp.i +@@ -19,7 +19,7 @@ Copyright (c) 2009-2010 Heikki Toivonen. All rights re + #include <openssl/rsa.h> + #include <openssl/opensslv.h> + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + HMAC_CTX *HMAC_CTX_new(void) { + HMAC_CTX *ret = PyMem_Malloc(sizeof(HMAC_CTX)); Index: patches/patch-src_SWIG__lib11_compat_i =================================================================== RCS file: patches/patch-src_SWIG__lib11_compat_i diff -N patches/patch-src_SWIG__lib11_compat_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__lib11_compat_i 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,16 @@ +$OpenBSD: patch-SWIG__lib11_compat_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/_lib11_compat.i +--- src/SWIG/_lib11_compat.i.orig ++++ src/SWIG/_lib11_compat.i +@@ -8,7 +8,7 @@ + */ + + %{ +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + #include <string.h> + #include <openssl/engine.h> Index: patches/patch-src_SWIG__lib_i =================================================================== RCS file: patches/patch-src_SWIG__lib_i diff -N patches/patch-src_SWIG__lib_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__lib_i 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,25 @@ +$OpenBSD: patch-SWIG__lib_i,v 1.5 2021/05/03 11:47:34 jasper Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/_lib.i +--- src/SWIG/_lib.i.orig ++++ src/SWIG/_lib.i +@@ -21,7 +21,7 @@ + + %{ + /* OpenSSL 1.0.2 copmatbility shim */ +-#if OPENSSL_VERSION_NUMBER < 0x10002000L ++#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) + typedef void (*OPENSSL_sk_freefunc)(void *); + typedef void *(*OPENSSL_sk_copyfunc)(const void *); + typedef struct stack_st OPENSSL_STACK; +@@ -532,7 +532,7 @@ int passphrase_callback(char *buf, int num, int v, voi + %inline %{ + + void lib_init() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + SSLeay_add_all_algorithms(); + ERR_load_ERR_strings(); + #endif Index: patches/patch-src_SWIG__ssl_i =================================================================== RCS file: patches/patch-src_SWIG__ssl_i diff -N patches/patch-src_SWIG__ssl_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__ssl_i 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,16 @@ +$OpenBSD: patch-SWIG__ssl_i,v 1.10 2020/07/17 17:47:30 jasper Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/_ssl.i +--- src/SWIG/_ssl.i.orig ++++ src/SWIG/_ssl.i +@@ -265,7 +265,7 @@ void ssl_init(PyObject *ssl_err, PyObject *ssl_timeout + } + + const SSL_METHOD *tlsv1_method(void) { +-#if OPENSSL_VERSION_NUMBER >= 0x10100000L ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + PyErr_WarnEx(PyExc_DeprecationWarning, + "Function TLSv1_method has been deprecated.", 1); + #endif Index: patches/patch-src_SWIG__threads_i =================================================================== RCS file: patches/patch-src_SWIG__threads_i diff -N patches/patch-src_SWIG__threads_i --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG__threads_i 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,52 @@ +$OpenBSD: patch-SWIG__threads_i,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/_threads.i +--- src/SWIG/_threads.i.orig ++++ src/SWIG/_threads.i +@@ -5,7 +5,7 @@ + #include <pythread.h> + #include <openssl/crypto.h> + +-#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + #define CRYPTO_num_locks() (CRYPTO_NUM_LOCKS) + static PyThread_type_lock lock_cs[CRYPTO_num_locks()]; + static long lock_count[CRYPTO_num_locks()]; +@@ -13,7 +13,7 @@ static int thread_mode = 0; + #endif + + void threading_locking_callback(int mode, int type, const char *file, int line) { +-#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + if (mode & CRYPTO_LOCK) { + PyThread_acquire_lock(lock_cs[type], WAIT_LOCK); + lock_count[type]++; +@@ -25,7 +25,7 @@ void threading_locking_callback(int mode, int type, co + } + + unsigned long threading_id_callback(void) { +-#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + return (unsigned long)PyThread_get_thread_ident(); + #else + return (unsigned long)0; +@@ -35,7 +35,7 @@ unsigned long threading_id_callback(void) { + + %inline %{ + void threading_init(void) { +-#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + int i; + if (!thread_mode) { + for (i=0; i<CRYPTO_num_locks(); i++) { +@@ -50,7 +50,7 @@ void threading_init(void) { + } + + void threading_cleanup(void) { +-#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + int i; + if (thread_mode) { + CRYPTO_set_locking_callback(NULL); Index: patches/patch-src_SWIG_libcrypto-compat_h =================================================================== RCS file: patches/patch-src_SWIG_libcrypto-compat_h diff -N patches/patch-src_SWIG_libcrypto-compat_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SWIG_libcrypto-compat_h 24 Jul 2021 19:13:38 -0000 @@ -0,0 +1,16 @@ +$OpenBSD: patch-SWIG_libcrypto-compat_h,v 1.1 2017/10/09 05:57:38 ajacoutot Exp $ + +Fix build with LibreSSL + +Index: src/SWIG/libcrypto-compat.h +--- src/SWIG/libcrypto-compat.h.orig ++++ src/SWIG/libcrypto-compat.h +@@ -1,7 +1,7 @@ + #ifndef LIBCRYPTO_COMPAT_H + #define LIBCRYPTO_COMPAT_H + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + #include <openssl/rsa.h> + #include <openssl/dsa.h> Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/security/py-M2Crypto/pkg/PLIST,v retrieving revision 1.10 diff -u -p -r1.10 PLIST --- pkg/PLIST 3 May 2021 11:47:34 -0000 1.10 +++ pkg/PLIST 24 Jul 2021 19:13:38 -0000 @@ -5,7 +5,7 @@ lib/python${MODPY_VERSION}/site-packages lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/PKG-INFO lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/SOURCES.txt lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/dependency_links.txt -lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/requires.txt +lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/not-zip-safe lib/python${MODPY_VERSION}/site-packages/M2Crypto-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/top_level.txt lib/python${MODPY_VERSION}/site-packages/M2Crypto/ASN1.py lib/python${MODPY_VERSION}/site-packages/M2Crypto/AuthCookie.py