summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsodium-pr70.patch39
-rw-r--r--php-pecl-libsodium.spec4
2 files changed, 43 insertions, 0 deletions
diff --git a/libsodium-pr70.patch b/libsodium-pr70.patch
new file mode 100644
index 0000000..b97287f
--- /dev/null
+++ b/libsodium-pr70.patch
@@ -0,0 +1,39 @@
+From ca45bd4a55541d58136c21b38b9b90e750fedfbc Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Mon, 30 Nov 2015 18:31:42 +0100
+Subject: [PATCH] fix test
+
+---
+ tests/crypto_auth.phpt | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/tests/crypto_auth.phpt b/tests/crypto_auth.phpt
+index c72451e..76f30eb 100644
+--- a/tests/crypto_auth.phpt
++++ b/tests/crypto_auth.phpt
+@@ -18,13 +18,9 @@ var_dump(\Sodium\crypto_auth_verify($mac, $badmsg, $key));
+
+ // Let's flip a bit pseudo-randomly
+ $badmsg = $msg;
+-$badmsg[mt_rand(0, 999)] = \chr(
+- \ord($msg[0]) ^ (
+- // Mask out higher bits (thus 256 => 0)
+- 0xFF & (
+- // 1, 2, 4, 8, 16, 32, 64, 128, 256
+- 1 << mt_rand(0, 8)
+- )
++$badmsg[$i=mt_rand(0, 999)] = \chr(
++ \ord($msg[$i]) ^ (
++ 1 << mt_rand(0, 7)
+ )
+ );
+
+@@ -32,7 +28,7 @@ var_dump(\Sodium\crypto_auth_verify($mac, $badmsg, $key));
+
+ // Now let's change a bit in the MAC
+ $badmac = $mac;
+-$badmac[0] = \chr(\ord($badmsg[0]) ^ 0x80);
++$badmac[0] = \chr(\ord($badmac[0]) ^ 0x80);
+ var_dump(\Sodium\crypto_auth_verify($badmac, $msg, $key));
+ ?>
+ --EXPECT--
diff --git a/php-pecl-libsodium.spec b/php-pecl-libsodium.spec
index b8151ce..f4f87ee 100644
--- a/php-pecl-libsodium.spec
+++ b/php-pecl-libsodium.spec
@@ -32,6 +32,9 @@ Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+# See https://github.com/jedisct1/libsodium-php/pull/70
+Patch0: %{pecl_name}-pr70.patch
+
BuildRequires: libsodium-devel >= 0.6.0
BuildRequires: php-devel > 5.2
BuildRequires: php-pear
@@ -66,6 +69,7 @@ mv %{pecl_name}-%{version} NTS
sed -e '/role="test"/d' -i package.xml
cd NTS
+%patch0 -p1 -b .pr70
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h)