summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json8
-rwxr-xr-xmakesrc.sh32
-rw-r--r--php-phpseclib3-autoload.php7
-rw-r--r--php-phpseclib3.spec79
4 files changed, 83 insertions, 43 deletions
diff --git a/composer.json b/composer.json
index 08b9c7c..c1b517a 100644
--- a/composer.json
+++ b/composer.json
@@ -51,11 +51,13 @@
}
],
"require": {
- "php": ">=5.3.3"
+ "paragonie/constant_time_encoding": "^1|^2",
+ "paragonie/random_compat": "^1.4|^2.0",
+ "php": ">=5.6.1"
},
"require-dev": {
"phing/phing": "~2.7",
- "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4",
+ "phpunit/phpunit": "^5.7|^6.0|^9.4",
"squizlabs/php_codesniffer": "~2.0"
},
"suggest": {
@@ -69,7 +71,7 @@
"phpseclib/bootstrap.php"
],
"psr-4": {
- "phpseclib\\": "phpseclib/"
+ "phpseclib3\\": "phpseclib/"
}
}
}
diff --git a/makesrc.sh b/makesrc.sh
index 4abe187..fea0ef6 100755
--- a/makesrc.sh
+++ b/makesrc.sh
@@ -7,22 +7,26 @@ VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec)
SHORT=${COMMIT:0:7}
-echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+if [ -f $NAME-$VERSION-$SHORT.tgz ]; then
+ echo "Already done"
+else
+ echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
-echo "Cloning..."
-rm -rf $PROJECT-$COMMIT
-git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+ echo "Cloning..."
+ rm -rf $PROJECT-$COMMIT
+ git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
-echo "Getting commit..."
-pushd $PROJECT-$COMMIT
-git checkout $COMMIT
-cp composer.json ../composer.json
-popd
+ echo "Getting commit..."
+ pushd $PROJECT-$COMMIT
+ git checkout $COMMIT || exit 1
+ cp composer.json ../composer.json
+ popd
-echo "Archiving..."
-tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+ echo "Archiving..."
+ tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
-echo "Cleaning..."
-rm -rf $PROJECT-$COMMIT
+ echo "Cleaning..."
+ rm -rf $PROJECT-$COMMIT
-echo "Done."
+ echo "Done."
+fi
diff --git a/php-phpseclib3-autoload.php b/php-phpseclib3-autoload.php
index 93e0f67..2c63ba1 100644
--- a/php-phpseclib3-autoload.php
+++ b/php-phpseclib3-autoload.php
@@ -7,5 +7,8 @@ require_once "/usr/share/php/Fedora/Autoloader/autoload.php";
// composer.json: "autoload": { "files": [ "phpseclib/bootstrap.php" ], "psr-4": { "phpseclib\\": "phpseclib/" }
require_once __DIR__ . '/bootstrap.php';
-\Fedora\Autoloader\Autoload::addPsr4('phpseclib\\', __DIR__);
-
+\Fedora\Autoloader\Autoload::addPsr4('phpseclib3\\', __DIR__);
+\Fedora\Autoloader\Dependencies::required([
+ '/usr/share/php/ParagonIE/ConstantTime/autoload.php',
+ '/usr/share/php/random_compat/autoload.php',
+]);
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