mirror of https://github.com/wolfSSL/wolfTPM.git
Static analysis cleanups from scan-build.
parent
6fbb49a94f
commit
32f0ef5107
|
@ -183,8 +183,10 @@ int TPM2_ActivateCredential_Example(void* userCtx, int argc, char *argv[])
|
|||
dataSize = (int)XFREAD((BYTE*)&activCredIn.credentialBlob, 1,
|
||||
sizeof(activCredIn.credentialBlob), fp);
|
||||
if (dataSize > 0) {
|
||||
dataSize += (int)XFREAD((BYTE*)&activCredIn.secret, 1,
|
||||
sizeof(activCredIn.secret), fp);
|
||||
int secSize = (int)XFREAD((BYTE*)&activCredIn.secret, 1,
|
||||
sizeof(activCredIn.secret), fp);
|
||||
if (secSize > 0)
|
||||
dataSize += secSize;
|
||||
}
|
||||
XFCLOSE(fp);
|
||||
}
|
||||
|
|
|
@ -90,10 +90,12 @@ static void show_ek_public(const TPM2B_PUBLIC* pub)
|
|||
pub->publicArea.unique.rsa.size);
|
||||
}
|
||||
else if (pub->publicArea.type == TPM_ALG_ECC) {
|
||||
const char* curveName = "NULL";
|
||||
const char* curveName;
|
||||
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && defined(HAVE_ECC)
|
||||
curveName = wc_ecc_get_name(
|
||||
TPM2_GetWolfCurve(pub->publicArea.parameters.eccDetail.curveID));
|
||||
#else
|
||||
curveName = "NULL";
|
||||
#endif
|
||||
printf("\tCurveID %s (0x%x), size %d, unique X/Y size %d/%d\n",
|
||||
curveName, pub->publicArea.parameters.eccDetail.curveID,
|
||||
|
|
|
@ -158,10 +158,11 @@ int TPM2_PCR_Extend_Test(void* userCtx, int argc, char *argv[])
|
|||
wc_HashInit(&dig, hashType);
|
||||
while (!XFEOF(fp)) {
|
||||
len = XFREAD(dataBuffer, 1, sizeof(dataBuffer), fp);
|
||||
if (len) {
|
||||
if (len > 0) {
|
||||
wc_HashUpdate(&dig, hashType, dataBuffer, (int)len);
|
||||
}
|
||||
}
|
||||
XFCLOSE(fp);
|
||||
wc_HashFinal(&dig, hashType, hash);
|
||||
|
||||
XMEMCPY(cmdIn.pcrExtend.digests.digests[0].digest.H,
|
||||
|
|
|
@ -175,8 +175,8 @@ int TPM2_Unseal_Example(void* userCtx, int argc, char *argv[])
|
|||
goto exit;
|
||||
}
|
||||
}
|
||||
printf("Stored unsealed data to file = %s\n", filename);
|
||||
XFCLOSE(fp);
|
||||
printf("Stored unsealed data to file = %s\n", filename);
|
||||
}
|
||||
#else
|
||||
printf("Unable to store unsealed data to a file. Enable wolfcrypt support.\n");
|
||||
|
|
|
@ -217,7 +217,9 @@ int readKeyBlob(const char* filename, WOLFTPM2_KEYBLOB* key)
|
|||
/* Decode the byte stream into a publicArea structure ready for use */
|
||||
rc = TPM2_ParsePublic(&key->pub, pubAreaBuffer,
|
||||
(word32)sizeof(pubAreaBuffer), &pubAreaSize);
|
||||
if (rc != TPM_RC_SUCCESS) return rc;
|
||||
if (rc != TPM_RC_SUCCESS) {
|
||||
goto exit;
|
||||
}
|
||||
#ifdef DEBUG_WOLFTPM
|
||||
TPM2_PrintPublicArea(&key->pub);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue