summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-05-12 13:42:33 -0400
committerjim-p <jimp@pfsense.org>2017-05-12 13:42:33 -0400
commita84e59a27094e3ccc4f13b596ff1bb80e3ae267a (patch)
tree33755e810d14ef10c7354006f16b552730fadfa0 /src
parent47d4784602466d723a84bb1af6d313c4ba5a0115 (diff)
downloadpfsense-a84e59a27094e3ccc4f13b596ff1bb80e3ae267a.zip
pfsense-a84e59a27094e3ccc4f13b596ff1bb80e3ae267a.tar.gz
Show if a CPU has AES-NI/CPU crypto support even if the module isn't loaded. Implements #7529
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/includes/functions.inc.php33
-rw-r--r--src/usr/local/www/widgets/widgets/system_information.widget.php3
2 files changed, 36 insertions, 0 deletions
diff --git a/src/usr/local/www/includes/functions.inc.php b/src/usr/local/www/includes/functions.inc.php
index 91b0a13..de4d95e 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 1fbdd58..838ee72 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;
<?= htmlspecialchars($cpucount) ?> <?=gettext('CPUs')?>: <?= htmlspecialchars(get_cpu_count(true)); ?>
</div>
<?php endif; ?>
+ <div id="cpucrypto">
+ <?= get_cpu_crypto_support(); ?>
+ </div>
</td>
</tr>
<?php
OpenPOWER on IntegriCloud