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.

selftests/bpf: verify_pkcs7_sig: Use 'struct module_signature' from the UAPI headers

Now that the UAPI headers provide the required definitions, use those.
Some symbols have been renamed, adapt to those.

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
55722b3f e340db30

+3 -25
+3 -25
tools/testing/selftests/bpf/prog_tests/verify_pkcs7_sig.c
··· 18 18 #include <linux/keyctl.h> 19 19 #include <sys/xattr.h> 20 20 #include <linux/fsverity.h> 21 + #include <linux/module_signature.h> 21 22 #include <test_progs.h> 22 23 23 24 #include "test_verify_pkcs7_sig.skel.h" ··· 33 32 #ifndef SHA256_DIGEST_SIZE 34 33 #define SHA256_DIGEST_SIZE 32 35 34 #endif 36 - 37 - /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ 38 - #define MODULE_SIG_STRING "~Module signature appended~\n" 39 - 40 - /* 41 - * Module signature information block. 42 - * 43 - * The constituents of the signature section are, in order: 44 - * 45 - * - Signer's name 46 - * - Key identifier 47 - * - Signature data 48 - * - Information block 49 - */ 50 - struct module_signature { 51 - __u8 algo; /* Public-key crypto algorithm [0] */ 52 - __u8 hash; /* Digest algorithm [0] */ 53 - __u8 id_type; /* Key identifier type [PKEY_ID_PKCS7] */ 54 - __u8 signer_len; /* Length of signer's name [0] */ 55 - __u8 key_id_len; /* Length of key identifier [0] */ 56 - __u8 __pad[3]; 57 - __be32 sig_len; /* Length of signature data */ 58 - }; 59 35 60 36 struct data { 61 37 __u8 data[MAX_DATA_SIZE]; ··· 193 215 return 0; 194 216 195 217 modlen = st.st_size; 196 - marker_len = sizeof(MODULE_SIG_STRING) - 1; 218 + marker_len = sizeof(MODULE_SIGNATURE_MARKER) - 1; 197 219 198 220 fd = open(mod_path, O_RDONLY); 199 221 if (fd == -1) ··· 206 228 if (mod == MAP_FAILED) 207 229 return -errno; 208 230 209 - if (strncmp(mod + modlen - marker_len, MODULE_SIG_STRING, marker_len)) { 231 + if (strncmp(mod + modlen - marker_len, MODULE_SIGNATURE_MARKER, marker_len)) { 210 232 ret = -EINVAL; 211 233 goto out; 212 234 }