Make the implementation of RouteConfig/ExtractConfig function
follow the UEFI spec.

Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index 3fb3553..ba01b69 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
@@ -28,10 +28,12 @@ extern UINT8  OpalPasswordFormBin[];
 // This Data array is ready to be used as input of HiiAddPackages() to
 // create a packagelist (which contains Form packages, String packages, etc).
 //
 extern UINT8  OpalPasswordDxeStrings[];
 
+CHAR16  OpalPasswordStorageName[] = L"OPAL_HII_CONFIGURATION";
+
 EFI_HII_CONFIG_ACCESS_PROTOCOL gHiiConfigAccessProtocol;
 
 //
 // Handle to the list of HII packages (forms and strings) for this driver
 //
@@ -1143,10 +1145,17 @@ RouteConfig(
 {
   if (Configuration == NULL || Progress == NULL) {
     return (EFI_INVALID_PARAMETER);
   }
 
+  *Progress = Configuration;
+  if (!HiiIsConfigHdrMatch (Configuration, &gHiiSetupVariableGuid, 
OpalPasswordStorageName)) {
+    return EFI_NOT_FOUND;
+  }
+
+  *Progress = Configuration + StrLen (Configuration);
+
   return EFI_SUCCESS;
 }
 
 /**
   This function allows a caller to extract the current configuration for one
@@ -1190,10 +1199,16 @@ ExtractConfig(
   //
   if (Progress == NULL || Results == NULL) {
     return (EFI_INVALID_PARAMETER);
   }
 
+  *Progress = Request;
+  if ((Request != NULL) &&
+    !HiiIsConfigHdrMatch (Request, &gHiiSetupVariableGuid, 
OpalPasswordStorageName)) {
+    return EFI_NOT_FOUND;
+  }
+
   //
   // Convert Buffer Data to <ConfigResp> by helper function BlockToConfig( )
   //
   Status = gHiiConfigRouting->BlockToConfig(
                gHiiConfigRouting,
-- 
1.9.5.msysgit.1

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

Reply via email to