fclose(fp);
return;
}
-
+
DBG1(DBG_PTS, "AIK Blob is not available");
}
result);
return FALSE;
}
-
+
result = Tspi_Context_Connect(hContext, NULL);
if (result != TSS_SUCCESS)
{
{
goto err;
}
-
+
*output = pcr_value;
*output = chunk_clone(*output);
{
goto err1;
}
-
+
result = Tspi_Context_LoadKeyByBlob (hContext, hSRK, this->aik_blob.len,
this->aik_blob.ptr, &hAIK);
if (result != TSS_SUCCESS)
valData.ulExternalDataLength = this->secret.len;
valData.rgbExternalData = (BYTE *)this->secret.ptr;
-
+
/* TPM Quote */
result = Tspi_TPM_Quote(hTPM, hAIK, hPcrComposite, &valData);
if (result != TSS_SUCCESS)
*pcr_composite = pcr_comp;
*pcr_composite = chunk_clone(*pcr_composite);
DBG3(DBG_PTS, "Hash of PCR Composite: %B",pcr_composite);
-
+
quote_sign = chunk_alloc(valData.ulValidationDataLength);
memcpy(quote_sign.ptr, valData.rgbValidationData,
valData.ulValidationDataLength);
err2:
Tspi_Context_CloseObject(hContext, hAIK);
-
+
err1:
Tspi_Context_Close(hContext);
free(pcrs);
{
enumerator_t *e;
pcr_entry_t *entry;
-
+
if (!this->pcrs)
{
this->pcrs = linked_list_create();
}
}
DESTROY_IF(e);
-
+
this->pcrs->insert_last(this->pcrs, new);
qsort(this->pcrs, this->pcrs->get_count(this->pcrs),
}
free(pcr_entry);
e->destroy(e);
-
+
/* PCR Composite structure */
pcr_composite = chunk_clone(writer->get_buf(writer));
writer->destroy(writer);
if (composite_algo)
{
hash_algorithm_t algo;
-
+
algo = pts_meas_algo_to_hash(composite_algo);
hasher = lib->crypto->create_hasher(lib->crypto, algo);
*out_pcr_composite = chunk_clone(pcr_composite);
DBG4(DBG_PTS, "calculated PCR Composite: %B", out_pcr_composite);
}
-
+
/* SHA1 hash of PCR Composite to construct TPM_QUOTE_INFO */
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
hasher->allocate_hash(hasher, pcr_composite, &hash_pcr_composite);
hasher->destroy(hasher);
-
+
writer->write_data(writer, hash_pcr_composite);
chunk_clear(&pcr_composite);
chunk_clear(&hash_pcr_composite);
-
+
if (!this->secret.ptr)
{
DBG1(DBG_PTS, "Secret assessment value unavailable",
*out_quote_info = chunk_clone(writer->get_buf(writer));
DBG4(DBG_PTS, "Calculated TPM Quote Info: %B", out_quote_info);
writer->destroy(writer);
-
+
return TRUE;
}
private_pts_t *this, chunk_t data, chunk_t signature)
{
public_key_t *aik_pub_key;
- chunk_t key_encoding;
aik_pub_key = this->aik->get_public_key(this->aik);
if (!aik_pub_key)
DESTROY_IF(aik_pub_key);
return FALSE;
}
-
+
aik_pub_key->destroy(aik_pub_key);
return TRUE;
}
goto err;
}
this->tpm_version_info = chunk_clone(this->tpm_version_info);
-
+
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
return TRUE;
/**
* Verification of an EMPSA PKCS1 signature described in PKCS#1
*/
-static bool verify_rsa_signature(private_openssl_rsa_public_key_t *this,
+static bool verify_signature(private_openssl_rsa_public_key_t *this,
int type, chunk_t data, chunk_t signature)
{
bool valid = FALSE;
switch (scheme)
{
case SIGN_RSA_SHA1:
- return verify_rsa_signature(this, NID_sha1, data, signature);
+ return verify_signature(this, NID_sha1, data, signature);
case SIGN_RSA_EMSA_PKCS1_NULL:
return verify_emsa_pkcs1_signature(this, NID_undef, data, signature);
case SIGN_RSA_EMSA_PKCS1_SHA1:
destroy(this);
return NULL;
}
-