Looks good to me, added to the commit queue. On 10/24/2013 04:42 AM, Ceri Coburn wrote: > > Signed-off-by: Ceri Coburn <[email protected]> > --- > src/tspi/tspi_certify.c | 28 +++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/src/tspi/tspi_certify.c b/src/tspi/tspi_certify.c > index 795d2d4..39dc568 100644 > --- a/src/tspi/tspi_certify.c > +++ b/src/tspi/tspi_certify.c > @@ -122,43 +122,53 @@ Tspi_Key_CertifyKey(TSS_HKEY hKey, > /* in */ > result |= Trspi_Hash_UINT32(&hashCtx, outDataSize); > result |= Trspi_HashUpdate(&hashCtx, outDataSize, outData); > if ((result |= Trspi_HashFinal(&hashCtx, digest.digest))) > - return result; > + goto cleanup; > > if (useAuthKey) > if ((result = obj_policy_validate_auth_oiap(hPolicy, > &digest, &keyAuth))) > - return result; > + goto cleanup; > > if (useAuthCert) > if ((result = > obj_policy_validate_auth_oiap(hCertPolicy, &digest, > &certAuth))) > - return result; > + goto cleanup; > } > > if (pValidationData == NULL) { > if ((result = Trspi_Hash(TSS_HASH_SHA1, CertifyInfoSize, > CertifyInfo, > digest.digest))) > - return result; > + goto cleanup; > + > > if ((result = __tspi_rsa_verify(hCertifyingKey, TSS_HASH_SHA1, > TPM_SHA1_160_HASH_LEN, > - digest.digest, outDataSize, outData))) > - return TSPERR(TSS_E_VERIFICATION_FAILED); > + digest.digest, outDataSize, outData))){ > + result = TSPERR(TSS_E_VERIFICATION_FAILED); > + goto cleanup; > + } > } else { > pValidationData->ulDataLength = CertifyInfoSize; > pValidationData->rgbData = calloc_tspi(tspContext, > CertifyInfoSize); > if (pValidationData->rgbData == NULL) { > LogError("malloc of %u bytes failed.", CertifyInfoSize); > - return TSPERR(TSS_E_OUTOFMEMORY); > + result = TSPERR(TSS_E_OUTOFMEMORY); > + goto cleanup; > } > memcpy(pValidationData->rgbData, CertifyInfo, CertifyInfoSize); > pValidationData->ulValidationDataLength = outDataSize; > pValidationData->rgbValidationData = calloc_tspi(tspContext, > outDataSize); > if (pValidationData->rgbValidationData == NULL) { > LogError("malloc of %u bytes failed.", outDataSize); > - return TSPERR(TSS_E_OUTOFMEMORY); > + result = TSPERR(TSS_E_OUTOFMEMORY); > + goto cleanup; > } > memcpy(pValidationData->rgbValidationData, outData, > outDataSize); > } > > - return TSS_SUCCESS; > + result = TSS_SUCCESS; > + > + cleanup: > + free(CertifyInfo); > + free(outData); > + return result; > } >
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ TrouSerS-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/trousers-tech
