//\r
VOID *mHashCtx = NULL;\r
\r
-//\r
-// The serialization of the values of the VariableName, VendorGuid and Attributes\r
-// parameters of the SetVariable() call and the TimeStamp component of the\r
-// EFI_VARIABLE_AUTHENTICATION_2 descriptor followed by the variable's new value\r
-// i.e. (VariableName, VendorGuid, Attributes, TimeStamp, Data)\r
-//\r
-UINT8 *mSerializationRuntimeBuffer = NULL;\r
-\r
//\r
// Requirement for different signature type which have been defined in UEFI spec.\r
// These data are used to peform SignatureList format check while setting PK/KEK variable.\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- //\r
- // Prepare runtime buffer for serialized data of time-based authenticated\r
- // Variable, i.e. (VariableName, VendorGuid, Attributes, TimeStamp, Data).\r
- //\r
- mSerializationRuntimeBuffer = AllocateRuntimePool (PcdGet32 (PcdMaxVariableSize) + sizeof (EFI_GUID) + sizeof (UINT32) + sizeof (EFI_TIME));\r
- if (mSerializationRuntimeBuffer == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
//\r
// Check "AuthVarKeyDatabase" variable's existence.\r
// If it doesn't exist, create a new one with initial value of 0 and EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.\r
PayloadSize = DataSize - OFFSET_OF_AUTHINFO2_CERT_DATA - (UINTN) SigDataSize;\r
\r
//\r
- // Construct a buffer to fill with (VariableName, VendorGuid, Attributes, TimeStamp, Data).\r
+ // Construct a serialization buffer of the values of the VariableName, VendorGuid and Attributes\r
+ // parameters of the SetVariable() call and the TimeStamp component of the\r
+ // EFI_VARIABLE_AUTHENTICATION_2 descriptor followed by the variable's new value\r
+ // i.e. (VariableName, VendorGuid, Attributes, TimeStamp, Data)\r
//\r
NewDataSize = PayloadSize + sizeof (EFI_TIME) + sizeof (UINT32) +\r
sizeof (EFI_GUID) + StrSize (VariableName) - sizeof (CHAR16);\r
- NewData = mSerializationRuntimeBuffer;\r
+ //\r
+ // Here is to reuse scratch data area(at the end of volatile variable store)\r
+ // to reduce SMRAM consumption for SMM variable driver.\r
+ // The scratch buffer is enough to hold the serialized data and safe to use,\r
+ // because it will be used at here to do verification only first\r
+ // and then used in UpdateVariable() for a time based auth variable set.\r
+ //\r
+ NewData = (UINT8 *) GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase));\r
\r
Buffer = NewData;\r
Length = StrLen (VariableName) * sizeof (CHAR16);\r