]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod/libkmod-signature: remove kmod_signature_info::algo
authorEmil Velikov <emil.l.velikov@gmail.com>
Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)
committerLucas De Marchi <demarchi@kernel.org>
Wed, 22 Apr 2026 13:54:42 +0000 (08:54 -0500)
Allegedly it has been hard-coded to RSA for ages and thus, it was
never printed by modinfo.

Furthermore out of the 3 code-paths only a single one parses it...

Just drop the dead code adding a somewhat helpful comment for future
code explorers.

Thus shaves ~150 bytes off the binary and allows us to shrink the
struct.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
libkmod/libkmod-internal.h
libkmod/libkmod-signature.c

index 014b34ae9058512c9fec7e0e457dad07c64080c4..d1177102e72675301bd75d53e32ddde7a5f22ed2 100644 (file)
@@ -170,7 +170,7 @@ struct kmod_signature_info {
        size_t signer_len;
        const char *key_id;
        size_t key_id_len;
-       const char *algo, *hash_algo, *id_type;
+       const char *hash_algo, *id_type;
        const char *sig;
        size_t sig_len;
        void (*free)(void *);
index c3d43b21b7c7c7e1d63e94c903e62a82036ad8c9..e50c1681cb288cf55a5eb530eda553794a77c328 100644 (file)
@@ -28,11 +28,6 @@ enum pkey_algo {
        PKEY_ALGO__LAST,
 };
 
-static const char *const pkey_algo[PKEY_ALGO__LAST] = {
-       [PKEY_ALGO_DSA] = "DSA",
-       [PKEY_ALGO_RSA] = "RSA",
-};
-
 enum pkey_hash_algo {
        PKEY_HASH_MD4,
        PKEY_HASH_MD5,
@@ -102,7 +97,6 @@ static bool fill_default(const char *mem, off_t size,
        sig_info->signer = mem + size;
        sig_info->signer_len = modsig->signer_len;
 
-       sig_info->algo = pkey_algo[modsig->algo];
        sig_info->hash_algo = pkey_hash_algo[modsig->hash];
 
        return true;
@@ -323,6 +317,9 @@ bool kmod_module_signature_info(const struct kmod_file *file,
                return false;
        size -= sizeof(struct module_signature);
        memcpy(&modsig, mem + size, sizeof(struct module_signature));
+       /* The algo value seems to be hard-coded to PKEY_ALGO_RSA, so we don't bother
+        * parsing and/or printing it.
+        */
        if (modsig.algo >= PKEY_ALGO__LAST || modsig.hash >= PKEY_HASH__LAST ||
            modsig.id_type >= PKEY_ID_TYPE__LAST)
                return false;