Correctly report OpenSSL errors from cookie encryption
Without calling openssl_error_string() we pollute openssl global state and some other library might report this as failure (eg. mysqlnd driver when connecting to SSL enabled server). Fixes #12293 Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
b866371b9a
commit
03bc52f6dc
@ -23,6 +23,7 @@ phpMyAdmin - ChangeLog
|
||||
- issue #11816 Fixed operation with lower_case_table_names=2
|
||||
- issue #12813 Fixed stored procedure execution
|
||||
- issue #12826 Honor user configured connection collation
|
||||
- issue #12293 Correctly report OpenSSL errors from cookie encryption
|
||||
|
||||
4.6.5.2 (2016-12-05)
|
||||
- issue #12765 Fixed SQL export with newlines
|
||||
|
||||
@ -717,6 +717,18 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports any SSL errors
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reportSSLErrors()
|
||||
{
|
||||
while (($ssl_err = openssl_error_string()) !== false) {
|
||||
trigger_error('OpenSSL error: ' . $ssl_err, E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encryption using openssl's AES or phpseclib's AES
|
||||
* (phpseclib uses mcrypt when it is available)
|
||||
@ -739,6 +751,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
0,
|
||||
$iv
|
||||
);
|
||||
$this->reportSSLErrors();
|
||||
} else {
|
||||
$cipher = new Crypt\AES(Crypt\Base::MODE_CBC);
|
||||
$cipher->setIV($iv);
|
||||
@ -783,13 +796,15 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
}
|
||||
|
||||
if ($this->_use_openssl) {
|
||||
return openssl_decrypt(
|
||||
$result = openssl_decrypt(
|
||||
$data['payload'],
|
||||
'AES-128-CBC',
|
||||
$secret,
|
||||
0,
|
||||
base64_decode($data['iv'])
|
||||
);
|
||||
$this->reportSSLErrors();
|
||||
return $result;
|
||||
} else {
|
||||
$cipher = new Crypt\AES(Crypt\Base::MODE_CBC);
|
||||
$cipher->setIV(base64_decode($data['iv']));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user