aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Lindholm <leif.lindholm@linaro.org>2016-12-06 17:30:57 +0000
committerLeif Lindholm <leif.lindholm@linaro.org>2016-12-06 17:30:57 +0000
commitdffc5926a0a5c9d5e3310da341ac51f05eef7d25 (patch)
tree0f7a2c4202bc6cc1148dcf129cc8a283409ebade
parent5f90b6ec349e50d65b45f2863386867a77deef9b (diff)
downloadOpenPlatformPkg-chaos.tar.gz
add stuffchaos
-rw-r--r--Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.c33
-rw-r--r--Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.h2
-rw-r--r--Drivers/Usb/Misc/ChaosKeyDxe/DriverBinding.c8
3 files changed, 39 insertions, 4 deletions
diff --git a/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.c b/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.c
index 1da1c30..c5c402d 100644
--- a/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.c
+++ b/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.c
@@ -16,6 +16,7 @@
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/Rng.h>
#include <Protocol/UsbIo.h>
#include "ChaosKeyDriver.h"
@@ -182,6 +183,18 @@ GetInfo (
OUT EFI_RNG_ALGORITHM *RNGAlgorithmList
)
{
+ UINTN Size;
+ Size = sizeof (AlgorithmList);
+
+ if (*RNGAlgorithmListSize < Size) {
+ *RNGAlgorithmListSize = Size;
+
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ gBS->CopyMem (RNGAlgorithmList, AlgorithmList, Size);
+
+ return EFI_SUCCESS;
}
STATIC
@@ -193,6 +206,7 @@ RngGet (
OUT UINT8 *RNGValue
)
{
+ return EFI_DEVICE_ERROR;
}
STATIC
@@ -200,3 +214,22 @@ EFI_RNG_PROTOCOL ChaosKeyRng = {
GetInfo,
RngGet
};
+
+EFI_STATUS
+ChaosKeyRegister (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN OUT CHAOSKEY_DEV *ChaosKey
+)
+{
+ EFI_STATUS Status;
+
+ Status = gBS->InstallProtocolInterface (
+ &ControllerHandle,
+ &gEfiRngProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &ChaosKeyRng
+ );
+
+ return Status;
+}
diff --git a/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.h b/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.h
index d4033f2..d5188c5 100644
--- a/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.h
+++ b/Drivers/Usb/Misc/ChaosKeyDxe/ChaosKeyDriver.h
@@ -36,7 +36,7 @@ typedef struct {
} CHAOSKEY_DEV;
#define CHAOSKEY_DEV_FROM_THIS(a) \
- CR(a, CHAOSKEY_DEV, SerialIo, CHAOSKEY_DEV_SIGNATURE)
+ CR(a, CHAOSKEY_DEV, UsbIo, CHAOSKEY_DEV_SIGNATURE)
EFI_STATUS
EFIAPI
diff --git a/Drivers/Usb/Misc/ChaosKeyDxe/DriverBinding.c b/Drivers/Usb/Misc/ChaosKeyDxe/DriverBinding.c
index 91fc58a..7a4bbcd 100644
--- a/Drivers/Usb/Misc/ChaosKeyDxe/DriverBinding.c
+++ b/Drivers/Usb/Misc/ChaosKeyDxe/DriverBinding.c
@@ -180,9 +180,11 @@ UsbHwrngDriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
- gBS->FreePool ();
+ EFI_STATUS Status;
- return EFI_UNSUPPORTED;
+ Status = gBS->FreePool (CHAOSKEY_DEV_FROM_THIS (This));
+
+ return Status;
}
@@ -294,7 +296,7 @@ UnloadImage (
//
// Free the handle array
//
- FreePool (HandleBuffer);
+ gBS->FreePool (HandleBuffer);
return EFI_SUCCESS;
}