When user input error password exceed the max allowed times, opal device
will return Invalid type error code even user input the correct password.
In this case, opal driver needs to force user shutdown the system before
let user input new password.

Cc: Hao, Wu <hao.a...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.d...@intel.com>
---
 SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c 
b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index 5d1638d5cf..cf1f4cd64e 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -1076,6 +1076,15 @@ OpalDriverRequestPassword (
         break;
       }
 
+      //
+      // Check whether opal device's Tries value has reach the TryLimit value, 
if yes, force a shutdown 
+      // before accept new password.
+      //
+      if (Ret == TcgResultFailureInvalidType) {
+        Count = MAX_PASSWORD_TRY_COUNT;
+        break;
+      }
+
       Count++;
 
       do {
-- 
2.15.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to