fix: fix syntax errors in ChaCha20 and Salsa20 tests

This commit is contained in:
thephilosoft 2021-12-03 13:08:08 -05:00 committed by terrafrost
parent 2bcb643660
commit aa88c5621b
2 changed files with 10 additions and 10 deletions

View File

@ -26,7 +26,7 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$expected = pack('H*', $expected);
$engines = ['PHP', 'OpenSSL', 'libsodium'];
for ($engines as $engine) {
foreach ($engines as $engine) {
$c = new ChaCha20();
$c->setKey($key);
$c->setNonce($nonce);
@ -63,8 +63,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$expected = str_replace(' ', '', $expected);
$expected = pack('H*', $expected);
$engines = ['PHP', OpenSSL', 'libsodium'];
for ($engines as $engine) {
$engines = ['PHP', 'OpenSSL', 'libsodium'];
foreach ($engines as $engine) {
$c = new ChaCha20();
$c->setKey($key);
$c->setNonce($nonce);
@ -119,8 +119,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$expected = str_replace(' ', '', $expected);
$expected = pack('H*', $expected);
$engines = ['PHP', OpenSSL', 'libsodium'];
for ($engines as $engine) {
$engines = ['PHP', 'OpenSSL', 'libsodium'];
foreach ($engines as $engine) {
$c = new ChaCha20();
$c->setKey($key);
$c->setNonce($nonce);
@ -163,8 +163,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$tag = str_replace(' ', '', $tag);
$tag = pack('H*', $tag);
$engines = ['PHP', OpenSSL', 'libsodium'];
for ($engines as $engine) {
$engines = ['PHP', 'OpenSSL', 'libsodium'];
foreach ($engines as $engine) {
$c = new ChaCha20();
$c->enablePoly1305();
$c->setKey($key);
@ -189,8 +189,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$plaintext = str_repeat("\0", array_sum($partitions));
$engines = ['PHP', OpenSSL', 'libsodium'];
for ($engines as $engine) {
$engines = ['PHP', 'OpenSSL', 'libsodium'];
foreach ($engines as $engine) {
$c = new ChaCha20();
$c->setKey($key);
$c->setNonce($nonce);

View File

@ -154,7 +154,7 @@ class Unit_Crypt_Salsa20Test extends PhpseclibTestCase
if ($cipher->getEngine() != $engine) {
self::markTestSkipped('Unable to initialize ' . $engine . ' engine for ' . (strlen($key) * 8) . '-bit key');
}
$result = $cipher->encrypt(str_repeat("\0", 64);
$result = $cipher->encrypt(str_repeat("\0", 64));
$this->assertEquals(bin2hex($result), $expected, "Failed asserting that key $key / $iv yielded expected output in $engine engine");
}
}