From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/16] include: pe.h: add signature-related definitions
Date: Mon, 18 Nov 2019 15:53:48 +0900 [thread overview]
Message-ID: <20191118065347.GR22427@linaro.org> (raw)
In-Reply-To: <a0b62a75-32a0-69f8-5ad0-ac005a8e62f0@gmx.de>
On Mon, Nov 18, 2019 at 07:26:55AM +0100, Heinrich Schuchardt wrote:
> On 11/18/19 6:44 AM, AKASHI Takahiro wrote:
> >Heinrich,
> >
> >On Sat, Nov 16, 2019 at 06:42:11PM +0100, Heinrich Schuchardt wrote:
> >>On 11/13/19 1:52 AM, AKASHI Takahiro wrote:
> >>>The index (IMAGE_DIRECTORY_ENTRY_CERTTABLE) in a table points to
> >>>a region containing authentication information (image's signature)
> >>>in PE format.
> >>>
> >>>WIN_CERTIFICATE structure defines an embedded signature format.
> >>>
> >>>Those definitions will be used in my UEFI secure boot patch.
> >>>
> >>>Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >>>---
> >>> include/pe.h | 16 ++++++++++++++++
> >>> 1 file changed, 16 insertions(+)
> >>>
> >>>diff --git a/include/pe.h b/include/pe.h
> >>>index bff3b0aa7a6c..650478ca78af 100644
> >>>--- a/include/pe.h
> >>>+++ b/include/pe.h
> >>>@@ -155,6 +155,7 @@ typedef struct _IMAGE_SECTION_HEADER {
> >>> uint32_t Characteristics;
> >>> } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
> >>>
> >>
> >>Please, add a comment here:
> >>
> >>/* Indices for Optional Header Data Directories */
> >
> >Okay.
> >
> >>>+#define IMAGE_DIRECTORY_ENTRY_CERTTABLE 4
> >>
> >>Yes, 4 is the index of the certificate table. But EDK II calls this
> >>EFI_IMAGE_DIRECTORY_ENTRY_SECURITY. Should we use the same name to avoid
> >>confusion?
> >
> >No. Because the naming is consistent with
> >
> >>> #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
> >
> >this existing one.
>
> IMAGE_DIRECTORY_ENTRY_BASERELOC is a constant name used by EDK2 in
> MdePkg/Include/IndustryStandard/PeImage.h. Why do you want to deviate
> for EFI_IMAGE_DIRECTORY_ENTRY_SECURITY?
Okay, but not due to EDK2, but because Windows uses it:
https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-imagedirectoryentrytodata
> >
> >>>
> >>> typedef struct _IMAGE_BASE_RELOCATION
> >>>@@ -252,4 +253,19 @@ typedef struct _IMAGE_RELOCATION
> >>> #define IMAGE_REL_AMD64_PAIR 0x000F
> >>> #define IMAGE_REL_AMD64_SSPAN32 0x0010
> >>>
> >>>+/* certificate appended to PE image */
> >>>+typedef struct _WIN_CERTIFICATE {
> >>
> >>We do not capitalize structs. Please use 'win_certificate' (like Linux
> >>does).
> >>
> >>>+ uint32_t dwLength;
> >>>+ uint16_t wRevision;
> >>>+ uint16_t wCertificateType;
> >>>+ uint8_t bCertificate[];
> >>
> >>We do not use camelcase and type prefixes. Please, use the same
> >>component names as Linux (plus 'certificate' for your extra field).
> >
> >nak.
> >Have you looked at 'pe.h' at all?
> >There are already bunch of use of camelcase's and capital names
> >since this file was first introduced by Alex.
>
> This shouldn't have happened in the first place.
For consistency, we should keep the style in the *existing* files.
-Takahiro Akashi
> Best regards
>
> Heinrich
>
> >
> >>>+} WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
> >>
> >>Please, always make use of scripts/checkpatch.pl before submitting
> >>patches. It says 'WARNING: do not add new typedefs'.
> >
> >ditto.
> >I have run scripts/cehckpatch.pl and dare to leave them unchanged.
> >
> >>Please, avoid the typedefs.
> >
> >No. this is also consistent with other typedef's.
> >
> >
> >>>+
> >>
> >>The following defines are verbatim copies from Linux. Please, also copy
> >>the comment:
> >>
> >>/* Definitions for the contents of the certs data block */
> >
> >Okay.
> >
> >>>+#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
> >>>+#define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0
> >>>+#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
> >>>+
> >>>+#define WIN_CERT_REVISION_1_0 0x0100
> >>>+#define WIN_CERT_REVISION_2_0 0x0200
> >>>+
> >>> #endif /* _PE_H */
> >>>
> >>
> >>Except for the style issues this looks ok.
> >
> >Thank you for your comments.
> >-Takahiro Akashi
> >
> >>Best regards
> >>
> >>Heinrich
> >>
> >
>
next prev parent reply other threads:[~2019-11-18 6:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 0:52 [U-Boot] [PATCH 00/16] efi_loader: add secure boot support AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 01/16] include: pe.h: add signature-related definitions AKASHI Takahiro
2019-11-16 17:42 ` Heinrich Schuchardt
2019-11-18 5:44 ` AKASHI Takahiro
2019-11-18 6:26 ` Heinrich Schuchardt
2019-11-18 6:53 ` AKASHI Takahiro [this message]
2019-11-13 0:52 ` [U-Boot] [PATCH 02/16] include: image.h: export hash algorithm helper functions AKASHI Takahiro
2019-11-16 17:59 ` Heinrich Schuchardt
2019-11-18 6:22 ` AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 03/16] secure boot: rename CONFIG_SECURE_BOOT config option AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 04/16] efi_loader: add CONFIG_EFI_SECURE_BOOT " AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 05/16] efi_loader: add signature verification functions AKASHI Takahiro
2019-11-16 20:00 ` Heinrich Schuchardt
2019-11-18 7:57 ` AKASHI Takahiro
2019-11-18 8:31 ` AKASHI Takahiro
2019-11-19 5:22 ` AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 06/16] efi_loader: add signature database parser AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 07/16] efi_loader: variable: support variable authentication AKASHI Takahiro
2019-11-16 20:02 ` Heinrich Schuchardt
2019-11-18 7:08 ` AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 08/16] efi_loader: variable: add secure boot state transition AKASHI Takahiro
2019-11-13 0:52 ` [U-Boot] [PATCH 09/16] efi_loader: variable: add VendorKeys variable AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 10/16] efi_loader: image_loader: support image authentication AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 11/16] efi_loader: set up secure boot AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 12/16] cmd: env: use appropriate guid for authenticated UEFI variable AKASHI Takahiro
2019-11-16 20:10 ` Heinrich Schuchardt
2019-11-18 6:34 ` AKASHI Takahiro
2019-11-18 6:56 ` Patrick Wildt
2019-11-13 0:53 ` [U-Boot] [PATCH 13/16] cmd: env: add "-at" option to "env set -e" command AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 14/16] efi_loader, pytest: set up secure boot environment AKASHI Takahiro
2019-11-16 20:19 ` Heinrich Schuchardt
2019-11-18 5:52 ` AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 15/16] efi_loader, pytest: add UEFI secure boot tests (authenticated variables) AKASHI Takahiro
2019-11-16 20:28 ` Heinrich Schuchardt
2019-11-18 5:58 ` AKASHI Takahiro
2019-11-20 2:17 ` AKASHI Takahiro
2019-11-13 0:53 ` [U-Boot] [PATCH 16/16] efi_loader, pytest: add UEFI secure boot tests (image) AKASHI Takahiro
2019-11-16 20:31 ` Heinrich Schuchardt
2019-11-18 6:00 ` AKASHI Takahiro
2019-11-15 2:19 ` [U-Boot] [PATCH 00/16] efi_loader: add secure boot support AKASHI Takahiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191118065347.GR22427@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox