summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2018-02-13 14:16:42 -0500
committerBrian Evans <grknight@gentoo.org>2018-02-13 14:18:40 -0500
commitc70a969da72864c3e5037b57a1779d3a3d704fea (patch)
tree0ddd47a677b2bd3dea2be854dd59e35401548991 /dev-php/PEAR-Crypt_HMAC
parentdev-php/PEAR-Crypt_CHAP: Drop old revision (diff)
downloadgentoo-c70a969da72864c3e5037b57a1779d3a3d704fea.tar.gz
gentoo-c70a969da72864c3e5037b57a1779d3a3d704fea.tar.bz2
gentoo-c70a969da72864c3e5037b57a1779d3a3d704fea.zip
dev-php/PEAR-Crypt_HMAC: Revbump to add tests and modern constructor
Package-Manager: Portage-2.3.24, Repoman-2.3.6
Diffstat (limited to 'dev-php/PEAR-Crypt_HMAC')
-rw-r--r--dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r1.ebuild12
-rw-r--r--dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r2.ebuild25
-rw-r--r--dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch57
3 files changed, 82 insertions, 12 deletions
diff --git a/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r1.ebuild b/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r1.ebuild
deleted file mode 100644
index 670e25e74bdd..000000000000
--- a/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r1.ebuild
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-inherit php-pear-r1
-
-DESCRIPTION="Calculates RFC 2104 compliant hashes"
-LICENSE="PHP-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
-IUSE=""
diff --git a/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r2.ebuild b/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r2.ebuild
new file mode 100644
index 000000000000..5fba6c704025
--- /dev/null
+++ b/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r2.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit php-pear-r2
+
+DESCRIPTION="Calculates RFC 2104 compliant hashes"
+LICENSE="PHP-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="test"
+DEPEND="test? ( dev-php/PEAR-PEAR )"
+PATCHES=( "${FILESDIR}/HMAC-1.0.1.patch" )
+
+src_test(){
+ ln -s . Crypt || die
+ peardev run-tests tests || die
+}
+
+src_install(){
+ insinto /usr/share/php/Crypt
+ doins HMAC.php
+ php-pear-r2_install_packagexml
+}
diff --git a/dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch b/dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch
new file mode 100644
index 000000000000..efa9d96bdedf
--- /dev/null
+++ b/dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch
@@ -0,0 +1,57 @@
+diff -aurN a/HMAC.php b/HMAC.php
+--- a/HMAC.php 2005-02-20 14:24:14.000000000 -0500
++++ b/HMAC.php 2018-02-13 14:03:59.421976960 -0500
+@@ -68,8 +68,21 @@
+ * @access private
+ */
+ var $_pack;
+-
+-
++
++ /**
++ * Constructor
++ * Pass method as first parameter
++ *
++ * @param string $key Key to use for hash
++ * @param string $func Hash function used for the calculation
++ * @return void
++ * @access public
++ */
++ function __construct($key, $func = 'md5')
++ {
++ $this->Crypt_HMAC($key, $func);
++ }
++
+ /**
+ * Constructor
+ * Pass method as first parameter
+diff -aurN a/tests/HMAC_001.phpt b/tests/HMAC_001.phpt
+--- a/tests/HMAC_001.phpt 1969-12-31 19:00:00.000000000 -0500
++++ b/tests/HMAC_001.phpt 2018-02-13 14:00:47.899812172 -0500
+@@ -0,0 +1,26 @@
++--TEST--
++RFC 2104 Test Vectors
++--DESCRIPTION--
++This test file implements the three test vectors as described in
++RFC 2104 (https://www.ietf.org/rfc/rfc2104.txt)
++--FILE--
++<?php
++ require_once 'Crypt/HMAC.php';
++
++ $key = str_repeat(chr(0x0b), 16);
++ $crypt = new Crypt_HMAC($key, 'md5');
++ echo $crypt->hash('Hi There')."\n";
++
++ $key = 'Jefe';
++ $crypt->setKey($key);
++ echo $crypt->hash('what do ya want for nothing?')."\n";
++
++ $key = str_repeat(chr(0xaa), 16);
++ $data = str_repeat(chr(0xdd), 50);
++ $crypt->setKey($key);
++ echo $crypt->hash($data)."\n";
++?>
++--EXPECT--
++9294727a3638bb1c13f48ef8158bfc9d
++750c783e6ab0b503eaa86e310a5db738
++56be34521d144c88dbb8c733f0e8b3f6