in TPMCmd/tpm/src/support/TableDrivenMarshal.c [150:173]
static TPM_RC ArrayUnmarshal(
UINT16 index, // IN: the type of the array
UINT8 *target, // IN: target for the data
UINT8 **buffer, // IN/OUT: place to get the data
INT32 *size, // IN/OUT: remaining unmarshal data
UINT32 count // IN: number of values of 'index' to
// unmarshal
)
{
marshalIndex_t which = ArrayLookupTable[index & NULL_MASK].type;
UINT16 stride = ArrayLookupTable[index & NULL_MASK].stride;
TPM_RC result;
//
if(stride == 1) // A byte array
result = UnmarshalBytes(target, buffer, size, count);
else
{
which |= index & NULL_FLAG;
for(result = TPM_RC_SUCCESS; count > 0; target += stride, count--)
if(!IS_SUCCESS(Unmarshal(which, target, buffer, size)))
break;
}
return result;
}