public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice.
@ 2016-09-29 15:59 Peter Jones
  2016-09-29 16:33 ` Kinney, Michael D
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Jones @ 2016-09-29 15:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: Peter Jones

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-30  1:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox