diff options
author | Daniel Axtens <dja@axtens.net> | 2021-03-23 08:58:21 +1100 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2021-03-31 14:39:16 +0530 |
commit | bc54b94fe145a23a503120c39da35274c951e71d (patch) | |
tree | 457229b42c61bb3e4608af070ba33d471cd6150d /libstb/secvar | |
parent | d51eb6f95e7078235ba2217e2dc9fc53e65bc902 (diff) | |
download | skiboot-bc54b94fe145a23a503120c39da35274c951e71d.zip skiboot-bc54b94fe145a23a503120c39da35274c951e71d.tar.gz skiboot-bc54b94fe145a23a503120c39da35274c951e71d.tar.bz2 |
secvar/backend/edk2.h: mark structs as __packed explicitly
The structes we import from EDK2 are expected to be packed.
The code we imported does this a #pragma pack, but it doesn't
restore the original non-packed state at the end of the header.
Rather than changing that, just explictly pack every structure.
The resulting skiboot.elf has the same disassembly (objdump -dr)
and readelf -a output, but I haven't been able to test this on
a real machine.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'libstb/secvar')
-rw-r--r-- | libstb/secvar/backend/edk2.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libstb/secvar/backend/edk2.h b/libstb/secvar/backend/edk2.h index 1ed9a11..c7b1999 100644 --- a/libstb/secvar/backend/edk2.h +++ b/libstb/secvar/backend/edk2.h @@ -42,6 +42,8 @@ #ifndef __EDK2_H__ #define __EDK2_H__ +#include <compiler.h> + #define UUID_SIZE 16 typedef struct { @@ -138,9 +140,8 @@ struct efi_time { /// /// The format of a signature database. /// -#pragma pack(1) -typedef struct { +typedef struct __packed { /// /// An identifier which identifies the agent which added the signature to the list. /// @@ -151,7 +152,7 @@ typedef struct { unsigned char SignatureData[0]; } EFI_SIGNATURE_DATA; -typedef struct { +typedef struct __packed { /// /// Type of the signature. GUID signature types are defined in below. /// @@ -204,7 +205,7 @@ struct win_certificate { * the certificate depends on wCertificateType. */ /// UINT8 bCertificate[ANYSIZE_ARRAY]; -}; +} __packed; /* * Certificate which encapsulates a GUID-specific digital signature @@ -226,7 +227,8 @@ struct win_certificate_uefi_guid { * EFI_CERT_BLOCK_RSA_2048_SHA256 structure. */ u8 cert_data[]; -}; +} __packed; + /* * When the attribute EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS is set, * then the Data buffer shall begin with an instance of a complete (and @@ -246,6 +248,6 @@ struct efi_variable_authentication_2 { * Only a CertType of EFI_CERT_TYPE_PKCS7_GUID is accepted. */ struct win_certificate_uefi_guid auth_info; -}; +} __packed; #endif |