TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeCryptLib.c
Go to the documentation of this file.
1
9#include <PiDxe.h>
10#include <Library/BaseLib.h>
11#include <Library/DebugLib.h>
13#include <Protocol/Crypto.h>
14
15EDKII_CRYPTO_PROTOCOL *mCryptoProtocol = NULL;
16
27VOID *
29 VOID
30 )
31{
32 return (VOID *)mCryptoProtocol;
33}
34
45EFIAPI
47 IN EFI_HANDLE ImageHandle,
48 IN EFI_SYSTEM_TABLE *SystemTable
49 )
50{
51 EFI_STATUS Status;
52 UINTN Version;
53
54 Status = gBS->LocateProtocol (
55 &gEdkiiCryptoProtocolGuid,
56 NULL,
57 (VOID **)&mCryptoProtocol
58 );
59
60 if (EFI_ERROR (Status) || (mCryptoProtocol == NULL)) {
61 DEBUG ((DEBUG_ERROR, "[DxeCryptLib] Failed to locate Crypto Protocol. Status = %r\n", Status));
62 ASSERT_EFI_ERROR (Status);
63 ASSERT (mCryptoProtocol != NULL);
64 mCryptoProtocol = NULL;
65 return EFI_NOT_FOUND;
66 }
67
68 Version = mCryptoProtocol->GetVersion ();
69 if (Version < EDKII_CRYPTO_VERSION) {
70 DEBUG ((DEBUG_ERROR, "[DxeCryptLib] Crypto Protocol unsupported version %d\n", Version));
71 ASSERT (Version >= EDKII_CRYPTO_VERSION);
72 mCryptoProtocol = NULL;
73 return EFI_NOT_FOUND;
74 }
75
76 return EFI_SUCCESS;
77}
UINT64 UINTN
EFI_STATUS EFIAPI DxeCryptLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: DxeCryptLib.c:46
VOID * GetCryptoServices(VOID)
Definition: DxeCryptLib.c:28
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define EDKII_CRYPTO_VERSION
Definition: Crypto.h:24
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EDKII_CRYPTO_GET_VERSION GetVersion
Version.
Definition: Crypto.h:5432