mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-07 13:08:09 +00:00
tests: Remove checks for sizes of ppList and auditCommands
It is not necessary anymore to check for an increase of the sizes of the PERSISTENT_DATA ppList and auditCommands fields since they are marshalled with an array-size indicator. Any previous version of libtpms should be able to resume a profile with the ppList and auditCommands written with a later version. If later versions have new commands, then those new commands must be added beyond the current TPM_CC_FIRST. The ppList and auditCommands may be bigger than before but can be truncated IFF new commands were added. These new commands will not be usable with the older verison of libtpms based on the StateFormatLevel then. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
a620c161bf
commit
636af2caa8
@ -413,6 +413,8 @@ RuntimeCommandsCountEnabled(struct RuntimeCommands *RuntimeCommands)
|
||||
TPM_CC commandCode;
|
||||
UINT32 count = 0;
|
||||
|
||||
/* the following assert must never change */
|
||||
MUST_BE(TPM_CC_FIRST == TPM_CC_NV_UndefineSpaceSpecial);
|
||||
for (commandCode = TPM_CC_FIRST;
|
||||
commandCode < sizeof(RuntimeCommands->enabledCommands) * 8;
|
||||
commandCode++) {
|
||||
|
||||
@ -8,30 +8,6 @@ extern BYTE s_indexOrderlyRam[RAM_INDEX_SPACE];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
PERSISTENT_DATA pd;
|
||||
|
||||
/* Check size of ppList that expands with new commands */
|
||||
/* was 14 when COMPRESSED_LISTS was enabled */
|
||||
#define PD_PP_LIST_EXP_SIZE 17
|
||||
if (sizeof(pd.ppList) != PD_PP_LIST_EXP_SIZE) {
|
||||
fprintf(stderr,
|
||||
"sizeof(PERSISTENT_DATA.ppList) does not have expected size "
|
||||
"of %u bytes but %zu bytes\n",
|
||||
PD_PP_LIST_EXP_SIZE, sizeof(pd.ppList));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Check size of auditCommands that expands with new commands */
|
||||
/* was 14 when COMPRESSED_LISTS was enabled */
|
||||
#define PD_AUDIT_COMMANDS_EXP_SIZE 17
|
||||
if (sizeof(pd.auditCommands) != PD_AUDIT_COMMANDS_EXP_SIZE) {
|
||||
fprintf(stderr,
|
||||
"sizeof(PERSISTENT_DATA.auditCommands) does not have expected size "
|
||||
"of %u bytes but %zu bytes\n",
|
||||
PD_AUDIT_COMMANDS_EXP_SIZE, sizeof(pd.auditCommands));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* ensure that the NVRAM offset of NV_USER_DYNAMIC is at the expected
|
||||
location so that there's enough memory for re-constructing NVRAM
|
||||
indices etc. into the NVRAM */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user