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:
parent
d85ee2cb3b
commit
a983412ea9
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user