in TPMCmd/tpm/src/support/TableDrivenMarshal.c [176:197]
static UINT16 ArrayMarshal(
UINT16 index, // IN: the type of the array
UINT8 *source, // IN: source of the data
UINT8 **buffer, // IN/OUT: place to put the data
INT32 *size, // IN/OUT: amount of space for the data
UINT32 count // IN: number of values of 'index' to marshal
)
{
marshalIndex_t which = ArrayLookupTable[index & NULL_MASK].type;
UINT16 stride = ArrayLookupTable[index & NULL_MASK].stride;
UINT16 retVal;
//
if(stride == 1) // A byte array
return MarshalBytes(source, buffer, size, count);
which |= index & NULL_FLAG;
for(retVal = 0
; count > 0
; source += stride, count--)
retVal += Marshal(which, source, buffer, size);
return retVal;
}