From patchwork Tue Apr 21 00:37:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 238147 List-Id: U-Boot discussion From: takahiro.akashi at linaro.org (AKASHI Takahiro) Date: Tue, 21 Apr 2020 09:37:52 +0900 Subject: [PATCH] lib/crypto, efi_loader: avoid multiple inclusions of header files Message-ID: <20200421003752.16009-1-takahiro.akashi@linaro.org> By adding extra symbols, we can now avoid including x509_parser and pkcs7_parser.h files multiple times. Signed-off-by: AKASHI Takahiro Suggested-by: Heinrich Schuchardt --- lib/crypto/pkcs7_parser.h | 4 ++++ lib/crypto/x509_parser.h | 4 ++++ lib/efi_loader/efi_image_loader.c | 1 + lib/efi_loader/efi_signature.c | 1 + 4 files changed, 10 insertions(+) diff --git a/lib/crypto/pkcs7_parser.h b/lib/crypto/pkcs7_parser.h index 6565fdc2d4ca..b8234da45a6a 100644 --- a/lib/crypto/pkcs7_parser.h +++ b/lib/crypto/pkcs7_parser.h @@ -5,6 +5,9 @@ * Written by David Howells (dhowells at redhat.com) */ +#ifndef _PKCS7_PARSER_H +#define _PKCS7_PARSER_H + #include #include #include "x509_parser.h" @@ -63,3 +66,4 @@ struct pkcs7_message { size_t data_hdrlen; /* Length of Data ASN.1 header */ const void *data; /* Content Data (or 0) */ }; +#endif /* _PKCS7_PARSER_H */ diff --git a/lib/crypto/x509_parser.h b/lib/crypto/x509_parser.h index c233f136fb35..4cbdc1d6612d 100644 --- a/lib/crypto/x509_parser.h +++ b/lib/crypto/x509_parser.h @@ -5,6 +5,9 @@ * Written by David Howells (dhowells at redhat.com) */ +#ifndef _X509_PARSER_H +#define _X509_PARSER_H + #include #include #include @@ -55,3 +58,4 @@ extern int x509_decode_time(time64_t *_t, size_t hdrlen, */ extern int x509_get_sig_params(struct x509_certificate *cert); extern int x509_check_for_self_signed(struct x509_certificate *cert); +#endif /* _X509_PARSER_H */ diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 6c270ce94f44..899adf8493d0 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -14,6 +14,7 @@ #include #include #include "../lib/crypto/pkcs7_parser.h" +#include "../lib/crypto/x509_parser.h" const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID; const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID; diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index 658e3547da37..6ad09e4acbd7 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -15,6 +15,7 @@ #include #include #include "../lib/crypto/pkcs7_parser.h" +#include "../lib/crypto/x509_parser.h" const efi_guid_t efi_guid_image_security_database = EFI_IMAGE_SECURITY_DATABASE_GUID;