diff options
author | Peter Jones <pjones@redhat.com> | 2017-08-01 10:59:00 +0800 |
---|---|---|
committer | Long Qin <qin.long@intel.com> | 2017-09-05 15:55:42 +0800 |
commit | 56e88e9e5f980e30f28d907e0ff442e4dc8dc5de (patch) | |
tree | 6b45fb3e81541b0a7d69d4d63d4482e1d4695181 /SecurityPkg/Pkcs7Verify | |
parent | a2481f81b357c892c8eda725836f255cf4f72879 (diff) | |
download | edk2-56e88e9e5f980e30f28d907e0ff442e4dc8dc5de.tar.gz edk2-56e88e9e5f980e30f28d907e0ff442e4dc8dc5de.tar.bz2 edk2-56e88e9e5f980e30f28d907e0ff442e4dc8dc5de.zip |
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.1
Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Diffstat (limited to 'SecurityPkg/Pkcs7Verify')
-rw-r--r-- | SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c index d9013212c1..0da549a6bd 100644 --- a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c +++ b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c @@ -1457,8 +1457,17 @@ 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 (!EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
//
// Install UEFI Pkcs7 Verification Protocol
|