Project

General

Profile

Actions

Bug #14417

closed

System Information widget does not properly form list of active hardware crypto algorithms

Added by Patrik Stahlman 12 months ago. Updated 7 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Dashboard
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.09
Release Notes:
Default
Affected Version:
Affected Architecture:
All

Description

The System Information widget fails to display support for crypto algorithms if the algorithm is available both in the CPU and the new IIMB.

With IPsec-MB crypto disabled the information is correct:

AES-NI CPU Crypto: Yes (active)
IPsec-MB Crypto: Yes (inactive)
QAT Crypto: No
Hardware crypto     AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS

When IPSec-MB is enabled, AES-GCM is not shown:

AES-NI CPU Crypto: Yes (active)
IPsec-MB Crypto: Yes (active)
QAT Crypto: No
Hardware crypto     AES-CBC,AES-CCM,ChaCha20-Poly1305,AES-ICM,AES-XTS

The problems seems to be in /usr/local/www/includes/functions.inc.php, function crypto_accel_get_algs() where the code to handle duplicates in the arrays is broken.

I simplified the function:

function crypto_accel_get_algs($crypto)
{
        $algs = [];

        foreach ($crypto['accel'] as $accel) {
                /* skip these... */
                if (!$accel['present'] || !$accel['enabled'])
                        continue;

                $algs = array_merge($algs, $accel['algs']);
        }

        /* return early */
        if (empty($algs))
                return (gettext('Inactive'));

        /* sort alphabetically */
        ksort($algs);

        /* now flip back so keys become values, done twice to remove duplicates */
        $algs = array_flip($algs);
        $algs = array_flip($algs);

        /* format and return the algs string */
        return (implode(',', $algs));
}

and the system information widget now outputs the correct information:


AES-NI CPU Crypto: Yes (active)
IPsec-MB Crypto: Yes (active)
QAT Crypto: No
Hardware crypto     AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,ChaCha20-Poly1305

Sorry but no patch, I forgot to make a backup before editing the file...


Files

Actions

Also available in: Atom PDF