Skip to content

Commit

Permalink
Fix warning: `cannot convert argument of incomplete type 'void *' to …
Browse files Browse the repository at this point in the history
…'WOLFTPM2_KEY *'`. Fix `extend.c:158:9: warning: Value stored to 'rc' is never read`. Fix `src/tpm2_wrap.c:2193:5: warning: Value stored to 'sensSz' is never read`.
  • Loading branch information
dgarske committed Nov 5, 2024
1 parent d986ec7 commit 3617abc
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/bench/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ int TPM2_Wrapper_BenchArgs(void* userCtx, int argc, char *argv[])
if (rc != 0) goto exit;

if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storageKey;
WOLFTPM2_KEY* bindKey = &storageKey;
#ifdef NO_RSA
bindKey = NULL; /* cannot bind to key without RSA enabled */
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/keygen/keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ int TPM2_Keygen_Example(void* userCtx, int argc, char *argv[])
if (rc != 0) goto exit;

if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = primary;
WOLFTPM2_KEY* bindKey = primary;
#ifndef HAVE_ECC
if (srkAlg == TPM_ALG_ECC)
bindKey = NULL; /* cannot bind to key without ECC enabled */
Expand Down
2 changes: 1 addition & 1 deletion examples/keygen/keyimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int TPM2_Keyimport_Example(void* userCtx, int argc, char *argv[])
if (rc != 0) goto exit;

if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storage;
WOLFTPM2_KEY* bindKey = &storage;
#ifndef HAVE_ECC
if (srkAlg == TPM_ALG_ECC)
bindKey = NULL; /* cannot bind to key without ECC enabled */
Expand Down
2 changes: 1 addition & 1 deletion examples/keygen/keyload.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int TPM2_Keyload_Example(void* userCtx, int argc, char *argv[])
if (rc != 0) goto exit;
}
else if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storage;
WOLFTPM2_KEY* bindKey = &storage;
#ifndef HAVE_ECC
if (srkAlg == TPM_ALG_ECC)
bindKey = NULL; /* cannot bind to key without ECC enabled */
Expand Down
1 change: 0 additions & 1 deletion examples/pcr/extend.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ int TPM2_PCR_Extend_Test(void* userCtx, int argc, char *argv[])
if (filename && fp != XBADFILE) {
rc = TPM2_GetHashType(alg);
hashType = (enum wc_HashType)rc;
rc = 0;
wc_HashInit(&dig, hashType);
while (!XFEOF(fp)) {
len = XFREAD(dataBuffer, 1, sizeof(dataBuffer), fp);
Expand Down
2 changes: 1 addition & 1 deletion examples/pcr/quote.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int TPM2_PCR_Quote_Test(void* userCtx, int argc, char *argv[])
#endif

if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storage;
WOLFTPM2_KEY* bindKey = &storage;
#ifndef HAVE_ECC
if (alg == TPM_ALG_ECC)
bindKey = NULL; /* cannot bind to key without ECC enabled */
Expand Down
4 changes: 2 additions & 2 deletions examples/wrap/wrap_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int TPM2_Wrapper_TestArgs(void* userCtx, int argc, char *argv[])

/* Start an authenticated session (salted / unbound) with parameter encryption */
if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storageKey;
WOLFTPM2_KEY* bindKey = &storageKey;
#ifdef NO_RSA
bindKey = NULL; /* cannot bind to key without RSA enabled */
#endif
Expand Down Expand Up @@ -547,7 +547,7 @@ int TPM2_Wrapper_TestArgs(void* userCtx, int argc, char *argv[])

/* Start an authenticated session (salted / unbound) with parameter encryption */
if (paramEncAlg != TPM_ALG_NULL) {
void* bindKey = &storageKey;
WOLFTPM2_KEY* bindKey = &storageKey;
#ifndef HAVE_ECC
bindKey = NULL; /* cannot bind to key without ECC enabled */
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/tpm2_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,8 @@ static int SensitiveToPrivate(TPM2B_SENSITIVE* sens, TPM2B_PRIVATE* priv,
ivField.size == 0 ? NULL : ivField.buffer, AES_ENCRYPTION);
if (rc == 0) {
/* use inline encryption for both IV and sensitive */
rc = wc_AesCfbEncrypt(&enc, sensitiveData, sensitiveData, sensSz);
rc = wc_AesCfbEncrypt(&enc, sensitiveData, sensitiveData,
sensSz);
}
wc_AesFree(&enc);
}
Expand Down Expand Up @@ -2272,6 +2273,7 @@ static int SensitiveToPrivate(TPM2B_SENSITIVE* sens, TPM2B_PRIVATE* priv,
(void)sensitiveData;
(void)name;
(void)symKey;
(void)sensSz;
rc = NOT_COMPILED_IN;
#endif
}
Expand Down

0 comments on commit 3617abc

Please sign in to comment.