Changed the static function name in openssl_rsa_public_key object

Removed unused chunk variable from PTS verify_quote_signature function
This commit is contained in:
Sansar Choinyambuu
2011-11-28 14:39:53 +01:00
committed by Andreas Steffen
parent 2b28a13182
commit 71741df078
4 changed files with 21 additions and 23 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ METHOD(imc_t, type_supported, bool,
METHOD(imc_t, destroy, void, METHOD(imc_t, destroy, void,
private_tnc_imc_t *this) private_tnc_imc_t *this)
{ {
dlclose(this->handle); //dlclose(this->handle);
this->mutex->destroy(this->mutex); this->mutex->destroy(this->mutex);
free(this->supported_types); free(this->supported_types);
free(this->name); free(this->name);
+1 -1
View File
@@ -162,7 +162,7 @@ METHOD(imv_t, type_supported, bool,
METHOD(imv_t, destroy, void, METHOD(imv_t, destroy, void,
private_tnc_imv_t *this) private_tnc_imv_t *this)
{ {
dlclose(this->handle); //dlclose(this->handle);
this->mutex->destroy(this->mutex); this->mutex->destroy(this->mutex);
free(this->supported_types); free(this->supported_types);
free(this->name); free(this->name);
+17 -18
View File
@@ -370,7 +370,7 @@ static void load_aik_blob(private_pts_t *this)
fclose(fp); fclose(fp);
return; return;
} }
DBG1(DBG_PTS, "AIK Blob is not available"); DBG1(DBG_PTS, "AIK Blob is not available");
} }
@@ -711,7 +711,7 @@ METHOD(pts_t, read_pcr, bool,
result); result);
return FALSE; return FALSE;
} }
result = Tspi_Context_Connect(hContext, NULL); result = Tspi_Context_Connect(hContext, NULL);
if (result != TSS_SUCCESS) if (result != TSS_SUCCESS)
{ {
@@ -728,7 +728,7 @@ METHOD(pts_t, read_pcr, bool,
{ {
goto err; goto err;
} }
*output = pcr_value; *output = pcr_value;
*output = chunk_clone(*output); *output = chunk_clone(*output);
@@ -849,7 +849,7 @@ METHOD(pts_t, quote_tpm, bool,
{ {
goto err1; goto err1;
} }
result = Tspi_Context_LoadKeyByBlob (hContext, hSRK, this->aik_blob.len, result = Tspi_Context_LoadKeyByBlob (hContext, hSRK, this->aik_blob.len,
this->aik_blob.ptr, &hAIK); this->aik_blob.ptr, &hAIK);
if (result != TSS_SUCCESS) if (result != TSS_SUCCESS)
@@ -884,7 +884,7 @@ METHOD(pts_t, quote_tpm, bool,
valData.ulExternalDataLength = this->secret.len; valData.ulExternalDataLength = this->secret.len;
valData.rgbExternalData = (BYTE *)this->secret.ptr; valData.rgbExternalData = (BYTE *)this->secret.ptr;
/* TPM Quote */ /* TPM Quote */
result = Tspi_TPM_Quote(hTPM, hAIK, hPcrComposite, &valData); result = Tspi_TPM_Quote(hTPM, hAIK, hPcrComposite, &valData);
if (result != TSS_SUCCESS) if (result != TSS_SUCCESS)
@@ -898,7 +898,7 @@ METHOD(pts_t, quote_tpm, bool,
*pcr_composite = pcr_comp; *pcr_composite = pcr_comp;
*pcr_composite = chunk_clone(*pcr_composite); *pcr_composite = chunk_clone(*pcr_composite);
DBG3(DBG_PTS, "Hash of PCR Composite: %B",pcr_composite); DBG3(DBG_PTS, "Hash of PCR Composite: %B",pcr_composite);
quote_sign = chunk_alloc(valData.ulValidationDataLength); quote_sign = chunk_alloc(valData.ulValidationDataLength);
memcpy(quote_sign.ptr, valData.rgbValidationData, memcpy(quote_sign.ptr, valData.rgbValidationData,
valData.ulValidationDataLength); valData.ulValidationDataLength);
@@ -923,7 +923,7 @@ METHOD(pts_t, quote_tpm, bool,
err2: err2:
Tspi_Context_CloseObject(hContext, hAIK); Tspi_Context_CloseObject(hContext, hAIK);
err1: err1:
Tspi_Context_Close(hContext); Tspi_Context_Close(hContext);
free(pcrs); free(pcrs);
@@ -950,7 +950,7 @@ METHOD(pts_t, add_pcr_entry, void,
{ {
enumerator_t *e; enumerator_t *e;
pcr_entry_t *entry; pcr_entry_t *entry;
if (!this->pcrs) if (!this->pcrs)
{ {
this->pcrs = linked_list_create(); this->pcrs = linked_list_create();
@@ -969,7 +969,7 @@ METHOD(pts_t, add_pcr_entry, void,
} }
} }
DESTROY_IF(e); DESTROY_IF(e);
this->pcrs->insert_last(this->pcrs, new); this->pcrs->insert_last(this->pcrs, new);
qsort(this->pcrs, this->pcrs->get_count(this->pcrs), qsort(this->pcrs, this->pcrs->get_count(this->pcrs),
@@ -1051,7 +1051,7 @@ METHOD(pts_t, get_quote_info, bool,
} }
free(pcr_entry); free(pcr_entry);
e->destroy(e); e->destroy(e);
/* PCR Composite structure */ /* PCR Composite structure */
pcr_composite = chunk_clone(writer->get_buf(writer)); pcr_composite = chunk_clone(writer->get_buf(writer));
writer->destroy(writer); writer->destroy(writer);
@@ -1073,7 +1073,7 @@ METHOD(pts_t, get_quote_info, bool,
if (composite_algo) if (composite_algo)
{ {
hash_algorithm_t algo; hash_algorithm_t algo;
algo = pts_meas_algo_to_hash(composite_algo); algo = pts_meas_algo_to_hash(composite_algo);
hasher = lib->crypto->create_hasher(lib->crypto, algo); hasher = lib->crypto->create_hasher(lib->crypto, algo);
@@ -1087,16 +1087,16 @@ METHOD(pts_t, get_quote_info, bool,
*out_pcr_composite = chunk_clone(pcr_composite); *out_pcr_composite = chunk_clone(pcr_composite);
DBG4(DBG_PTS, "calculated PCR Composite: %B", out_pcr_composite); DBG4(DBG_PTS, "calculated PCR Composite: %B", out_pcr_composite);
} }
/* SHA1 hash of PCR Composite to construct TPM_QUOTE_INFO */ /* SHA1 hash of PCR Composite to construct TPM_QUOTE_INFO */
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1); hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
hasher->allocate_hash(hasher, pcr_composite, &hash_pcr_composite); hasher->allocate_hash(hasher, pcr_composite, &hash_pcr_composite);
hasher->destroy(hasher); hasher->destroy(hasher);
writer->write_data(writer, hash_pcr_composite); writer->write_data(writer, hash_pcr_composite);
chunk_clear(&pcr_composite); chunk_clear(&pcr_composite);
chunk_clear(&hash_pcr_composite); chunk_clear(&hash_pcr_composite);
if (!this->secret.ptr) if (!this->secret.ptr)
{ {
DBG1(DBG_PTS, "Secret assessment value unavailable", DBG1(DBG_PTS, "Secret assessment value unavailable",
@@ -1111,7 +1111,7 @@ METHOD(pts_t, get_quote_info, bool,
*out_quote_info = chunk_clone(writer->get_buf(writer)); *out_quote_info = chunk_clone(writer->get_buf(writer));
DBG4(DBG_PTS, "Calculated TPM Quote Info: %B", out_quote_info); DBG4(DBG_PTS, "Calculated TPM Quote Info: %B", out_quote_info);
writer->destroy(writer); writer->destroy(writer);
return TRUE; return TRUE;
} }
@@ -1119,7 +1119,6 @@ METHOD(pts_t, verify_quote_signature, bool,
private_pts_t *this, chunk_t data, chunk_t signature) private_pts_t *this, chunk_t data, chunk_t signature)
{ {
public_key_t *aik_pub_key; public_key_t *aik_pub_key;
chunk_t key_encoding;
aik_pub_key = this->aik->get_public_key(this->aik); aik_pub_key = this->aik->get_public_key(this->aik);
if (!aik_pub_key) if (!aik_pub_key)
@@ -1134,7 +1133,7 @@ METHOD(pts_t, verify_quote_signature, bool,
DESTROY_IF(aik_pub_key); DESTROY_IF(aik_pub_key);
return FALSE; return FALSE;
} }
aik_pub_key->destroy(aik_pub_key); aik_pub_key->destroy(aik_pub_key);
return TRUE; return TRUE;
} }
@@ -1294,7 +1293,7 @@ static bool has_tpm(private_pts_t *this)
goto err; goto err;
} }
this->tpm_version_info = chunk_clone(this->tpm_version_info); this->tpm_version_info = chunk_clone(this->tpm_version_info);
Tspi_Context_FreeMemory(hContext, NULL); Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext); Tspi_Context_Close(hContext);
return TRUE; return TRUE;
@@ -119,7 +119,7 @@ error:
/** /**
* Verification of an EMPSA PKCS1 signature described in PKCS#1 * 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) int type, chunk_t data, chunk_t signature)
{ {
bool valid = FALSE; bool valid = FALSE;
@@ -187,7 +187,7 @@ METHOD(public_key_t, verify, bool,
switch (scheme) switch (scheme)
{ {
case SIGN_RSA_SHA1: 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: case SIGN_RSA_EMSA_PKCS1_NULL:
return verify_emsa_pkcs1_signature(this, NID_undef, data, signature); return verify_emsa_pkcs1_signature(this, NID_undef, data, signature);
case SIGN_RSA_EMSA_PKCS1_SHA1: case SIGN_RSA_EMSA_PKCS1_SHA1:
@@ -448,4 +448,3 @@ openssl_rsa_public_key_t *openssl_rsa_public_key_load(key_type_t type,
destroy(this); destroy(this);
return NULL; return NULL;
} }