TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector)
{
    UINT16 written = 0;

    switch (selector) {
#if ALG_SHA1
      case TPM_ALG_SHA1:
	written += Array_Marshal(&source->sha1[0], SHA1_DIGEST_SIZE, buffer, size); 
	break;
#endif
#if ALG_SHA256
      case TPM_ALG_SHA256:
	written += Array_Marshal(&source->sha256[0], SHA256_DIGEST_SIZE, buffer, size); 
	break;
#endif
#if ALG_SHA384
      case TPM_ALG_SHA384:
	written += Array_Marshal(&source->sha384[0], SHA384_DIGEST_SIZE, buffer, size);
	break;
#endif
#if ALG_SHA512
      case TPM_ALG_SHA512:
	written += Array_Marshal(&source->sha512[0], SHA512_DIGEST_SIZE, buffer, size);
	break;
#endif
#if ALG_SM3_256
      case TPM_ALG_SM3_256:
	written += Array_Marshal(&source->sm3_256[0], SM3_256_DIGEST_SIZE, buffer, size);
	break;
#endif
      case TPM_ALG_NULL:
	break;
      default:
	pAssert(FALSE);
    }
    return written;
}
TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector)
{
    UINT16 written = 0;

    switch (selector) {
#if ALG_SHA1
      case TPM_ALG_SHA1:
	written += Array_Marshal(&source->sha1[0], SHA1_DIGEST_SIZE, buffer, size); 
	break;
#endif
#if ALG_SHA256
      case TPM_ALG_SHA256:
	written += Array_Marshal(&source->sha256[0], SHA256_DIGEST_SIZE, buffer, size); 
	break;
#endif
#if ALG_SHA384
      case TPM_ALG_SHA384:
	written += Array_Marshal(&source->sha384[0], SHA384_DIGEST_SIZE, buffer, size);
	break;
#endif
#if ALG_SHA512
      case TPM_ALG_SHA512:
	written += Array_Marshal(&source->sha512[0], SHA512_DIGEST_SIZE, buffer, size);
	break;
#endif
#if ALG_SM3_256
      case TPM_ALG_SM3_256:
	written += Array_Marshal(&source->sm3_256[0], SM3_256_DIGEST_SIZE, buffer, size);
	break;
#endif
      case TPM_ALG_NULL:
	break;
      default:
	pAssert(FALSE);
    }
    return written;
}