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.

sign-file: 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.

Also adapt the include path for the custom sign-file rule in the
bpf selftests.

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
e340db30 d2d7561d

+6 -15
+1
scripts/Makefile
··· 35 35 HOSTLDLIBS_sorttable = -lpthread 36 36 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include 37 37 HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null) 38 + HOSTCFLAGS_sign-file.o += -I$(srctree)/tools/include/uapi/ 38 39 HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) 39 40 40 41 ifdef CONFIG_UNWINDER_ORC
+4 -15
scripts/sign-file.c
··· 40 40 #endif 41 41 #include "ssl-common.h" 42 42 43 - struct module_signature { 44 - uint8_t algo; /* Public-key crypto algorithm [0] */ 45 - uint8_t hash; /* Digest algorithm [0] */ 46 - uint8_t id_type; /* Key identifier type [PKEY_ID_PKCS7] */ 47 - uint8_t signer_len; /* Length of signer's name [0] */ 48 - uint8_t key_id_len; /* Length of key identifier [0] */ 49 - uint8_t __pad[3]; 50 - uint32_t sig_len; /* Length of signature data */ 51 - }; 52 - 53 - #define PKEY_ID_PKCS7 2 54 - 55 - static char magic_number[] = "~Module signature appended~\n"; 43 + #include <linux/module_signature.h> 56 44 57 45 static __attribute__((noreturn)) 58 46 void format(void) ··· 185 197 186 198 int main(int argc, char **argv) 187 199 { 188 - struct module_signature sig_info = { .id_type = PKEY_ID_PKCS7 }; 200 + struct module_signature sig_info = { .id_type = MODULE_SIGNATURE_TYPE_PKCS7 }; 189 201 char *hash_algo = NULL; 190 202 char *private_key_name = NULL, *raw_sig_name = NULL; 191 203 char *x509_name, *module_name, *dest_name; ··· 345 357 sig_size = BIO_number_written(bd) - module_size; 346 358 sig_info.sig_len = htonl(sig_size); 347 359 ERR(BIO_write(bd, &sig_info, sizeof(sig_info)) < 0, "%s", dest_name); 348 - ERR(BIO_write(bd, magic_number, sizeof(magic_number) - 1) < 0, "%s", dest_name); 360 + ERR(BIO_write(bd, MODULE_SIGNATURE_MARKER, sizeof(MODULE_SIGNATURE_MARKER) - 1) < 0, 361 + "%s", dest_name); 349 362 350 363 ERR(BIO_free(bd) != 1, "%s", dest_name); 351 364
+1
tools/testing/selftests/bpf/Makefile
··· 274 274 $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c 275 275 $(call msg,SIGN-FILE,,$@) 276 276 $(Q)$(CC) $(shell $(PKG_CONFIG) --cflags libcrypto 2> /dev/null) \ 277 + -I$(srctree)/tools/include/uapi/ \ 277 278 $< -o $@ \ 278 279 $(shell $(PKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) 279 280