lang/swi-prolog: unbreak build with opaque RSA, BIO and BIO_METHOD.

Independently of these patches, the ssl test hangs and if that hang
is worked around, a number of cert validation failures show up, most
of them to do with differences between the old and new verifier. An
update of this port is long overdue.

Discussed with edd (maintainer)
This commit is contained in:
tb 2021-11-30 10:41:45 +00:00
parent 53ef95b1f6
commit 9d185a28c1
3 changed files with 66 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.91 2021/10/26 10:01:12 tb Exp $
# $OpenBSD: Makefile,v 1.92 2021/11/30 10:41:45 tb Exp $
BROKEN-hppa = undefined reference to __sync_fetch_and_add_4
BROKEN-sparc64 = infinite loop or aborts during build
@ -6,7 +6,7 @@ BROKEN-sparc64 = infinite loop or aborts during build
COMMENT = Prolog for the real world
V = 7.6.0
REVISION = 12
REVISION = 13
DISTNAME = swipl-$V
PKGNAME = swi-prolog-$V
CATEGORIES = lang

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-packages_ssl_crypto4pl_c,v 1.1 2021/11/30 10:41:46 tb Exp $
Fix build with opaque RSA in LibreSSL 3.5.
Index: packages/ssl/crypto4pl.c
--- packages/ssl/crypto4pl.c.orig
+++ packages/ssl/crypto4pl.c
@@ -763,7 +763,7 @@ static int
recover_rsa(term_t t, RSA** rsap)
{ RSA *rsa = RSA_new();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
if ( get_bn_arg(1, t, &rsa->n) &&
get_bn_arg(2, t, &rsa->e) &&
get_bn_arg(3, t, &rsa->d) &&

View File

@ -0,0 +1,48 @@
$OpenBSD: patch-packages_ssl_cryptolib_c,v 1.1 2021/11/30 10:41:46 tb Exp $
Fix build with opaque BIO and BIO_METHOD in LibreSSL 3.5.
LibreSSL doesn't have CRYPTO_ONCE and CRYPTO_THREAD_run_once().
Replace them with their pthread equivalents.
Index: packages/ssl/cryptolib.c
--- packages/ssl/cryptolib.c.orig
+++ packages/ssl/cryptolib.c
@@ -33,6 +33,7 @@
*/
#include <config.h>
+#include <pthread.h>
#include <string.h>
#include "cryptolib.h"
@@ -293,7 +294,7 @@ bio_control(BIO* bio, int cmd, long num, void* ptr)
static int
bio_create(BIO* bio)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
bio->shutdown = 1;
bio->init = 1;
bio->num = -1;
@@ -321,7 +322,7 @@ bio_destroy(BIO* bio)
return 1;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
/*
* Specify the BIO read and write function structures
*/
@@ -364,6 +365,12 @@ bio_write_method(void)
* In OpenSSL >= 1.1.0, the BIO methods are constructed
* using functions. We initialize them exactly once.
*/
+
+#if defined(LIBRESSL_VERSION_NUMBER)
+#define CRYPTO_ONCE pthread_once_t
+#define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
+#define CRYPTO_THREAD_run_once(a, b) (pthread_once((a), (b)) == 0)
+#endif
static CRYPTO_ONCE once_read = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_ONCE once_write = CRYPTO_ONCE_STATIC_INIT;