diff --git a/src/tpm2/AlgorithmCap.c b/src/tpm2/AlgorithmCap.c index 736c6530..f3820796 100644 --- a/src/tpm2/AlgorithmCap.c +++ b/src/tpm2/AlgorithmCap.c @@ -202,6 +202,9 @@ AlgorithmCapGetImplemented( // If algID is less than the starting algorithm ID, skip it if(s_algorithms[i].algID < algID) continue; + if(!RuntimeAlgorithmCheckEnabled(&g_RuntimeProfile.RuntimeAlgorithm,// libtpms added begin + s_algorithms[i].algID)) + continue; // libtpms added end if(algList->count < count) { // If we have not filled up the return list, add more algorithms @@ -267,7 +270,10 @@ AlgorithmGetImplementedVector( // Go through the list of implemented algorithms and SET the corresponding bit in // in the implemented vector for(index = (sizeof(s_algorithms) / sizeof(s_algorithms[0])) - 1; - index >= 0; index--) - SET_BIT(s_algorithms[index].algID, *implemented); + index >= 0; index--) { // libtpms changed + if (RuntimeAlgorithmCheckEnabled(&g_RuntimeProfile.RuntimeAlgorithm, // libtpms added begin + s_algorithms[index].algID)) + SET_BIT(s_algorithms[index].algID, *implemented); + } // libtpms added end return; } diff --git a/src/tpm2/AlgorithmTests.c b/src/tpm2/AlgorithmTests.c index a62ba1ba..17bcd6ed 100644 --- a/src/tpm2/AlgorithmTests.c +++ b/src/tpm2/AlgorithmTests.c @@ -232,6 +232,12 @@ static void TestSymmetricAlgorithm(const SYMMETRIC_TEST_VECTOR* test, // // libtpms added begin if (test->dataOut[mode - TPM_ALG_CTR] == NULL) return; + /* Skip test cases whose algorithms or keysizes are runtime-disabled */ + if (!RuntimeAlgorithmKeySizeCheckEnabled(&g_RuntimeProfile.RuntimeAlgorithm, + test->alg, test->keyBits, + TPM_ECC_NONE, + g_RuntimeProfile.stateFormatLevel)) + return; // libtpms added end //