Add HeaderLength field in Hash Store header

This patch add HeaderLength to indicate the length of Hahs Store
header so that common code can be used to skip the header without
using the sizeof() operator.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
Maurice Ma 2019-12-07 07:13:11 -08:00
parent 4ed0742524
commit 70cb62f68f
3 changed files with 7 additions and 4 deletions

View File

@ -14,6 +14,8 @@
///
extern EFI_GUID gPayloadKeyHashGuid;
#define HASH_STORE_SIGNATURE SIGNATURE_32('_', 'H', 'S', '_')
#define COMP_TYPE_STAGE_1B 0
#define COMP_TYPE_STAGE_2 1
#define COMP_TYPE_PAYLOAD 2
@ -64,7 +66,8 @@ typedef struct {
typedef struct {
UINT32 Signature;
UINT8 Revision;
UINT8 Reserved[3];
UINT8 HeaderLength;
UINT8 Reserved[2];
//
// Total valid hash store data including the header
//

View File

@ -10,8 +10,6 @@
#include <Guid/KeyHashGuid.h>
#define HASH_STORE_SIGNATURE SIGNATURE_32('_', 'H', 'S', '_')
#define HASH_INDEX_MAX_NUM 8

View File

@ -132,7 +132,8 @@ class HashStoreTable(Structure):
_fields_ = [
('Signature', ARRAY(c_char, 4)),
('Revision', c_uint8),
('Reserved', ARRAY(c_uint8, 3)),
('HeaderLength', c_uint8),
('Reserved', ARRAY(c_uint8, 2)),
('UsedLength', c_uint32),
('TotalLength', c_uint32),
('Data', ARRAY(c_uint8, 0)),
@ -141,6 +142,7 @@ class HashStoreTable(Structure):
def __init__(self):
self.Signature = HashStoreTable.HASH_STORE_SIGNATURE
self.Revision = 1
self.HeaderLength = sizeof(HashStoreTable)
class ImageVer(Structure):