Skip to content

Commit

Permalink
Fix scan-build warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Dec 26, 2023
1 parent 2d92393 commit 15e3420
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ Adds backend support for TPM 2.0 using wolfTPM. Adds AES CBC key wrap / unwrap s
* Added CI testing for wolfPKCS11 with wolfTPM backend and single threaded. (PR #23)
* Added PKCS11 TPM NV store (enabled with `WOLFPKCS11_TPM_STORE`). Allow `WOLFPKCS11_NO_STORE` for TPM use case. (PR #23)
* Fixed compiler warnings from mingw. (PR #23)
* Added portability macro `WOLFPKCS11_NO_ENV` when setenv/getenv is not available. (PR #23)
* Added portability macro `WOLFPKCS11_NO_ENV` when setenv/getenv are not available. (PR #23)
* Fix to only require `-ldl` for non-static builds. (PR #23)
* Portability fixes. Added `NO_MAIN_DRIVER`. Support for `SINGLE_THREADED`. Add `static` to some globals. (PR #24)
* Fixes for portability where `XREALLOC` is not available. (PR #25)
* Added support for custom setenv/get env using `WOLFPKCS11_USER_ENV`. (PR #25)
* Fix for final not being called after init in edge case pin failure. (PR #25)
* Added support for hashing PIN with SHA2-256.
- PKS11 uses scrypt, which uses multiple MB of memory and is not practical. (PR #25)
- PKS11 uses scrypt, which uses multiple MB of memory and is not practical for embedded systems. (PR #25)

### wolfPKCS11 Release 1.1 (May 6, 2022)

Expand Down
2 changes: 1 addition & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6953,7 +6953,7 @@ int WP11_Ec_GenerateKeyPair(WP11_Object* pub, WP11_Object* priv,
CK_BBOOL isSign = CK_FALSE;
CK_ULONG len = sizeof(isSign);
ret = WP11_Object_GetAttr(priv, CKA_SIGN, &isSign, &len);
if (isSign)
if (ret == 0 && isSign)
priv->slot->tpmCtx.eccKey = (WOLFTPM2_KEY*)&priv->tpmKey;
else
priv->slot->tpmCtx.ecdhKey = (WOLFTPM2_KEY*)&priv->tpmKey;
Expand Down
6 changes: 6 additions & 0 deletions tests/pkcs11mtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6527,6 +6527,12 @@ int pkcs11test_mtt(int argc, char* argv[])
return 1;
}
testCase = atoi(*argv);
if (testCase <= 0 || testCase > testFuncCnt) {
fprintf(stderr, "Test case out of range: %s\n", *argv);
return 1;
}
testFunc[testCase - 1].run = 1;
onlySet = 1;
}
else if (string_matches(*argv, "-token")) {
argc--;
Expand Down
7 changes: 7 additions & 0 deletions tests/pkcs11test.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ static CK_RV test_open_close_session(void* args)
funcList->C_CloseSession(session);

ret = funcList->C_Logout(soSession);
CHECK_CKR(ret, "Session Logout failed");
}
ret = funcList->C_CloseSession(soSession);
}
Expand Down Expand Up @@ -7942,6 +7943,12 @@ int pkcs11test_test(int argc, char* argv[])
return 1;
}
testCase = atoi(*argv);
if (testCase <= 0 || testCase > testFuncCnt) {
fprintf(stderr, "Test case out of range: %s\n", *argv);
return 1;
}
testFunc[testCase - 1].run = 1;
onlySet = 1;
}
else if (string_matches(*argv, "-token")) {
argc--;
Expand Down

0 comments on commit 15e3420

Please sign in to comment.