From 28f18f83ec1476a028a81fe71152978ed792b8a6 Mon Sep 17 00:00:00 2001 From: David Stensland Date: Mon, 1 Apr 2013 12:29:28 -0400 Subject: [PATCH 1/2] SSH2: Be less overly clever loading Crypt/Random --- composer.json | 5 ++++- phpseclib/Net/SSH2.php | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 11008cd8..843fd311 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,9 @@ "File": "phpseclib/", "Math": "phpseclib/", "Net": "phpseclib/" - } + }, + "files": [ + "phpseclib/Crypt/Random.php" + ] } } diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index c05a4cd0..7845fe50 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -80,11 +80,7 @@ if (!class_exists('Math_BigInteger')) { /** * Include Crypt_Random */ -// the class_exists() will only be called if the crypt_random_string function hasn't been defined and -// will trigger a call to __autoload() if you're wanting to auto-load classes -// call function_exists() a second time to stop the require_once from being called outside -// of the auto loader -if (!function_exists('crypt_random_string') && !class_exists('Crypt_Random') && !function_exists('crypt_random_string')) { +if (!function_exists('crypt_random_string')) { require_once('Crypt/Random.php'); } From 700d28f64296ae74542d5614e598dca6ecf9cc67 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 8 Apr 2013 01:04:52 -0500 Subject: [PATCH 2/2] RSA: apply terite's changes to RSA.php too --- phpseclib/Crypt/RSA.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index 51c3df10..a58ce3bc 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -83,7 +83,7 @@ if (!class_exists('Math_BigInteger')) { // will trigger a call to __autoload() if you're wanting to auto-load classes // call function_exists() a second time to stop the require_once from being called outside // of the auto loader -if (!function_exists('crypt_random_string') && !class_exists('Crypt_Random') && !function_exists('crypt_random_string')) { +if (!function_exists('crypt_random_string')) { require_once('Crypt/Random.php'); } @@ -2658,4 +2658,4 @@ class Crypt_RSA { return $this->_rsassa_pss_verify($message, $signature); } } -} \ No newline at end of file +}