[PATCH 08/15] uefirtauthvar: delete authenticated variable test
Ivan Hu
ivan.hu at canonical.com
Wed Oct 22 09:40:33 UTC 2014
This test deletes the test authenticated variable and checks if it still exists.
Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
src/uefi/uefirtauthvar/uefirtauthvar.c | 53 ++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
index 0d98f33..fc123f3 100644
--- a/src/uefi/uefirtauthvar/uefirtauthvar.c
+++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
@@ -464,6 +464,58 @@ static int uefirtauthvar_test6(fwts_framework *fw)
return FWTS_ERROR;
}
+/*
+ * Delete the test authenticated variable.
+ */
+static int uefirtauthvar_test7(fwts_framework *fw)
+{
+ long ioret;
+ int supcheck;
+
+ uint8_t data[getvar_buf_size];
+ uint64_t getdatasize = sizeof(data);
+ uint64_t status;
+ uint32_t attributestest;
+
+ ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status);
+
+ if (ioret == -1) {
+ supcheck = check_fw_support(fw, status);
+ if (supcheck != FWTS_OK)
+ return supcheck;
+
+ fwts_failed(fw, LOG_LEVEL_HIGH,
+ "UEFIDelAuthVar",
+ "Failed to delete autheticated variable with UEFI "
+ "runtime service.");
+ fwts_uefi_print_status_info(fw, status);
+ return FWTS_ERROR;
+ }
+
+ ioret = getvar(>estguid, &attributestest, &getdatasize, data, &status);
+ if (ioret == -1) {
+ if (status == EFI_NOT_FOUND) {
+ fwts_passed(fw, "Delete authenticated variable tests passed.");
+ return FWTS_OK;
+ }
+
+ fwts_failed(fw, LOG_LEVEL_MEDIUM,
+ "UEFIDelAuthVar",
+ "Failed to get authenticated variable with UEFI "
+ "runtime service.");
+ fwts_uefi_print_status_info(fw, status);
+ return FWTS_ERROR;
+ }
+
+ fwts_failed(fw, LOG_LEVEL_HIGH,
+ "UEFIDelAuthVar",
+ "Failed to delete autheticated variable still get the test"
+ "autheticated variable.");
+
+ return FWTS_ERROR;
+}
+
+
static fwts_framework_minor_test uefirtauthvar_tests[] = {
{ uefirtauthvar_test1, "Create authenticated variable test." },
{ uefirtauthvar_test2, "Authenticated variable test with the same authenticated variable." },
@@ -471,6 +523,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = {
{ uefirtauthvar_test4, "Append authenticated variable test." },
{ uefirtauthvar_test5, "Update authenticated variable test." },
{ uefirtauthvar_test6, "Authenticated variable test with old authenticated variable." },
+ { uefirtauthvar_test7, "Delete authenticated variable test." },
{ NULL, NULL }
};
--
1.7.9.5
More information about the fwts-devel
mailing list