From 01cc2d07b4b3b1dd8acf1fa30bfd54968a3f1284 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 17 Apr 2020 18:56:23 -0400 Subject: [PATCH] tpm2: rev162: Rename TPM_SYM_MODE_FIRST/LAST to SYM_MODE_FIRST/LAST Signed-off-by: Stefan Berger --- src/tpm2/AlgorithmTests.c | 14 +++++++------- src/tpm2/SelfTest.h | 13 +++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/tpm2/AlgorithmTests.c b/src/tpm2/AlgorithmTests.c index 9ee2f3af..e54ee28f 100644 --- a/src/tpm2/AlgorithmTests.c +++ b/src/tpm2/AlgorithmTests.c @@ -132,8 +132,8 @@ TestHash( #endif #if ALG_SM3_256 case ALG_SM3_256_VALUE: -#error Missing test case for SM3 - // There are currently not test vectors for SM3 +#error Missing test case for SM3 // libtpms added + // There are currently no test vectors for SM3 // testDigest = &c_SM3_256_digest.b; testDigest = NULL; break; @@ -286,7 +286,7 @@ AllModesAreDone( ) { TPM_ALG_ID alg; - for(alg = TPM_SYM_MODE_FIRST; alg <= TPM_SYM_MODE_LAST; alg++) + for(alg = SYM_MODE_FIRST; alg <= SYM_MODE_LAST; alg++) if(TEST_BOTH(alg)) return FALSE; return TRUE; @@ -314,8 +314,8 @@ TestSymmetric( { if(c_symTestValues[index].alg == alg) { - for(mode = TPM_SYM_MODE_FIRST; - mode <= TPM_SYM_MODE_LAST; + for(mode = SYM_MODE_FIRST; + mode <= SYM_MODE_LAST; mode++) { if(TEST_BIT(mode, g_implementedAlgorithms)) // libtpms always test implemented modes @@ -327,11 +327,11 @@ TestSymmetric( if(AllSymsAreDone(toTest)) { // all symmetric algorithms tested so no modes should be set - for(alg = TPM_SYM_MODE_FIRST; alg <= TPM_SYM_MODE_LAST; alg++) + for(alg = SYM_MODE_FIRST; alg <= SYM_MODE_LAST; alg++) CLEAR_BOTH(alg); } } - else if(TPM_SYM_MODE_FIRST <= alg && alg <= TPM_SYM_MODE_LAST) + else if(SYM_MODE_FIRST <= alg && alg <= SYM_MODE_LAST) { // Test this mode for all key sizes and algorithms for(index = 0; index < NUM_SYMS; index++) diff --git a/src/tpm2/SelfTest.h b/src/tpm2/SelfTest.h index 1605914f..19737216 100644 --- a/src/tpm2/SelfTest.h +++ b/src/tpm2/SelfTest.h @@ -3,7 +3,7 @@ /* Structure definitions for the self-test */ /* Written by Ken Goldman */ /* IBM Thomas J. Watson Research Center */ -/* $Id: SelfTest.h 1529 2019-11-21 23:29:01Z kgoldman $ */ +/* $Id: SelfTest.h 1594 2020-03-26 22:15:48Z kgoldman $ */ /* */ /* Licenses and Notices */ /* */ @@ -55,7 +55,7 @@ /* arising in any way out of use or reliance upon this specification or any */ /* information herein. */ /* */ -/* (c) Copyright IBM Corp. and others, 2016 - 2019 */ +/* (c) Copyright IBM Corp. and others, 2016 - 2020 */ /* */ /********************************************************************************/ @@ -80,11 +80,12 @@ typedef UINT32 SYM_INDEX; /* These two defines deal with the fact that the TPM_ALG_ID table does not delimit the symmetric - mode values with a TPM_SYM_MODE_FIRST and TPM_SYM_MODE_LAST */ + mode values with a SYM_MODE_FIRST and SYM_MODE_LAST */ -#define TPM_SYM_MODE_FIRST ALG_CTR_VALUE -#define TPM_SYM_MODE_LAST ALG_ECB_VALUE -#define NUM_SYM_MODES (TPM_SYM_MODE_LAST - TPM_SYM_MODE_FIRST + 1) +#define SYM_MODE_FIRST ALG_CTR_VALUE +#define SYM_MODE_LAST ALG_ECB_VALUE + +#define NUM_SYM_MODES (SYM_MODE_LAST - SYM_MODE_FIRST + 1) /* Define a type to hold a bit vector for the modes. */ #if NUM_SYM_MODES <= 0