CS adjustments

This commit is contained in:
terrafrost 2024-07-31 18:28:13 -05:00
parent a015cded00
commit 6ad7c53bbf
4 changed files with 8 additions and 3 deletions

View File

@ -433,7 +433,7 @@ class Blowfish extends BlockCipher
$this->bctx['p'][$i ] = $l; $this->bctx['p'][$i ] = $l;
$this->bctx['p'][$i + 1] = $r; $this->bctx['p'][$i + 1] = $r;
} }
for ($i = 0; $i < 0x400; $i+= 0x100) { for ($i = 0; $i < 0x400; $i += 0x100) {
for ($j = 0; $j < 256; $j += 2) { for ($j = 0; $j < 256; $j += 2) {
list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data)));
$this->bctx['sb'][$i | $j] = $l; $this->bctx['sb'][$i | $j] = $l;

View File

@ -266,11 +266,13 @@ final class PrivateKey extends EC implements Common\PrivateKey
$temp = new \ReflectionMethod($format, 'save'); $temp = new \ReflectionMethod($format, 'save');
$paramCount = $temp->getNumberOfRequiredParameters(); $paramCount = $temp->getNumberOfRequiredParameters();
// @codingStandardsIgnoreStart
switch ($paramCount) { switch ($paramCount) {
case 2: return $format::save($r, $s); case 2: return $format::save($r, $s);
case 3: return $format::save($r, $s, $this->getCurve()); case 3: return $format::save($r, $s, $this->getCurve());
case 4: return $format::save($r, $s, $this->getCurve(), $this->getLength()); case 4: return $format::save($r, $s, $this->getCurve(), $this->getLength());
} }
// @codingStandardsIgnoreEnd
// presumably the only way you could get to this is if you were using a custom plugin // presumably the only way you could get to this is if you were using a custom plugin
throw new UnsupportedOperationException("$format::save() has $paramCount parameters - the only valid parameter counts are 2 or 3"); throw new UnsupportedOperationException("$format::save() has $paramCount parameters - the only valid parameter counts are 2 or 3");

View File

@ -4490,7 +4490,8 @@ class SSH2
*/ */
protected function send_channel_packet($client_channel, $data) protected function send_channel_packet($client_channel, $data)
{ {
if (isset($this->channel_buffers_write[$client_channel]) if (
isset($this->channel_buffers_write[$client_channel])
&& strpos($data, $this->channel_buffers_write[$client_channel]) === 0 && strpos($data, $this->channel_buffers_write[$client_channel]) === 0
) { ) {
// if buffer holds identical initial data content, resume send from the unmatched data portion // if buffer holds identical initial data content, resume send from the unmatched data portion

View File

@ -15,7 +15,9 @@ class RandomTest extends PhpseclibTestCase
{ {
public static function stringLengthData() public static function stringLengthData()
{ {
return array_map(function($x) { return [$x]; }, [ return array_map(function ($x) {
return [$x];
}, [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 20, 23, 29, 31, 37, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 20, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 111, 128, 1000, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 111, 128, 1000,
1024, 10000, 12345, 100000, 123456 1024, 10000, 12345, 100000, 123456