libtpmtss: Fix build with DEBUG_LEVEL < 2
This commit is contained in:
@@ -124,7 +124,6 @@ static bool initialize_context(private_tpm_tss_trousers_t *this)
|
||||
uint32_t version_len;
|
||||
|
||||
TSS_RESULT result;
|
||||
TPM_CAP_VERSION_INFO *info;
|
||||
|
||||
result = Tspi_Context_Create(&this->hContext);
|
||||
if (result != TSS_SUCCESS)
|
||||
@@ -159,12 +158,14 @@ static bool initialize_context(private_tpm_tss_trousers_t *this)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
info = (TPM_CAP_VERSION_INFO *)version_ptr;
|
||||
#if DEBUG_LEVEL > 2
|
||||
TPM_CAP_VERSION_INFO *info = (TPM_CAP_VERSION_INFO *)version_ptr;
|
||||
DBG2(DBG_PTS, "TPM Version Info: Chip Version: %u.%u.%u.%u, "
|
||||
"Spec Level: %u, Errata Rev: %u, Vendor ID: %.4s",
|
||||
info->version.major, info->version.minor,
|
||||
info->version.revMajor, info->version.revMinor,
|
||||
untoh16(&info->specLevel), info->errataRev, info->tpmVendorID);
|
||||
#endif
|
||||
|
||||
this->version_info = chunk_clone(chunk_create(version_ptr, version_len));
|
||||
|
||||
@@ -466,7 +467,7 @@ METHOD(tpm_tss_t, quote, bool,
|
||||
uint32_t version_info_size, pcr;
|
||||
aik_t *aik;
|
||||
chunk_t aik_blob = chunk_empty;
|
||||
chunk_t quote_chunk, pcr_digest;
|
||||
chunk_t quote_chunk DBG_UNUSED, pcr_digest;
|
||||
enumerator_t *enumerator;
|
||||
bool success = FALSE;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ METHOD(tpm_tss_tss2_session_t, set_cmd_auths, bool,
|
||||
hasher_t *hasher;
|
||||
pseudo_random_function_t prf_alg;
|
||||
prf_t *prf;
|
||||
chunk_t data, cp_hash, cp_hmac, nonce_caller, nonce_tpm, session_attributes;
|
||||
chunk_t data, cp_hash, nonce_caller, nonce_tpm, session_attributes;
|
||||
bool success;
|
||||
uint32_t rval;
|
||||
|
||||
@@ -233,8 +233,8 @@ METHOD(tpm_tss_tss2_session_t, set_cmd_auths, bool,
|
||||
DBG1(DBG_PTS, "cpHmac computation failed");
|
||||
return FALSE;
|
||||
}
|
||||
cp_hmac = chunk_create(cmd.auths[0].hmac.buffer, cmd.auths[0].hmac.size);
|
||||
DBG2(DBG_PTS, LABEL "cpHmac: %B", &cp_hmac);
|
||||
DBG2(DBG_PTS, LABEL "cpHmac: %b", cmd.auths[0].hmac.buffer,
|
||||
cmd.auths[0].hmac.size);
|
||||
|
||||
rval = Tss2_Sys_SetCmdAuths(this->sys_context, &cmd);
|
||||
if (rval != TSS2_RC_SUCCESS)
|
||||
@@ -319,7 +319,7 @@ METHOD(tpm_tss_tss2_session_t, get_rsp_auths, bool,
|
||||
prf_t *prf;
|
||||
crypter_t *crypter;
|
||||
chunk_t kdf_label = chunk_from_chars('C','F','B', 0x00);
|
||||
chunk_t data, rp_hash, rp_hmac, nonce_caller, nonce_tpm, session_attributes;
|
||||
chunk_t data, rp_hash, nonce_caller, nonce_tpm, session_attributes;
|
||||
chunk_t key_mat, aes_key, aes_iv;
|
||||
bool success;
|
||||
uint32_t rval;
|
||||
@@ -410,8 +410,7 @@ METHOD(tpm_tss_tss2_session_t, get_rsp_auths, bool,
|
||||
DBG1(DBG_PTS, "computation of rpHmac failed");
|
||||
return FALSE;
|
||||
}
|
||||
rp_hmac = chunk_create(rpHmac.buffer, rpHmac.size);
|
||||
DBG2(DBG_PTS, LABEL "rpHMAC: %B", &rp_hmac);
|
||||
DBG2(DBG_PTS, LABEL "rpHMAC: %b", rpHmac.buffer, rpHmac.size);
|
||||
|
||||
/* verify rpHmac */
|
||||
if (!memeq(rsp.auths[0].hmac.buffer, rpHmac.buffer, rpHmac.size))
|
||||
|
||||
@@ -664,6 +664,8 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
||||
DBG1(DBG_PTS, LABEL "unsupported key type");
|
||||
return chunk_empty;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL >= 1
|
||||
if (public.publicArea.objectAttributes & TPMA_OBJECT_SIGN_ENCRYPT)
|
||||
{
|
||||
TPMT_ASYM_SCHEME *s;
|
||||
@@ -682,6 +684,7 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
||||
tpm_alg_id_names, s->algorithm,
|
||||
tpm_alg_id_names, s->mode, s->keyBits.sym);
|
||||
}
|
||||
#endif
|
||||
|
||||
return aik_pubkey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user