main/mosquitto: rebuild against libressl

This commit is contained in:
Natanael Copa 2016-10-04 12:41:06 +00:00
parent e2673eed35
commit 175f96b00b
2 changed files with 61 additions and 6 deletions

View File

@ -1,26 +1,27 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mosquitto
pkgver=1.4.10
pkgrel=0
pkgrel=1
pkgdesc="An Open Source MQTT v3.1 Broker"
url="http://mosquitto.org/"
arch="all"
license="BSD"
depends=""
depends_dev=""
makedepends="$depends_dev openssl-dev c-ares-dev util-linux-dev
makedepends="$depends_dev libressl-dev c-ares-dev util-linux-dev
libwebsockets-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs++:_pp
$pkgname-libs $pkgname-clients"
replaces="mosquitto-utils"
source="http://mosquitto.org/files/source/mosquitto-$pkgver.tar.gz
libressl.patch
mosquitto.initd"
_builddir="$srcdir"/mosquitto-$pkgver
builddir="$srcdir"/mosquitto-$pkgver
prepare() {
local i
cd "$_builddir"
cd "$builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
@ -35,16 +36,18 @@ prepare() {
}
build() {
cd "$_builddir"
cd "$builddir"
# PSK not supported by libressl
make \
WITH_MEMORY_TRACKING=no \
WITH_WEBSOCKETS=yes \
WITH_SRV=yes \
WITH_TLS_PSK=no \
prefix=/usr || return 1
}
package() {
cd "$_builddir"
cd "$builddir"
make prefix=/usr DESTDIR="$pkgdir" install || return 1
mv "$pkgdir"/etc/mosquitto/mosquitto.conf.example \
"$pkgdir"/etc/mosquitto/mosquitto.conf || return 1
@ -68,8 +71,11 @@ clients() {
}
md5sums="61839b47b58c5799aab76584f13ed66f mosquitto-1.4.10.tar.gz
60b04a0ecba85e76ddf806da343fcebb libressl.patch
3a5c35f76efabcb7bd4fb6398caf9e5b mosquitto.initd"
sha256sums="437648d68a4a781dd8d913814cd5451f59ab4a5fcf84cccaf7c36e6a07459770 mosquitto-1.4.10.tar.gz
175134ccd92944f5861bd84e16c93adedac88a625c0e37091e4330e56fbf3834 libressl.patch
97c7324f0f5e9dce52b241366bcfc3fb02ef8d2e0d622bab898eb36f261056c9 mosquitto.initd"
sha512sums="fe5d6d7196a137a496ba6881c77d852396baefb4f0b83ccd9a22175fc05b09e48a09ea249e30ec7db966e11de134ebcc4e2e9b1fd40b31dc59fb0fa2f60b75a1 mosquitto-1.4.10.tar.gz
53859b628f965b77f6e47910c0ceba2f2737b815131ed800dc64a80419e434d25b5ba0938ae645882e9aa5d475d4940c7d35cc6d56f54bc4937a66b32d7db4ad libressl.patch
16f96d8f7f3a8b06e2b2e04d42d7e0d89a931b52277fc017e4802f7a3bc85aff4dd290b1a0c40382ea8f5568d0ceb7319c031d9be916f346d805231a002b0433 mosquitto.initd"

View File

@ -0,0 +1,49 @@
diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h
index 4b4cf85..700bbb0 100644
--- a/lib/mosquitto_internal.h
+++ b/lib/mosquitto_internal.h
@@ -25,6 +25,9 @@ Contributors:
#ifdef WITH_TLS
# include <openssl/ssl.h>
+# if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+# define HAVE_OPENSSL_OPAQUE_STRUCTS
+# endif
#else
# include <time.h>
#endif
diff --git a/src/mosquitto_passwd.c b/src/mosquitto_passwd.c
index de9a719..5b854d9 100644
--- a/src/mosquitto_passwd.c
+++ b/src/mosquitto_passwd.c
@@ -90,7 +90,7 @@ int output_new_password(FILE *fptr, const char *username, const char *password)
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
const EVP_MD *digest;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX context;
#else
EVP_MD_CTX *context;
@@ -117,7 +117,7 @@ int output_new_password(FILE *fptr, const char *username, const char *password)
return 1;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX_init(&context);
EVP_DigestInit_ex(&context, digest, NULL);
EVP_DigestUpdate(&context, password, strlen(password));
diff --git a/src/security_default.c b/src/security_default.c
index 64ca846..9ad8708 100644
--- a/src/security_default.c
+++ b/src/security_default.c
@@ -770,7 +770,7 @@ int mosquitto_psk_key_get_default(struct mosquitto_db *db, const char *hint, con
int _pw_digest(const char *password, const unsigned char *salt, unsigned int salt_len, unsigned char *hash, unsigned int *hash_len)
{
const EVP_MD *digest;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX context;
digest = EVP_get_digestbyname("sha512");