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.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -0,0 +1,41 @@ | ||
| 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 */ | |