module: Give 'enum pkey_id_type' a more specific name

This enum originates in generic cryptographic code and has a very
generic name. Nowadays it is only used for module signatures.

As this enum is going to be exposed in a UAPI header, give it a more
specific name for clarity and consistency.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Thomas Weißschuh
2026-03-05 10:31:39 +01:00
committed by Sami Tolvanen
parent 8988913aac
commit acd87264af
3 changed files with 5 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len)
return -EKEYREJECTED; return -EKEYREJECTED;
kernel_len -= sig_len; kernel_len -= sig_len;
if (ms->id_type != PKEY_ID_PKCS7) if (ms->id_type != MODULE_SIGNATURE_TYPE_PKCS7)
return -EKEYREJECTED; return -EKEYREJECTED;
if (ms->algo != 0 || if (ms->algo != 0 ||

View File

@@ -14,8 +14,8 @@
/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
#define MODULE_SIG_STRING "~Module signature appended~\n" #define MODULE_SIG_STRING "~Module signature appended~\n"
enum pkey_id_type { enum module_signature_type {
PKEY_ID_PKCS7 = 2, /* Signature in PKCS#7 message */ MODULE_SIGNATURE_TYPE_PKCS7 = 2, /* Signature in PKCS#7 message */
}; };
/* /*
@@ -31,7 +31,7 @@ enum pkey_id_type {
struct module_signature { struct module_signature {
u8 algo; /* Public-key crypto algorithm [0] */ u8 algo; /* Public-key crypto algorithm [0] */
u8 hash; /* Digest algorithm [0] */ u8 hash; /* Digest algorithm [0] */
u8 id_type; /* Key identifier type [PKEY_ID_PKCS7] */ u8 id_type; /* Key identifier type [enum module_signature_type] */
u8 signer_len; /* Length of signer's name [0] */ u8 signer_len; /* Length of signer's name [0] */
u8 key_id_len; /* Length of key identifier [0] */ u8 key_id_len; /* Length of key identifier [0] */
u8 __pad[3]; u8 __pad[3];

View File

@@ -24,7 +24,7 @@ int mod_check_sig(const struct module_signature *ms, size_t file_len,
if (be32_to_cpu(ms->sig_len) >= file_len - sizeof(*ms)) if (be32_to_cpu(ms->sig_len) >= file_len - sizeof(*ms))
return -EBADMSG; return -EBADMSG;
if (ms->id_type != PKEY_ID_PKCS7) { if (ms->id_type != MODULE_SIGNATURE_TYPE_PKCS7) {
pr_err("%s: not signed with expected PKCS#7 message\n", pr_err("%s: not signed with expected PKCS#7 message\n",
name); name);
return -ENOPKG; return -ENOPKG;