diff options
author | David Howells <dhowells@redhat.com> | 2012-10-22 10:05:48 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-12-04 19:57:24 -0500 |
commit | 12e130b04580532aa099893158aa2776b321ae7f (patch) | |
tree | b7a6ed562d7293aa1e5b584e109a9669db253f49 /kernel | |
parent | df2fc246c8ee8b6067af1fa55d3bc23107457f61 (diff) |
MODSIGN: Don't use enum-type bitfields in module signature info block
Don't use enum-type bitfields in the module signature info block as we can't be
certain how the compiler will handle them. As I understand it, it is arch
dependent, and it is possible for the compiler to rearrange them based on
endianness and to insert a byte of padding to pad the three enums out to four
bytes.
Instead use u8 fields for these, which the compiler should emit in the right
order without padding.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module_signing.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/module_signing.c b/kernel/module_signing.c index ea1b1df5dbb..f2970bddc5e 100644 --- a/kernel/module_signing.c +++ b/kernel/module_signing.c | |||
@@ -27,13 +27,13 @@ | |||
27 | * - Information block | 27 | * - Information block |
28 | */ | 28 | */ |
29 | struct module_signature { | 29 | struct module_signature { |
30 | enum pkey_algo algo : 8; /* Public-key crypto algorithm */ | 30 | u8 algo; /* Public-key crypto algorithm [enum pkey_algo] */ |
31 | enum pkey_hash_algo hash : 8; /* Digest algorithm */ | 31 | u8 hash; /* Digest algorithm [enum pkey_hash_algo] */ |
32 | enum pkey_id_type id_type : 8; /* Key identifier type */ | 32 | u8 id_type; /* Key identifier type [enum pkey_id_type] */ |
33 | u8 signer_len; /* Length of signer's name */ | 33 | u8 signer_len; /* Length of signer's name */ |
34 | u8 key_id_len; /* Length of key identifier */ | 34 | u8 key_id_len; /* Length of key identifier */ |
35 | u8 __pad[3]; | 35 | u8 __pad[3]; |
36 | __be32 sig_len; /* Length of signature data */ | 36 | __be32 sig_len; /* Length of signature data */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | /* | 39 | /* |