From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: Peter Jones <pjones@redhat.com>,
"edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>,
"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice.
Date: Thu, 29 Sep 2016 16:33:07 +0000 [thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F56481DC1E@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <20160929155911.9838-1-pjones@redhat.com>
Hi Peter,
If the protocol is already installed, you want to return an error
so the PE/COFF image for the driver will be unloaded. Following the
example from Section 7.8 of UEFI Driver Writer's Guide an error code
of EFI_ABORTED can be used for this case.
Status = gBS->LocateProtocol (&gEfiPkcs7VerifyProtocolGuid, NULL, (VOID **)&Useless);
if (!EFI_ERROR (Status)) {
return EFI_ABORTED;
}
Best regards,
Mike
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Peter Jones
> Sent: Thursday, September 29, 2016 8:59 AM
> To: edk2-devel@ml01.01.org
> Cc: Peter Jones <pjones@redhat.com>
> Subject: [edk2] [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols
> twice.
>
> This patch makes Pkcs7VerifyDxe check that it has not already been
> installed before installing its protocols. This prevents the case where
> loading it as an external driver (either manually, through Driver####
> variables, etc.) will refuse to add a second provider of the API.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Peter Jones <pjones@redhat.com>
> ---
> SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> index 07fdf55..3389af4 100644
> --- a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> +++ b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> @@ -1030,8 +1030,16 @@ Pkcs7VerifyDriverEntry (
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> - EFI_STATUS Status;
> - EFI_HANDLE Handle;
> + EFI_STATUS Status;
> + EFI_HANDLE Handle;
> + EFI_PKCS7_VERIFY_PROTOCOL Useless;
> +
> + //
> + // Avoid loading a second copy if this is built as an external module.
> + //
> + Status = gBS->LocateProtocol (&gEfiPkcs7VerifyProtocolGuid, NULL, (VOID **)
> &Useless);
> + if (Status != EFI_NOT_FOUND)
> + return EFI_SUCCESS;>
> //
> // Install UEFI Pkcs7 Verification Protocol
> --
> 2.10.0
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2016-09-29 16:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 15:59 [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice Peter Jones
2016-09-29 16:33 ` Kinney, Michael D [this message]
2016-09-29 17:45 ` Peter Jones
2016-09-29 18:38 ` Kinney, Michael D
2016-09-29 18:39 ` Peter Jones
2016-09-29 18:45 ` Peter Jones
2016-09-29 18:48 ` Kinney, Michael D
2016-09-30 1:06 ` Long, Qin
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-list 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=E92EE9817A31E24EB0585FDF735412F56481DC1E@ORSMSX113.amr.corp.intel.com \
--to=devel@edk2.groups.io \
/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