libimcv: No need to load AIK pubkey if AIK certificate is available

This commit is contained in:
Andreas Steffen
2016-08-31 16:12:55 +02:00
parent f883cd6df6
commit 288ee54875
+16 -13
View File
@@ -388,26 +388,29 @@ static void load_aik(private_pts_t *this)
DBG1(DBG_PTS, "AIK Blob is not available"); DBG1(DBG_PTS, "AIK Blob is not available");
} }
/* get AIK public key */ /* get AIK public key if no AIK certificate is available */
if (key_path) if (!this->aik_cert)
{ {
map = chunk_map(key_path, FALSE); if (key_path)
if (map)
{ {
DBG2(DBG_PTS, "loaded AIK public key from '%s'", key_path); map = chunk_map(key_path, FALSE);
aik_pubkey = chunk_clone(*map); if (map)
chunk_unmap(map); {
DBG2(DBG_PTS, "loaded AIK public key from '%s'", key_path);
aik_pubkey = chunk_clone(*map);
chunk_unmap(map);
}
else
{
DBG1(DBG_PTS, "unable to map AIK public key file '%s': %s",
key_path, strerror(errno));
}
} }
else else
{ {
DBG1(DBG_PTS, "unable to map AIK public key file '%s': %s", DBG1(DBG_PTS, "AIK public key is not available");
key_path, strerror(errno));
} }
} }
else
{
DBG1(DBG_PTS, "AIK public key is not available");
}
/* Load AIK item into TPM 1.2 object */ /* Load AIK item into TPM 1.2 object */
tpm_12 = (tpm_tss_trousers_t *)this->tpm; tpm_12 = (tpm_tss_trousers_t *)this->tpm;