tpm2: fix missing algorithm macro checks

Signed-off-by: Ben Lytle <ben.dav.lytle@hpe.com>
This commit is contained in:
Ben Lytle 2023-03-17 11:33:37 -05:00 committed by Stefan Berger
parent dc1aac1ecf
commit 0c32f39788
4 changed files with 8 additions and 2 deletions

View File

@ -84,7 +84,7 @@ const SYMMETRIC_TEST_VECTOR c_symTestValues[NUM_SYMS + 1] = {
dataOut_AES128_CFB, dataOut_AES128_ECB}},
#endif
#if ALG_AES && AES_192
{TPM_ALG_AES_, 192, key_AES192, 16, sizeof(dataIn_AES192), dataIn_AES192,
{TPM_ALG_AES, 192, key_AES192, 16, sizeof(dataIn_AES192), dataIn_AES192,
{dataOut_AES192_CTR, dataOut_AES192_OFB, dataOut_AES192_CBC,
dataOut_AES192_CFB, dataOut_AES192_ECB}},
#endif

View File

@ -102,7 +102,10 @@
//#define TDES DES[3] /* libtpms commented */
typedef union tpmCryptKeySchedule_t {
FOR_EACH_SYM_WITHOUT_TDES(KEY_SCHEDULE) /* libtpms changed from FOR_EACH_SYM */
#if ALG_TDES // libtpms added
tpmKeyScheduleTDES tdes[3]; /* libtpms added */
#endif // libtpms added
#if SYMMETRIC_ALIGNMENT == 8
uint64_t alignment;

View File

@ -104,6 +104,7 @@ EcdsaDigest(
/* e) n is the order of the curve */
/* Error Returns Meaning */
/* TPM_RC_NO_RESULT the result of the operation was zero or r (mod n) is zero */
#if ALG_ECSCHNORR // libtpms added
static TPM_RC
BnSchnorrSign(
bigNum bnS, // OUT: s component of the signature
@ -130,6 +131,7 @@ BnSchnorrSign(
BnDiv(NULL, bnS, bnT1, bnN);
return (BnEqualZero(bnS)) ? TPM_RC_NO_RESULT : TPM_RC_SUCCESS;
}
#endif // ALG_ECSHNORR - libtpms added
/* 10.2.12.3 Signing Functions */
/* 10.2.12.3.1 BnSignEcdsa() */
/* This function implements the ECDSA signing algorithm. The method is described in the comments

View File

@ -91,6 +91,7 @@ BuildRSAKey(EVP_PKEY **ppkey, // OUT
#if USE_OPENSSL_FUNCTIONS_SYMMETRIC
#if ALG_TDES
TPM_RC
OpenSSLCryptGenerateKeyDes(
TPMT_SENSITIVE *sensitive // OUT: sensitive area
@ -114,7 +115,7 @@ OpenSSLCryptGenerateKeyDes(
return retVal;
}
#endif // ALG_TDES
#define __NUM_ALGS 4 /* AES, TDES, Camellia, SM4 */
#define __NUM_MODES 5 /* CTR, OFB, CBC, CFB, ECB */