mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-27 12:55:58 +01:00
Tests: update unit tests to use CRYPT_ENGINE_* instead of CRYPT_MODE_*
This commit is contained in:
parent
51c0deba45
commit
8d40eb22ef
@ -9,6 +9,6 @@ class Unit_Crypt_AES_InternalTest extends Unit_Crypt_AES_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->engine = CRYPT_MODE_INTERNAL;
|
||||
$this->engine = CRYPT_ENGINE_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ class Unit_Crypt_AES_McryptTest extends Unit_Crypt_AES_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->engine = CRYPT_MODE_MCRYPT;
|
||||
$this->engine = CRYPT_ENGINE_MCRYPT;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ class Unit_Crypt_AES_OpenSSLTest extends Unit_Crypt_AES_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->engine = CRYPT_MODE_OPENSSL;
|
||||
$this->engine = CRYPT_ENGINE_OPENSSL;
|
||||
}
|
||||
}
|
||||
|
@ -17,19 +17,19 @@ class Unit_Crypt_DES_TestCase extends PhpseclibTestCase
|
||||
$des->setKey('d');
|
||||
$des->setIV('d');
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_INTERNAL);
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_INTERNAL);
|
||||
$internal = $des->encrypt('d');
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_MCRYPT);
|
||||
if ($des->getEngine() == CRYPT_MODE_MCRYPT) {
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_MCRYPT);
|
||||
if ($des->getEngine() == CRYPT_ENGINE_MCRYPT) {
|
||||
$mcrypt = $des->encrypt('d');
|
||||
$this->assertEquals($internal, $mcrypt, 'Failed asserting that the internal and mcrypt engines produce identical results');
|
||||
} else {
|
||||
self::markTestSkipped('Unable to initialize mcrypt engine');
|
||||
}
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_OPENSSL);
|
||||
if ($des->getEngine() == CRYPT_MODE_OPENSSL) {
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_OPENSSL);
|
||||
if ($des->getEngine() == CRYPT_ENGINE_OPENSSL) {
|
||||
$openssl = $des->encrypt('d');
|
||||
$this->assertEquals($internal, $openssl, 'Failed asserting that the internal and OpenSSL engines produce identical results');
|
||||
} else {
|
||||
@ -47,19 +47,19 @@ class Unit_Crypt_DES_TestCase extends PhpseclibTestCase
|
||||
//$des->setKey();
|
||||
//$des->setIV();
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_INTERNAL);
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_INTERNAL);
|
||||
$internal = $des->decrypt('d');
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_MCRYPT);
|
||||
if ($des->getEngine() == CRYPT_MODE_MCRYPT) {
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_MCRYPT);
|
||||
if ($des->getEngine() == CRYPT_ENGINE_MCRYPT) {
|
||||
$mcrypt = $des->decrypt('d');
|
||||
$this->assertEquals($internal, $mcrypt, 'Failed asserting that the internal and mcrypt engines produce identical results');
|
||||
} else {
|
||||
self::markTestSkipped('Unable to initialize mcrypt engine');
|
||||
}
|
||||
|
||||
$des->setPreferredEngine(CRYPT_MODE_OPENSSL);
|
||||
if ($des->getEngine() == CRYPT_MODE_OPENSSL) {
|
||||
$des->setPreferredEngine(CRYPT_ENGINE_OPENSSL);
|
||||
if ($des->getEngine() == CRYPT_ENGINE_OPENSSL) {
|
||||
$openssl = $des->decrypt('d');
|
||||
$this->assertEquals($internal, $openssl, 'Failed asserting that the internal and OpenSSL engines produce identical results');
|
||||
} else {
|
||||
|
@ -49,19 +49,19 @@ class Unit_Crypt_RC2_TestCase extends PhpseclibTestCase
|
||||
|
||||
$rc2->setKey(str_repeat('d', 16), 128);
|
||||
|
||||
$rc2->setPreferredEngine(CRYPT_MODE_INTERNAL);
|
||||
$rc2->setPreferredEngine(CRYPT_ENGINE_INTERNAL);
|
||||
$internal = $rc2->encrypt('d');
|
||||
|
||||
$rc2->setPreferredEngine(CRYPT_MODE_MCRYPT);
|
||||
if ($rc2->getEngine() == CRYPT_MODE_MCRYPT) {
|
||||
$rc2->setPreferredEngine(CRYPT_ENGINE_MCRYPT);
|
||||
if ($rc2->getEngine() == CRYPT_ENGINE_MCRYPT) {
|
||||
$mcrypt = $rc2->encrypt('d');
|
||||
$this->assertEquals($internal, $mcrypt, 'Failed asserting that the internal and mcrypt engines produce identical results');
|
||||
} else {
|
||||
self::markTestSkipped('Unable to initialize mcrypt engine');
|
||||
}
|
||||
|
||||
$rc2->setPreferredEngine(CRYPT_MODE_OPENSSL);
|
||||
if ($rc2->getEngine() == CRYPT_MODE_OPENSSL) {
|
||||
$rc2->setPreferredEngine(CRYPT_ENGINE_OPENSSL);
|
||||
if ($rc2->getEngine() == CRYPT_ENGINE_OPENSSL) {
|
||||
$openssl = $rc2->encrypt('d');
|
||||
$this->assertEquals($internal, $openssl, 'Failed asserting that the internal and OpenSSL engines produce identical results');
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user