1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-03 10:08:04 +01:00

Crypt: fix OpenSSL engine on <= PHP 5.3.6

This commit is contained in:
terrafrost 2017-05-13 23:18:42 -05:00
parent d85ee2cb3b
commit a983412ea9
2 changed files with 20 additions and 1 deletions

View File

@ -390,6 +390,9 @@ class Crypt_Blowfish extends Crypt_Base
function isValidEngine($engine)
{
if ($engine == CRYPT_ENGINE_OPENSSL) {
if (version_compare(PHP_VERSION, '5.3.7') < 0 && $this->key_length != 16) {
return false;
}
if ($this->key_length < 16) {
return false;
}

View File

@ -190,7 +190,23 @@ class Crypt_RC4 extends Crypt_Base
function isValidEngine($engine)
{
if ($engine == CRYPT_ENGINE_OPENSSL) {
$this->cipher_name_openssl = 'rc4-40';
if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
$this->cipher_name_openssl = 'rc4-40';
} else {
switch (strlen($this->key)) {
case 5:
$this->cipher_name_openssl = 'rc4-40';
break;
case 8:
$this->cipher_name_openssl = 'rc4-64';
break;
case 16:
$this->cipher_name_openssl = 'rc4';
break;
default:
return false;
}
}
}
return parent::isValidEngine($engine);