aboutsummaryrefslogtreecommitdiffstats
path: root/main/kamailio
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-04-27 10:23:03 +0000
committerTimo Teräs <timo.teras@iki.fi>2017-04-27 10:28:32 +0000
commit1d01e2a4d43f989bfdb930dc41f473421867c281 (patch)
tree4530aff415659e07f2c2f7c3906ac4adf9ece715 /main/kamailio
parentc459226eed8f4aeb4a47a1b256715a582366e1a0 (diff)
downloadaports-1d01e2a4d43f989bfdb930dc41f473421867c281.tar.bz2
aports-1d01e2a4d43f989bfdb930dc41f473421867c281.tar.xz
main/kamailio: fix tls module build against libressl
Diffstat (limited to 'main/kamailio')
-rw-r--r--main/kamailio/0002-fix-libressl.patch156
-rw-r--r--main/kamailio/APKBUILD10
2 files changed, 160 insertions, 6 deletions
diff --git a/main/kamailio/0002-fix-libressl.patch b/main/kamailio/0002-fix-libressl.patch
new file mode 100644
index 0000000000..be7670eec1
--- /dev/null
+++ b/main/kamailio/0002-fix-libressl.patch
@@ -0,0 +1,156 @@
+diff -ru kamailio-5.0.1.orig/src/modules/tls/tls_bio.c kamailio-5.0.1/src/modules/tls/tls_bio.c
+--- kamailio-5.0.1.orig/src/modules/tls/tls_bio.c 2017-04-05 13:32:39.000000000 +0000
++++ kamailio-5.0.1/src/modules/tls/tls_bio.c 2017-04-27 10:16:48.389532400 +0000
+@@ -63,7 +63,7 @@
+ static long tls_bio_mbuf_ctrl(BIO* b, int cmd, long arg1, void* arg2);
+
+
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
++#if OPENSSL_VERSION_NUMBER < 0x010100000L || defined(LIBRESSL_VERSION_NUMBER)
+ static BIO_METHOD tls_mbuf_method = {
+ BIO_TYPE_TLS_MBUF, /* type */
+ "sr_tls_mbuf", /* name */
+@@ -76,6 +76,27 @@
+ tls_bio_mbuf_free, /* destroy(free) function */
+ 0 /* ctrl callback */
+ };
++
++static void *CRYPTO_zalloc(size_t num, const char *file, int line)
++{
++ void *ret = CRYPTO_malloc(num, file, line);
++ if (ret != NULL)
++ memset(ret, 0, num);
++ return ret;
++}
++# define OPENSSL_zalloc(num) CRYPTO_zalloc(num, __FILE__, __LINE__)
++static void *BIO_get_data(BIO *b)
++{
++ return b->ptr;
++}
++static void BIO_set_data(BIO *b, void *ptr)
++{
++ b->ptr = ptr;
++}
++static void BIO_set_init(BIO *b, int init)
++{
++ b->init = init;
++}
+ #else
+ static BIO_METHOD *tls_mbuf_method = NULL;
+ #endif
+@@ -84,7 +105,7 @@
+ /** returns a custom tls_mbuf BIO. */
+ BIO_METHOD* tls_BIO_mbuf(void)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
++#if OPENSSL_VERSION_NUMBER < 0x010100000L || defined(LIBRESSL_VERSION_NUMBER)
+ return &tls_mbuf_method;
+ #else
+ if(tls_mbuf_method != NULL) {
+@@ -137,22 +158,14 @@
+ struct tls_bio_mbuf_data* d;
+
+ TLS_BIO_DBG("tls_BIO_mbuf_set called (%p => %p, %p)\n", b, rd, wr);
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- d = b->ptr;
+-#else
+ d = BIO_get_data(b);
+-#endif
+ if (unlikely(d == 0)){
+ BUG("null BIO ptr data\n");
+ return 0;
+ }
+ d->rd = rd;
+ d->wr = wr;
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- b->init = 1;
+-#else
+ BIO_set_init(b, 1);
+-#endif
+ return 1;
+ }
+
+@@ -167,25 +180,12 @@
+ struct tls_bio_mbuf_data* d;
+
+ TLS_BIO_DBG("tls_bio_mbuf_new called (%p)\n", b);
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- b->init = 0; /* not initialized yet */
+- b->num = 0;
+- b->ptr = 0;
+- b->flags = 0;
+- d = OPENSSL_malloc(sizeof(*d));
+- if (unlikely(d == 0))
+- return 0;
+- d->rd = 0;
+- d->wr = 0;
+- b->ptr = d;
+-#else
+ BIO_set_init(b, 0);
+ BIO_set_data(b, NULL);
+ d = OPENSSL_zalloc(sizeof(*d));
+ if (unlikely(d == 0))
+ return 0;
+ BIO_set_data(b, d);
+-#endif
+ return 1;
+ }
+
+@@ -200,13 +200,6 @@
+ TLS_BIO_DBG("tls_bio_mbuf_free called (%p)\n", b);
+ if (unlikely( b == 0))
+ return 0;
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- if (likely(b->ptr)){
+- OPENSSL_free(b->ptr);
+- b->ptr = 0;
+- b->init = 0;
+- }
+-#else
+ do {
+ struct tls_bio_mbuf_data* d;
+ d = BIO_get_data(b);
+@@ -216,7 +209,6 @@
+ BIO_set_init(b, 0);
+ }
+ } while(0);
+-#endif
+ return 1;
+ }
+
+@@ -235,11 +227,7 @@
+
+ ret = 0;
+ if (likely(dst)) {
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- d = b->ptr;
+-#else
+ d = BIO_get_data(b);
+-#endif
+ BIO_clear_retry_flags(b);
+ if (unlikely(d == 0 || d->rd->buf == 0)) {
+ if (d == 0)
+@@ -291,11 +279,7 @@
+ int ret;
+
+ ret = 0;
+-#if OPENSSL_VERSION_NUMBER < 0x010100000L
+- d = b->ptr;
+-#else
+ d = BIO_get_data(b);
+-#endif
+ BIO_clear_retry_flags(b);
+ if (unlikely(d == 0 || d->wr->buf == 0)) {
+ if (d == 0)
+diff -ru kamailio-5.0.1.orig/src/modules/tls/tls_domain.c kamailio-5.0.1/src/modules/tls/tls_domain.c
+--- kamailio-5.0.1.orig/src/modules/tls/tls_domain.c 2017-04-05 13:32:39.000000000 +0000
++++ kamailio-5.0.1/src/modules/tls/tls_domain.c 2017-04-27 10:15:10.447718361 +0000
+@@ -124,7 +124,7 @@
+ return;
+ }
+
+-#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
++#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(LIBRESSL_VERSION_NUMBER)
+ /* libssl >= v1.1.0 */
+ DH_set0_pqg(dh, p, NULL, g);
+ #else
diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index 0049fbe368..364e96c834 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -13,7 +13,7 @@ _gittag=HEAD
pkgver=5.0.1
-pkgrel=0
+pkgrel=1
[ -z "${_gitcommit}" ] && _suffix="_src" || _suffix="-${_gitcommit}"
pkgdesc="Open Source SIP Server"
@@ -224,13 +224,9 @@ _module_group_kstandard="$_mod_list_basic $_mod_list_dbuid $_mod_list_pcre"
subpackages="$pkgname-doc $pkgname-dbg"
_modules="$_module_group_kstandard"
-#
-# We do not include tls modules because the tls module does not compile against libressl
-# Once it has been properly refactored we can add it back in (2017-04-26)
-#
for _i in db postgres sqlite dbtext mysql \
cpl xml unixodbc snmpstats xmpp carrierroute \
- ldap utils presence lua ims outbound debugger \
+ ldap utils tls presence lua ims outbound debugger \
extras json websocket authephemeral \
uuid ev memcached redis geoip2 jansson \
jsdt http_async; do
@@ -241,6 +237,7 @@ done
source="http://www.kamailio.org/pub/kamailio/$pkgver/src/${pkgname}-${pkgver}${_suffix}.tar.gz
0001-musl-fixes.patch
+ 0002-fix-libressl.patch
0003-kamdbctl.base.patch
0004-remove-spurious-execinfo.patch
kamailio.cfg
@@ -509,6 +506,7 @@ http_async() {
sha512sums="8e30d2d615e435f51d99113823652403dd0fd874d325b7e5c0e2c6055f977ab16adc8ce9de9031c591150ee43fd1a1bfe5adb252890c14087ac1795f060fc478 kamailio-5.0.1_src.tar.gz
4371c04ffdbd876cbc8128a4ae42368be7e4783eff564bd424fd4cebba18c8841212837ce305557f4d0643f37711741d157feba8cd6d24be3e9dc6a436142110 0001-musl-fixes.patch
+27150c5ef2b77e5944513a5e3a45ef550be3e3aaa6539ba4984624442940b8df1649b3269af1afd0f1019c5fd33029177ced2cd6011ab0d633cd64a69d38e9a2 0002-fix-libressl.patch
139fab275e7d01da85bf3422a16966165c72584122513d34b5fb3d9341c430eeb69ec5b86b82ff4acce709f5ab3f651de5954ae38ff9a256a19b22d88cfea830 0003-kamdbctl.base.patch
e60e8d41e55008f0473e4d645af3b43f2bc097e341bb3bb81daec8bc47abcd6d037cbb56082675c24ffb1c50b2eb93e3c4fc50b0dc2df9cdfe4f28ad7b9fbf9e 0004-remove-spurious-execinfo.patch
c1abf69b48847dc8c7ab0d11ef9adb531aa4635f9d44db6933981edc5a47df374664fb24867b19aa64abbcc9777bf1cd0360d9aea54e27b081065928c61e0f0b kamailio.cfg