Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

module: Move 'struct module_signature' to UAPI

This structure definition is used outside the kernel proper.
For example in kmod and the kernel build environment.

To allow reuse, move it to a new UAPI header.

While it is not a true UAPI, it is a common practice to have
non-UAPI interface definitions in the kernel's UAPI headers.

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>

authored by

Thomas Weißschuh and committed by
Sami Tolvanen
f9909cf0 2ae4ea2d

+42 -27
+1 -27
include/linux/module_signature.h
··· 10 10 #define _LINUX_MODULE_SIGNATURE_H 11 11 12 12 #include <linux/types.h> 13 - 14 - /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ 15 - #define MODULE_SIGNATURE_MARKER "~Module signature appended~\n" 16 - 17 - enum module_signature_type { 18 - MODULE_SIGNATURE_TYPE_PKCS7 = 2, /* Signature in PKCS#7 message */ 19 - }; 20 - 21 - /* 22 - * Module signature information block. 23 - * 24 - * The constituents of the signature section are, in order: 25 - * 26 - * - Signer's name 27 - * - Key identifier 28 - * - Signature data 29 - * - Information block 30 - */ 31 - struct module_signature { 32 - u8 algo; /* Public-key crypto algorithm [0] */ 33 - u8 hash; /* Digest algorithm [0] */ 34 - u8 id_type; /* Key identifier type [enum module_signature_type] */ 35 - u8 signer_len; /* Length of signer's name [0] */ 36 - u8 key_id_len; /* Length of key identifier [0] */ 37 - u8 __pad[3]; 38 - __be32 sig_len; /* Length of signature data */ 39 - }; 13 + #include <uapi/linux/module_signature.h> 40 14 41 15 int mod_check_sig(const struct module_signature *ms, size_t file_len, 42 16 const char *name);
+41
include/uapi/linux/module_signature.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 + /* 3 + * Module signature handling. 4 + * 5 + * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. 6 + * Written by David Howells (dhowells@redhat.com) 7 + */ 8 + 9 + #ifndef _UAPI_LINUX_MODULE_SIGNATURE_H 10 + #define _UAPI_LINUX_MODULE_SIGNATURE_H 11 + 12 + #include <linux/types.h> 13 + 14 + /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ 15 + #define MODULE_SIGNATURE_MARKER "~Module signature appended~\n" 16 + 17 + enum module_signature_type { 18 + MODULE_SIGNATURE_TYPE_PKCS7 = 2, /* Signature in PKCS#7 message */ 19 + }; 20 + 21 + /* 22 + * Module signature information block. 23 + * 24 + * The constituents of the signature section are, in order: 25 + * 26 + * - Signer's name 27 + * - Key identifier 28 + * - Signature data 29 + * - Information block 30 + */ 31 + struct module_signature { 32 + __u8 algo; /* Public-key crypto algorithm [0] */ 33 + __u8 hash; /* Digest algorithm [0] */ 34 + __u8 id_type; /* Key identifier type [enum module_signature_type] */ 35 + __u8 signer_len; /* Length of signer's name [0] */ 36 + __u8 key_id_len; /* Length of key identifier [0] */ 37 + __u8 __pad[3]; 38 + __be32 sig_len; /* Length of signature data */ 39 + }; 40 + 41 + #endif /* _UAPI_LINUX_MODULE_SIGNATURE_H */