Skip to content

Commit

Permalink
Merge pull request #645 from nextcloud/dependabot/composer/phpseclib/…
Browse files Browse the repository at this point in the history
…phpseclib-2.0.31

Bump phpseclib/phpseclib from 2.0.30 to 2.0.31
  • Loading branch information
rullzer committed Apr 8, 2021
2 parents 67f4c90 + 37dbf0b commit 3fad2ce
Show file tree
Hide file tree
Showing 16 changed files with 246 additions and 117 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"php-ds/php-ds": "^1.3",
"php-http/guzzle7-adapter": "^0.1.1",
"php-opencloud/openstack": "^3.1",
"phpseclib/phpseclib": "2.0.30",
"phpseclib/phpseclib": "2.0.31",
"pimple/pimple": "^3.4.0",
"psr/container": "^1.1.1",
"psr/event-dispatcher": "^1.0",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '0d770f0d47d905f207c3a14f4450db65b538dcc9',
'reference' => '25265c5d601a621789e427d57c8a04163da7697f',
'name' => 'nextcloud/3rdparty',
),
'versions' =>
Expand Down Expand Up @@ -312,7 +312,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '0d770f0d47d905f207c3a14f4450db65b538dcc9',
'reference' => '25265c5d601a621789e427d57c8a04163da7697f',
),
'nextcloud/lognormalizer' =>
array (
Expand Down Expand Up @@ -454,12 +454,12 @@ class InstalledVersions
),
'phpseclib/phpseclib' =>
array (
'pretty_version' => '2.0.30',
'version' => '2.0.30.0',
'pretty_version' => '2.0.31',
'version' => '2.0.31.0',
'aliases' =>
array (
),
'reference' => '136b9ca7eebef78be14abf90d65c5e57b6bc5d36',
'reference' => '233a920cb38636a43b18d428f9a8db1f0a1a08f4',
),
'pimple/pimple' =>
array (
Expand Down
2 changes: 1 addition & 1 deletion composer/autoload_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
'356736db98a6834f0a886b8d509b0ecd' => $vendorDir . '/thecodingmachine/safe/generated/zlib.php',
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
'538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
);
2 changes: 1 addition & 1 deletion composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
'356736db98a6834f0a886b8d509b0ecd' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/zlib.php',
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
'538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
);

public static $prefixLengthsPsr4 = array (
Expand Down
14 changes: 7 additions & 7 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2924,17 +2924,17 @@
},
{
"name": "phpseclib/phpseclib",
"version": "2.0.30",
"version_normalized": "2.0.30.0",
"version": "2.0.31",
"version_normalized": "2.0.31.0",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36"
"reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/136b9ca7eebef78be14abf90d65c5e57b6bc5d36",
"reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/233a920cb38636a43b18d428f9a8db1f0a1a08f4",
"reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4",
"shasum": ""
},
"require": {
Expand All @@ -2951,7 +2951,7 @@
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"time": "2020-12-17T05:42:04+00:00",
"time": "2021-04-06T13:56:45+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -3016,7 +3016,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.30"
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.31"
},
"funding": [
{
Expand Down
10 changes: 5 additions & 5 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '0d770f0d47d905f207c3a14f4450db65b538dcc9',
'reference' => '25265c5d601a621789e427d57c8a04163da7697f',
'name' => 'nextcloud/3rdparty',
),
'versions' =>
Expand Down Expand Up @@ -288,7 +288,7 @@
'aliases' =>
array (
),
'reference' => '0d770f0d47d905f207c3a14f4450db65b538dcc9',
'reference' => '25265c5d601a621789e427d57c8a04163da7697f',
),
'nextcloud/lognormalizer' =>
array (
Expand Down Expand Up @@ -430,12 +430,12 @@
),
'phpseclib/phpseclib' =>
array (
'pretty_version' => '2.0.30',
'version' => '2.0.30.0',
'pretty_version' => '2.0.31',
'version' => '2.0.31.0',
'aliases' =>
array (
),
'reference' => '136b9ca7eebef78be14abf90d65c5e57b6bc5d36',
'reference' => '233a920cb38636a43b18d428f9a8db1f0a1a08f4',
),
'pimple/pimple' =>
array (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final class Versions
'php-http/httplug' => '2.2.0@191a0a1b41ed026b717421931f8d3bd2514ffbf9',
'php-http/promise' => '1.1.0@4c4c1f9b7289a2ec57cde7f1e9762a5789506f88',
'php-opencloud/openstack' => 'v3.1.0@7b0eeb63defe533fb802514af3c70855c45eaf1e',
'phpseclib/phpseclib' => '2.0.30@136b9ca7eebef78be14abf90d65c5e57b6bc5d36',
'phpseclib/phpseclib' => '2.0.31@233a920cb38636a43b18d428f9a8db1f0a1a08f4',
'pimple/pimple' => 'v3.4.0@86406047271859ffc13424a048541f4531f53601',
'psr/container' => '1.1.1@8622567409010282b7aeebe4bb841fe98b58dcaf',
'psr/event-dispatcher' => '1.0.0@dbefd12671e8a14ec7f180cab83036ed26714bb0',
Expand Down Expand Up @@ -120,7 +120,7 @@ final class Versions
'web-auth/cose-lib' => 'v3.3.1@eea6fae63ff5c81bf98c115b1be5f38a69682c16',
'web-auth/metadata-service' => 'v3.3.1@8488d3a832a38cc81c670fce05de1e515c6e64b1',
'web-auth/webauthn-lib' => 'v3.3.1@e411527a41c1013512fccdfce61681eb36484c77',
'nextcloud/3rdparty' => 'dev-master@0d770f0d47d905f207c3a14f4450db65b538dcc9',
'nextcloud/3rdparty' => 'dev-master@25265c5d601a621789e427d57c8a04163da7697f',
);

private function __construct()
Expand Down
67 changes: 46 additions & 21 deletions phpseclib/phpseclib/phpseclib/Crypt/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,14 @@ function encrypt($plaintext)
}

if ($this->engine === self::ENGINE_MCRYPT) {
set_error_handler(array($this, 'do_nothing'));

if ($this->changed) {
$this->_setupMcrypt();
$this->changed = false;
}
if ($this->enchanged) {
@mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
$this->enchanged = false;
}

Expand Down Expand Up @@ -817,15 +819,15 @@ function encrypt($plaintext)
if ($len >= $block_size) {
if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) {
if ($this->enbuffer['enmcrypt_init'] === true) {
@mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
$this->enbuffer['enmcrypt_init'] = false;
}
$ciphertext.= @mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size));
$ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size));
$iv = substr($ciphertext, -$block_size);
$len%= $block_size;
} else {
while ($len >= $block_size) {
$iv = @mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size);
$iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size);
$ciphertext.= $iv;
$len-= $block_size;
$i+= $block_size;
Expand All @@ -834,22 +836,26 @@ function encrypt($plaintext)
}

if ($len) {
$iv = @mcrypt_generic($this->ecb, $iv);
$iv = mcrypt_generic($this->ecb, $iv);
$block = $iv ^ substr($plaintext, -$len);
$iv = substr_replace($iv, $block, 0, $len);
$ciphertext.= $block;
$pos = $len;
}

restore_error_handler();

return $ciphertext;
}

$ciphertext = @mcrypt_generic($this->enmcrypt, $plaintext);
$ciphertext = mcrypt_generic($this->enmcrypt, $plaintext);

if (!$this->continuousBuffer) {
@mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
}

restore_error_handler();

return $ciphertext;
}

Expand Down Expand Up @@ -1118,13 +1124,14 @@ function decrypt($ciphertext)
}

if ($this->engine === self::ENGINE_MCRYPT) {
set_error_handler(array($this, 'do_nothing'));
$block_size = $this->block_size;
if ($this->changed) {
$this->_setupMcrypt();
$this->changed = false;
}
if ($this->dechanged) {
@mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
$this->dechanged = false;
}

Expand Down Expand Up @@ -1152,26 +1159,30 @@ function decrypt($ciphertext)
}
if ($len >= $block_size) {
$cb = substr($ciphertext, $i, $len - $len % $block_size);
$plaintext.= @mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
$plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
$iv = substr($cb, -$block_size);
$len%= $block_size;
}
if ($len) {
$iv = @mcrypt_generic($this->ecb, $iv);
$iv = mcrypt_generic($this->ecb, $iv);
$plaintext.= $iv ^ substr($ciphertext, -$len);
$iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
$pos = $len;
}

restore_error_handler();

return $plaintext;
}

$plaintext = @mdecrypt_generic($this->demcrypt, $ciphertext);
$plaintext = mdecrypt_generic($this->demcrypt, $ciphertext);

if (!$this->continuousBuffer) {
@mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
}

restore_error_handler();

return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
}

Expand Down Expand Up @@ -1649,9 +1660,12 @@ function isValidEngine($engine)
}
return false;
case self::ENGINE_MCRYPT:
return $this->cipher_name_mcrypt &&
set_error_handler(array($this, 'do_nothing'));
$result = $this->cipher_name_mcrypt &&
extension_loaded('mcrypt') &&
in_array($this->cipher_name_mcrypt, @mcrypt_list_algorithms());
in_array($this->cipher_name_mcrypt, mcrypt_list_algorithms());
restore_error_handler();
return $result;
case self::ENGINE_INTERNAL:
return true;
}
Expand Down Expand Up @@ -1728,17 +1742,19 @@ function _setEngine()
}

if ($this->engine != self::ENGINE_MCRYPT && $this->enmcrypt) {
set_error_handler(array($this, 'do_nothing'));
// Closing the current mcrypt resource(s). _mcryptSetup() will, if needed,
// (re)open them with the module named in $this->cipher_name_mcrypt
@mcrypt_module_close($this->enmcrypt);
@mcrypt_module_close($this->demcrypt);
mcrypt_module_close($this->enmcrypt);
mcrypt_module_close($this->demcrypt);
$this->enmcrypt = null;
$this->demcrypt = null;

if ($this->ecb) {
@mcrypt_module_close($this->ecb);
mcrypt_module_close($this->ecb);
$this->ecb = null;
}
restore_error_handler();
}

$this->changed = true;
Expand Down Expand Up @@ -1851,19 +1867,19 @@ function _setupMcrypt()
self::MODE_STREAM => MCRYPT_MODE_STREAM,
);

$this->demcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
$this->enmcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
$this->demcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
$this->enmcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');

// we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer()
// to workaround mcrypt's broken ncfb implementation in buffered mode
// see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
if ($this->mode == self::MODE_CFB) {
$this->ecb = @mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
$this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
}
} // else should mcrypt_generic_deinit be called?
if ($this->mode == self::MODE_CFB) {
@mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size));
mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size));
}
}

Expand Down Expand Up @@ -2696,4 +2712,13 @@ function safe_intval_inline()
return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))';
}
}

/**
* Dummy error handler to suppress mcrypt errors
*
* @access private
*/
function do_nothing()
{
}
}

0 comments on commit 3fad2ce

Please sign in to comment.