Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from phpseclib:master #195

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
7f31a1e
SSH2: make it so phpseclib initiates key re-exchange after 1GB
terrafrost Nov 22, 2024
0b9fd56
Merge branch '1.0' into 2.0
terrafrost Nov 22, 2024
ccf4b48
SSH2: PHP didn't support constant expressions until PHP 5.6
terrafrost Nov 22, 2024
b966aa2
Merge branch '1.0' into 2.0
terrafrost Nov 22, 2024
b38e849
SSH2: don't count len of packets sent / rcvd during key exchange
terrafrost Nov 22, 2024
53645af
Merge branch '1.0' into 2.0
terrafrost Nov 22, 2024
dcd4b2a
Merge branch '2.0' into 3.0
terrafrost Nov 22, 2024
feb12c8
Merge branch '3.0'
terrafrost Nov 22, 2024
7aa66fd
CS adjustments
terrafrost Nov 22, 2024
6f4af7e
SSH2: extra_packets is no longer used
terrafrost Nov 22, 2024
9957287
Merge branch '1.0' into 2.0
terrafrost Nov 22, 2024
614d8ae
Merge branch '2.0' into 3.0
terrafrost Nov 22, 2024
e81fd68
SSH2: rm changes i made for debugging
terrafrost Nov 22, 2024
f388cb1
Merge branch '3.0'
terrafrost Nov 22, 2024
f5113e1
SSH2: rm extra_packets in a few more places
terrafrost Nov 22, 2024
7070529
Merge branch '3.0'
terrafrost Nov 22, 2024
7c56d2c
CS adjustments
terrafrost Nov 22, 2024
b66b5dc
SSH2: replace user_error with Exceptions
terrafrost Nov 23, 2024
5160738
Merge branch '3.0'
terrafrost Nov 23, 2024
b39334b
SSH2: replace \RuntimeException with UnsupportedAlgorithmException
terrafrost Nov 23, 2024
ccac840
Merge branch '3.0'
terrafrost Nov 23, 2024
88fd8e0
run unit tests on PHP 8.3 and 8.4
terrafrost Nov 23, 2024
910927a
Merge branch '1.0' into 2.0
terrafrost Nov 23, 2024
a27023a
Merge branch '2.0' into 3.0
terrafrost Nov 23, 2024
866ae12
Merge branch '3.0'
terrafrost Nov 23, 2024
2b79c06
fix deprecated
dmnlk Nov 26, 2024
57435e2
SSH2: add bytesUntilKeyReexchange() method
terrafrost Nov 28, 2024
6865afb
Merge branch '1.0' into 2.0
terrafrost Nov 28, 2024
8eb3c09
Merge branch '2.0' into 3.0
terrafrost Nov 28, 2024
c38fde1
CS adjustments
terrafrost Nov 28, 2024
49825b8
Merge branch '3.0'
terrafrost Nov 28, 2024
3e27d83
more CS adjustments
terrafrost Nov 28, 2024
181f13a
fix unit tests on PHP 8.3/8.4
terrafrost Nov 28, 2024
3106784
Merge branch '1.0' into 2.0
terrafrost Nov 28, 2024
10a9c2e
Merge branch '2.0' into 3.0
terrafrost Nov 28, 2024
a60ebaf
Merge branch '3.0'
terrafrost Nov 28, 2024
e432117
fix PHP 8.4 deprecations
terrafrost Nov 29, 2024
e6864d4
Merge branch '3.0'
terrafrost Nov 29, 2024
6dcb3bb
X509: fix another PHP 8.4 deprecation
terrafrost Nov 29, 2024
b5d32a8
Merge branch '3.0'
terrafrost Nov 29, 2024
7d1779e
X509: even more PHP 8.4 deprecations
terrafrost Nov 29, 2024
18d71ce
Merge branch '3.0'
terrafrost Nov 29, 2024
e6b4017
Merge pull request #2052 from dmnlk/feature/php84-compatible
terrafrost Nov 29, 2024
58709cf
RSA: PHP 8.4 deprecated xml_set_object()
terrafrost Nov 29, 2024
05085f4
BigInteger: fix for PHP 8.4.0 - 8.4.1 regression
terrafrost Nov 29, 2024
ca7ae97
Merge branch '1.0' into 2.0
terrafrost Nov 29, 2024
7127d93
Merge branch '2.0' into 3.0
terrafrost Nov 29, 2024
faced4d
Merge branch '3.0'
terrafrost Nov 29, 2024
46c3756
SSH2: fix PHP 8.4 deprecatin w.r.t. declare(strict_types=1)
terrafrost Nov 29, 2024
8de7a89
BigInteger: improve detection of newly introduced GMP bug
terrafrost Nov 29, 2024
702bd33
Merge branch '1.0' into 2.0
terrafrost Nov 29, 2024
ad709d8
Merge branch '2.0' into 3.0
terrafrost Nov 29, 2024
eefcfdd
Merge branch '3.0'
terrafrost Nov 29, 2024
5cadfba
Merge branch 'master' of https://github.com/phpseclib/phpseclib
terrafrost Nov 29, 2024
2914a15
Tests/X509: add testRSACertWithECSDASig unit test
terrafrost Dec 4, 2024
7b43ea0
X509: algorithmidentifier parameters could get incorrectly set
terrafrost Nov 29, 2024
83978e6
Tests/CSR: update testNewCSR() test
terrafrost Dec 4, 2024
fc5b4b3
CS adjustments
terrafrost Dec 4, 2024
1f7937f
Merge branch '3.0'
terrafrost Dec 4, 2024
573f4aa
SFTP: fix possible SFTPv3 error when rcving date only attributes
terrafrost Dec 4, 2024
487bfa2
Merge branch '3.0'
terrafrost Dec 4, 2024
0efd317
EC/BaseCurves/Montgomery: fix needless conversion in multiplyPoint
terrafrost Dec 4, 2024
ff82c80
Merge branch '3.0'
terrafrost Dec 4, 2024
80c7ee9
unset($block);
jmarchan-ByTel Dec 2, 2024
58e9e43
Merge branch '3.0'
terrafrost Dec 4, 2024
2fe0eab
SSH2: ignore [email protected] in key re-exchanges
terrafrost Dec 7, 2024
0a14273
Merge branch '1.0' into 2.0
terrafrost Dec 7, 2024
b59d7be
Merge branch '2.0' into 3.0
terrafrost Dec 7, 2024
c6c89a6
Merge branch '3.0'
terrafrost Dec 7, 2024
eaa7be7
CHANGELOG: add 2.0.48 release
terrafrost Dec 14, 2024
709ec10
Merge branch '2.0' into 3.0
terrafrost Dec 14, 2024
17b0998
Merge branch '3.0'
terrafrost Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3']
php-version: ['8.1', '8.2', '8.3', '8.4']
quality_tools:
name: Quality Tools
timeout-minutes: 5
Expand Down Expand Up @@ -92,4 +92,4 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
php-version: ['8.1', '8.2', '8.3']
php-version: ['8.1', '8.2', '8.3', '8.4']
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 3.0.43 - 2024-12-14

- fix PHP 8.4 deprecations
- BigInteger: introduce regression in GMP that PHP introduced
- BigInteger: speed up Barrett reductions
- X509: make the attributes section of new CSRs be blank (#1522)
- X509: add getRequestedCertificateExtensions()
- X509: algorithmidentifier parameters could get incorrectly set (#2051)
- SSH2: ignore [email protected] in key re-exchanges (#2005)
- SSH2: make it so phpseclib initiates key re-exchange after 1GB (#2050)
- SSH2: if string is passed to setPreferredAlgorithms treat as array
- SSH2: update setPreferredAlgorithms() to accept csv's

## 3.0.42 - 2024-09-15

- X509: CRL version number wasn't correctly being saved (#2037)
Expand Down Expand Up @@ -287,6 +300,19 @@
- Salsa20 / ChaCha20
- namespace changed from `phpseclib\` to `\phpseclib3` to facilitate phpseclib 2 shim (phpseclib2_compat)

## 2.0.48 - 2024-12-14

- BigInteger: introduce regression in GMP that PHP introduced
- X509: make the attributes section of new CSRs be blank (#1522)
- X509: CRL version number wasn't correctly being saved (#2037)
- SSH2: ignore [email protected] in key re-exchanges (#2005)
- SSH2: make it so phpseclib initiates key re-exchange after 1GB (#2050)
- SSH2: if string is passed to setPreferredAlgorithms treat as array
- SSH2: identification strings > 255 bytes didn't get parsed correctly
- SSH2: fix possible infinite loop on packet timeout
- SSH2: handle SSH2_MSG_EXT_INFO out of login (#2001, #2002)
- SSH2/Agent: reset supported_private_key_algorithms for every key (#1995)

## 2.0.47 - 2024-02-25

- BigInteger: add getLength() and getLengthInBytes() methods
Expand Down
12 changes: 5 additions & 7 deletions phpseclib/Crypt/Common/Formats/Keys/PKCS8.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ public static function setPRF(string $algo): void

/**
* Returns a SymmetricKey object based on a PBES1 $algo
*
* @return SymmetricKey
*/
private static function getPBES1EncryptionObject(string $algo)
private static function getPBES1EncryptionObject(string $algo): SymmetricKey
{
$algo = preg_match('#^pbeWith(?:MD2|MD5|SHA1|SHA)And(.*?)-CBC$#', $algo, $matches) ?
$matches[1] :
Expand Down Expand Up @@ -511,7 +509,7 @@ protected static function load($key, ?string $password = null): array
*
* @param bool $enabled
*/
public static function setBinaryOutput($enabled)
public static function setBinaryOutput($enabled): void
{
self::$binary = $enabled;
}
Expand Down Expand Up @@ -616,7 +614,7 @@ protected static function wrapPrivateKey(string $key, $attr, $params, $password,

$key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP);

if (isset($options['binary']) ? $options['binary'] : self::$binary) {
if ($options['binary'] ?? self::$binary) {
return $key;
}

Expand All @@ -625,7 +623,7 @@ protected static function wrapPrivateKey(string $key, $attr, $params, $password,
"-----END ENCRYPTED PRIVATE KEY-----";
}

if (isset($options['binary']) ? $options['binary'] : self::$binary) {
if ($options['binary'] ?? self::$binary) {
return $key;
}

Expand Down Expand Up @@ -654,7 +652,7 @@ protected static function wrapPublicKey(string $key, $params, ?string $oid = nul

$key = ASN1::encodeDER($key, Maps\PublicKeyInfo::MAP);

if (isset($options['binary']) ? $options['binary'] : self::$binary) {
if ($options['binary'] ?? self::$binary) {
return $key;
}

Expand Down
2 changes: 1 addition & 1 deletion phpseclib/Crypt/EC/BaseCurves/Montgomery.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private function doubleAndAddPoint(array $p, array $q, PrimeInteger $x1): array
public function multiplyPoint(array $p, BigInteger $d): array
{
$p1 = [$this->one, $this->zero];
$alreadyInternal = isset($x[1]);
$alreadyInternal = isset($p[1]);
$p2 = $this->convertToInternal($p);
$x = $p[0];

Expand Down
4 changes: 3 additions & 1 deletion phpseclib/Crypt/Salsa20.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private function crypt(string $text, int $mode): string
foreach ($blocks as &$block) {
$block ^= static::salsa20($this->p1 . pack('V', $i++) . $this->p2);
}

unset($block);
return implode('', $blocks);
}

Expand Down Expand Up @@ -356,6 +356,7 @@ private function crypt(string $text, int $mode): string
foreach ($blocks as &$block) {
$block ^= static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2);
}
unset($block);
}
$encrypted = implode('', $blocks);
$temp = static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2);
Expand All @@ -378,6 +379,7 @@ private function crypt(string $text, int $mode): string
foreach ($blocks as &$block) {
$block ^= static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2);
}
unset($block);
$ciphertext .= implode('', $blocks);
}
}
Expand Down
2 changes: 1 addition & 1 deletion phpseclib/File/ASN1/Maps/TBSCertList.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class TBSCertList
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1', 'v2'],
'optional' => true,
'default' => 'v1'
'default' => 'v1',
],
'signature' => AlgorithmIdentifier::MAP,
'issuer' => Name::MAP,
Expand Down
13 changes: 5 additions & 8 deletions phpseclib/File/X509.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,6 @@ public function saveX509(array $cert, int $format = self::FORMAT_PEM)
);
}

if ($algorithm == 'rsaEncryption') {
$cert['signatureAlgorithm']['parameters'] = null;
$cert['tbsCertificate']['signature']['parameters'] = null;
}

$filters = [];
$type_utf8_string = ['type' => ASN1::TYPE_UTF8_STRING];
$filters['tbsCertificate']['signature']['parameters'] = $type_utf8_string;
Expand Down Expand Up @@ -2879,7 +2874,10 @@ private static function identifySignatureAlgorithm(PrivateKey $key): array
case 'sha256':
case 'sha384':
case 'sha512':
return ['algorithm' => $key->getHash()->__toString() . 'WithRSAEncryption'];
return [
'algorithm' => $key->getHash()->__toString() . 'WithRSAEncryption',
'parameters' => null
];
}
throw new UnsupportedAlgorithmException('The only supported hash algorithms for RSA are: md2, md5, sha1, sha224, sha256, sha384, sha512');
}
Expand Down Expand Up @@ -3361,9 +3359,8 @@ public function getAttribute(string $id, int $disposition = self::ATTR_ALL, ?arr
* Returns the list of extensions if there are any and false if not
*
* @param array $csr optional
* @return mixed
*/
public function getRequestedCertificateExtensions(array $csr = null)
public function getRequestedCertificateExtensions(?array $csr = null)
{
if (empty($csr)) {
$csr = $this->currentCert;
Expand Down
4 changes: 3 additions & 1 deletion phpseclib/Net/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,8 @@ private function parseTime(string $key, int $flags, string &$response): array
*/
protected function parseAttributes(string &$response): array
{
$attr = [];

if ($this->version >= 4) {
[$flags, $attr['type']] = Strings::unpackSSH2('NC', $response);
} else {
Expand Down Expand Up @@ -3273,7 +3275,7 @@ public function posix_rename(string $oldname, string $newname): bool
}

// if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
list($status) = Strings::unpackSSH2('N', $response);
[$status] = Strings::unpackSSH2('N', $response);
if ($status != StatusCode::OK) {
$this->logError($response, $status);
return false;
Expand Down
Loading