mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Show if a CPU has AES-NI/CPU crypto support even if the module isn't loaded. Implements #7529
This commit is contained in:
parent
47d4784602
commit
a84e59a270
@ -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');
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user