public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Revert two commits for authenticated variable store support in VPD
@ 2022-01-24 15:54 Chen Lin Z
  0 siblings, 0 replies; only message in thread
From: Chen Lin Z @ 2022-01-24 15:54 UTC (permalink / raw)
  To: bob.c.feng, gaoliming, yuwei.chen, devel; +Cc: di.zhang, Chen Lin Z

Variable driver will responsible to convert normal variable format
to the authenticated variable format, so no need to add support in
BaseTools.

1.Revert "BaseTools: Add authenticated variable store support"
This reverts commit 22c3b5a865ec800b7eecf43de336ad5e2d917a08.

2. Revert "BaseTools: Fix wrong variable header size"
This reverts commit 7438a85bf1388add286a89707079d9afca735814.
---
 BaseTools/Source/Python/AutoGen/GenVar.py     | 63 ++-----------------
 BaseTools/Source/Python/Common/DataType.py    |  1 -
 .../Source/Python/Workspace/DscBuildData.py   |  4 --
 3 files changed, 4 insertions(+), 64 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index f2ad54ba63..591ef3df55 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -15,12 +15,10 @@ from Common.VariableAttributes import VariableAttributes
 from Common.Misc import *
 import collections
 import Common.DataType as DataType
-import Common.GlobalData as GlobalData
 
 var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type,PcdDscLine,StructurePcd")
 NvStorageHeaderSize = 28
 VariableHeaderSize = 32
-AuthenticatedVariableHeaderSize = 60
 
 class VariableMgr(object):
     def __init__(self, DefaultStoreMap, SkuIdMap):
@@ -172,22 +170,14 @@ class VariableMgr(object):
             DataBuffer = VariableMgr.AlignData(var_name_buffer + default_data)
 
             data_size = len(DataBuffer)
-            if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
-                offset += AuthenticatedVariableHeaderSize + len(default_info.var_name.split(","))
-            else:
-                offset += VariableHeaderSize + len(default_info.var_name.split(","))
+            offset += VariableHeaderSize + len(default_info.var_name.split(","))
             var_data_offset[default_info.pcdindex] = offset
             offset += data_size - len(default_info.var_name.split(","))
-            if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
-                var_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
-            else:
-                var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
+
+            var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
             NvStoreDataBuffer += (var_header_buffer + DataBuffer)
 
-        if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
-            variable_storage_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
-        else:
-            variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
+        variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
 
         nv_default_part = VariableMgr.AlignData(VariableMgr.PACK_DEFAULT_DATA(0, 0, VariableMgr.unpack_data(variable_storage_header_buffer+NvStoreDataBuffer)), 8)
 
@@ -262,20 +252,6 @@ class VariableMgr(object):
 
         return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
 
-    def PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(size):
-        #Signature: gEfiAuthenticatedVariableGuid
-        Guid = "{ 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}"
-        Guid = GuidStructureStringToGuidString(Guid)
-        GuidBuffer = PackGUID(Guid.split('-'))
-
-        SizeBuffer = pack('=L', size)
-        FormatBuffer = pack('=B', 0x5A)
-        StateBuffer = pack('=B', 0xFE)
-        reservedBuffer = pack('=H', 0)
-        reservedBuffer += pack('=L', 0)
-
-        return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
-
     @staticmethod
     def PACK_NV_STORE_DEFAULT_HEADER(size, maxsize):
         Signature = pack('=B', ord('N'))
@@ -303,37 +279,6 @@ class VariableMgr(object):
 
         return Buffer
 
-    @staticmethod
-    def PACK_AUTHENTICATED_VARIABLE_HEADER(attribute, namesize, datasize, vendorguid):
-
-        Buffer = pack('=H', 0x55AA)    # pack StartID
-        Buffer += pack('=B', 0x3F)     # pack State
-        Buffer += pack('=B', 0)        # pack reserved
-
-        Buffer += pack('=L', attribute)
-
-        Buffer += pack('=Q', 0)        # pack MonotonicCount
-        Buffer += pack('=HBBBBBBLhBB', # pack TimeStamp
-                         0,            # UINT16 Year
-                         0,            # UINT8  Month
-                         0,            # UINT8  Day
-                         0,            # UINT8  Hour
-                         0,            # UINT8  Minute
-                         0,            # UINT8  Second
-                         0,            # UINT8  Pad1
-                         0,            # UINT32 Nanosecond
-                         0,            # INT16  TimeZone
-                         0,            # UINT8  Daylight
-                         0)            # UINT8  Pad2
-        Buffer += pack('=L', 0)        # pack PubKeyIndex
-
-        Buffer += pack('=L', namesize)
-        Buffer += pack('=L', datasize)
-
-        Buffer += PackGUID(vendorguid)
-
-        return Buffer
-
     @staticmethod
     def PACK_VARIABLES_DATA(var_value,data_type, tail = None):
         Buffer = bytearray()
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index dc49623333..4e9c9e34af 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -406,7 +406,6 @@ TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
 TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
 TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX = 'PCD_DYNAMIC_AS_DYNAMICEX'
 TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
-TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE = 'VPD_AUTHENTICATED_VARIABLE_STORE'
 TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
 TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
 TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 35ec5b37ff..d1ee0ccaea 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -387,10 +387,6 @@ class DscBuildData(PlatformBuildClassObject):
                 for i in range(0, len(LanguageCodes), 3):
                     LanguageList.append(LanguageCodes[i:i + 3])
                 self._ISOLanguages = LanguageList
-            elif Name == TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE:
-                if TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE not in gCommandLineDefines:
-                    gCommandLineDefines[TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE] = Record[2].strip()
-
             elif Name == TAB_DSC_DEFINES_VPD_TOOL_GUID:
                 #
                 # try to convert GUID to a real UUID value to see whether the GUID is format
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-24  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-24 15:54 [PATCH] Revert two commits for authenticated variable store support in VPD Chen Lin Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox