From: Kent Y. <ky...@us...> - 2013-05-14 21:21:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Trousers". The branch, master has been updated via 29a8b1abfaf6d8bb08449750d897d4a342b1bc0f (commit) via dbdbf1fdcb46bdf65ad186e3eb0b0556df500e39 (commit) via 2ff2601c96d4c6899fa54fcbd4a54e8af41a6e48 (commit) via cb962cfad7e3a6cfcb5f883fd8e8406a31260493 (commit) via 801796399cbe481af8774fa935810f617c15b94e (commit) via a8f9d44221455eeabce72d761938b5974626df10 (commit) via 1ea392107d5eed2aab31ded9d4dc485df6d264ab (commit) via 514d6c4ff069ff0b509334d3bd124491abd0b688 (commit) from a4f3872c8f39977e0c6777c7bdb7ba301e980c40 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=29a8b1abfaf6d8bb08449750d897d4a342b1bc0f commit 29a8b1abfaf6d8bb08449750d897d4a342b1bc0f Author: Kent Yoder <ke...@li...> Date: Tue May 14 16:16:04 2013 -0500 tspi: add a memset that shouldn't be optimized out Signed-off-by: Kent Yoder <ke...@li...> diff --git a/src/include/spi_utils.h b/src/include/spi_utils.h index f93e877..11255b2 100644 --- a/src/include/spi_utils.h +++ b/src/include/spi_utils.h @@ -44,9 +44,16 @@ MUTEX_DECLARE_EXTERN(mem_cache_lock); #define TSS_PSFILE_INCREMENT_NUM_KEYS 1 #define TSS_PSFILE_DECREMENT_NUM_KEYS 0 +#ifdef __GNUC__ +#define __no_optimize __attribute__((optimize("O0"))) +#else +#define __no_optimize +#endif + void *calloc_tspi(TSS_HCONTEXT, UINT32); TSS_RESULT free_tspi(TSS_HCONTEXT, void *); TSS_RESULT __tspi_add_mem_entry(TSS_HCONTEXT, void *); +void * __no_optimize __tspi_memset(void *, int, size_t); /* secrets.c */ diff --git a/src/tspi/gtk/main.c b/src/tspi/gtk/main.c index 3b76402..7d76995 100644 --- a/src/tspi/gtk/main.c +++ b/src/tspi/gtk/main.c @@ -65,7 +65,7 @@ DisplayPINWindow(BYTE *string, UINT32 *string_len, BYTE *popup) if (ud.string_len) { memcpy(string, ud.string, ud.string_len); - memset(ud.string, 0, ud.string_len); + __tspi_memset(ud.string, 0, ud.string_len); free(ud.string); } *string_len = ud.string_len; @@ -107,7 +107,7 @@ DisplayNewPINWindow(BYTE *string, UINT32 *string_len, BYTE *popup) if (ud.string_len) { memcpy(string, ud.string, ud.string_len); - memset(ud.string, 0, ud.string_len); + __tspi_memset(ud.string, 0, ud.string_len); free(ud.string); } *string_len = ud.string_len; diff --git a/src/tspi/log.c b/src/tspi/log.c index 9f691be..ef2cc9a 100644 --- a/src/tspi/log.c +++ b/src/tspi/log.c @@ -13,6 +13,7 @@ #include <string.h> #include "trousers/tss.h" +#include "spi_utils.h" #include "tsplog.h" #ifdef TSS_DEBUG @@ -38,12 +39,12 @@ LogBlobData(char *szDescriptor, unsigned long sizeOfBlob, unsigned char *blob) if (getenv("TSS_DEBUG_OFF")) return; - memset(temp, 0, sizeof(temp)); + __tspi_memset(temp, 0, sizeof(temp)); for (i = 0; (unsigned long)i < sizeOfBlob; i++) { if ((i > 0) && ((i % 16) == 0)) { fprintf(stdout, "%s\n", temp); - memset(temp, 0, sizeof(temp)); + __tspi_memset(temp, 0, sizeof(temp)); } snprintf(&temp[(i%16)*3], 4, "%.2X ", blob[i]); } diff --git a/src/tspi/obj_context.c b/src/tspi/obj_context.c index cb2091e..75e4f6b 100644 --- a/src/tspi/obj_context.c +++ b/src/tspi/obj_context.c @@ -133,13 +133,13 @@ obj_context_close(TSS_HCONTEXT tspContext) if (context->transAuth.AuthHandle) { RPC_FlushSpecific(tspContext, context->transAuth.AuthHandle, TPM_RT_TRANS); - memset(&context->transPub, 0, sizeof(TPM_TRANSPORT_PUBLIC)); - memset(&context->transMod, 0, sizeof(TPM_MODIFIER_INDICATOR)); - memset(&context->transSecret, 0, sizeof(TPM_TRANSPORT_AUTH)); - memset(&context->transAuth, 0, sizeof(TPM_AUTH)); - memset(&context->transLogIn, 0, sizeof(TPM_TRANSPORT_LOG_IN)); - memset(&context->transLogOut, 0, sizeof(TPM_TRANSPORT_LOG_OUT)); - memset(&context->transLogDigest, 0, sizeof(TPM_DIGEST)); + __tspi_memset(&context->transPub, 0, sizeof(TPM_TRANSPORT_PUBLIC)); + __tspi_memset(&context->transMod, 0, sizeof(TPM_MODIFIER_INDICATOR)); + __tspi_memset(&context->transSecret, 0, sizeof(TPM_TRANSPORT_AUTH)); + __tspi_memset(&context->transAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&context->transLogIn, 0, sizeof(TPM_TRANSPORT_LOG_IN)); + __tspi_memset(&context->transLogOut, 0, sizeof(TPM_TRANSPORT_LOG_OUT)); + __tspi_memset(&context->transLogDigest, 0, sizeof(TPM_DIGEST)); } #endif @@ -795,7 +795,7 @@ obj_context_transport_establish(TSS_HCONTEXT tspContext, struct tr_context_obj * tcsTransKey = TPM_KH_TRANSPORT; /* If logging is on, do TPM commands spec rev106 step 8.a */ - memset(context->transLogDigest.digest, 0, sizeof(TPM_DIGEST)); + __tspi_memset(context->transLogDigest.digest, 0, sizeof(TPM_DIGEST)); if (context->flags & TSS_CONTEXT_FLAGS_TRANSPORT_AUTHENTIC) { context->transLogIn.tag = TPM_TAG_TRANSPORT_LOG_IN; @@ -809,7 +809,7 @@ obj_context_transport_establish(TSS_HCONTEXT tspContext, struct tr_context_obj * return result; /* step 8.a, ii */ - memset(context->transLogIn.pubKeyHash.digest, 0, sizeof(TPM_DIGEST)); + __tspi_memset(context->transLogIn.pubKeyHash.digest, 0, sizeof(TPM_DIGEST)); /* step 8.a, iii */ result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1); @@ -1113,7 +1113,7 @@ obj_context_transport_execute(TSS_HCONTEXT tspContext, memcpy(context->transLogIn.pubKeyHash.digest, pubKeyHash->digest, sizeof(TPM_DIGEST)); else - memset(context->transLogIn.pubKeyHash.digest, 0, sizeof(TPM_DIGEST)); + __tspi_memset(context->transLogIn.pubKeyHash.digest, 0, sizeof(TPM_DIGEST)); /* TPM Commands spec rev106 step 10.f */ result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1); @@ -1420,13 +1420,13 @@ obj_context_transport_close(TSS_HCONTEXT tspContext, signInfo->dataLen = sizeof(TPM_DIGEST); /* destroy all transport session info, except the key handle */ - memset(&context->transPub, 0, sizeof(TPM_TRANSPORT_PUBLIC)); - memset(&context->transMod, 0, sizeof(TPM_MODIFIER_INDICATOR)); - memset(&context->transSecret, 0, sizeof(TPM_TRANSPORT_AUTH)); - memset(&context->transAuth, 0, sizeof(TPM_AUTH)); - memset(&context->transLogIn, 0, sizeof(TPM_TRANSPORT_LOG_IN)); - memset(&context->transLogOut, 0, sizeof(TPM_TRANSPORT_LOG_OUT)); - memset(&context->transLogDigest, 0, sizeof(TPM_DIGEST)); + __tspi_memset(&context->transPub, 0, sizeof(TPM_TRANSPORT_PUBLIC)); + __tspi_memset(&context->transMod, 0, sizeof(TPM_MODIFIER_INDICATOR)); + __tspi_memset(&context->transSecret, 0, sizeof(TPM_TRANSPORT_AUTH)); + __tspi_memset(&context->transAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&context->transLogIn, 0, sizeof(TPM_TRANSPORT_LOG_IN)); + __tspi_memset(&context->transLogOut, 0, sizeof(TPM_TRANSPORT_LOG_OUT)); + __tspi_memset(&context->transLogDigest, 0, sizeof(TPM_DIGEST)); done_disabled: context->flags &= ~TSS_CONTEXT_FLAGS_TRANSPORT_ESTABLISHED; diff --git a/src/tspi/obj_pcrs.c b/src/tspi/obj_pcrs.c index c36b761..4430300 100644 --- a/src/tspi/obj_pcrs.c +++ b/src/tspi/obj_pcrs.c @@ -250,7 +250,7 @@ obj_pcrs_set_value(TSS_HPCRS hPcrs, UINT32 idx, UINT32 size, BYTE *value) goto done; } select->sizeOfSelect = bytes_to_hold; - memset(select->pcrSelect, 0, bytes_to_hold); + __tspi_memset(select->pcrSelect, 0, bytes_to_hold); /* allocate the pcr array */ if ((pcrs->pcrs = malloc(bytes_to_hold * 8 * @@ -267,8 +267,8 @@ obj_pcrs_set_value(TSS_HPCRS hPcrs, UINT32 idx, UINT32 size, BYTE *value) goto done; } /* set the newly allocated bytes to 0 */ - memset(&select->pcrSelect[select->sizeOfSelect], 0, - bytes_to_hold - select->sizeOfSelect); + __tspi_memset(&select->pcrSelect[select->sizeOfSelect], 0, + bytes_to_hold - select->sizeOfSelect); select->sizeOfSelect = bytes_to_hold; /* realloc the pcrs array */ @@ -427,7 +427,7 @@ obj_pcrs_select_index(TSS_HPCRS hPcrs, UINT32 idx) goto done; } select->sizeOfSelect = bytes_to_hold; - memset(select->pcrSelect, 0, bytes_to_hold); + __tspi_memset(select->pcrSelect, 0, bytes_to_hold); /* alloc the pcrs array */ if ((pcrs->pcrs = malloc(bytes_to_hold * 8 * TCPA_SHA1_160_HASH_LEN)) == NULL) { @@ -443,8 +443,8 @@ obj_pcrs_select_index(TSS_HPCRS hPcrs, UINT32 idx) goto done; } /* set the newly allocated bytes to 0 */ - memset(&select->pcrSelect[select->sizeOfSelect], 0, - bytes_to_hold - select->sizeOfSelect); + __tspi_memset(&select->pcrSelect[select->sizeOfSelect], 0, + bytes_to_hold - select->sizeOfSelect); select->sizeOfSelect = bytes_to_hold; /* realloc the pcrs array */ @@ -514,7 +514,7 @@ obj_pcrs_select_index_ex(TSS_HPCRS hPcrs, UINT32 dir, UINT32 idx) goto done; } select->sizeOfSelect = bytes_to_hold; - memset(select->pcrSelect, 0, bytes_to_hold); + __tspi_memset(select->pcrSelect, 0, bytes_to_hold); /* alloc the pcrs array */ if ((pcrs->pcrs = malloc(bytes_to_hold * 8 * TCPA_SHA1_160_HASH_LEN)) == NULL) { @@ -530,8 +530,8 @@ obj_pcrs_select_index_ex(TSS_HPCRS hPcrs, UINT32 dir, UINT32 idx) goto done; } /* set the newly allocated bytes to 0 */ - memset(&select->pcrSelect[select->sizeOfSelect], 0, - bytes_to_hold - select->sizeOfSelect); + __tspi_memset(&select->pcrSelect[select->sizeOfSelect], 0, + bytes_to_hold - select->sizeOfSelect); select->sizeOfSelect = bytes_to_hold; /* realloc the pcrs array */ @@ -608,7 +608,7 @@ obj_pcrs_create_info(TSS_HPCRS hPcrs, UINT32 *size, BYTE **info) pcrs = (struct tr_pcrs_obj *)obj->data; /* Set everything that is not assigned to be all zeroes */ - memset(&info11, 0, sizeof(info11)); + __tspi_memset(&info11, 0, sizeof(info11)); switch (pcrs->type) { case TSS_PCRS_STRUCT_INFO: @@ -668,7 +668,7 @@ obj_pcrs_create_info_long(TSS_HPCRS hPcrs, UINT32 *size, BYTE **info) pcrs = (struct tr_pcrs_obj *)obj->data; /* Set everything that is not assigned to be all zeroes */ - memset(&infolong, 0, sizeof(infolong)); + __tspi_memset(&infolong, 0, sizeof(infolong)); infolong.tag = TPM_TAG_PCR_INFO_LONG; /* localityAtCreation and creationPCRSelection certainly do not need to be set here, but @@ -732,7 +732,7 @@ obj_pcrs_create_info_short(TSS_HPCRS hPcrs, UINT32 *size, BYTE **info) BYTE *ret; /* Set everything that is not assigned to be all zeroes */ - memset(&infoshort, 0, sizeof(infoshort)); + __tspi_memset(&infoshort, 0, sizeof(infoshort)); if (hPcrs != NULL_HPCRS) { if ((obj = obj_list_get_obj(&pcrs_list, hPcrs)) == NULL) diff --git a/src/tspi/obj_policy.c b/src/tspi/obj_policy.c index e76681b..19c4b22 100644 --- a/src/tspi/obj_policy.c +++ b/src/tspi/obj_policy.c @@ -195,7 +195,7 @@ obj_policy_get_secret(TSS_HPOLICY hPolicy, TSS_BOOL ctx, TCPA_SECRET *secret) policy = (struct tr_policy_obj *)obj->data; - memset(&null_secret, 0, sizeof(TCPA_SECRET)); + __tspi_memset(&null_secret, 0, sizeof(TCPA_SECRET)); switch (policy->SecretMode) { case TSS_SECRET_MODE_POPUP: @@ -247,7 +247,7 @@ obj_policy_flush_secret(TSS_HPOLICY hPolicy) policy = (struct tr_policy_obj *)obj->data; - memset(&policy->Secret, 0, policy->SecretSize); + __tspi_memset(&policy->Secret, 0, policy->SecretSize); policy->SecretSet = FALSE; obj_list_put(&policy_list); @@ -328,7 +328,7 @@ obj_policy_set_secret(TSS_HPOLICY hPolicy, TSS_FLAG mode, UINT32 size, BYTE *dat TSS_BOOL secret_set = TRUE; TSS_RESULT result; - memset(&digest.digest, 0, sizeof(TCPA_DIGEST)); + __tspi_memset(&digest.digest, 0, sizeof(TCPA_DIGEST)); switch (mode) { case TSS_SECRET_MODE_PLAIN: diff --git a/src/tspi/obj_rsakey.c b/src/tspi/obj_rsakey.c index 3f509f1..3e15c6c 100644 --- a/src/tspi/obj_rsakey.c +++ b/src/tspi/obj_rsakey.c @@ -87,7 +87,7 @@ obj_rsakey_add(TSS_HCONTEXT tspContext, TSS_FLAG initFlags, TSS_HOBJECT *phObjec if (initFlags == TSS_KEY_EMPTY_KEY) goto add_key; - memset(&rsaKeyParms, 0, sizeof(TCPA_RSA_KEY_PARMS)); + __tspi_memset(&rsaKeyParms, 0, sizeof(TCPA_RSA_KEY_PARMS)); rsakey->key.algorithmParms.algorithmID = TCPA_ALG_RSA; rsakey->key.algorithmParms.parmSize = sizeof(TCPA_RSA_KEY_PARMS); diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c index 56eb936..c6f9c3d 100644 --- a/src/tspi/ps/tspps.c +++ b/src/tspi/ps/tspps.c @@ -651,7 +651,7 @@ psfile_remove_key(int fd, TSS_UUID *uuid) /* head_offset now contains a pointer to where we want to truncate the * file. Zero out the old tail end of the file and truncate it. */ - memset(buf, 0, sizeof(buf)); + __tspi_memset(buf, 0, sizeof(buf)); /* Zero out the old tail end of the file */ if ((result = write_data(fd, (void *)buf, tail_offset - head_offset))) { @@ -916,7 +916,7 @@ restart_search: free(keyinfos); return TSPERR(TSS_E_OUTOFMEMORY); } - memset(&keyinfos[j], 0, sizeof(TSS_KM_KEYINFO)); + __tspi_memset(&keyinfos[j], 0, sizeof(TSS_KM_KEYINFO)); if ((result = copy_key_info(fd, &keyinfos[j], &cache_entries[i]))) { free(cache_entries); @@ -1006,7 +1006,7 @@ psfile_get_registered_keys2(int fd, } /* Here the key UUID is found and needs to be copied for the array*/ /* Initializes the keyinfos with 0's*/ - memset(&keyinfos[j], 0, sizeof(TSS_KM_KEYINFO2)); + __tspi_memset(&keyinfos[j], 0, sizeof(TSS_KM_KEYINFO2)); if ((result = copy_key_info2(fd, &keyinfos[j], &cache_entries[i]))) { free(cache_entries); diff --git a/src/tspi/rpc/tcstp/rpc.c b/src/tspi/rpc/tcstp/rpc.c index 04cc6e8..3b4ed12 100644 --- a/src/tspi/rpc/tcstp/rpc.c +++ b/src/tspi/rpc/tcstp/rpc.c @@ -37,13 +37,13 @@ void initData(struct tcsd_comm_data *comm, int parm_count) { /* min packet size should be the size of the header */ - memset(&comm->hdr, 0, sizeof(struct tcsd_packet_hdr)); + __tspi_memset(&comm->hdr, 0, sizeof(struct tcsd_packet_hdr)); comm->hdr.packet_size = sizeof(struct tcsd_packet_hdr); comm->hdr.type_offset = sizeof(struct tcsd_packet_hdr); comm->hdr.parm_offset = comm->hdr.type_offset + (sizeof(TCSD_PACKET_TYPE) * parm_count); comm->hdr.packet_size = comm->hdr.parm_offset; - memset(comm->buf, 0, comm->buf_size); + __tspi_memset(comm->buf, 0, comm->buf_size); } int @@ -352,7 +352,7 @@ send_init(struct host_table_entry *hte) goto err_exit; } - memset(&addr, 0, sizeof(addr)); + __tspi_memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(get_port()); diff --git a/src/tspi/rpc/tcstp/rpc_admin.c b/src/tspi/rpc/tcstp/rpc_admin.c index e29726e..aae6b91 100644 --- a/src/tspi/rpc/tcstp/rpc_admin.c +++ b/src/tspi/rpc/tcstp/rpc_admin.c @@ -273,7 +273,7 @@ RPC_SetTempDeactivated2_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 1, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } diff --git a/src/tspi/rpc/tcstp/rpc_audit.c b/src/tspi/rpc/tcstp/rpc_audit.c index 63cc0e2..5b828f4 100644 --- a/src/tspi/rpc/tcstp/rpc_audit.c +++ b/src/tspi/rpc/tcstp/rpc_audit.c @@ -16,6 +16,7 @@ #include "trousers/tss.h" #include "trousers/trousers.h" #include "trousers_types.h" +#include "spi_utils.h" #include "tsplog.h" #include "hosttable.h" #include "tcsd_wrap.h" @@ -158,7 +159,7 @@ RPC_GetAuditDigestSigned_TP(struct host_table_entry *hte, hte->comm.hdr.u.ordinal = TCSD_ORD_GETAUDITDIGESTSIGNED; LogDebugFn("TCS Context: 0x%x", hte->tcsContext); - memset(&null_auth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&null_auth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); diff --git a/src/tspi/rpc/tcstp/rpc_certify.c b/src/tspi/rpc/tcstp/rpc_certify.c index 3568c94..3c9a0c8 100644 --- a/src/tspi/rpc/tcstp/rpc_certify.c +++ b/src/tspi/rpc/tcstp/rpc_certify.c @@ -42,7 +42,7 @@ RPC_CertifyKey_TP(struct host_table_entry *hte, int i; initData(&hte->comm, 6); - memset(&null_auth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&null_auth, 0, sizeof(TPM_AUTH)); hte->comm.hdr.u.ordinal = TCSD_ORD_CERTIFYKEY; LogDebugFn("TCS Context: 0x%x", hte->tcsContext); diff --git a/src/tspi/rpc/tcstp/rpc_cmk.c b/src/tspi/rpc/tcstp/rpc_cmk.c index ef8dfd5..c9db6e6 100644 --- a/src/tspi/rpc/tcstp/rpc_cmk.c +++ b/src/tspi/rpc/tcstp/rpc_cmk.c @@ -16,6 +16,7 @@ #include "trousers/tss.h" #include "trousers/trousers.h" #include "trousers_types.h" +#include "spi_utils.h" #include "tsplog.h" #include "hosttable.h" #include "tcsd_wrap.h" @@ -123,7 +124,7 @@ RPC_CMK_CreateKey_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 7, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -266,7 +267,7 @@ RPC_CMK_CreateBlob_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 14, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -359,7 +360,7 @@ RPC_CMK_ConvertMigration_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 10, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } diff --git a/src/tspi/rpc/tcstp/rpc_delegate.c b/src/tspi/rpc/tcstp/rpc_delegate.c index d4b6ac2..dd55e43 100644 --- a/src/tspi/rpc/tcstp/rpc_delegate.c +++ b/src/tspi/rpc/tcstp/rpc_delegate.c @@ -55,7 +55,7 @@ RPC_Delegate_Manage_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 5, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -120,7 +120,7 @@ RPC_Delegate_CreateKeyDelegation_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 5, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -185,7 +185,7 @@ RPC_Delegate_CreateOwnerDelegation_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 5, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -244,7 +244,7 @@ RPC_Delegate_LoadOwnerDelegation_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 4, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } @@ -345,7 +345,7 @@ RPC_Delegate_UpdateVerificationCount_TP(struct host_table_entry *hte, } else { TPM_AUTH nullAuth; - memset(&nullAuth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&nullAuth, 0, sizeof(TPM_AUTH)); if (setData(TCSD_PACKET_TYPE_AUTH, 3, &nullAuth, 0, &hte->comm)) return TSPERR(TSS_E_INTERNAL_ERROR); } diff --git a/src/tspi/rpc/tcstp/rpc_migration.c b/src/tspi/rpc/tcstp/rpc_migration.c index 43f7f27..cf272e1 100644 --- a/src/tspi/rpc/tcstp/rpc_migration.c +++ b/src/tspi/rpc/tcstp/rpc_migration.c @@ -45,7 +45,7 @@ RPC_CreateMigrationBlob_TP(struct host_table_entry *hte, UINT32 i; initData(&hte->comm, 9); - memset(&null_auth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&null_auth, 0, sizeof(TPM_AUTH)); hte->comm.hdr.u.ordinal = TCSD_ORD_CREATEMIGRATIONBLOB; LogDebugFn("TCS Context: 0x%x", hte->tcsContext); diff --git a/src/tspi/rpc/tcstp/rpc_transport.c b/src/tspi/rpc/tcstp/rpc_transport.c index 91102cc..6e12696 100644 --- a/src/tspi/rpc/tcstp/rpc_transport.c +++ b/src/tspi/rpc/tcstp/rpc_transport.c @@ -138,7 +138,7 @@ RPC_ExecuteTransport_TP(struct host_table_entry *hte, TPM_AUTH null_auth; UINT32 i = 0; - memset(&null_auth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&null_auth, 0, sizeof(TPM_AUTH)); initData(&hte->comm, 9); hte->comm.hdr.u.ordinal = TCSD_ORD_EXECUTETRANSPORT; @@ -283,7 +283,7 @@ RPC_ReleaseTransportSigned_TP(struct host_table_entry *hte, TSS_RESULT result; TPM_AUTH null_auth; - memset(&null_auth, 0, sizeof(TPM_AUTH)); + __tspi_memset(&null_auth, 0, sizeof(TPM_AUTH)); initData(&hte->comm, 5); hte->comm.hdr.u.ordinal = TCSD_ORD_RELEASETRANSPORTSIGNED; diff --git a/src/tspi/ssl_ui.c b/src/tspi/ssl_ui.c index 7e4ab0e..380389d 100644 --- a/src/tspi/ssl_ui.c +++ b/src/tspi/ssl_ui.c @@ -49,7 +49,7 @@ static TSS_RESULT do_ui(BYTE *string, UINT32 *string_len, BYTE *popup, int verif ret = TSS_SUCCESS; unicode = Trspi_Native_To_UNICODE((BYTE *)pin_buf, string_len); - memset(string, 0, UI_MAX_SECRET_STRING_LENGTH); + __tspi_memset(string, 0, UI_MAX_SECRET_STRING_LENGTH); memcpy(string, unicode, *string_len); free(unicode); out: diff --git a/src/tspi/tsp_context_mem.c b/src/tspi/tsp_context_mem.c index 13f1243..2982df9 100644 --- a/src/tspi/tsp_context_mem.c +++ b/src/tspi/tsp_context_mem.c @@ -256,3 +256,10 @@ free_tspi(TSS_HCONTEXT tspContext, void *memPointer) return result; } + +/* definition for a memset that cannot be optimized away */ +void * __no_optimize +__tspi_memset(void *s, int c, size_t n) +{ + return memset(s, c, n); +} diff --git a/src/tspi/tsp_daa.c b/src/tspi/tsp_daa.c index 5afbf96..f8fb477 100644 --- a/src/tspi/tsp_daa.c +++ b/src/tspi/tsp_daa.c @@ -69,7 +69,7 @@ Trspi_UnloadBlob_DAA_PK(UINT64 *offset, BYTE *blob, TSS_DAA_PK *pk) { UINT32 i = 0, j; - memset(pk, 0, sizeof(TSS_DAA_PK)); + __tspi_memset(pk, 0, sizeof(TSS_DAA_PK)); Trspi_UnloadBlob_TSS_VERSION(offset, blob, &pk->versionInfo); @@ -201,7 +201,7 @@ error: } free(pk->issuerBaseName); - memset(pk, 0, sizeof(TSS_DAA_PK)); + __tspi_memset(pk, 0, sizeof(TSS_DAA_PK)); return TSPERR(TSS_E_OUTOFMEMORY); } diff --git a/src/tspi/tsp_delegate.c b/src/tspi/tsp_delegate.c index 8a9ec68..02e2c23 100644 --- a/src/tspi/tsp_delegate.c +++ b/src/tspi/tsp_delegate.c @@ -392,7 +392,7 @@ __tspi_build_delegate_public_info(BYTE bLabel, if ((result = obj_pcrs_create_info_short(hPcrs, &pcrInfoSize, &pcrInfo))) return result; - memset(&public, 0, sizeof(public)); + __tspi_memset(&public, 0, sizeof(public)); public.tag = TPM_TAG_DELEGATE_PUBLIC; public.label.label = bLabel; offset = 0; diff --git a/src/tspi/tsp_pcr.c b/src/tspi/tsp_pcr.c index cc562d7..68db694 100644 --- a/src/tspi/tsp_pcr.c +++ b/src/tspi/tsp_pcr.c @@ -116,8 +116,8 @@ pcrs_sanity_check_selection(TSS_HCONTEXT tspContext, return TSPERR(TSS_E_OUTOFMEMORY); } /* set the newly allocated bytes to 0 */ - memset(&select->pcrSelect[select->sizeOfSelect], 0, - bytes_to_hold - select->sizeOfSelect); + __tspi_memset(&select->pcrSelect[select->sizeOfSelect], 0, + bytes_to_hold - select->sizeOfSelect); select->sizeOfSelect = bytes_to_hold; /* realloc the pcr array as well */ diff --git a/src/tspi/tsp_policy.c b/src/tspi/tsp_policy.c index 9d5ec5d..1e94098 100644 --- a/src/tspi/tsp_policy.c +++ b/src/tspi/tsp_policy.c @@ -77,7 +77,7 @@ popup_GetSecret(UINT32 new_pin, UINT32 hash_mode, BYTE *popup_str, void *auth_ha result = Trspi_Hash(TSS_HASH_SHA1, secret_len, secret, auth_hash); /* zero, then unpin the memory */ - memset(secret, 0, secret_len); + __tspi_memset(secret, 0, secret_len); unpin_mem(&secret, UI_MAX_SECRET_STRING_LENGTH); return result; diff --git a/src/tspi/tsp_ps.c b/src/tspi/tsp_ps.c index 96c267a..8dca6ed 100644 --- a/src/tspi/tsp_ps.c +++ b/src/tspi/tsp_ps.c @@ -297,7 +297,7 @@ load_from_system_ps(TSS_HCONTEXT tspContext, TSS_UUID *uuid, TSS_HKEY *phKey) TCS_LOADKEY_INFO info; BYTE *keyBlob = NULL; - memset(&info, 0, sizeof(TCS_LOADKEY_INFO)); + __tspi_memset(&info, 0, sizeof(TCS_LOADKEY_INFO)); result = TCSP_LoadKeyByUUID(tspContext, uuidData, &info, &tcsKeyHandle); diff --git a/src/tspi/tspi_aik.c b/src/tspi/tspi_aik.c index 9476341..54dd729 100644 --- a/src/tspi/tspi_aik.c +++ b/src/tspi/tspi_aik.c @@ -103,7 +103,7 @@ Tspi_TPM_CollateIdentityRequest(TSS_HTPM hTPM, /* in */ return result; /* setup the symmetric key's parms. */ - memset(&symParms, 0, sizeof(TCPA_KEY_PARMS)); + __tspi_memset(&symParms, 0, sizeof(TCPA_KEY_PARMS)); switch (algID) { case TSS_ALG_AES: symParms.algorithmID = TCPA_ALG_AES; @@ -155,7 +155,7 @@ Tspi_TPM_CollateIdentityRequest(TSS_HTPM hTPM, /* in */ return result; offset = 0; - memset(&caKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&caKey, 0, sizeof(TSS_KEY)); if ((result = UnloadBlob_TSS_KEY(&offset, caKeyBlob, &caKey))) return result; diff --git a/src/tspi/tspi_audit.c b/src/tspi/tspi_audit.c index 1c13ca1..5ee3abb 100644 --- a/src/tspi/tspi_audit.c +++ b/src/tspi/tspi_audit.c @@ -198,7 +198,7 @@ done1: &sig))) return result; - memset(&signInfo, 0, sizeof(signInfo)); + __tspi_memset(&signInfo, 0, sizeof(signInfo)); signInfo.tag = TPM_TAG_SIGNINFO; memcpy(signInfo.fixed, "ADIG", strlen("ADIG")); signInfo.replay = antiReplay; diff --git a/src/tspi/tspi_changeauth.c b/src/tspi/tspi_changeauth.c index 1d6d8f1..37d35d6 100644 --- a/src/tspi/tspi_changeauth.c +++ b/src/tspi/tspi_changeauth.c @@ -290,7 +290,7 @@ Tspi_ChangeAuthAsym(TSS_HOBJECT hObjectToChange, /* in */ &keyObjectSize, &keyObject))) return result; - memset(&keyContainer, 0, sizeof(TSS_KEY)); + __tspi_memset(&keyContainer, 0, sizeof(TSS_KEY)); offset = 0; if ((result = UnloadBlob_TSS_KEY(&offset, diff --git a/src/tspi/tspi_cmk.c b/src/tspi/tspi_cmk.c index 6ced203..6ded97b 100644 --- a/src/tspi/tspi_cmk.c +++ b/src/tspi/tspi_cmk.c @@ -223,7 +223,7 @@ Tspi_Key_CMKCreateBlob(TSS_HKEY hKeyToMigrate, /* in */ UINT64 offset; TSS_RESULT result; - memset(&tssKey, 0, sizeof(tssKey)); + __tspi_memset(&tssKey, 0, sizeof(tssKey)); if (!pulRandomLength || !prgbRandom) return TSPERR(TSS_E_BAD_PARAMETER); diff --git a/src/tspi/tspi_ek.c b/src/tspi/tspi_ek.c index d1b2065..6fc5f0b 100644 --- a/src/tspi/tspi_ek.c +++ b/src/tspi/tspi_ek.c @@ -41,8 +41,8 @@ Tspi_TPM_CreateEndorsementKey(TSS_HTPM hTPM, /* in */ TCPA_PUBKEY pubEK; Trspi_HashCtx hashCtx; - memset(&pubEK, 0, sizeof(TCPA_PUBKEY)); - memset(&dummyKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&pubEK, 0, sizeof(TCPA_PUBKEY)); + __tspi_memset(&dummyKey, 0, sizeof(TSS_KEY)); if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext))) return result; @@ -149,7 +149,7 @@ Tspi_TPM_GetPubEndorsementKey(TSS_HTPM hTPM, /* in */ TCPA_PUBKEY pubKey; Trspi_HashCtx hashCtx; - memset(&pubKey, 0, sizeof(TCPA_PUBKEY)); + __tspi_memset(&pubKey, 0, sizeof(TCPA_PUBKEY)); if (phEndorsementPubKey == NULL) return TSPERR(TSS_E_BAD_PARAMETER); @@ -194,7 +194,7 @@ Tspi_TPM_GetPubEndorsementKey(TSS_HTPM hTPM, /* in */ * Atmel chips specifically. */ offset = 0; - memset(&pubKey, 0, sizeof(TCPA_PUBKEY)); + __tspi_memset(&pubKey, 0, sizeof(TCPA_PUBKEY)); if ((result = Trspi_UnloadBlob_PUBKEY(&offset, pubEK, &pubKey))) goto done; @@ -281,9 +281,9 @@ Tspi_TPM_CreateRevocableEndorsementKey(TSS_HTPM hTPM, /* in */ TPM_PUBKEY pubEK; Trspi_HashCtx hashCtx; - memset(&pubEK, 0, sizeof(TPM_PUBKEY)); - memset(&dummyKey, 0, sizeof(TSS_KEY)); - memset(&eKResetAuth, 0xff, sizeof(eKResetAuth)); + __tspi_memset(&pubEK, 0, sizeof(TPM_PUBKEY)); + __tspi_memset(&dummyKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&eKResetAuth, 0xff, sizeof(eKResetAuth)); if (!pulEkResetDataLength || !prgbEkResetData) return TSPERR(TSS_E_BAD_PARAMETER); diff --git a/src/tspi/tspi_key.c b/src/tspi/tspi_key.c index 5acd605..bfead42 100644 --- a/src/tspi/tspi_key.c +++ b/src/tspi/tspi_key.c @@ -385,7 +385,7 @@ Tspi_Key_WrapKey(TSS_HKEY hKey, /* in */ if ((result = obj_policy_get_secret(hMigPolicy, TR_SECRET_CTX_NEW, &migration))) goto done; - memset(&keyContainer, 0, sizeof(TSS_KEY)); + __tspi_memset(&keyContainer, 0, sizeof(TSS_KEY)); /* unload the key to be wrapped's blob */ offset = 0; diff --git a/src/tspi/tspi_migration.c b/src/tspi/tspi_migration.c index 83b73f4..39bf712 100644 --- a/src/tspi/tspi_migration.c +++ b/src/tspi/tspi_migration.c @@ -83,7 +83,7 @@ Tspi_TPM_AuthorizeMigrationTicket(TSS_HTPM hTPM, /* in */ /* First, turn the keyBlob into a TSS_KEY structure */ offset = 0; - memset(&tssKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&tssKey, 0, sizeof(TSS_KEY)); if ((result = UnloadBlob_TSS_KEY(&offset, migrationKeyBlob, &tssKey))) { free_tspi(tspContext, migrationKeyBlob); return result; @@ -172,7 +172,7 @@ Tspi_Key_CreateMigrationBlob(TSS_HKEY hKeyToMigrate, /* in */ TSS_HCONTEXT tspContext; Trspi_HashCtx hashCtx; - memset(&tssKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&tssKey, 0, sizeof(TSS_KEY)); if (pulRandomLength == NULL || prgbRandom == NULL || rgbMigTicket == NULL || pulMigrationBlobLength == NULL || prgbMigrationBlob == NULL) @@ -196,7 +196,7 @@ Tspi_Key_CreateMigrationBlob(TSS_HKEY hKeyToMigrate, /* in */ goto done; /* Parsing the migration scheme from the blob and key object */ - memset(&migAuth, 0, sizeof(TCPA_MIGRATIONKEYAUTH)); + __tspi_memset(&migAuth, 0, sizeof(TCPA_MIGRATIONKEYAUTH)); offset = 0; if ((result = Trspi_UnloadBlob_MIGRATIONKEYAUTH(&offset, rgbMigTicket, &migAuth))) @@ -324,7 +324,7 @@ Tspi_Key_ConvertMigrationBlob(TSS_HKEY hKeyToMigrate, /* in */ Trspi_HashCtx hashCtx; UINT64 offset; - memset(&tssKey, 0, sizeof(TSS_KEY)); + __tspi_memset(&tssKey, 0, sizeof(TSS_KEY)); if ((result = obj_rsakey_get_tsp_context(hKeyToMigrate, &tspContext))) return result; diff --git a/src/tspi/tspi_nv.c b/src/tspi/tspi_nv.c index bdf10ad..709b6ec 100644 --- a/src/tspi/tspi_nv.c +++ b/src/tspi/tspi_nv.c @@ -69,7 +69,7 @@ Tspi_NV_DefineSpace(TSS_HNVSTORE hNvstore, /* in */ if ((result = obj_nvstore_get_tsp_context(hNvstore, &tspContext))) return result; - memset(&nv_data_public, 0, sizeof(NV_DATA_PUBLIC)); + __tspi_memset(&nv_data_public, 0, sizeof(NV_DATA_PUBLIC)); if ((result = obj_nvstore_get_index(hNvstore, &nv_data_public.nvIndex))) return result; @@ -184,7 +184,7 @@ Tspi_NV_ReleaseSpace(TSS_HNVSTORE hNvstore) /* in */ Trspi_HashCtx hashCtx; struct authsess *xsap = NULL; - memset(&nv_data_public, 0, sizeof(NV_DATA_PUBLIC)); + __tspi_memset(&nv_data_public, 0, sizeof(NV_DATA_PUBLIC)); if ((result = obj_nvstore_get_tsp_context(hNvstore, &tspContext))) return result; diff --git a/src/tspi/tspi_ps.c b/src/tspi/tspi_ps.c index b6df78c..bde3e53 100644 --- a/src/tspi/tspi_ps.c +++ b/src/tspi/tspi_ps.c @@ -58,7 +58,7 @@ Tspi_Context_LoadKeyByUUID(TSS_HCONTEXT tspContext, /* in */ /* This key is in the System Persistant storage */ if (persistentStorageType == TSS_PS_TYPE_SYSTEM) { #if 1 - memset(&info, 0, sizeof(TCS_LOADKEY_INFO)); + __tspi_memset(&info, 0, sizeof(TCS_LOADKEY_INFO)); result = RPC_LoadKeyByUUID(tspContext, uuidData, &info, &tcsKeyHandle); diff --git a/src/tspi/tspi_quote.c b/src/tspi/tspi_quote.c index 4615ece..f634207 100644 --- a/src/tspi/tspi_quote.c +++ b/src/tspi/tspi_quote.c @@ -125,7 +125,7 @@ Tspi_TPM_Quote(TSS_HTPM hTPM, /* in */ if (hPcrComposite) { TCPA_PCR_COMPOSITE pcrComp; - memset(&pcrComp, 0, sizeof(pcrComp)); + __tspi_memset(&pcrComp, 0, sizeof(pcrComp)); offset = 0; if ((result = Trspi_UnloadBlob_PCR_COMPOSITE(&offset, pcrDataOut, &pcrComp))) { free(pcrDataOut); @@ -156,7 +156,7 @@ Tspi_TPM_Quote(TSS_HTPM hTPM, /* in */ /* create the validation data */ offset = 0; - memset(&keyContainer, 0, sizeof(TSS_KEY)); + __tspi_memset(&keyContainer, 0, sizeof(TSS_KEY)); if ((result = UnloadBlob_TSS_KEY(&offset, keyData, &keyContainer))) return result; diff --git a/src/tspi/tspi_quote2.c b/src/tspi/tspi_quote2.c index 584f097..1ead481 100644 --- a/src/tspi/tspi_quote2.c +++ b/src/tspi/tspi_quote2.c @@ -191,7 +191,7 @@ Tspi_TPM_Quote2(TSS_HTPM hTPM, // in } /* generate TPM_QUOTE_INFO2 struct */ - memset("einfo, 0, sizeof(quoteinfo)); + __tspi_memset("einfo, 0, sizeof(quoteinfo)); offset = 0; /* 1. Add Structure TAG */ quoteinfo[offset++] = 0x00; diff --git a/src/tspi/tspi_selftest.c b/src/tspi/tspi_selftest.c index 2cd31d2..cdba02f 100644 --- a/src/tspi/tspi_selftest.c +++ b/src/tspi/tspi_selftest.c @@ -125,7 +125,7 @@ Tspi_TPM_CertifySelfTest(TSS_HTPM hTPM, /* in */ } offset = 0; - memset(&keyContainer, 0, sizeof(TSS_KEY)); + __tspi_memset(&keyContainer, 0, sizeof(TSS_KEY)); if ((result = UnloadBlob_TSS_KEY(&offset, keyData, &keyContainer))) return result; http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=dbdbf1fdcb46bdf65ad186e3eb0b0556df500e39 commit dbdbf1fdcb46bdf65ad186e3eb0b0556df500e39 Author: Kent Yoder <ke...@li...> Date: Thu May 9 10:25:39 2013 -0500 manpages: Only build DAA man pages when DAA code is built. Signed-off-by: Kent Yoder <ke...@li...> diff --git a/man/man3/Makefile.am b/man/man3/Makefile.am index 0cf6127..14b4986 100644 --- a/man/man3/Makefile.am +++ b/man/man3/Makefile.am @@ -73,18 +73,20 @@ man3_MANS = Tspi_ChangeAuth.3 \ Tspi_TPM_SetStatus.3 \ Tspi_TPM_StirRandom.3 \ Tspi_TPM_TakeOwnership.3 \ - Tspi_DAA_IssueCredential.3 \ - Tspi_DAA_VerifySignature.3 \ - Tspi_DAA_IssueInit.3 \ - Tspi_TPM_DAA_JoinCreateDaaPubKey.3 \ - Tspi_DAA_IssuerKeyVerification.3 \ - Tspi_TPM_DAA_JoinInit.3 \ - Tspi_DAA_IssueSetup.3 \ - Tspi_TPM_DAA_JoinStoreCredential.3 \ - Tspi_DAA_VerifyInit.3 \ - Tspi_TPM_DAA_Sign.3 \ Tspi_TPM_GetAuditDigest.3 \ Tspi_TPM_OwnerGetSRKPubKey.3 \ Tspi_TPM_Quote.3 \ Tspi_TPM_CMKSetRestrictions.3 +if TSS_BUILD_DAA +man3_MANS += Tspi_DAA_IssueCredential.3 \ + Tspi_DAA_VerifySignature.3 \ + Tspi_DAA_IssueInit.3 \ + Tspi_TPM_DAA_JoinCreateDaaPubKey.3 \ + Tspi_DAA_IssuerKeyVerification.3 \ + Tspi_TPM_DAA_JoinInit.3 \ + Tspi_DAA_IssueSetup.3 \ + Tspi_TPM_DAA_JoinStoreCredential.3 \ + Tspi_DAA_VerifyInit.3 \ + Tspi_TPM_DAA_Sign.3 +endif EXTRA_DIST = $(man3_MANS) http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=2ff2601c96d4c6899fa54fcbd4a54e8af41a6e48 commit 2ff2601c96d4c6899fa54fcbd4a54e8af41a6e48 Author: Andreas Fuchs <and...@si...> Date: Thu May 9 08:45:16 2013 -0500 tcs/tcsi_evlog: Fix overflow condition in calc'ing last event Signed-off-by: Kent Yoder <ke...@li...> Signed-off-by: Andreas Fuchs <and...@si...> diff --git a/src/tcs/tcsi_evlog.c b/src/tcs/tcsi_evlog.c index 7d49600..2d048c7 100644 --- a/src/tcs/tcsi_evlog.c +++ b/src/tcs/tcsi_evlog.c @@ -248,6 +248,11 @@ TCS_GetPcrEventsByPcr_Internal(TCS_CONTEXT_HANDLE hContext, /* in */ if (PcrIndex >= tpm_metrics.num_pcrs) return TCSERR(TSS_E_BAD_PARAMETER); + if (*pEventCount == 0) { + *ppEvents = NULL; + return TSS_SUCCESS; + } + /* if this is a kernel or firmware controlled PCR, call an external routine */ if ((tcsd_options.kernel_pcrs & (1 << PcrIndex)) || (tcsd_options.firmware_pcrs & (1 << PcrIndex))) { @@ -266,9 +271,11 @@ TCS_GetPcrEventsByPcr_Internal(TCS_CONTEXT_HANDLE hContext, /* in */ MUTEX_UNLOCK(tcs_event_log->lock); /* if pEventCount is larger than the number of events to return, just return less. - * *pEventCount will be set to the number returned below. + * *pEventCount will be set to the number returned below. First, check for overflow. */ - lastEventNumber = MIN(lastEventNumber, FirstEvent + *pEventCount); + if ((FirstEvent + *pEventCount) >= FirstEvent && + (FirstEvent + *pEventCount) >= *pEventCount) + lastEventNumber = MIN(lastEventNumber, FirstEvent + *pEventCount); if (FirstEvent > lastEventNumber) return TCSERR(TSS_E_BAD_PARAMETER); http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=cb962cfad7e3a6cfcb5f883fd8e8406a31260493 commit cb962cfad7e3a6cfcb5f883fd8e8406a31260493 Author: Kent Yoder <ke...@li...> Date: Thu Apr 11 12:15:46 2013 -0500 tspi/context: add case in Tspi_Context_CloseObject for NV Signed-off-by: Kent Yoder <ke...@li...> diff --git a/src/tspi/tspi_context.c b/src/tspi/tspi_context.c index c935a28..77f7999 100644 --- a/src/tspi/tspi_context.c +++ b/src/tspi/tspi_context.c @@ -359,6 +359,10 @@ Tspi_Context_CloseObject(TSS_HCONTEXT tspContext, /* in */ #ifdef TSS_BUILD_CMK result = obj_migdata_remove(hObject, tspContext); #endif + } else if (obj_is_nvstore(hObject)) { +#ifdef TSS_BUILD_NV + result = obj_nvstore_remove(hObject, tspContext); +#endif } else { result = TSPERR(TSS_E_INVALID_HANDLE); } http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=801796399cbe481af8774fa935810f617c15b94e commit 801796399cbe481af8774fa935810f617c15b94e Author: Kent Yoder <ke...@li...> Date: Fri Mar 22 10:53:43 2013 -0500 Return success in owner_evict_init() in the case where the last key we query for status returns TPM_E_INVALID_KEYHANDLE. Reported-by: Jan Just Keijser <ja...@ni...> Signed-off-by: Kent Yoder <ke...@li...> diff --git a/src/tcs/tcs_key_mem_cache.c b/src/tcs/tcs_key_mem_cache.c index 4db0259..ccff339 100644 --- a/src/tcs/tcs_key_mem_cache.c +++ b/src/tcs/tcs_key_mem_cache.c @@ -1099,8 +1099,11 @@ owner_evict_init() sizeof(UINT32), (BYTE *)&keyHandle, &respDataSize, &respData); /* special case, invalid keys are automatically evicted later */ - if (result == TPM_E_INVALID_KEYHANDLE) + if (result == TPM_E_INVALID_KEYHANDLE) { + result = TSS_SUCCESS; continue; + } + if (result != TSS_SUCCESS) { free(keyList.handle); return result; http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=a8f9d44221455eeabce72d761938b5974626df10 commit a8f9d44221455eeabce72d761938b5974626df10 Author: Kent Yoder <ke...@li...> Date: Thu Mar 7 15:14:55 2013 -0600 evlog imaem: remove printfs Signed-off-by: Kent Yoder <ke...@li...> diff --git a/src/tcs/tcs_evlog_imaem.c b/src/tcs/tcs_evlog_imaem.c index 0b4922c..5cb8d20 100644 --- a/src/tcs/tcs_evlog_imaem.c +++ b/src/tcs/tcs_evlog_imaem.c @@ -168,9 +168,7 @@ ima_get_entries_by_pcr(FILE *handle, UINT32 pcr_index, UINT32 first, } copied_events++; -printf("%d %s ", copied_events, name); -printf("%s\n", cur->event.rgbEvent); if (copied_events == *count) goto copy_events; @@ -188,7 +186,6 @@ copy_events: /* we've copied all the events we need to from this PCR, now * copy them all into one contiguous memory block */ -printf("copied_events: %d\n", copied_events); *events = calloc(copied_events, sizeof(TSS_PCR_EVENT)); if (*events == NULL) { LogError("malloc of %zd bytes failed.", copied_events * sizeof(TSS_PCR_EVENT)); @@ -333,7 +330,6 @@ ima_get_entry(FILE *handle, UINT32 pcr_index, UINT32 *num, TSS_PCR_EVENT **ppEve } fseek(fp, len, SEEK_CUR); seen_indices++; - printf("%d - index\n", seen_indices); } done: if (ppEvent == NULL) http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=1ea392107d5eed2aab31ded9d4dc485df6d264ab commit 1ea392107d5eed2aab31ded9d4dc485df6d264ab Author: Kent Yoder <ke...@li...> Date: Fri Jan 18 08:51:34 2013 -0600 transport: use the TPM_RT_TRANSPORT key handle Use the special key handle to establish the transport session when the session is unencrypted. Signed-off-by: Kent Yoder <ke...@li...> diff --git a/src/tcs/tcsi_transport.c b/src/tcs/tcsi_transport.c index ce47e09..488221f 100644 --- a/src/tcs/tcsi_transport.c +++ b/src/tcs/tcsi_transport.c @@ -42,7 +42,7 @@ TCSP_EstablishTransport_Internal(TCS_CONTEXT_HANDLE hContext, TSS_RESULT result; UINT32 paramSize; UINT64 offset; - TPM_KEY_HANDLE keySlot = 0; + TPM_KEY_HANDLE keySlot = TPM_KH_TRANSPORT; BYTE txBlob[TSS_TPM_TXBLOB_SIZE]; if ((result = ctx_verify_context(hContext))) http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=514d6c4ff069ff0b509334d3bd124491abd0b688 commit 514d6c4ff069ff0b509334d3bd124491abd0b688 Author: Kent Yoder <ke...@li...> Date: Mon Jan 7 17:28:16 2013 -0600 man: Updated tcsd.8.in for correct driver info Signed-off-by: Kent Yoder <ke...@li...> diff --git a/man/man8/tcsd.8.in b/man/man8/tcsd.8.in index 721538e..d4b1a33 100644 --- a/man/man8/tcsd.8.in +++ b/man/man8/tcsd.8.in @@ -93,8 +93,9 @@ can be supressed by setting the TSS_DEBUG_OFF environment variable. .SH "DEVICE DRIVERS" .PP \fBtcsd\fR is compatible with the IBM Research TPM device driver available -from http://www.research.ibm.com/gsal/tcpa and the TPM device driver available -from http://sf.net/projects/tmpdd +from http://ibmswtpm.sourceforge.net/ and the TPM device driver available +from http://sf.net/projects/tpmdd, which is also available in the upstream +Linux kernel and many Linux distros. .SH "CONFORMING TO" .PP ----------------------------------------------------------------------- Summary of changes: man/man3/Makefile.am | 22 ++++++++++++---------- man/man8/tcsd.8.in | 5 +++-- src/include/spi_utils.h | 7 +++++++ src/tcs/tcs_evlog_imaem.c | 4 ---- src/tcs/tcs_key_mem_cache.c | 5 ++++- src/tcs/tcsi_evlog.c | 11 +++++++++-- src/tcs/tcsi_transport.c | 2 +- src/tspi/gtk/main.c | 4 ++-- src/tspi/log.c | 5 +++-- src/tspi/obj_context.c | 34 +++++++++++++++++----------------- src/tspi/obj_pcrs.c | 24 ++++++++++++------------ src/tspi/obj_policy.c | 6 +++--- src/tspi/obj_rsakey.c | 2 +- src/tspi/ps/tspps.c | 6 +++--- src/tspi/rpc/tcstp/rpc.c | 6 +++--- src/tspi/rpc/tcstp/rpc_admin.c | 2 +- src/tspi/rpc/tcstp/rpc_audit.c | 3 ++- src/tspi/rpc/tcstp/rpc_certify.c | 2 +- src/tspi/rpc/tcstp/rpc_cmk.c | 7 ++++--- src/tspi/rpc/tcstp/rpc_delegate.c | 10 +++++----- src/tspi/rpc/tcstp/rpc_migration.c | 2 +- src/tspi/rpc/tcstp/rpc_transport.c | 4 ++-- src/tspi/ssl_ui.c | 2 +- src/tspi/tsp_context_mem.c | 7 +++++++ src/tspi/tsp_daa.c | 4 ++-- src/tspi/tsp_delegate.c | 2 +- src/tspi/tsp_pcr.c | 4 ++-- src/tspi/tsp_policy.c | 2 +- src/tspi/tsp_ps.c | 2 +- src/tspi/tspi_aik.c | 4 ++-- src/tspi/tspi_audit.c | 2 +- src/tspi/tspi_changeauth.c | 2 +- src/tspi/tspi_cmk.c | 2 +- src/tspi/tspi_context.c | 4 ++++ src/tspi/tspi_ek.c | 14 +++++++------- src/tspi/tspi_key.c | 2 +- src/tspi/tspi_migration.c | 8 ++++---- src/tspi/tspi_nv.c | 4 ++-- src/tspi/tspi_ps.c | 2 +- src/tspi/tspi_quote.c | 4 ++-- src/tspi/tspi_quote2.c | 2 +- src/tspi/tspi_selftest.c | 2 +- 42 files changed, 139 insertions(+), 109 deletions(-) hooks/post-receive -- Trousers |