From a84e59a27094e3ccc4f13b596ff1bb80e3ae267a Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 12 May 2017 13:42:33 -0400 Subject: [PATCH] Show if a CPU has AES-NI/CPU crypto support even if the module isn't loaded. Implements #7529 --- src/usr/local/www/includes/functions.inc.php | 33 +++++++++++++++++++ .../widgets/system_information.widget.php | 3 ++ 2 files changed, 36 insertions(+) diff --git a/src/usr/local/www/includes/functions.inc.php b/src/usr/local/www/includes/functions.inc.php index 91b0a13fb0..de4d95e6fa 100644 --- a/src/usr/local/www/includes/functions.inc.php +++ b/src/usr/local/www/includes/functions.inc.php @@ -239,6 +239,39 @@ function get_cpufreq() { return $out; } +function get_cpu_crypto_support() { + $machine = get_single_sysctl('hw.machine'); + $accelerated_arm_platforms = array('am335x'); + $cpucrypto_type = ""; + + switch ($machine) { + case 'amd64': + $cpucrypto_type = "AES-NI CPU Crypto: "; + exec("/usr/bin/grep -c ' Features.*AESNI' /var/log/dmesg.boot", $cpucrypto_present); + if ($cpucrypto_present[0] > 0) { + $cpucrypto_type .= "Yes "; + $cpucrypto_type .= ($cpucrypto_active) ? "(active)" : "(inactive)"; + } else { + $cpucrypto_type .= "No"; + } + $cpucrypto_active = is_module_loaded('aesni'); + case 'arm': + $armplatform = get_single_sysctl('hw.platform'); + if (in_array($armplatform, $accelerated_arm_platforms)) { + /* No drivers yet, so mark inactive! */ + $cpucrypto_type = "{$armplatform} built-in CPU Crypto (inactive)"; + } + default: + /* Unknown/unidentified platform */ + } + + if (!empty($cpucrypto_type)) { + return $cpucrypto_type; + } else { + return "CPU Crypto: None/Unknown Platform"; + } +} + function get_cpu_count($show_detail = false) { $cpucount = get_single_sysctl('kern.smp.cpus'); diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php index 1fbdd58688..838ee72b87 100644 --- a/src/usr/local/www/widgets/widgets/system_information.widget.php +++ b/src/usr/local/www/widgets/widgets/system_information.widget.php @@ -232,6 +232,9 @@ $rows_displayed = false; : +
+ +