aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/phpseclib
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/phpseclib')
-rw-r--r--vendor/phpseclib/phpseclib/AUTHORS1
-rw-r--r--vendor/phpseclib/phpseclib/BACKERS.md3
-rw-r--r--vendor/phpseclib/phpseclib/composer.json3
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php86
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php439
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php4
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php2
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php52
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php39
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php36
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/File/X509.php7
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php4
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php52
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php6
14 files changed, 65 insertions, 669 deletions
diff --git a/vendor/phpseclib/phpseclib/AUTHORS b/vendor/phpseclib/phpseclib/AUTHORS
index 9f10d2671..a08b3099c 100644
--- a/vendor/phpseclib/phpseclib/AUTHORS
+++ b/vendor/phpseclib/phpseclib/AUTHORS
@@ -4,4 +4,3 @@ phpseclib Developers: monnerat (Patrick Monnerat)
bantu (Andreas Fischer)
petrich (Hans-Jürgen Petrich)
GrahamCampbell (Graham Campbell)
- hc-jworman \ No newline at end of file
diff --git a/vendor/phpseclib/phpseclib/BACKERS.md b/vendor/phpseclib/phpseclib/BACKERS.md
index f942f48f4..558293b55 100644
--- a/vendor/phpseclib/phpseclib/BACKERS.md
+++ b/vendor/phpseclib/phpseclib/BACKERS.md
@@ -10,5 +10,4 @@ phpseclib ongoing development is made possible by [Tidelift](https://tidelift.co
- Zane Hooper
- [Setasign](https://www.setasign.com/)
- [Charles Severance](https://github.com/csev)
-- [Rachel Fish](https://github.com/itsrachelfish)
-- Tharyrok \ No newline at end of file
+- [Rachel Fish](https://github.com/itsrachelfish) \ No newline at end of file
diff --git a/vendor/phpseclib/phpseclib/composer.json b/vendor/phpseclib/phpseclib/composer.json
index 3fbffa67c..08b9c7c91 100644
--- a/vendor/phpseclib/phpseclib/composer.json
+++ b/vendor/phpseclib/phpseclib/composer.json
@@ -62,8 +62,7 @@
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
- "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
- "ext-xml": "Install the XML extension to load XML formatted public keys."
+ "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations."
},
"autoload": {
"files": [
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php
index 05ffa6362..2c143940b 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php
@@ -500,44 +500,6 @@ abstract class Base
}
$this->_setEngine();
-
- // Determining whether inline crypting can be used by the cipher
- if ($this->use_inline_crypt !== false) {
- $this->use_inline_crypt = version_compare(PHP_VERSION, '5.3.0') >= 0 || function_exists('create_function');
- }
-
- if (!defined('PHP_INT_SIZE')) {
- define('PHP_INT_SIZE', 4);
- }
-
- if (!defined('CRYPT_BASE_USE_REG_INTVAL')) {
- switch (true) {
- // PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
- case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
- case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
- case PHP_INT_SIZE == 8:
- define('CRYPT_BASE_USE_REG_INTVAL', true);
- break;
- case (php_uname('m') & "\xDF\xDF\xDF") == 'ARM':
- switch (true) {
- /* PHP 7.0.0 introduced a bug that affected 32-bit ARM processors:
-
- https://github.com/php/php-src/commit/716da71446ebbd40fa6cf2cea8a4b70f504cc3cd
-
- altho the changelogs make no mention of it, this bug was fixed with this commit:
-
- https://github.com/php/php-src/commit/c1729272b17a1fe893d1a54e423d3b71470f3ee8
-
- affected versions of PHP are: 7.0.x, 7.1.0 - 7.1.23 and 7.2.0 - 7.2.11 */
- case PHP_VERSION_ID >= 70000 && PHP_VERSION_ID <= 70123:
- case PHP_VERSION_ID >= 70200 && PHP_VERSION_ID <= 70211:
- define('CRYPT_BASE_USE_REG_INTVAL', false);
- break;
- default:
- define('CRYPT_BASE_USE_REG_INTVAL', true);
- }
- }
- }
}
/**
@@ -631,10 +593,6 @@ abstract class Base
* $hash, $salt, $count, $dkLen
*
* Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php
- * {@link https://en.wikipedia.org/wiki/Bcrypt bcypt}:
- * $salt, $rounds, $keylen
- *
- * This is a modified version of bcrypt used by OpenSSH.
*
* @see Crypt/Hash.php
* @param string $password
@@ -648,28 +606,6 @@ abstract class Base
$key = '';
switch ($method) {
- case 'bcrypt':
- $func_args = func_get_args();
-
- if (!isset($func_args[2])) {
- return false;
- }
-
- $salt = $func_args[2];
-
- $rounds = isset($func_args[3]) ? $func_args[3] : 16;
- $keylen = isset($func_args[4]) ? $func_args[4] : $this->key_length;
-
- $bf = new Blowfish();
- $key = $bf->bcrypt_pbkdf($password, $salt, $keylen + $this->block_size, $rounds);
- if (!$key) {
- return false;
- }
-
- $this->setKey(substr($key, 0, $keylen));
- $this->setIV(substr($key, $keylen));
-
- return true;
default: // 'pbkdf2' or 'pbkdf1'
$func_args = func_get_args();
@@ -1169,7 +1105,7 @@ abstract class Base
$plaintext = '';
if ($this->continuousBuffer) {
$iv = &$this->decryptIV;
- $pos = &$this->debuffer['pos'];
+ $pos = &$this->buffer['pos'];
} else {
$iv = $this->decryptIV;
$pos = 0;
@@ -2862,8 +2798,11 @@ abstract class Base
*/
function safe_intval($x)
{
- if (is_int($x)) {
- return $x;
+ switch (true) {
+ case is_int($x):
+ // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
+ case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
+ return $x;
}
return (fmod($x, 0x80000000) & 0x7FFFFFFF) |
((fmod(floor($x / 0x80000000), 2) & 1) << 31);
@@ -2877,12 +2816,15 @@ abstract class Base
*/
function safe_intval_inline()
{
- if (CRYPT_BASE_USE_REG_INTVAL) {
- return PHP_INT_SIZE == 4 ? 'intval(%s)' : '%s';
+ switch (true) {
+ case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8:
+ case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
+ return '%s';
+ break;
+ default:
+ $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | ';
+ return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))';
}
-
- $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | ';
- return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))';
}
/**
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
index 78e6367e1..74cc49de8 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
@@ -11,87 +11,6 @@
*
* - {@link http://en.wikipedia.org/wiki/Blowfish_(cipher) Wikipedia description of Blowfish}
*
- * # An overview of bcrypt vs Blowfish
- *
- * OpenSSH private keys use a customized version of bcrypt. Specifically, instead of
- * encrypting OrpheanBeholderScryDoubt 64 times OpenSSH's bcrypt variant encrypts
- * OxychromaticBlowfishSwatDynamite 64 times. so we can't use crypt().
- *
- * bcrypt is basically Blowfish but instead of performing the key expansion once it performs
- * the expansion 129 times for each round, with the first key expansion interleaving the salt
- * and password. This renders OpenSSL unusable and forces us to use a pure-PHP implementation
- * of blowfish.
- *
- * # phpseclib's four different _encryptBlock() implementations
- *
- * When using Blowfish as an encryption algorithm, _encryptBlock() is called 9 + 512 +
- * (the number of blocks in the plaintext) times.
- *
- * Each of the first 9 calls to _encryptBlock() modify the P-array. Each of the next 512
- * calls modify the S-boxes. The remaining _encryptBlock() calls operate on the plaintext to
- * produce the ciphertext. In the pure-PHP implementation of Blowfish these remaining
- * _encryptBlock() calls are highly optimized through the use of eval(). Among other things,
- * P-array lookups are eliminated by hard-coding the key-dependent P-array values, and thus we
- * have explained 2 of the 4 different _encryptBlock() implementations.
- *
- * With bcrypt things are a bit different. _encryptBlock() is called 1,079,296 times,
- * assuming 16 rounds (which is what OpenSSH's bcrypt defaults to). The eval()-optimized
- * _encryptBlock() isn't as beneficial because the P-array values are not constant. Well, they
- * are constant, but only for, at most, 777 _encryptBlock() calls, which is equivalent to ~6KB
- * of data. The average length of back to back _encryptBlock() calls with a fixed P-array is
- * 514.12, which is ~4KB of data. Creating an eval()-optimized _encryptBlock() has an upfront
- * cost, which is CPU dependent and is probably not going to be worth it for just ~4KB of
- * data. Conseqeuently, bcrypt does not benefit from the eval()-optimized _encryptBlock().
- *
- * The regular _encryptBlock() does unpack() and pack() on every call, as well, and that can
- * begin to add up after one million function calls.
- *
- * In theory, one might think that it might be beneficial to rewrite all block ciphers so
- * that, instead of passing strings to _encryptBlock(), you convert the string to an array of
- * integers and then pass successive subarrays of that array to _encryptBlock. This, however,
- * kills PHP's memory use. Like let's say you have a 1MB long string. After doing
- * $in = str_repeat('a', 1024 * 1024); PHP's memory utilization jumps up by ~1MB. After doing
- * $blocks = str_split($in, 4); it jumps up by an additional ~16MB. After
- * $blocks = array_map(fn($x) => unpack('N*', $x), $blocks); it jumps up by an additional
- * ~90MB, yielding a 106x increase in memory usage. Consequently, it bcrypt calls a different
- * _encryptBlock() then the regular Blowfish does. That said, the Blowfish _encryptBlock() is
- * basically just a thin wrapper around the bcrypt _encryptBlock(), so there's that.
- *
- * This explains 3 of the 4 _encryptBlock() implementations. the last _encryptBlock()
- * implementation can best be understood by doing Ctrl + F and searching for where
- * CRYPT_BASE_USE_REG_INTVAL is defined.
- *
- * # phpseclib's three different _setupKey() implementations
- *
- * Every bcrypt round is the equivalent of encrypting 512KB of data. Since OpenSSH uses 16
- * rounds by default that's ~8MB of data that's essentially being encrypted whenever
- * you use bcrypt. That's a lot of data, however, bcrypt operates within tighter constraints
- * than regular Blowfish, so we can use that to our advantage. In particular, whereas Blowfish
- * supports variable length keys, in bcrypt, the initial "key" is the sha512 hash of the
- * password. sha512 hashes are 512 bits or 64 bytes long and thus the bcrypt keys are of a
- * fixed length whereas Blowfish keys are not of a fixed length.
- *
- * bcrypt actually has two different key expansion steps. The first one (expandstate) is
- * constantly XOR'ing every _encryptBlock() parameter against the salt prior _encryptBlock()'s
- * being called. The second one (expand0state) is more similar to Blowfish's _setupKey()
- * but it can still use the fixed length key optimization discussed above and can do away with
- * the pack() / unpack() calls.
- *
- * I suppose _setupKey() could be made to be a thin wrapper around expandstate() but idk it's
- * just a lot of work for very marginal benefits as _setupKey() is only called once for
- * regular Blowfish vs the 128 times it's called --per round-- with bcrypt.
- *
- * # blowfish + bcrypt in the same class
- *
- * Altho there's a lot of Blowfish code that bcrypt doesn't re-use, bcrypt does re-use the
- * initial S-boxes, the initial P-array and the int-only _encryptBlock() implementation.
- *
- * # Credit
- *
- * phpseclib's bcrypt implementation is based losely off of OpenSSH's implementation:
- *
- * https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/bcrypt_pbkdf.c
- *
* Here's a short example of how to use this library:
* <code>
* <?php
@@ -156,15 +75,6 @@ class Blowfish extends Base
var $cfb_init_len = 500;
/**
- * SHA512 Object
- *
- * @see self::bcrypt_pbkdf
- * @var object
- * @access private
- */
- var $sha512;
-
- /**
* The fixed subkeys boxes ($sbox0 - $sbox3) with 256 entries each
*
* S-Box 0
@@ -374,41 +284,6 @@ class Blowfish extends Base
var $key_length = 16;
/**
- * Default Constructor.
- *
- * Determines whether or not the mcrypt extension should be used.
- *
- * $mode could be:
- *
- * - CRYPT_MODE_ECB
- *
- * - CRYPT_MODE_CBC
- *
- * - CRYPT_MODE_CTR
- *
- * - CRYPT_MODE_CFB
- *
- * - CRYPT_MODE_OFB
- *
- * (or the alias constants of the chosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
- *
- * If not explicitly set, CRYPT_MODE_CBC will be used.
- *
- * @param int $mode
- * @access public
- */
- function __construct($mode = self::MODE_CBC)
- {
- parent::__construct($mode);
-
- $this->sbox0 = array_map('intval', $this->sbox0);
- $this->sbox1 = array_map('intval', $this->sbox1);
- $this->sbox2 = array_map('intval', $this->sbox2);
- $this->sbox3 = array_map('intval', $this->sbox3);
- $this->parray = array_map('intval', $this->parray);
- }
-
- /**
* Sets the key length.
*
* Key lengths can be between 32 and 448 bits.
@@ -483,7 +358,6 @@ class Blowfish extends Base
// unpack binary string in unsigned chars
$key = array_values(unpack('C*', $this->key));
$keyl = count($key);
- // with bcrypt $keyl will always be 16 (because the key is the sha512 of the key you provide)
for ($j = 0, $i = 0; $i < 18; ++$i) {
// xor P1 with the first 32-bits of the key, xor P2 with the second 32-bits ...
for ($data = 0, $k = 0; $k < 4; ++$k) {
@@ -492,7 +366,7 @@ class Blowfish extends Base
$j = 0;
}
}
- $this->bctx['p'][] = $this->parray[$i] ^ intval($data);
+ $this->bctx['p'][] = $this->parray[$i] ^ $data;
}
// encrypt the zero-string, replace P1 and P2 with the encrypted data,
@@ -513,230 +387,6 @@ class Blowfish extends Base
}
/**
- * bcrypt
- *
- * @param string $sha2pass
- * @param string $sha2salt
- * @access private
- * @return string
- */
- function _bcrypt_hash($sha2pass, $sha2salt)
- {
- $p = $this->parray;
- $sbox0 = $this->sbox0;
- $sbox1 = $this->sbox1;
- $sbox2 = $this->sbox2;
- $sbox3 = $this->sbox3;
-
- $cdata = array_values(unpack('N*', 'OxychromaticBlowfishSwatDynamite'));
- $sha2pass = array_values(unpack('N*', $sha2pass));
- $sha2salt = array_values(unpack('N*', $sha2salt));
-
- $this->_expandstate($sha2salt, $sha2pass, $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 0; $i < 64; $i++) {
- $this->_expand0state($sha2salt, $sbox0, $sbox1, $sbox2, $sbox3, $p);
- $this->_expand0state($sha2pass, $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- for ($i = 0; $i < 64; $i++) {
- for ($j = 0; $j < 8; $j+= 2) { // count($cdata) == 8
- list($cdata[$j], $cdata[$j + 1]) = $this->_encryptBlockHelperFast($cdata[$j], $cdata[$j + 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
- }
-
- $output = '';
- for ($i = 0; $i < count($cdata); $i++) {
- $output.= pack('L*', $cdata[$i]);
- }
- return $output;
- }
-
- /**
- * Performs OpenSSH-style bcrypt
- *
- * @param string $pass
- * @param string $salt
- * @param int $keylen
- * @param int $rounds
- * @access public
- * @return false|string
- */
- function bcrypt_pbkdf($pass, $salt, $keylen, $rounds)
- {
- if (PHP_INT_SIZE == 4) {
- user_error('bcrypt is far too slow to be practical on 32-bit versions of PHP');
- return false;
- }
-
- if (!isset($this->sha512)) {
- $this->sha512 = new Hash('sha512');
- }
-
- $sha2pass = $this->sha512->hash($pass);
- $results = array();
- $count = 1;
- while (32 * count($results) < $keylen) {
- $countsalt = $salt . pack('N', $count++);
- $sha2salt = $this->sha512->hash($countsalt);
- $out = $tmpout = $this->_bcrypt_hash($sha2pass, $sha2salt);
- for ($i = 1; $i < $rounds; $i++) {
- $sha2salt = $this->sha512->hash($tmpout);
- $tmpout = $this->_bcrypt_hash($sha2pass, $sha2salt);
- $out^= $tmpout;
- }
- $results[] = $out;
- }
- $output = '';
- for ($i = 0; $i < 32; $i++) {
- foreach ($results as $result) {
- $output.= $result[$i];
- }
- }
- return substr($output, 0, $keylen);
- }
-
- /**
- * Key expansion without salt
- *
- * @access private
- * @param int[] $key
- * @param int[] $sbox0
- * @param int[] $sbox1
- * @param int[] $sbox2
- * @param int[] $sbox3
- * @param int[] $p
- * @see self::_bcrypt_hash()
- */
- function _expand0state($key, &$sbox0, &$sbox1, &$sbox2, &$sbox3, &$p)
- {
- // expand0state is basically the same thing as this:
- //return $this->_expandstate(array_fill(0, 16, 0), $key);
- // but this separate function eliminates a bunch of XORs and array lookups
-
- $p = array(
- $p[0] ^ $key[0],
- $p[1] ^ $key[1],
- $p[2] ^ $key[2],
- $p[3] ^ $key[3],
- $p[4] ^ $key[4],
- $p[5] ^ $key[5],
- $p[6] ^ $key[6],
- $p[7] ^ $key[7],
- $p[8] ^ $key[8],
- $p[9] ^ $key[9],
- $p[10] ^ $key[10],
- $p[11] ^ $key[11],
- $p[12] ^ $key[12],
- $p[13] ^ $key[13],
- $p[14] ^ $key[14],
- $p[15] ^ $key[15],
- $p[16] ^ $key[0],
- $p[17] ^ $key[1]
- );
-
- // @codingStandardsIgnoreStart
- list( $p[0], $p[1]) = $this->_encryptBlockHelperFast( 0, 0, $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[2], $p[3]) = $this->_encryptBlockHelperFast($p[ 0], $p[ 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[4], $p[5]) = $this->_encryptBlockHelperFast($p[ 2], $p[ 3], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[6], $p[7]) = $this->_encryptBlockHelperFast($p[ 4], $p[ 5], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[8], $p[9]) = $this->_encryptBlockHelperFast($p[ 6], $p[ 7], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[10], $p[11]) = $this->_encryptBlockHelperFast($p[ 8], $p[ 9], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[12], $p[13]) = $this->_encryptBlockHelperFast($p[10], $p[11], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[14], $p[15]) = $this->_encryptBlockHelperFast($p[12], $p[13], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[16], $p[17]) = $this->_encryptBlockHelperFast($p[14], $p[15], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- // @codingStandardsIgnoreEnd
-
- list($sbox0[0], $sbox0[1]) = $this->_encryptBlockHelperFast($p[16], $p[17], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2; $i < 256; $i+= 2) {
- list($sbox0[$i], $sbox0[$i + 1]) = $this->_encryptBlockHelperFast($sbox0[$i - 2], $sbox0[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox1[0], $sbox1[1]) = $this->_encryptBlockHelperFast($sbox0[254], $sbox0[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2; $i < 256; $i+= 2) {
- list($sbox1[$i], $sbox1[$i + 1]) = $this->_encryptBlockHelperFast($sbox1[$i - 2], $sbox1[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox2[0], $sbox2[1]) = $this->_encryptBlockHelperFast($sbox1[254], $sbox1[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2; $i < 256; $i+= 2) {
- list($sbox2[$i], $sbox2[$i + 1]) = $this->_encryptBlockHelperFast($sbox2[$i - 2], $sbox2[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox3[0], $sbox3[1]) = $this->_encryptBlockHelperFast($sbox2[254], $sbox2[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2; $i < 256; $i+= 2) {
- list($sbox3[$i], $sbox3[$i + 1]) = $this->_encryptBlockHelperFast($sbox3[$i - 2], $sbox3[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
- }
-
- /**
- * Key expansion with salt
- *
- * @access private
- * @param int[] $data
- * @param int[] $key
- * @param int[] $sbox0
- * @param int[] $sbox1
- * @param int[] $sbox2
- * @param int[] $sbox3
- * @param int[] $p
- * @see self::_bcrypt_hash()
- */
- function _expandstate($data, $key, &$sbox0, &$sbox1, &$sbox2, &$sbox3, &$p)
- {
- $p = array(
- $p[0] ^ $key[0],
- $p[1] ^ $key[1],
- $p[2] ^ $key[2],
- $p[3] ^ $key[3],
- $p[4] ^ $key[4],
- $p[5] ^ $key[5],
- $p[6] ^ $key[6],
- $p[7] ^ $key[7],
- $p[8] ^ $key[8],
- $p[9] ^ $key[9],
- $p[10] ^ $key[10],
- $p[11] ^ $key[11],
- $p[12] ^ $key[12],
- $p[13] ^ $key[13],
- $p[14] ^ $key[14],
- $p[15] ^ $key[15],
- $p[16] ^ $key[0],
- $p[17] ^ $key[1]
- );
-
- // @codingStandardsIgnoreStart
- list( $p[0], $p[1]) = $this->_encryptBlockHelperFast($data[ 0] , $data[ 1] , $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[2], $p[3]) = $this->_encryptBlockHelperFast($data[ 2] ^ $p[ 0], $data[ 3] ^ $p[ 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[4], $p[5]) = $this->_encryptBlockHelperFast($data[ 4] ^ $p[ 2], $data[ 5] ^ $p[ 3], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[6], $p[7]) = $this->_encryptBlockHelperFast($data[ 6] ^ $p[ 4], $data[ 7] ^ $p[ 5], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list( $p[8], $p[9]) = $this->_encryptBlockHelperFast($data[ 8] ^ $p[ 6], $data[ 9] ^ $p[ 7], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[10], $p[11]) = $this->_encryptBlockHelperFast($data[10] ^ $p[ 8], $data[11] ^ $p[ 9], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[12], $p[13]) = $this->_encryptBlockHelperFast($data[12] ^ $p[10], $data[13] ^ $p[11], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[14], $p[15]) = $this->_encryptBlockHelperFast($data[14] ^ $p[12], $data[15] ^ $p[13], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- list($p[16], $p[17]) = $this->_encryptBlockHelperFast($data[ 0] ^ $p[14], $data[ 1] ^ $p[15], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- // @codingStandardsIgnoreEnd
-
- list($sbox0[0], $sbox0[1]) = $this->_encryptBlockHelperFast($data[2] ^ $p[16], $data[3] ^ $p[17], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2, $j = 4; $i < 256; $i+= 2, $j = ($j + 2) % 16) { // instead of 16 maybe count($data) would be better?
- list($sbox0[$i], $sbox0[$i + 1]) = $this->_encryptBlockHelperFast($data[$j] ^ $sbox0[$i - 2], $data[$j + 1] ^ $sbox0[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox1[0], $sbox1[1]) = $this->_encryptBlockHelperFast($data[2] ^ $sbox0[254], $data[3] ^ $sbox0[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2, $j = 4; $i < 256; $i+= 2, $j = ($j + 2) % 16) {
- list($sbox1[$i], $sbox1[$i + 1]) = $this->_encryptBlockHelperFast($data[$j] ^ $sbox1[$i - 2], $data[$j + 1] ^ $sbox1[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox2[0], $sbox2[1]) = $this->_encryptBlockHelperFast($data[2] ^ $sbox1[254], $data[3] ^ $sbox1[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2, $j = 4; $i < 256; $i+= 2, $j = ($j + 2) % 16) {
- list($sbox2[$i], $sbox2[$i + 1]) = $this->_encryptBlockHelperFast($data[$j] ^ $sbox2[$i - 2], $data[$j + 1] ^ $sbox2[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
-
- list($sbox3[0], $sbox3[1]) = $this->_encryptBlockHelperFast($data[2] ^ $sbox2[254], $data[3] ^ $sbox2[255], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- for ($i = 2, $j = 4; $i < 256; $i+= 2, $j = ($j + 2) % 16) {
- list($sbox3[$i], $sbox3[$i + 1]) = $this->_encryptBlockHelperFast($data[$j] ^ $sbox3[$i - 2], $data[$j + 1] ^ $sbox3[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p);
- }
- }
-
- /**
* Encrypts a block
*
* @access private
@@ -756,83 +406,18 @@ class Blowfish extends Base
$l = $in[1];
$r = $in[2];
- list($r, $l) = CRYPT_BASE_USE_REG_INTVAL ?
- $this->_encryptBlockHelperFast($l, $r, $sb_0, $sb_1, $sb_2, $sb_3, $p) :
- $this->_encryptBlockHelperSlow($l, $r, $sb_0, $sb_1, $sb_2, $sb_3, $p);
-
- return pack("N*", $r, $l);
- }
-
- /**
- * Fast helper function for block encryption
- *
- * @access private
- * @param int $x0
- * @param int $x1
- * @param int[] $sbox0
- * @param int[] $sbox1
- * @param int[] $sbox2
- * @param int[] $sbox3
- * @param int[] $p
- * @return int[]
- */
- function _encryptBlockHelperFast($x0, $x1, $sbox0, $sbox1, $sbox2, $sbox3, $p)
- {
- $x0 ^= $p[0];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[1];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[2];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[3];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[4];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[5];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[6];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[7];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[8];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[9];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[10];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[11];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[12];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[13];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[14];
- $x1 ^= ((($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[15];
- $x0 ^= ((($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[16];
-
- return array($x1 & 0xFFFFFFFF ^ $p[17], $x0 & 0xFFFFFFFF);
- }
+ for ($i = 0; $i < 16; $i+= 2) {
+ $l^= $p[$i];
+ $r^= $this->safe_intval(($this->safe_intval($sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]) ^
+ $sb_2[$l >> 8 & 0xff]) +
+ $sb_3[$l & 0xff]);
- /**
- * Slow helper function for block encryption
- *
- * @access private
- * @param int $x0
- * @param int $x1
- * @param int[] $sbox0
- * @param int[] $sbox1
- * @param int[] $sbox2
- * @param int[] $sbox3
- * @param int[] $p
- * @return int[]
- */
- function _encryptBlockHelperSlow($x0, $x1, $sbox0, $sbox1, $sbox2, $sbox3, $p)
- {
- $x0^= $p[0];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[1];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[2];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[3];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[4];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[5];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[6];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[7];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[8];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[9];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[10];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[11];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[12];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[13];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[14];
- $x1^= $this->safe_intval(($this->safe_intval($sbox0[($x0 & 0xFF000000) >> 24] + $sbox1[($x0 & 0xFF0000) >> 16]) ^ $sbox2[($x0 & 0xFF00) >> 8]) + $sbox3[$x0 & 0xFF]) ^ $p[15];
- $x0^= $this->safe_intval(($this->safe_intval($sbox0[($x1 & 0xFF000000) >> 24] + $sbox1[($x1 & 0xFF0000) >> 16]) ^ $sbox2[($x1 & 0xFF00) >> 8]) + $sbox3[$x1 & 0xFF]) ^ $p[16];
-
- return array($x1 & 0xFFFFFFFF ^ $p[17], $x0 & 0xFFFFFFFF);
+ $r^= $p[$i + 1];
+ $l^= $this->safe_intval(($this->safe_intval($sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]) ^
+ $sb_2[$r >> 8 & 0xff]) +
+ $sb_3[$r & 0xff]);
+ }
+ return pack("N*", $r ^ $p[17], $l ^ $p[16]);
}
/**
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
index a19d1a0ba..9a8225fb5 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
@@ -1246,9 +1246,9 @@ class DES extends Base
$pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[ $d & 0xFF];
// Reorder: odd bytes/even bytes. Push the result in key schedule.
- $val1 = ( $cp & intval(0xFF000000)) | (($cp << 8) & 0x00FF0000) |
+ $val1 = ( $cp & 0xFF000000) | (($cp << 8) & 0x00FF0000) |
(($dp >> 16) & 0x0000FF00) | (($dp >> 8) & 0x000000FF);
- $val2 = (($cp << 8) & intval(0xFF000000)) | (($cp << 16) & 0x00FF0000) |
+ $val2 = (($cp << 8) & 0xFF000000) | (($cp << 16) & 0x00FF0000) |
(($dp >> 8) & 0x0000FF00) | ( $dp & 0x000000FF);
$keys[$des_round][self::ENCRYPT][ ] = $val1;
$keys[$des_round][self::DECRYPT][$ki - 1] = $val1;
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
index 4d27f42de..b2b9d48ea 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
@@ -72,7 +72,7 @@ class RC2 extends Base
* @var string
* @access private
*/
- var $orig_key = '';
+ var $orig_key;
/**
* Don't truncate / null pad key
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
index a8fa23156..122d281a8 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
@@ -1388,10 +1388,6 @@ class RSA
// http://en.wikipedia.org/wiki/XML_Signature
case self::PRIVATE_FORMAT_XML:
case self::PUBLIC_FORMAT_XML:
- if (!extension_loaded('xml')) {
- return false;
- }
-
$this->components = array();
$xml = xml_parser_create('UTF-8');
@@ -1526,44 +1522,14 @@ class RSA
if ($magic !== "openssh-key-v1\0") {
return false;
}
- extract(unpack('Nlength', $this->_string_shift($decoded, 4)));
- if (strlen($decoded) < $length) {
- return false;
- }
- $ciphername = $this->_string_shift($decoded, $length);
- extract(unpack('Nlength', $this->_string_shift($decoded, 4)));
- if (strlen($decoded) < $length) {
+ $options = $this->_string_shift($decoded, 24);
+ // \0\0\0\4none = ciphername
+ // \0\0\0\4none = kdfname
+ // \0\0\0\0 = kdfoptions
+ // \0\0\0\1 = numkeys
+ if ($options != "\0\0\0\4none\0\0\0\4none\0\0\0\0\0\0\0\1") {
return false;
}
- $kdfname = $this->_string_shift($decoded, $length);
- extract(unpack('Nlength', $this->_string_shift($decoded, 4)));
- if (strlen($decoded) < $length) {
- return false;
- }
- $kdfoptions = $this->_string_shift($decoded, $length);
- extract(unpack('Nnumkeys', $this->_string_shift($decoded, 4)));
- if ($numkeys != 1 || ($ciphername != 'none' && $kdfname != 'bcrypt')) {
- return false;
- }
- switch ($ciphername) {
- case 'none':
- break;
- case 'aes256-ctr':
- extract(unpack('Nlength', $this->_string_shift($kdfoptions, 4)));
- if (strlen($kdfoptions) < $length) {
- return false;
- }
- $salt = $this->_string_shift($kdfoptions, $length);
- extract(unpack('Nrounds', $this->_string_shift($kdfoptions, 4)));
- $crypto = new AES(AES::MODE_CTR);
- $crypto->disablePadding();
- if (!$crypto->setPassword($this->password, 'bcrypt', $salt, $rounds, 32)) {
- return false;
- }
- break;
- default:
- return false;
- }
extract(unpack('Nlength', $this->_string_shift($decoded, 4)));
if (strlen($decoded) < $length) {
return false;
@@ -1573,16 +1539,12 @@ class RSA
if (strlen($decoded) < $length) {
return false;
}
+ $paddedKey = $this->_string_shift($decoded, $length);
if ($this->_string_shift($publicKey, 11) !== "\0\0\0\7ssh-rsa") {
return false;
}
- $paddedKey = $this->_string_shift($decoded, $length);
- if (isset($crypto)) {
- $paddedKey = $crypto->decrypt($paddedKey);
- }
-
$checkint1 = $this->_string_shift($paddedKey, 4);
$checkint2 = $this->_string_shift($paddedKey, 4);
if (strlen($checkint1) != 4 || $checkint1 !== $checkint2) {
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
index 7a6be2a67..3648a1972 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
@@ -340,7 +340,7 @@ class Rijndael extends Base
$k = $c[2];
$l = $c[3];
while ($i < $Nb) {
- $temp[$i] = ($state[$i] & intval(0xFF000000)) ^
+ $temp[$i] = ($state[$i] & 0xFF000000) ^
($state[$j] & 0x00FF0000) ^
($state[$k] & 0x0000FF00) ^
($state[$l] & 0x000000FF) ^
@@ -426,7 +426,7 @@ class Rijndael extends Base
$l = $Nb - $c[3];
while ($i < $Nb) {
- $word = ($state[$i] & intval(0xFF000000)) |
+ $word = ($state[$i] & 0xFF000000) |
($state[$j] & 0x00FF0000) |
($state[$k] & 0x0000FF00) |
($state[$l] & 0x000000FF);
@@ -465,19 +465,14 @@ class Rijndael extends Base
{
// Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field.
// See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse
- static $rcon;
-
- if (!isset($rcon)) {
- $rcon = array(0,
- 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
- 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000,
- 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000,
- 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
- 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000,
- 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000
- );
- $rcon = array_map('intval', $rcon);
- }
+ static $rcon = array(0,
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000,
+ 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000,
+ 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
+ 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000,
+ 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000
+ );
if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) {
// already expanded
@@ -516,7 +511,7 @@ class Rijndael extends Base
// on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine,
// 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and'
// with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is.
- $temp = (($temp << 8) & intval(0xFFFFFF00)) | (($temp >> 24) & 0x000000FF); // rotWord
+ $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord
$temp = $this->_subWord($temp) ^ $rcon[$i / $this->Nk];
} elseif ($this->Nk > 6 && $i % $this->Nk == 4) {
$temp = $this->_subWord($temp);
@@ -646,9 +641,9 @@ class Rijndael extends Base
));
foreach ($t3 as $t3i) {
- $t0[] = (($t3i << 24) & intval(0xFF000000)) | (($t3i >> 8) & 0x00FFFFFF);
- $t1[] = (($t3i << 16) & intval(0xFFFF0000)) | (($t3i >> 16) & 0x0000FFFF);
- $t2[] = (($t3i << 8) & intval(0xFFFFFF00)) | (($t3i >> 24) & 0x000000FF);
+ $t0[] = (($t3i << 24) & 0xFF000000) | (($t3i >> 8) & 0x00FFFFFF);
+ $t1[] = (($t3i << 16) & 0xFFFF0000) | (($t3i >> 16) & 0x0000FFFF);
+ $t2[] = (($t3i << 8) & 0xFFFFFF00) | (($t3i >> 24) & 0x000000FF);
}
$tables = array(
@@ -730,9 +725,9 @@ class Rijndael extends Base
));
foreach ($dt3 as $dt3i) {
- $dt0[] = (($dt3i << 24) & intval(0xFF000000)) | (($dt3i >> 8) & 0x00FFFFFF);
- $dt1[] = (($dt3i << 16) & intval(0xFFFF0000)) | (($dt3i >> 16) & 0x0000FFFF);
- $dt2[] = (($dt3i << 8) & intval(0xFFFFFF00)) | (($dt3i >> 24) & 0x000000FF);
+ $dt0[] = (($dt3i << 24) & 0xFF000000) | (($dt3i >> 8) & 0x00FFFFFF);
+ $dt1[] = (($dt3i << 16) & 0xFFFF0000) | (($dt3i >> 16) & 0x0000FFFF);
+ $dt2[] = (($dt3i << 8) & 0xFFFFFF00) | (($dt3i >> 24) & 0x000000FF);
};
$tables = array(
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php
index 1c020481a..70980a2ff 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php
@@ -369,42 +369,6 @@ class Twofish extends Base
var $key_length = 16;
/**
- * Default Constructor.
- *
- * Determines whether or not the mcrypt extension should be used.
- *
- * $mode could be:
- *
- * - CRYPT_MODE_ECB
- *
- * - CRYPT_MODE_CBC
- *
- * - CRYPT_MODE_CTR
- *
- * - CRYPT_MODE_CFB
- *
- * - CRYPT_MODE_OFB
- *
- * (or the alias constants of the chosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
- *
- * If not explicitly set, CRYPT_MODE_CBC will be used.
- *
- * @param int $mode
- * @access public
- */
- function __construct($mode = self::MODE_CBC)
- {
- parent::__construct($mode);
-
- $this->m0 = array_map('intval', $this->m0);
- $this->m1 = array_map('intval', $this->m1);
- $this->m2 = array_map('intval', $this->m2);
- $this->m3 = array_map('intval', $this->m3);
- $this->q0 = array_map('intval', $this->q0);
- $this->q1 = array_map('intval', $this->q1);
- }
-
- /**
* Sets the key length.
*
* Valid key lengths are 128, 192 or 256 bits
diff --git a/vendor/phpseclib/phpseclib/phpseclib/File/X509.php b/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
index 73ecd25de..0da0b83cc 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
@@ -145,7 +145,6 @@ class X509
var $AuthorityKeyIdentifier;
var $CertificatePolicies;
var $AuthorityInfoAccessSyntax;
- var $SubjectInfoAccessSyntax;
var $SubjectAltName;
var $SubjectDirectoryAttributes;
var $PrivateKeyUsagePeriod;
@@ -2164,11 +2163,7 @@ class X509
if (!$fsock) {
return false;
}
- $path = $parts['path'];
- if (isset($parts['query'])) {
- $path.= '?' . $parts['query'];
- }
- fputs($fsock, "GET $path HTTP/1.0\r\n");
+ fputs($fsock, "GET $parts[path] HTTP/1.0\r\n");
fputs($fsock, "Host: $parts[host]\r\n\r\n");
$line = fgets($fsock, 1024);
if (strlen($line) < 3) {
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
index 7c0b0a8d3..52adcd450 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
@@ -263,12 +263,12 @@ class BigInteger
}
}
- if (extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
+ if (function_exists('phpinfo') && extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
// some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work
$versions = array();
// avoid generating errors (even with suppression) when phpinfo() is disabled (common in production systems)
- if (function_exists('phpinfo')) {
+ if (strpos(ini_get('disable_functions'), 'phpinfo') === false) {
ob_start();
@phpinfo();
$content = ob_get_contents();
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
index ade0ea5ca..0c06c35f4 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
@@ -718,16 +718,7 @@ class SFTP extends SSH2
return false;
}
- $this->pwd = true;
$this->pwd = $this->_realpath('.');
- if ($this->pwd === false) {
- if (!$this->canonicalize_paths) {
- user_error('Unable to canonicalize current working directory');
- return false;
- }
- $this->canonicalize_paths = false;
- $this->_reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST);
- }
$this->_update_stat_cache($this->pwd, array());
@@ -775,9 +766,7 @@ class SFTP extends SSH2
}
/**
- * Disable path canonicalization
- *
- * If this is enabled then $sftp->pwd() will not return the canonicalized absolute path
+ * Enable path canonicalization
*
* @access public
*/
@@ -883,37 +872,10 @@ class SFTP extends SSH2
function _realpath($path)
{
if (!$this->canonicalize_paths) {
- if ($this->pwd === true) {
- return '.';
- }
- if (!strlen($path) || $path[0] != '/') {
- $path = $this->pwd . '/' . $path;
- }
-
- $parts = explode('/', $path);
- $afterPWD = $beforePWD = [];
- foreach ($parts as $part) {
- switch ($part) {
- //case '': // some SFTP servers /require/ double /'s. see https://github.com/phpseclib/phpseclib/pull/1137
- case '.':
- break;
- case '..':
- if (!empty($afterPWD)) {
- array_pop($afterPWD);
- } else {
- $beforePWD[] = '..';
- }
- break;
- default:
- $afterPWD[] = $part;
- }
- }
-
- $beforePWD = count($beforePWD) ? implode('/', $beforePWD) : '.';
- return $beforePWD . '/' . implode('/', $afterPWD);
+ return $path;
}
- if ($this->pwd === true) {
+ if ($this->pwd === false) {
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.9
if (!$this->_send_sftp_packet(NET_SFTP_REALPATH, pack('Na*', strlen($path), $path))) {
return false;
@@ -935,6 +897,7 @@ class SFTP extends SSH2
$this->_logError($response);
return false;
default:
+ user_error('Expected SSH_FXP_NAME or SSH_FXP_STATUS');
return false;
}
}
@@ -2310,7 +2273,7 @@ class SFTP extends SSH2
case is_resource($data):
$mode = $mode & ~self::SOURCE_LOCAL_FILE;
$info = stream_get_meta_data($data);
- if (isset($info['wrapper_type']) && $info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') {
+ if ($info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') {
$fp = fopen('php://memory', 'w+');
stream_copy_to_stream($data, $fp);
rewind($fp);
@@ -2746,7 +2709,7 @@ class SFTP extends SSH2
// normally $entries would have at least . and .. but it might not if the directories
// permissions didn't allow reading
if (empty($entries)) {
- $entries = array();
+ return false;
}
unset($entries['.'], $entries['..']);
@@ -3655,9 +3618,6 @@ class SFTP extends SSH2
while ($tempLength > 0) {
$temp = $this->_get_channel_packet(self::CHANNEL, true);
if (is_bool($temp)) {
- if ($temp && $this->channel_status[self::CHANNEL] === NET_SSH2_MSG_CHANNEL_CLOSE) {
- $this->channel_close = true;
- }
$this->packet_type = false;
$this->packet_buffer = '';
return false;
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
index d8e373578..7ec4a1e36 100644
--- a/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
+++ b/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
@@ -3519,11 +3519,7 @@ class SSH2
if (!is_resource($this->fsock) || feof($this->fsock)) {
$this->bitmap = 0;
- $str = 'Connection closed (by server) prematurely';
- if (isset($elapsed)) {
- $str.= ' ' . $elapsed . 's';
- }
- user_error($str);
+ user_error('Connection closed (by server) prematurely ' . $elapsed . 's');
return false;
}