mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
Merge pull request #460 from kroleg/patch-1
Error: "Constant CRYPT_RSA_MODE already defined" * kroleg/patch-1: Replaced "case true:" with "default:" Error: "Constant CRYPT_RSA_MODE already defined"
This commit is contained in:
commit
e0868df0ec
@ -493,14 +493,13 @@ class Crypt_RSA
|
|||||||
$this->configFile = CRYPT_RSA_OPENSSL_CONFIG;
|
$this->configFile = CRYPT_RSA_OPENSSL_CONFIG;
|
||||||
|
|
||||||
if ( !defined('CRYPT_RSA_MODE') ) {
|
if ( !defined('CRYPT_RSA_MODE') ) {
|
||||||
// Math/BigInteger's openssl requirements are a little less stringent than Crypt/RSA's. in particular,
|
switch (true) {
|
||||||
// Math/BigInteger doesn't require an openssl.cfg file whereas Crypt/RSA does. so if Math/BigInteger
|
// Math/BigInteger's openssl requirements are a little less stringent than Crypt/RSA's. in particular,
|
||||||
// can't use OpenSSL it can be pretty trivially assumed, then, that Crypt/RSA can't either.
|
// Math/BigInteger doesn't require an openssl.cfg file whereas Crypt/RSA does. so if Math/BigInteger
|
||||||
if ( defined('MATH_BIGINTEGER_OPENSSL_DISABLE') ) {
|
// can't use OpenSSL it can be pretty trivially assumed, then, that Crypt/RSA can't either.
|
||||||
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
case defined('MATH_BIGINTEGER_OPENSSL_DISABLE'):
|
||||||
}
|
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||||
|
break;
|
||||||
switch ( !defined('CRYPT_RSA_MODE') ) { // ie. only run this if the above didn't set CRYPT_RSA_MODE already
|
|
||||||
// openssl_pkey_get_details - which is used in the only place Crypt/RSA.php uses OpenSSL - was introduced in PHP 5.2.0
|
// openssl_pkey_get_details - which is used in the only place Crypt/RSA.php uses OpenSSL - was introduced in PHP 5.2.0
|
||||||
case !function_exists('openssl_pkey_get_details'):
|
case !function_exists('openssl_pkey_get_details'):
|
||||||
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||||
@ -533,7 +532,7 @@ class Crypt_RSA
|
|||||||
define('MATH_BIGINTEGER_OPENSSL_DISABLE', true);
|
define('MATH_BIGINTEGER_OPENSSL_DISABLE', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case true:
|
default:
|
||||||
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user