summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Lipp2017-09-25 14:19:21 +0200
committerMoritz Lipp2017-09-25 14:19:21 +0200
commitf67c357ac1df52e203ed8e7d64ecf2d9fce88b94 (patch)
treefc22fc6e913c974f94bf4818ddf5086781c3da2e
parent8873dbceb01d857725f95c514756f3bdcece9ccf (diff)
downloadaur-f67c357ac1df52e203ed8e7d64ecf2d9fce88b94.tar.gz
Update to 2.3.1
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD32
-rw-r--r--openssl1.1.patch210
3 files changed, 238 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index cac14ac4ba9..adb66571ea7 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,18 @@
# Generated by mksrcinfo v8
-# Sun Nov 20 17:09:39 UTC 2016
+# Mon Sep 25 12:19:10 UTC 2017
pkgbase = libsignal-protocol-c
pkgdesc = Signal Protocol C Library
- pkgver = 2.3.0
+ pkgver = 2.3.1
pkgrel = 1
- url = https://github.com/rizsotto/Bear
+ url = https://github.com/WhisperSystems/libsignal-protocol-c
arch = i686
arch = x86_64
license = GPL3
makedepends = cmake
- source = https://github.com/WhisperSystems/libsignal-protocol-c/archive/v2.3.0.tar.gz
- md5sums = 987c0ae7cd054816016e6e286cd4fd7b
+ source = https://github.com/WhisperSystems/libsignal-protocol-c/archive/v2.3.1.tar.gz
+ source = openssl1.1.patch
+ md5sums = 8321edeba3e0642c4c98d5d2870db8cd
+ md5sums = 59f4b598a16fde94b3305377adbf7b83
pkgname = libsignal-protocol-c
diff --git a/PKGBUILD b/PKGBUILD
index 22603a55b80..331eac66e10 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,16 +1,24 @@
# Maintainer: Moritz Lipp <mlq@pwmt.org>
pkgname=libsignal-protocol-c
-pkgver=2.3.0
+pkgver=2.3.1
pkgrel=1
pkgdesc="Signal Protocol C Library"
arch=('i686' 'x86_64')
-url="https://github.com/rizsotto/Bear"
+url="https://github.com/WhisperSystems/libsignal-protocol-c"
license=('GPL3')
makedepends=('cmake')
testdepends=('check', 'openssl>=1.0')
-source=(https://github.com/WhisperSystems/$pkgname/archive/v$pkgver.tar.gz)
-md5sums=('987c0ae7cd054816016e6e286cd4fd7b')
+source=(https://github.com/WhisperSystems/$pkgname/archive/v$pkgver.tar.gz
+'openssl1.1.patch')
+md5sums=('8321edeba3e0642c4c98d5d2870db8cd'
+ '59f4b598a16fde94b3305377adbf7b83')
+
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p1 < $srcdir/openssl1.1.patch
+}
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -19,18 +27,20 @@ build() {
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
+ -DBUILD_TESTING=1 \
..
- # -DBUILD_TESTING=1 \
make
}
-# check() {
-# cd "$srcdir/$pkgname-$pkgver/tests"
-# make
-# cd ..
-# ctest
-# }
+check() {
+ cd "$srcdir/$pkgname-$pkgver/build/tests"
+
+ make
+ cd ..
+
+ ctest
+}
package() {
cd "$srcdir/$pkgname-$pkgver/build"
diff --git a/openssl1.1.patch b/openssl1.1.patch
new file mode 100644
index 00000000000..41db4e064c3
--- /dev/null
+++ b/openssl1.1.patch
@@ -0,0 +1,210 @@
+From 0dbc7bdbe1ad3b42fed52d2a326db6fa40204a06 Mon Sep 17 00:00:00 2001
+From: Derek Konigsberg <dkonigsberg@whatsapp.com>
+Date: Thu, 4 May 2017 09:22:35 -0700
+Subject: [PATCH] Added support for building against OpenSSL 1.1
+
+OpenSSL 1.1 introduced some minor API changes in how certain context
+objects could be created. This update uses preprocessor macros to adapt
+to those changes, while preserving backwards compatibility.
+
+Referencing #66
+---
+ tests/test_common_openssl.c | 79 +++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 65 insertions(+), 14 deletions(-)
+
+diff --git a/tests/test_common_openssl.c b/tests/test_common_openssl.c
+index da3fb87..90d4b0c 100644
+--- a/tests/test_common_openssl.c
++++ b/tests/test_common_openssl.c
+@@ -1,5 +1,6 @@
+ #include "test_common.h"
+
++#include <openssl/opensslv.h>
+ #include <openssl/evp.h>
+ #include <openssl/hmac.h>
+ #include <openssl/rand.h>
+@@ -17,11 +18,19 @@ int test_random_generator(uint8_t *data, size_t len, void *user_data)
+
+ int test_hmac_sha256_init(void **hmac_context, const uint8_t *key, size_t key_len, void *user_data)
+ {
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ HMAC_CTX *ctx = HMAC_CTX_new();
++ if(!ctx) {
++ return SG_ERR_NOMEM;
++ }
++#else
+ HMAC_CTX *ctx = malloc(sizeof(HMAC_CTX));
+ if(!ctx) {
+ return SG_ERR_NOMEM;
+ }
+ HMAC_CTX_init(ctx);
++#endif
++
+ *hmac_context = ctx;
+
+ if(HMAC_Init_ex(ctx, key, key_len, EVP_sha256(), 0) != 1) {
+@@ -65,8 +74,12 @@ void test_hmac_sha256_cleanup(void *hmac_context, void *user_data)
+ {
+ if(hmac_context) {
+ HMAC_CTX *ctx = hmac_context;
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ HMAC_CTX_free(ctx);
++#else
+ HMAC_CTX_cleanup(ctx);
+ free(ctx);
++#endif
+ }
+ }
+
+@@ -188,6 +201,7 @@ int test_encrypt(signal_buffer **output,
+ void *user_data)
+ {
+ int result = 0;
++ EVP_CIPHER_CTX *ctx = 0;
+ uint8_t *out_buf = 0;
+
+ const EVP_CIPHER *evp_cipher = aes_cipher(cipher, key_len);
+@@ -206,10 +220,22 @@ int test_encrypt(signal_buffer **output,
+ return SG_ERR_UNKNOWN;
+ }
+
+- EVP_CIPHER_CTX ctx;
+- EVP_CIPHER_CTX_init(&ctx);
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ ctx = EVP_CIPHER_CTX_new();
++ if(!ctx) {
++ result = SG_ERR_NOMEM;
++ goto complete;
++ }
++#else
++ ctx = malloc(sizeof(EVP_CIPHER_CTX));
++ if(!ctx) {
++ result = SG_ERR_NOMEM;
++ goto complete;
++ }
++ EVP_CIPHER_CTX_init(ctx);
++#endif
+
+- result = EVP_EncryptInit_ex(&ctx, evp_cipher, 0, key, iv);
++ result = EVP_EncryptInit_ex(ctx, evp_cipher, 0, key, iv);
+ if(!result) {
+ fprintf(stderr, "cannot initialize cipher\n");
+ result = SG_ERR_UNKNOWN;
+@@ -217,7 +243,7 @@ int test_encrypt(signal_buffer **output,
+ }
+
+ if(cipher == SG_CIPHER_AES_CTR_NOPADDING) {
+- result = EVP_CIPHER_CTX_set_padding(&ctx, 0);
++ result = EVP_CIPHER_CTX_set_padding(ctx, 0);
+ if(!result) {
+ fprintf(stderr, "cannot set padding\n");
+ result = SG_ERR_UNKNOWN;
+@@ -233,7 +259,7 @@ int test_encrypt(signal_buffer **output,
+ }
+
+ int out_len = 0;
+- result = EVP_EncryptUpdate(&ctx,
++ result = EVP_EncryptUpdate(ctx,
+ out_buf, &out_len, plaintext, plaintext_len);
+ if(!result) {
+ fprintf(stderr, "cannot encrypt plaintext\n");
+@@ -242,7 +268,7 @@ int test_encrypt(signal_buffer **output,
+ }
+
+ int final_len = 0;
+- result = EVP_EncryptFinal_ex(&ctx, out_buf + out_len, &final_len);
++ result = EVP_EncryptFinal_ex(ctx, out_buf + out_len, &final_len);
+ if(!result) {
+ fprintf(stderr, "cannot finish encrypting plaintext\n");
+ result = SG_ERR_UNKNOWN;
+@@ -252,7 +278,13 @@ int test_encrypt(signal_buffer **output,
+ *output = signal_buffer_create(out_buf, out_len + final_len);
+
+ complete:
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ if(ctx) {
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ EVP_CIPHER_CTX_free(ctx);
++#else
++ free(ctx);
++#endif
++ }
+ if(out_buf) {
+ free(out_buf);
+ }
+@@ -267,6 +299,7 @@ int test_decrypt(signal_buffer **output,
+ void *user_data)
+ {
+ int result = 0;
++ EVP_CIPHER_CTX *ctx = 0;
+ uint8_t *out_buf = 0;
+
+ const EVP_CIPHER *evp_cipher = aes_cipher(cipher, key_len);
+@@ -285,10 +318,22 @@ int test_decrypt(signal_buffer **output,
+ return SG_ERR_UNKNOWN;
+ }
+
+- EVP_CIPHER_CTX ctx;
+- EVP_CIPHER_CTX_init(&ctx);
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ ctx = EVP_CIPHER_CTX_new();
++ if(!ctx) {
++ result = SG_ERR_NOMEM;
++ goto complete;
++ }
++#else
++ ctx = malloc(sizeof(EVP_CIPHER_CTX));
++ if(!ctx) {
++ result = SG_ERR_NOMEM;
++ goto complete;
++ }
++ EVP_CIPHER_CTX_init(ctx);
++#endif
+
+- result = EVP_DecryptInit_ex(&ctx, evp_cipher, 0, key, iv);
++ result = EVP_DecryptInit_ex(ctx, evp_cipher, 0, key, iv);
+ if(!result) {
+ fprintf(stderr, "cannot initialize cipher\n");
+ result = SG_ERR_UNKNOWN;
+@@ -296,7 +341,7 @@ int test_decrypt(signal_buffer **output,
+ }
+
+ if(cipher == SG_CIPHER_AES_CTR_NOPADDING) {
+- result = EVP_CIPHER_CTX_set_padding(&ctx, 0);
++ result = EVP_CIPHER_CTX_set_padding(ctx, 0);
+ if(!result) {
+ fprintf(stderr, "cannot set padding\n");
+ result = SG_ERR_UNKNOWN;
+@@ -312,7 +357,7 @@ int test_decrypt(signal_buffer **output,
+ }
+
+ int out_len = 0;
+- result = EVP_DecryptUpdate(&ctx,
++ result = EVP_DecryptUpdate(ctx,
+ out_buf, &out_len, ciphertext, ciphertext_len);
+ if(!result) {
+ fprintf(stderr, "cannot decrypt ciphertext\n");
+@@ -321,7 +366,7 @@ int test_decrypt(signal_buffer **output,
+ }
+
+ int final_len = 0;
+- result = EVP_DecryptFinal_ex(&ctx, out_buf + out_len, &final_len);
++ result = EVP_DecryptFinal_ex(ctx, out_buf + out_len, &final_len);
+ if(!result) {
+ fprintf(stderr, "cannot finish decrypting ciphertext\n");
+ result = SG_ERR_UNKNOWN;
+@@ -331,7 +376,13 @@ int test_decrypt(signal_buffer **output,
+ *output = signal_buffer_create(out_buf, out_len + final_len);
+
+ complete:
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ if(ctx) {
++#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
++ EVP_CIPHER_CTX_free(ctx);
++#else
++ free(ctx);
++#endif
++ }
+ if(out_buf) {
+ free(out_buf);
+ }