1 |
commit: c70a969da72864c3e5037b57a1779d3a3d704fea |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 13 19:16:42 2018 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 13 19:18:40 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c70a969d |
7 |
|
8 |
dev-php/PEAR-Crypt_HMAC: Revbump to add tests and modern constructor |
9 |
|
10 |
Package-Manager: Portage-2.3.24, Repoman-2.3.6 |
11 |
|
12 |
.../PEAR-Crypt_HMAC-1.0.1-r1.ebuild | 12 ----- |
13 |
.../PEAR-Crypt_HMAC-1.0.1-r2.ebuild | 25 ++++++++++ |
14 |
dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch | 57 ++++++++++++++++++++++ |
15 |
3 files changed, 82 insertions(+), 12 deletions(-) |
16 |
|
17 |
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 |
18 |
deleted file mode 100644 |
19 |
index 670e25e74bd..00000000000 |
20 |
--- a/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r1.ebuild |
21 |
+++ /dev/null |
22 |
@@ -1,12 +0,0 @@ |
23 |
-# Copyright 1999-2014 Gentoo Foundation |
24 |
-# Distributed under the terms of the GNU General Public License v2 |
25 |
- |
26 |
-EAPI=5 |
27 |
- |
28 |
-inherit php-pear-r1 |
29 |
- |
30 |
-DESCRIPTION="Calculates RFC 2104 compliant hashes" |
31 |
-LICENSE="PHP-3" |
32 |
-SLOT="0" |
33 |
-KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
34 |
-IUSE="" |
35 |
|
36 |
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 |
37 |
new file mode 100644 |
38 |
index 00000000000..5fba6c70402 |
39 |
--- /dev/null |
40 |
+++ b/dev-php/PEAR-Crypt_HMAC/PEAR-Crypt_HMAC-1.0.1-r2.ebuild |
41 |
@@ -0,0 +1,25 @@ |
42 |
+# Copyright 1999-2018 Gentoo Foundation |
43 |
+# Distributed under the terms of the GNU General Public License v2 |
44 |
+ |
45 |
+EAPI=6 |
46 |
+ |
47 |
+inherit php-pear-r2 |
48 |
+ |
49 |
+DESCRIPTION="Calculates RFC 2104 compliant hashes" |
50 |
+LICENSE="PHP-3" |
51 |
+SLOT="0" |
52 |
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
53 |
+IUSE="test" |
54 |
+DEPEND="test? ( dev-php/PEAR-PEAR )" |
55 |
+PATCHES=( "${FILESDIR}/HMAC-1.0.1.patch" ) |
56 |
+ |
57 |
+src_test(){ |
58 |
+ ln -s . Crypt || die |
59 |
+ peardev run-tests tests || die |
60 |
+} |
61 |
+ |
62 |
+src_install(){ |
63 |
+ insinto /usr/share/php/Crypt |
64 |
+ doins HMAC.php |
65 |
+ php-pear-r2_install_packagexml |
66 |
+} |
67 |
|
68 |
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 |
69 |
new file mode 100644 |
70 |
index 00000000000..efa9d96bded |
71 |
--- /dev/null |
72 |
+++ b/dev-php/PEAR-Crypt_HMAC/files/HMAC-1.0.1.patch |
73 |
@@ -0,0 +1,57 @@ |
74 |
+diff -aurN a/HMAC.php b/HMAC.php |
75 |
+--- a/HMAC.php 2005-02-20 14:24:14.000000000 -0500 |
76 |
++++ b/HMAC.php 2018-02-13 14:03:59.421976960 -0500 |
77 |
+@@ -68,8 +68,21 @@ |
78 |
+ * @access private |
79 |
+ */ |
80 |
+ var $_pack; |
81 |
+- |
82 |
+- |
83 |
++ |
84 |
++ /** |
85 |
++ * Constructor |
86 |
++ * Pass method as first parameter |
87 |
++ * |
88 |
++ * @param string $key Key to use for hash |
89 |
++ * @param string $func Hash function used for the calculation |
90 |
++ * @return void |
91 |
++ * @access public |
92 |
++ */ |
93 |
++ function __construct($key, $func = 'md5') |
94 |
++ { |
95 |
++ $this->Crypt_HMAC($key, $func); |
96 |
++ } |
97 |
++ |
98 |
+ /** |
99 |
+ * Constructor |
100 |
+ * Pass method as first parameter |
101 |
+diff -aurN a/tests/HMAC_001.phpt b/tests/HMAC_001.phpt |
102 |
+--- a/tests/HMAC_001.phpt 1969-12-31 19:00:00.000000000 -0500 |
103 |
++++ b/tests/HMAC_001.phpt 2018-02-13 14:00:47.899812172 -0500 |
104 |
+@@ -0,0 +1,26 @@ |
105 |
++--TEST-- |
106 |
++RFC 2104 Test Vectors |
107 |
++--DESCRIPTION-- |
108 |
++This test file implements the three test vectors as described in |
109 |
++RFC 2104 (https://www.ietf.org/rfc/rfc2104.txt) |
110 |
++--FILE-- |
111 |
++<?php |
112 |
++ require_once 'Crypt/HMAC.php'; |
113 |
++ |
114 |
++ $key = str_repeat(chr(0x0b), 16); |
115 |
++ $crypt = new Crypt_HMAC($key, 'md5'); |
116 |
++ echo $crypt->hash('Hi There')."\n"; |
117 |
++ |
118 |
++ $key = 'Jefe'; |
119 |
++ $crypt->setKey($key); |
120 |
++ echo $crypt->hash('what do ya want for nothing?')."\n"; |
121 |
++ |
122 |
++ $key = str_repeat(chr(0xaa), 16); |
123 |
++ $data = str_repeat(chr(0xdd), 50); |
124 |
++ $crypt->setKey($key); |
125 |
++ echo $crypt->hash($data)."\n"; |
126 |
++?> |
127 |
++--EXPECT-- |
128 |
++9294727a3638bb1c13f48ef8158bfc9d |
129 |
++750c783e6ab0b503eaa86e310a5db738 |
130 |
++56be34521d144c88dbb8c733f0e8b3f6 |