summaryrefslogtreecommitdiffstats
path: root/crypto-upstream.patch
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-06-09 08:25:59 +0200
committerRemi Collet <fedora@famillecollet.com>2016-06-09 08:25:59 +0200
commit977e0dbb085ab18063e19ffc0fd227da31dd1e3c (patch)
tree3779f9be06f6c43f676240a406725a1494b5ed06 /crypto-upstream.patch
parent5cc7e951f1c62d852d66aec89b28e680e3ca5ad3 (diff)
php-pecl-crypto: upstream patch for PHP 7.1
Diffstat (limited to 'crypto-upstream.patch')
-rw-r--r--crypto-upstream.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/crypto-upstream.patch b/crypto-upstream.patch
new file mode 100644
index 0000000..b7b010b
--- /dev/null
+++ b/crypto-upstream.patch
@@ -0,0 +1,91 @@
+From ee493a2737fd29a8ff8c8e3dec7c6fa46822ef05 Mon Sep 17 00:00:00 2001
+From: Jakub Zelenka <bukka@php.net>
+Date: Wed, 6 Jan 2016 14:40:54 +0000
+Subject: [PATCH] Split name codes for Hash and MAC alg not found
+
+It prevents constant redefinition error
+---
+ crypto_hash.c | 8 ++++----
+ tests/CMAC___construct_basic.phpt | 2 +-
+ tests/HMAC___construct_basic.phpt | 2 +-
+ tests/Hash___construct_basic.phpt | 2 +-
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/crypto_hash.c b/crypto_hash.c
+index 7fc0ded..2ce172a 100644
+--- a/crypto_hash.c
++++ b/crypto_hash.c
+@@ -29,7 +29,7 @@
+ PHP_CRYPTO_EXCEPTION_DEFINE(Hash)
+ PHP_CRYPTO_ERROR_INFO_BEGIN(Hash)
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+- ALGORITHM_NOT_FOUND,
++ HASH_ALGORITHM_NOT_FOUND,
+ "Hash algorithm '%s' not found"
+ )
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+@@ -134,7 +134,7 @@ static const zend_function_entry php_crypto_hash_object_methods[] = {
+ PHP_CRYPTO_EXCEPTION_DEFINE(MAC)
+ PHP_CRYPTO_ERROR_INFO_BEGIN(MAC)
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+- ALGORITHM_NOT_FOUND,
++ MAC_ALGORITHM_NOT_FOUND,
+ "MAC algorithm '%s' not found"
+ )
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+@@ -609,7 +609,7 @@ PHP_CRYPTO_METHOD(Hash, __construct)
+
+ digest = EVP_get_digestbyname(algorithm);
+ if (!digest) {
+- php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(Hash, ALGORITHM_NOT_FOUND), algorithm);
++ php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(Hash, HASH_ALGORITHM_NOT_FOUND), algorithm);
+ } else {
+ PHP_CRYPTO_HASH_ALG(PHPC_THIS) = digest;
+ }
+@@ -787,6 +787,6 @@ PHP_CRYPTO_METHOD(MAC, __construct)
+ return;
+
+ php_crypto_mac_alg_not_found:
+- php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(MAC, ALGORITHM_NOT_FOUND), algorithm);
++ php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(MAC, MAC_ALGORITHM_NOT_FOUND), algorithm);
+ efree(algorithm_uc);
+ }
+diff --git a/tests/CMAC___construct_basic.phpt b/tests/CMAC___construct_basic.phpt
+index abd58a3..77a66c6 100644
+--- a/tests/CMAC___construct_basic.phpt
++++ b/tests/CMAC___construct_basic.phpt
+@@ -28,7 +28,7 @@ try {
+ $cmac = new Crypto\CMAC($key, 'nnn');
+ }
+ catch (Crypto\MACException $e) {
+- if ($e->getCode() === Crypto\MACException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\MACException::MAC_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }
+diff --git a/tests/HMAC___construct_basic.phpt b/tests/HMAC___construct_basic.phpt
+index 09a4d11..0200091 100644
+--- a/tests/HMAC___construct_basic.phpt
++++ b/tests/HMAC___construct_basic.phpt
+@@ -11,7 +11,7 @@ try {
+ $hmac = new Crypto\HMAC('key', 'nnn');
+ }
+ catch (Crypto\MACException $e) {
+- if ($e->getCode() === Crypto\MACException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\MACException::MAC_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }
+diff --git a/tests/Hash___construct_basic.phpt b/tests/Hash___construct_basic.phpt
+index 0755703..ac8b0f5 100644
+--- a/tests/Hash___construct_basic.phpt
++++ b/tests/Hash___construct_basic.phpt
+@@ -11,7 +11,7 @@ try {
+ $hash = new Crypto\Hash('nnn');
+ }
+ catch (Crypto\HashException $e) {
+- if ($e->getCode() === Crypto\HashException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\HashException::HASH_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }