rev148: Check for blockSize==0 to make static analyzer happy

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-07-11 00:44:56 -04:00 committed by Stefan Berger
parent 01544ab239
commit a3f3d346e8
2 changed files with 6 additions and 2 deletions

View File

@ -127,8 +127,9 @@ EncryptDecryptShared(
keySize = symKey->publicArea.parameters.symDetail.sym.keyBits.sym;
alg = symKey->publicArea.parameters.symDetail.sym.algorithm;
blockSize = CryptGetSymmetricBlockSize(alg, keySize);
if (blockSize == 0)
return TPM_RC_FAILURE;
// reverify the algorithm. This is mainly to keep static analysis tools happy
if(blockSize == 0)
return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle;
// Note: When an algorithm is not supported by a TPM, the TPM_ALG_xxx for that
// algorithm is not defined. However, it is assumed that the ALG_xxx_VALUE for
// the algorithm is always defined. Both have the same numeric value.

View File

@ -117,6 +117,9 @@ TPM2_EncryptDecrypt(
keySize = symKey->publicArea.parameters.symDetail.sym.keyBits.sym;
alg = symKey->publicArea.parameters.symDetail.sym.algorithm;
blockSize = CryptGetSymmetricBlockSize(alg, keySize);
// reverify the algorithm. This is mainly to keep static analysis tools happy
if(blockSize == 0)
return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle;
// Note: When an algorithm is not supported by a TPM, the TPM_ALG_xxx for that
// algorithm is not defined. However, it is assumed that the ALG_xxx_VALUE for
// the algorithm is always defined. Both have the same numeric value.