CryptGetSymmetricBlockSize(
			   TPM_ALG_ID      symmetricAlg,   // IN: the symmetric algorithm
			   UINT16          keySizeInBits   // IN: the key size
			   )
{
    const INT16    *sizes;
    INT16            i;
#define ALG_CASE(SYM, sym)  case TPM_ALG_##SYM: sizes = sym##KeyBlockSizes; break
    switch(symmetricAlg)
	{
#if ALG_AES
	    ALG_CASE(AES, aes);
#endif
#if ALG_SM4
	    ALG_CASE(SM4, sm4);
#endif
#if ALG_CAMELLIA
	    ALG_CASE(CAMELLIA, camellia);
#endif
#if ALG_TDES
	    ALG_CASE(TDES, tdes);
#endif
	  default:
	    return 0;
	}
    // Find the index of the indicated keySizeInBits
    for(i = 0; *sizes >= 0; i++, sizes++)
	{
	    if(*sizes == keySizeInBits)
		break;
	}
    // If sizes is pointing at the end of the list of key sizes, then the desired
    // key size was not found so set the block size to zero.
    if(*sizes++ < 0)
	return 0;
    // Advance until the end of the list is found
    while(*sizes++ >= 0);
    // sizes is pointing to the first entry in the list of block sizes. Use the
    // ith index to find the block size for the corresponding key size.
    return sizes[i];
}
CryptGetSymmetricBlockSize(
			   TPM_ALG_ID      symmetricAlg,    
			   UINT16          keySizeInBits    
			   )
{
    const INT16    *sizes;
    INT16            i;
#define ALG_CASE(SYM, sym)  case TPM_ALG_##SYM: sizes = sym##KeyBlockSizes; break
    switch(symmetricAlg)
	{
#if ALG_AES
	    ALG_CASE(AES, aes);
#endif
#if ALG_SM4
	    ALG_CASE(SM4, sm4);
#endif
#if ALG_CAMELLIA
	    ALG_CASE(CAMELLIA, camellia);
#endif
#if ALG_TDES
	    ALG_CASE(TDES, tdes);
#endif
	  default:
	    return 0;
	}
     
    for(i = 0; *sizes >= 0; i++, sizes++)
	{
	    if(*sizes == keySizeInBits)
		break;
	}
     
     
    if(*sizes++ < 0)
	return 0;
     
    while(*sizes++ >= 0);
     
     
    return sizes[i];
}