summaryrefslogtreecommitdiffstats
path: root/php-phpseclib3.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-12-17 11:36:57 +0100
committerRemi Collet <remi@remirepo.net>2020-12-17 11:36:57 +0100
commit3fb797aff4520a0c492e895c8f9264bf8d44b685 (patch)
treea8844ae20a7ff468004fe79258103d1ca1b38605 /php-phpseclib3.spec
parent6df6e746beed8e451983d65c782bced24290a86b (diff)
update to 3.0.0
rename to php-phpseclib3 install in /usr/share/php/phpseclib3 raise dependency on PHP 5.6 add dependency on paragonie/constant_time_encoding add dependency on paragonie/random_compat
Diffstat (limited to 'php-phpseclib3.spec')
-rw-r--r--php-phpseclib3.spec79
1 files changed, 55 insertions, 24 deletions
diff --git a/php-phpseclib3.spec b/php-phpseclib3.spec
index 715d79d..ea9b953 100644
--- a/php-phpseclib3.spec
+++ b/php-phpseclib3.spec
@@ -3,12 +3,14 @@
%global github_owner phpseclib
%global github_name phpseclib
-%global github_commit 136b9ca7eebef78be14abf90d65c5e57b6bc5d36
+%global github_commit fe62c85e0203503231d489af95d0ac053b7d3575
%global github_short %(c=%{github_commit}; echo ${c:0:7})
+%global major 3
+
%bcond_without tests
-Name: php-%{composer_vendor}
-Version: 2.0.30
+Name: php-%{composer_vendor}%{major}
+Version: 3.0.0
Release: 1%{?dist}
Summary: PHP Secure Communications Library
License: MIT
@@ -26,15 +28,18 @@ Source2: makesrc.sh
BuildArch: noarch
%if %{with tests}
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires:(php-composer(paragonie/constant_time_encoding) >= 2 with php-composer(paragonie/constant_time_encoding) < 3)
+BuildRequires:(php-composer(paragonie/random_compat) >= 2 with php-composer(paragonie/random_compat) < 3)
+%else
+BuildRequires: php-paragonie-constant-time-encoding
+BuildRequires: php-paragonie-random-compat
+%endif
BuildRequires: php-composer(fedora/autoloader)
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%global phpunit %{_bindir}/phpunit9
%else
-%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8
%global phpunit %{_bindir}/phpunit6
-%else
-%global phpunit %{_bindir}/phpunit
-%endif
%endif
BuildRequires: %{phpunit}
BuildRequires: %{_bindir}/phpab
@@ -43,7 +48,19 @@ BuildRequires: php-bcmath
BuildRequires: php-gmp
%endif
-Requires: php(language) >= 5.3.3
+# from composer.json, "require": {
+# "paragonie/constant_time_encoding": "^1|^2",
+# "paragonie/random_compat": "^1.4|^2.0",
+# "php": ">=5.6.1"
+#
+Requires: php(language) >= 5.6.1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(paragonie/constant_time_encoding) >= 2 with php-composer(paragonie/constant_time_encoding) < 3)
+Requires: (php-composer(paragonie/random_compat) >= 2 with php-composer(paragonie/random_compat) < 3)
+%else
+Requires: php-paragonie-constant-time-encoding
+Requires: php-paragonie-random-compat
+%endif
Requires: php-bcmath
Requires: php-date
Requires: php-gmp
@@ -61,8 +78,10 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
MIT-licensed pure-PHP implementations of an arbitrary-precision integer
-arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4,
-Rijndael, AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509
+arithmetic library, Ed25519 / Ed449 / Curve25519 / Curve449, ECDSA / ECDH
+(with support for 66 curves), RSA (PKCS#1 v2.2 compliant), DSA / DH,
+DES / 3DES / RC4 / Rijndael / AES / Blowfish / Twofish / Salsa20 / ChaCha20,
+GCM / Poly1305.
%prep
@@ -75,20 +94,25 @@ cp %{SOURCE1} %{composer_vendor}/autoload.php
%install
mkdir -p %{buildroot}%{_datadir}/php
-cp -pr %{composer_vendor} %{buildroot}%{_datadir}/php
+cp -pr %{composer_vendor} %{buildroot}%{_datadir}/php/%{composer_vendor}%{major}
%if %{with tests}
%check
-%{_bindir}/phpab --output tests/bootstrap.php tests
-cat << 'EOF' | tee -a tests/bootstrap.php
-if (class_exists("PHPUnit_Framework_TestCase") && !class_exists("PHPUnit\\Framework\\TestCase")) {
- class_alias("PHPUnit_Framework_TestCase", "PHPUnit\\Framework\\TestCase");
-}
-require "%{buildroot}%{_datadir}/php/%{composer_vendor}/autoload.php";
+cat << 'EOF' | tee tests/bootstrap.php
+<?php
+require "%{buildroot}%{_datadir}/php/%{composer_vendor}%{major}/autoload.php";
+\Fedora\Autoloader\Autoload::addPsr0('', __DIR__);
date_default_timezone_set('UTC');
EOF
+# avoid already defined class
+sed -e 's/CreateKeyTest/RSACreateKeyTest/' -i tests/Unit/Crypt/RSA/CreateKeyTest.php
+sed -e 's/CreateKeyTest/DSACreateKeyTest/' -i tests/Unit/Crypt/DSA/CreateKeyTest.php
+
+# Not supported curves ? (need investigations)
+rm phpseclib/Crypt/EC/Curves/{brainpoolP160t1,secp128r2,secp112r1,secp160r2,secp192r1,brainpoolP192t1,brainpoolP160r1,secp112r2,secp192k1,prime192v3,secp160r1,brainpoolP192r1,secp128r1,prime192v2,secp160k1}.php
+
# from travis/run-phpunit.sh
if %{phpunit} --atleast-version 8
then
@@ -97,26 +121,25 @@ then
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n tearDown()/n tearDown(): void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsArray([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsString([^)]*)\)/\1: void/g'
+ find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsResource([^)]*)\)/\1: void/g'
+ find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsObject([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringContainsString([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringNotContainsString([^)]*)\)/\1: void/g'
- find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Crypt_\(AES\|Hash\|RSA\)_/class /g'
+ find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Crypt_\(AES\|DSA\|EC\|RSA\)_/class /g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_File_\(X509\)_/class /g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Math_\(BigInteger\)_/class /g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_\(Crypt\|File\|Math\|Net\)_/class /g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Functional_Net_/class /g'
- find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/extends Unit_Crypt_Hash_\(SHA512Test\|SHA256Test\)/extends \1/g'
fi
-# avoid already defined class
-sed -e '/require /d' -i tests/Unit/Crypt/Hash/SHA*_96Test.php
-
# testAuthorityInfoAccess fails without internet access
+# testCurveExistance as we remove some files
ret=0
for cmd in "php %{phpunit}" php73 php74 php80; do
if which $cmd; then
set $cmd
$1 -d memory_limit=1G ${2:-%{_bindir}/phpunit9} \
- --filter '^((?!(testAuthorityInfoAccess)).)*$' \
+ --filter '^((?!(testAuthorityInfoAccess|testCurveExistance)).)*$' \
--verbose || ret=1
fi
done
@@ -125,13 +148,21 @@ exit $ret
%files
-%{_datadir}/php/%{composer_vendor}
+%{_datadir}/php/%{composer_vendor}%{major}
%doc AUTHORS CHANGELOG.md composer.json README.md
%{!?_licensedir:%global license %%doc}
%license LICENSE
%changelog
+* Thu Dec 17 2020 Remi Collet <remi@remirepo.net> - 3.0.0-1
+- update to 3.0.0
+- rename to php-phpseclib3
+- install in /usr/share/php/phpseclib3
+- raise dependency on PHP 5.6
+- add dependency on paragonie/constant_time_encoding
+- add dependency on paragonie/random_compat
+
* Thu Dec 17 2020 Remi Collet <remi@remirepo.net> - 2.0.30-1
- update to 2.0.30
- switch to phpunit9 on Fedora