RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: libtpm Date: 03-Sep-2013 12:40:16 Branch: HEAD Handle: 2013090310401500 Modified files: libtpm/libtpm/utils cmk_createkey.c cmk_loadmigrationblob.c cmk_migrate.c counter_release.c delegatemanage.c delegatereadtable.c getcapability.c identity.c loadmigrationblob.c loadownerdelegation.c migrate.c migratekey.c nv.c nv_readvalue.c pcrread.c readmanumaintpub.c selftest.c session.c sha.c updateverification.c verifydelegation.c Log: - WIP. Summary: Revision Changes Path 1.4 +1 -1 libtpm/libtpm/utils/cmk_createkey.c 1.4 +11 -11 libtpm/libtpm/utils/cmk_loadmigrationblob.c 1.4 +6 -6 libtpm/libtpm/utils/cmk_migrate.c 1.4 +3 -3 libtpm/libtpm/utils/counter_release.c 1.3 +2 -2 libtpm/libtpm/utils/delegatemanage.c 1.4 +3 -3 libtpm/libtpm/utils/delegatereadtable.c 1.4 +8 -8 libtpm/libtpm/utils/getcapability.c 1.4 +4 -4 libtpm/libtpm/utils/identity.c 1.4 +5 -6 libtpm/libtpm/utils/loadmigrationblob.c 1.4 +1 -1 libtpm/libtpm/utils/loadownerdelegation.c 1.4 +11 -11 libtpm/libtpm/utils/migrate.c 1.4 +4 -4 libtpm/libtpm/utils/migratekey.c 1.4 +8 -8 libtpm/libtpm/utils/nv.c 1.4 +3 -3 libtpm/libtpm/utils/nv_readvalue.c 1.4 +1 -1 libtpm/libtpm/utils/pcrread.c 1.4 +1 -1 libtpm/libtpm/utils/readmanumaintpub.c 1.4 +4 -4 libtpm/libtpm/utils/selftest.c 1.4 +11 -11 libtpm/libtpm/utils/session.c 1.4 +3 -3 libtpm/libtpm/utils/sha.c 1.4 +1 -1 libtpm/libtpm/utils/updateverification.c 1.4 +1 -1 libtpm/libtpm/utils/verifydelegation.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/cmk_createkey.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 cmk_createkey.c --- libtpm/libtpm/utils/cmk_createkey.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/cmk_createkey.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -350,7 +350,7 @@ { struct stat _stat; int ret = 0; - if (0 == stat(filename, &_stat)) { + if (stat(filename, &_stat) == 0) { if (_stat.st_size == TPM_HASH_SIZE + TPM_DIGEST_SIZE) { int fd = open(filename, O_RDONLY); if (fd > 0) { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/cmk_loadmigrationblob.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 cmk_loadmigrationblob.c --- libtpm/libtpm/utils/cmk_loadmigrationblob.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/cmk_loadmigrationblob.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -169,12 +169,12 @@ (void)verbose; - if (0 == migkeyhandle || - NULL == filename || - NULL == keypass || - NULL == msa_list_filename || - NULL == migrationkey_filename || - NULL == ownerpass) { + if (migkeyhandle == 0 || + filename == NULL || + keypass == NULL || + msa_list_filename == NULL || + migrationkey_filename == NULL || + ownerpass == NULL) { printf("Missing mandatory parameter.\n"); usage(); return -1; @@ -206,13 +206,13 @@ * read the msa list from the file. */ ret = TPM_ReadMSAFile(msa_list_filename, &msaList); - if (0 != (ret & ERR_MASK)) { + if ((ret & ERR_MASK)) { printf("Could not read msa file from %s.\n",msa_list_filename); exit(ret); } ret = TPM_ReadKeyfile(migrationkey_filename, &migrationkey); - if (0 != (ret & ERR_MASK)) { + if ((ret & ERR_MASK)) { printf("Could not read migration key from %s.\n",migrationkey_filename); exit(ret); } @@ -232,7 +232,7 @@ ret = TPM_ReadFile(filename, &buffer, &buffersize); - if (0 == (ret & ERR_MASK) ) { + if ((ret & ERR_MASK) == 0) { int offset = 0; unsigned char * encblob = NULL; uint32_t encsize = 0; @@ -363,7 +363,7 @@ &msaList, rndblob, rndsize, outblob, &outblen); - if (0 == ret) { + if (ret == 0) { uint32_t newhandle; memcpy(newkey.encData.buffer, outblob, @@ -372,7 +372,7 @@ migkeypasshash, &newkey, &newhandle); - if (0 == ret) { + if (ret == 0) { printf("Successfully loaded key into TPM.\n" "New Key Handle = %08X\n", newhandle); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/cmk_migrate.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 cmk_migrate.c --- libtpm/libtpm/utils/cmk_migrate.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/cmk_migrate.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -307,7 +307,7 @@ */ printf("Loading the (public) key to use for migration...\n"); - if (0 == ret) { + if (ret == 0) { printf("Migration key is: %s\n",migkeyfile); ret = TPM_ReadKeyfile(migkeyfile, &migkey); if ((ret & ERR_MASK)) { @@ -390,8 +390,8 @@ else { /* TPM_MS_RESTRICT_MIGRATE */ restrictTicketParameter = NULL; /* command does not need restrictTicket */ } - if (0 == ret) { - if (0 == ret) { + if (ret == 0) { + if (ret == 0) { STACK_TPM_BUFFER( keyblob) STACK_TPM_BUFFER( migblob); @@ -411,7 +411,7 @@ migscheme, // migration scheme &keyblob, // public key to be authorized &migblob); - if (0 == ret) { + if (ret == 0) { unsigned char rndblob[1024]; uint32_t rndblen = sizeof(rndblob); unsigned char outblob[1024]; @@ -426,7 +426,7 @@ q.encData.size); encblen = q.encData.size; - if (0!= ret) { + if (ret) { printf("Error occurred while creating encrypted blob.\n"); exit (-1); } @@ -448,7 +448,7 @@ encblob, encblen, // encrypted private key that will show up re-encrypted in outblob rndblob, &rndblen, // output: used for xor encryption outblob, &outblen);// output: re-encrypted private key - if (0 == ret) { + if (ret == 0) { if (NULL != filename) { STACK_TPM_BUFFER(keybuf) // serialize the key in 'q' @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/counter_release.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 counter_release.c --- libtpm/libtpm/utils/counter_release.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/counter_release.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -110,7 +110,7 @@ if (counterpass != NULL) { ret= TPM_ReleaseCounter(id, passptr2); - if (0 != ret) { + if (ret) { printf("Got error '%s' (0x%x) from TPM_ReleaseCounter.\n", TPM_GetErrMsg(ret), ret); @@ -118,14 +118,14 @@ } else { ret = TPM_ReleaseCounterOwner(id, passptr1); - if (0 != ret) { + if (ret) { printf("Got error '%s' (0x%x) from TPM_ReleaseCounterOwner.\n", TPM_GetErrMsg(ret), ret); } } - if (0 == ret) { + if (ret) { printf("Successfully released the counter.\n"); } @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/delegatemanage.c ============================================================================ $ cvs diff -u -r1.2 -r1.3 delegatemanage.c --- libtpm/libtpm/utils/delegatemanage.c 31 Aug 2013 21:53:12 -0000 1.2 +++ libtpm/libtpm/utils/delegatemanage.c 3 Sep 2013 10:40:15 -0000 1.3 @@ -171,7 +171,7 @@ buffer.buffer, len, ownerHashPtr, retbuffer, &retbufferlen); - if (0 == ret) { + if (ret == 0) { if (4 == retbufferlen) { uint32_t id = LOAD32(retbuffer, 0); printf("Family ID that was created: %d\n",id); @@ -197,7 +197,7 @@ break; } - if (0 != ret) { + if (ret) { printf("Error %s from TPM_Delegate_manage.\n", TPM_GetErrMsg(ret)); } else { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/delegatereadtable.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 delegatereadtable.c --- libtpm/libtpm/utils/delegatereadtable.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/delegatereadtable.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -31,7 +31,7 @@ ret = TPM_Delegate_ReadTable(familyTable, &familyTableSize, delegateTable, &delegateTableSize); - if (0 != ret) { + if (ret) { printf("Delegate_ReadTable returned error '%s' (%d).\n", TPM_GetErrMsg(ret), ret); @@ -43,7 +43,7 @@ while (i < familyTableSize) { TPM_FAMILY_TABLE_ENTRY fte; ret = TPM_ReadFamilyTableEntry(&buffer, i, &fte); - if (0 == (ret & ERR_MASK) && ret > 0) { + if ((ret & ERR_MASK) == 0 && ret > 0) { printf("Family Table Entry:\n" "familyLabel : %d\n" "familyID : "OUT_FORMAT("%d","%d")"\n" @@ -68,7 +68,7 @@ TPM_DELEGATE_INDEX didx = LOAD32(buffer.buffer, i); i += 4; ret = TPM_ReadDelegatePublic(&buffer, i, &dtp); - if (0 == (ret & ERR_MASK) && ret > 0) { + if ((ret & ERR_MASK) == 0 && ret > 0) { printf("\n\nDelegate Table Entry:\n" "index : "OUT_FORMAT("%d","%d")"\n" "rowLabel : %d\n" @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/getcapability.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 getcapability.c --- libtpm/libtpm/utils/getcapability.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/getcapability.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -192,7 +192,7 @@ printf("Need subcap parameter for this capability!\n"); exit(-1); } - if (0 == prepare_subcap(cap, &subcap, scap)) { + if (prepare_subcap(cap, &subcap, scap) == 0) { if (2 == matrx[index].subcap_size) { STORE16(subcap.buffer,0,scap); subcap.used = 2; @@ -204,12 +204,12 @@ } } - if (0 == sikeyhandle) { + if (sikeyhandle == 0) { ret = TPM_GetCapability(cap, &subcap, &resp); - if (0 != ret) { + if (ret) { printf("TPM_GetCapability returned %s.\n", TPM_GetErrMsg(ret)); exit(ret); @@ -236,7 +236,7 @@ sigkeyhashptr, &pubkey); - if (0 != ret) { + if (ret) { printf("Error while trying to access the signing key's public key.\n"); exit(-1); } @@ -251,7 +251,7 @@ &resp, signature, &signaturelen); - if (0 != ret) { + if (ret) { printf("TPM_GetCapabilitySigned returned %s.\n", TPM_GetErrMsg(ret)); exit(ret); @@ -280,7 +280,7 @@ } } - if (0 == resp.used) { + if (resp.used == 0) { printf("Empty response.\n"); } else { @@ -563,7 +563,7 @@ if (scap == TPM_CAP_PROP_OWNER || scap == TPM_CAP_PROP_DAA_INTERRUPT ) { - if (0 == resp.buffer[0]) { + if (resp.buffer[0] == 0) { printf("FALSE\n"); } else { printf("TRUE\n"); @@ -635,7 +635,7 @@ if (scap == TPM_CAP_PROP_ACTIVE_COUNTER) { uint32_t val = LOAD32(resp.buffer,0); printf("0x%08X=%d",val,val); - if (0xffffffff == val) { + if (val == 0xffffffff) { printf(" (no counter is active)"); } printf("\n"); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/identity.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 identity.c --- libtpm/libtpm/utils/identity.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/identity.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -260,7 +260,7 @@ idbindingbuffer, &idbindingbuffersize); - if (0 != ret) { + if (ret) { printf("MakeIdentity returned error '%s' (%d).\n", TPM_GetErrMsg(ret), ret); @@ -346,7 +346,7 @@ &idkey, &newhandle); } - if (0 != ret) { + if (ret) { printf("LoadKey returned error '%s' (%d).\n", TPM_GetErrMsg(ret), ret); @@ -487,7 +487,7 @@ tpm_oaep_pad_str, sizeof(tpm_oaep_pad_str)); - if (0 == ret) { + if (ret == 0) { printf("Error while adding padding.\n"); exit(-1); } @@ -512,7 +512,7 @@ passptr1, &returnbuffer); - if (0 != ret) { + if (ret) { printf("ActivateIdentity returned error '%s' (0x%x).\n", TPM_GetErrMsg(ret), ret); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/loadmigrationblob.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 loadmigrationblob.c --- libtpm/libtpm/utils/loadmigrationblob.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/loadmigrationblob.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -98,8 +98,7 @@ } (void)verbose; - if (0 == migkeyhandle || - NULL == filename) { + if (migkeyhandle == 0 || filename == NULL) { printf("Missing mandatory parameter.\n"); usage(); } @@ -155,7 +154,7 @@ encblob, encsize, outblob, &outblen); - if (0 == ret) { + if (ret == 0) { memcpy(newkey.encData.buffer, outblob, outblen); @@ -166,13 +165,13 @@ ret); } } - if (0 == ret) { + if (ret == 0) { uint32_t newhandle; ret = TPM_LoadKey(migkeyhandle, keyhashptr, &newkey, &newhandle); - if (0 == ret) { + if (ret == 0) { printf("Successfully loaded key into TPM.\n" "New Key Handle = %08X\n", newhandle); @@ -192,7 +191,7 @@ f = fopen(filename,"rb"); if (NULL != f) { struct stat sbuff; - if (0 == stat(filename,&sbuff)) { + if (stat(filename,&sbuff) == 0) { buffer = malloc(sbuff.st_size); if (NULL != buffer) { int n = fread(buffer, 1, sbuff.st_size,f); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/loadownerdelegation.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 loadownerdelegation.c --- libtpm/libtpm/utils/loadownerdelegation.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/loadownerdelegation.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -93,7 +93,7 @@ ownerHashPtr = ownerpasshash; } - if (0 == stat(filename, &_stat)) { + if (stat(filename, &_stat) == 0) { unsigned char *blob = malloc(_stat.st_size); uint32_t blobSize = _stat.st_size; FILE *f; @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/migrate.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 migrate.c --- libtpm/libtpm/utils/migrate.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/migrate.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -225,10 +225,10 @@ ret = TPM_ReadKeyfile(keyfile, &q); - if (0 == ret) { + if (ret == 0) { STACK_TPM_BUFFER(migkeybuffer); - if (0 != migkeyhandle) { + if (migkeyhandle != 0) { keydata kd; ret = TPM_GetPubKey(migkeyhandle, aptr4, @@ -254,14 +254,14 @@ } } - if (0 == ret) { + if (ret == 0) { STACK_TPM_BUFFER(keyblob) keydata keyd; memset(&keyd, 0x0, sizeof(keyd)); - if (0 != migkeyhandle) { + if (migkeyhandle != 0) { SET_TPM_BUFFER(&keyblob, migkeybuffer.buffer, migkeybuffer.used); @@ -279,7 +279,7 @@ migscheme, // migration scheme &keyblob, // public key to be authorized &migkeybuffer); - if (0 == ret) { + if (ret == 0) { unsigned char * rndblob = NULL; uint32_t rndblen; unsigned char * outblob = NULL; @@ -328,7 +328,7 @@ encblob, encblen, // encrypted private key that will show up re-encrypted in outblob rndblob, &rndblen, // output: used for xor encryption outblob, &outblen);// output: re-encrypted private key - if (0 == ret) { + if (ret == 0) { if (NULL != filename) { STACK_TPM_BUFFER(keybuf) /* @@ -374,7 +374,7 @@ } } else { ret = 0; - if (0 == ret) { + if (ret == 0) { uint32_t newesthandle = 0; if (TPM_MS_REWRAP == migscheme) { memcpy(q.encData.buffer, @@ -395,8 +395,8 @@ rndblob, rndblen, // used for xor encryption/decryption outblob, outblen, // re-encrypted private key (here input) newencblob, &newencblen); // - if (0 == ret) { - if (0 != newencblen) { + if (ret == 0) { + if (newencblen != 0) { memcpy(q.encData.buffer, newencblob, newencblen); @@ -407,7 +407,7 @@ ret); } } - if (0 == ret) { + if (ret == 0) { printf("Trying to load encrypted key back into TPM.\n"); // if (NULL == aptr1) { // ret = TPM_LoadKey(migkeyhandle, @@ -420,7 +420,7 @@ &q, &newesthandle); // } - if (0 == ret) { + if (ret == 0) { printf("Loading the migrated key back into the tpm was successful.\n"); printf("The handle for the key is 0x%X\n",newesthandle); } else { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/migratekey.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 migratekey.c --- libtpm/libtpm/utils/migratekey.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/migratekey.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -194,7 +194,7 @@ * that key. */ ret = loadKey(migrationkeyfile, &migrationkey); - if (0 == ret) { + if (ret == 0) { STACK_TPM_BUFFER(keyblob) uint32_t keyblen = 0; unsigned char * reencData = malloc(encsize); @@ -220,7 +220,7 @@ encblob, encsize, reencData, &reencDataSize); - if (0 == ret) { + if (ret == 0) { STACK_TPM_BUFFER(keybuf) // serialize the key to be migrated ret = TPM_WriteKey(&keybuf,&tobemigkey); @@ -278,7 +278,7 @@ ret = -1; } else { struct stat sbuf; - if (0 ==stat(filename,&sbuf)) { + if (stat(filename,&sbuf) == 0) { unsigned int keyblen; unsigned char * keyblob = NULL; keyblen = (int)sbuf.st_size; @@ -314,7 +314,7 @@ f = fopen(filename,"rb"); if (NULL != f) { struct stat sbuff; - if (0 == stat(filename,&sbuff)) { + if (stat(filename,&sbuff) == 0) { buffer = malloc(sbuff.st_size); if (NULL != buffer) { int n = fread(buffer, 1, sbuff.st_size,f); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/nv.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 nv.c --- libtpm/libtpm/utils/nv.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/nv.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -215,7 +215,7 @@ NULL); - if (0 != ret){ + if (ret){ printf("Got error '%s' from NV_DefineSpace.\n",TPM_GetErrMsg(ret)); } else { ret = TPM_NV_WriteValue(index, @@ -224,7 +224,7 @@ passptr1 ); } - if (0 != ret) { + if (ret) { printf("Got error '%s' from NV_WriteValue.\n",TPM_GetErrMsg(ret)); } else { unsigned char * buffer = malloc(strlen((char *)data)+1); @@ -234,7 +234,7 @@ strlen((char *)data), buffer,&bufferlen, passptr1); - if (0 == ret) { + if (ret == 0) { uint32_t i = 0; printf("Received %d bytes: ",bufferlen); while (i < bufferlen) { @@ -245,7 +245,7 @@ buffer[bufferlen] = 0; printf("%s\n",buffer); - if (0 == memcmp(buffer,data,bufferlen)) { + if (memcmp(buffer,data,bufferlen) == 0) { printf("Test was successful. Could read what was written.\n"); } else { printf("Test was Unsuccessful. Read different data than what was written.\n"); @@ -277,7 +277,7 @@ NULL, NULL); - if (0 != ret){ + if (ret){ printf("Got error code from NV_DefineSpace2: %d (0x%x)\n",ret,ret); } else { ret = TPM_NV_WriteValueAuth(index, @@ -286,7 +286,7 @@ passptr2 ); } - if (0 != ret) { + if (ret) { printf("Got error code from NV_WriteValueAuth: %d (0x%x)\n",ret,ret); } else { unsigned char * buffer = malloc(strlen((char *)data)+1); @@ -296,7 +296,7 @@ strlen((char *)data), buffer,&bufferlen, passptr2); - if (0 == ret) { + if (ret == 0) { uint32_t i = 0; printf("Received %d bytes: ",bufferlen); while (i < bufferlen) { @@ -307,7 +307,7 @@ buffer[bufferlen] = 0; printf("%s\n",buffer); - if (0 == memcmp(buffer,data,bufferlen)) { + if (memcmp(buffer,data,bufferlen) == 0) { printf("Test was successful. Could read what was written.\n"); } else { printf("Test was Unsuccessful. Read different data than what was written.\n"); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/nv_readvalue.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 nv_readvalue.c --- libtpm/libtpm/utils/nv_readvalue.c 1 Sep 2013 19:32:52 -0000 1.3 +++ libtpm/libtpm/utils/nv_readvalue.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -190,7 +190,7 @@ size, readbuffer,&readbufferlen, passptr1); - if (0 != ret) { + if (ret) { if (ret == expectederror) { } else { printf("Error %s from NV_ReadValue\n", @@ -208,7 +208,7 @@ size, readbuffer,&readbufferlen, passptr2); - if (0 != ret) { + if (ret) { if (ret == expectederror) { } else { printf("Error %s from NV_ReadValueAuth\n", @@ -221,7 +221,7 @@ printf("Owner and area password cannot both be specified\n"); usage(); } - if (0 == ret) { + if (ret == 0) { uint32_t i = 0; int is_ascii = TRUE; printf("Received %d bytes:\n",readbufferlen); @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/pcrread.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 pcrread.c --- libtpm/libtpm/utils/pcrread.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/pcrread.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -81,7 +81,7 @@ ret = TPM_PcrRead(index, digest); - if (0 == ret) { + if (ret == 0) { printf("Current value of PCR %d: ",index); i = 0; while (i < TPM_HASH_SIZE) { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/readmanumaintpub.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 readmanumaintpub.c --- libtpm/libtpm/utils/readmanumaintpub.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/readmanumaintpub.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -107,7 +107,7 @@ free(buffer); - if (0 == memcmp(calcdigest, digest, sizeof(digest))) { + if (memcmp(calcdigest, digest, sizeof(digest)) == 0) { printf("The same public key is in the TPM.\n"); ret = 0; } else { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/selftest.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 selftest.c --- libtpm/libtpm/utils/selftest.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/selftest.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -39,25 +39,25 @@ } ret = TPM_SelfTestFull(); - if (0 != ret) { + if (ret) { char outData[2048]; uint32_t outDataSize = sizeof(outData); printf("Error %s from TPM_SelfTestFull\n", TPM_GetErrMsg(ret)); ret = TPM_GetTestResult(outData, &outDataSize); - if (0 != ret) { + if (ret) { printf("Error %s from TPM_GetTestResult\n", TPM_GetErrMsg(ret)); } else { int i = 0; - if (0 == outDataSize) { + if (outDataSize == 0) { printf("The TPM returned no test result data.\n"); } else { printf("Received the following test result:\n"); while (i < (int)outDataSize) { printf("%02X ",outData[i]); i++; - if (0 == (i & 0xf)) { + if ((i & 0xf) == 0) { printf("\n"); } } @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/session.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 session.c --- libtpm/libtpm/utils/session.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/session.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -221,7 +221,7 @@ usage(); exit(-1); } - if (0 != parseHash(argv[i], enonce)) { + if (parseHash(argv[i], enonce) != 0) { printf("Error parsing nonce.\n"); exit(-1); } @@ -232,7 +232,7 @@ usage(); exit(-1); } - if (0 != parseHash(argv[i], ssecret)) { + if (parseHash(argv[i], ssecret) != 0) { printf("Error parsing session secret.\n"); exit(-1); } @@ -488,7 +488,7 @@ } } else if (!strcmp(pwdtype,"key")) { - if (0 == keyhandle) { + if (keyhandle == 0) { printf("Need a keyhandle for this test."); break; @@ -553,7 +553,7 @@ TPM_GetErrMsg(ret)); } } else if (!strcmp(pwdtype,"key")) { - if (0 == keyhandle) { + if (keyhandle == 0) { printf("Need a keyhandle for this test."); exit(-1); } @@ -623,7 +623,7 @@ TPM_GetErrMsg(ret)); } } else if (!strcmp(pwdtype,"key")) { - if (0 == keyhandle) { + if (keyhandle == 0) { printf("Need a keyhandle for this test."); break; } @@ -686,7 +686,7 @@ /* generate odd nonce */ ret = TSS_gennonce(nonceodd); - if (0 == ret) + if (ret == 0) return ERR_CRYPT_ERR; /* move Network byte order data to variable for HMAC calculation */ @@ -694,7 +694,7 @@ TPM_U32_SIZE,&ordinal_no, 0,0); - if (0 != ret) { + if (ret) { return ret; } /* build the request buffer */ @@ -744,7 +744,7 @@ /* generate odd nonce */ ret = TSS_gennonce(nonceodd); - if (0 == ret) + if (ret == 0) return ERR_CRYPT_ERR; /* move Network byte order data to variable for HMAC calculation */ @@ -754,7 +754,7 @@ TPM_U32_SIZE,&ordinal_no, 0,0); - if (0 != ret) { + if (ret) { return ret; } /* build the request buffer */ @@ -812,7 +812,7 @@ /* generate odd nonce */ ret = TSS_gennonce(nonceodd); - if (0 == ret) + if (ret == 0) return ERR_CRYPT_ERR; /* move Network byte order data to variable for HMAC calculation */ @@ -820,7 +820,7 @@ TPM_U32_SIZE,&ordinal_no, 0,0); - if (0 != ret) { + if (ret) { return ret; } /* build the request buffer */ @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/sha.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 sha.c --- libtpm/libtpm/utils/sha.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/sha.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -92,7 +92,7 @@ } /* Common processing, for data or file */ ret = TPM_SHA1Start(&maxNumBytes); - if (0 != ret) { + if (ret) { printf("Error from TPM_SHA1Start(): %d (0x%x)\n", ret, ret); @@ -152,7 +152,7 @@ } else { ret = TPM_SHA1Complete(&data[offset],len,hashbuffer); } - if (0 == ret) { + if (ret == 0) { printf("Hash: "); i = 0; while (i < (int)sizeof(hashbuffer)) { @@ -227,7 +227,7 @@ fclose(f); free(buf); - if (0 == ret) { + if (ret == 0) { printf("Hash: "); i = 0; while (i < (int)sizeof(hashbuffer)) { @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/updateverification.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 updateverification.c --- libtpm/libtpm/utils/updateverification.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/updateverification.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -93,7 +93,7 @@ ownerHashPtr = ownerpasshash; } - if (0 == stat(filename, &_stat)) { + if (stat(filename, &_stat) == 0) { unsigned char *blob = malloc(_stat.st_size); uint32_t blobSize = _stat.st_size; unsigned char outBlob[1024]; @@ . patch -p0 <<'@@ .' Index: libtpm/libtpm/utils/verifydelegation.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 verifydelegation.c --- libtpm/libtpm/utils/verifydelegation.c 1 Sep 2013 19:32:53 -0000 1.3 +++ libtpm/libtpm/utils/verifydelegation.c 3 Sep 2013 10:40:15 -0000 1.4 @@ -60,7 +60,7 @@ usage(); } - if (0 == stat(filename, &_stat)) { + if (stat(filename, &_stat) == 0) { unsigned char *blob = malloc(_stat.st_size); uint32_t blobSize = _stat.st_size; FILE *f; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org