See inline comments...

On 9/21/23 11:37 AM, Abhimanyu Singh via groups.io wrote:
SCT spec: https://bugzilla.tianocore.org/show_bug.cgi?id=4374

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4419

-Implement MemoryOverwriteRequestControlLock Locked No Key
  State test cases
  -Add Assertions 23 - 32 from SCT spec
  -Add Test Case to MemoryOverwriteRequestFunctionTest

Cc: G Edhaya Chandran <edhaya.chand...@arm.com>
Cc: Barton Gao <gao...@byosoft.com.cn>
Cc: Carolyn Gjertsen <carolyn.gjert...@amd.com>
Signed-off-by: Abhi Singh <abhi.si...@arm.com>
Change-Id: I298f8a0f55376b00233c9ee9c6b0262dc8869ccb
---

I think there is one test assertion missing from the code and from
the SCT spec for these tests.  There should be a test for the
case where MemoryOverwriteRequestControlLock is locked without
a key and there is an attempt to _delete_ MemoryOverwriteRequestControl.

That is a different path in the firmware from writing data to
the variable and should return ACCESS_DENIED.


[cut]

+TCGMemoryOverwriteRequestControlLockLockedNoKeyState (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL       *StandardLib,
+  IN EFI_TEST_RECOVERY_LIBRARY_PROTOCOL       *RecoveryLib,
+  IN RESET_DATA                               *ResetData
+  )
+{
+  EFI_STATUS                           Status;
+  EFI_TEST_ASSERTION                   Result;
+  UINTN                                DataSize;
+  UINTN                                MemoryOverwriteControlLockKeyValue;
+  UINT8                                MemoryOverwriteRequestControlLockData;
+  UINT8                                MemoryOverwriteRequestControlData;
+  UINT8                                MemoryOverwriteRequestControlDataCached;
+  UINT32                               Attributes;
+
+   if (ResetData->Step == 0) {
+    goto INITIAL_RESET;
+  } else if (ResetData->Step == 1) {
+    goto MORLOCK_LOCKED_STATE;
+  }
+
+INITIAL_RESET:
+  //
+  // Reset MORLock variable by performing a cold reset
+  //
+  ResetData->Step = 1;
+  ResetData->CheckpointStep = LOCK_NO_KEY_STATE_TEST;
+
+  Status = RecoveryLib->WriteResetRecord (
+                  RecoveryLib,
+                  sizeof (RESET_DATA),
+                  (UINT8*)ResetData
+                  );
+  if (EFI_ERROR(Status)) {
+    StandardLib->RecordAssertion (
+                  StandardLib,
+                  EFI_TEST_ASSERTION_FAILED,
+                  gTestGenericFailureGuid,
+                  L"TestRecoveryLib - WriteResetRecord",
+                  L"%a:%d:Status - %r",
+                  __FILE__,
+                  (UINTN)__LINE__,
+                  Status
+                  );
+    return Status;
+  }
+  SctPrint (L"System will cold reset after 1 second...");
+  gtBS->Stall (1000000);
+  gtRT->ResetSystem (
+                  EfiResetCold,
+                  EFI_SUCCESS,
+                  0,
+                  NULL
+                  );
+
+MORLOCK_LOCKED_STATE:
+  //change checkpoint to next function

Nit- space after comment char.

Thanks,
Stuart


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108966): https://edk2.groups.io/g/devel/message/108966
Mute This Topic: https://groups.io/mt/101504340/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to