aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2012-12-06 10:03:58 +0000
committerJames Bottomley <JBottomley@Parallels.com>2012-12-06 10:03:58 +0000
commit7c6eef2c2e63f4874160db8151d2c58af60606e2 (patch)
tree57867349497578cd7a2d0882a15a3f58d6534b6e
parent59d8deea0a5d55f8f8cf73d504e03d2218203f90 (diff)
downloadefitools-7c6eef2c2e63f4874160db8151d2c58af60606e2.tar.gz
variables: separate find_in_esl() from find_in_variable_esl()
-rw-r--r--include/variables.h2
-rw-r--r--lib/variables.c28
2 files changed, 23 insertions, 7 deletions
diff --git a/include/variables.h b/include/variables.h
index a8cd33e..af882cc 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -20,6 +20,8 @@ EFI_STATUS
get_variable_attr(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner,
UINT32 *attributes);
EFI_STATUS
+find_in_esl(UINT8 *Data, UINTN DataSize, UINT8 *key, UINTN keylen);
+EFI_STATUS
find_in_variable_esl(CHAR16* var, EFI_GUID owner, UINT8 *key, UINTN keylen);
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
diff --git a/lib/variables.c b/lib/variables.c
index 0f0b7b2..9d7d0ed 100644
--- a/lib/variables.c
+++ b/lib/variables.c
@@ -255,16 +255,12 @@ get_variable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner)
}
EFI_STATUS
-find_in_variable_esl(CHAR16* var, EFI_GUID owner, UINT8 *key, UINTN keylen)
+find_in_esl(UINT8 *Data, UINTN DataSize, UINT8 *key, UINTN keylen)
{
- UINTN DataSize;
- UINT8 *Data;
- EFI_STATUS status;
EFI_SIGNATURE_LIST *CertList;
- status = get_variable(var, &Data, &DataSize, owner);
- if (status != EFI_SUCCESS)
- return status;
+ Print(L"FIND IN ESL %lx[%d]\n", Data, DataSize);
+
for (CertList = (EFI_SIGNATURE_LIST *) Data;
DataSize > 0
&& DataSize >= CertList->SignatureListSize;
@@ -279,6 +275,24 @@ find_in_variable_esl(CHAR16* var, EFI_GUID owner, UINT8 *key, UINTN keylen)
return EFI_NOT_FOUND;
}
+EFI_STATUS
+find_in_variable_esl(CHAR16* var, EFI_GUID owner, UINT8 *key, UINTN keylen)
+{
+ UINTN DataSize;
+ UINT8 *Data;
+ EFI_STATUS status;
+
+ status = get_variable(var, &Data, &DataSize, owner);
+ if (status != EFI_SUCCESS)
+ return status;
+
+ status = find_in_esl(Data, DataSize, key, keylen);
+
+ FreePool(Data);
+
+ return status;
+}
+
int
variable_is_setupmode(void)
{