Commit 0fa0ed31 authored by Franco Fichtner's avatar Franco Fichtner

openvpn: add fallback chain for openssl

parent 78dfd81e
...@@ -212,9 +212,21 @@ function openvpn_get_digestlist() { ...@@ -212,9 +212,21 @@ function openvpn_get_digestlist() {
return $digests; return $digests;
} }
function openvpn_get_engines() { function openvpn_get_engines()
{
if (file_exists('/usr/local/bin/openssl')) {
/* use the ports version */
$bin_openssl = '/usr/local/bin/openssl';
} elseif (file_exists('/usr/bin/openssl')) {
/* use the base version (legacy fallback) */
$bin_openssl = '/usr/bin/openssl';
} else {
/* the infamous "this should never happen" */
log_error(_('Could not find an OpenSSL implementation on your system.'));
}
$openssl_engines = array('none' => 'No Hardware Crypto Acceleration'); $openssl_engines = array('none' => 'No Hardware Crypto Acceleration');
exec("/usr/bin/openssl engine -t -c", $openssl_engine_output); exec($bin_openssl . ' engine -t -c', $openssl_engine_output);
$openssl_engine_output = implode("\n", $openssl_engine_output); $openssl_engine_output = implode("\n", $openssl_engine_output);
$openssl_engine_output = preg_replace("/\\n\\s+/", "|", $openssl_engine_output); $openssl_engine_output = preg_replace("/\\n\\s+/", "|", $openssl_engine_output);
$openssl_engine_output = explode("\n", $openssl_engine_output); $openssl_engine_output = explode("\n", $openssl_engine_output);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment