[PATCH 3/3] uefirtauthvar: remove duplicate authenticated attribute test (LP: #1432752)

Ivan Hu ivan.hu at canonical.com
Fri Mar 20 07:09:01 UTC 2015


Test12 tests both authenticated attributes are set, the fimware need to
return EFI_INVALID_PARAMETER. It might be cofused on the firmware which
unsupport authenticated variable also get pass on this test.

Simplely remove test12 because fwts has the same test on the uefirtvariable
setvariable_test7 test.

This patch also fix the wrong attribute set on setvariable_test7.

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/uefi/uefirtauthvar/uefirtauthvar.c   | 53 ++------------------------------
 src/uefi/uefirtvariable/uefirtvariable.c |  2 +-
 2 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
index 7c5dbf1..a2b535f 100644
--- a/src/uefi/uefirtauthvar/uefirtauthvar.c
+++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
@@ -714,58 +714,10 @@ static int uefirtauthvar_test11(fwts_framework *fw)
 }
 
 /*
- * Set the authenticated variable with both EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
- * and the EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attributes, firmware
- * should return EFI_INVALID_PARAMETER.
- */
-static int uefirtauthvar_test12(fwts_framework *fw)
-{
-	long ioret;
-
-	uint64_t status;
-	uint32_t attr_both = attributes | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS;
-
-	ioret = setvar(&gtestguid, attr_both, sizeof(AuthVarCreate), AuthVarCreate, &status);
-
-	if (ioret == -1) {
-		if (status == EFI_INVALID_PARAMETER) {
-			fwts_passed(fw, "Test with both authenticated attributes are set passed.");
-
-			return FWTS_OK;
-		}
-		if (status == EFI_OUT_OF_RESOURCES) {
-			fwts_uefi_print_status_info(fw, status);
-			fwts_skipped(fw,
-				"Run out of resources for SetVariable "
-				"UEFI runtime interface: cannot test.");
-			fwts_advice(fw,
-				"Firmware may reclaim some resources "
-				"after rebooting. Reboot and test "
-				"again may be helpful to continue "
-				"the test.");
-			return FWTS_SKIP;
-		}
-		fwts_failed(fw, LOG_LEVEL_MEDIUM,
-			"UEFIRuntimeSetVariable",
-			"Failed to set variable with UEFI "
-			"runtime service.");
-
-		fwts_uefi_print_status_info(fw, status);
-		return FWTS_ERROR;
-	}
-
-	fwts_failed(fw, LOG_LEVEL_HIGH,
-		"UEFSetAuthVarWithBothAuthAttr",
-		"Should not pass setting the authenticated variable "
-		"with both authenticated attributes are set.");
-	return FWTS_ERROR;
-}
-
-/*
  * Test with setting and deleting another authenticated variable,
  * after previous test authenticated variable was deleted.
  */
-static int uefirtauthvar_test13(fwts_framework *fw)
+static int uefirtauthvar_test12(fwts_framework *fw)
 {
 	long ioret;
 
@@ -872,8 +824,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = {
 	{ uefirtauthvar_test9, "Authenticated variable test with invalid modified timestamp." },
 	{ uefirtauthvar_test10, "Authenticated variable test with different guid." },
 	{ uefirtauthvar_test11, "Authenticated variable test with invalid attributes." },
-	{ uefirtauthvar_test12, "Test with both authenticated attributes are set." },
-	{ uefirtauthvar_test13, "Set and delete authenticated variable created by different key test." },
+	{ uefirtauthvar_test12, "Set and delete authenticated variable created by different key test." },
 	{ NULL, NULL }
 };
 
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index d47f50e..ddf3885 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -1345,7 +1345,7 @@ static int setvariable_test7(fwts_framework *fw)
 	uint8_t datadiff = 0;
 	uint32_t attr;
 
-	attr = attributes | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS;
+	attr = attributes | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
 	ret = setvariable_invalidattr(fw, attr, datasize, variablenametest, &gtestguid1, datadiff);
 		if (ret == FWTS_ERROR) {
 			fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIRuntimeSetVariable",
-- 
1.9.1




More information about the fwts-devel mailing list