Skip to content

wolfPKCS11 test#731

Open
danielinux wants to merge 11 commits intowolfSSL:masterfrom
danielinux:wolfPKCS11_test
Open

wolfPKCS11 test#731
danielinux wants to merge 11 commits intowolfSSL:masterfrom
danielinux:wolfPKCS11_test

Conversation

@danielinux
Copy link
Member

@danielinux danielinux commented Mar 20, 2026

  • move pkcs11/tz test to its own module in test-app
  • add m33mu two-runs test for persistent storage coverage

Copilot AI review requested due to automatic review settings March 20, 2026 16:37
@danielinux danielinux changed the title Wolf pkcs11 test wolfPKCS11 test Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings March 20, 2026 17:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 20, 2026 18:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

Makefile:1

  • This change removes the previous || true behavior, making signing failures stop the build. That’s a significant behavior change and isn’t mentioned in the PR description (which focuses on PKCS11 tests). If the intent is to make signing errors fatal, please call it out in the PR description; if not, consider restoring the prior non-fatal behavior for this target.
## wolfBoot Makefile

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 20, 2026 19:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 21, 2026 08:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@danielinux danielinux marked this pull request as ready for review March 21, 2026 15:09
Copilot AI review requested due to automatic review settings March 21, 2026 15:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +573 to +574
(void)wolfpkcs11nsFunctionList.C_Logout(session);
(void)wolfpkcs11nsFunctionList.C_CloseSession(session);
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cleanup you call C_Logout/C_CloseSession unconditionally even when session is still CK_INVALID_HANDLE (e.g., if session open/login failed and you goto cleanup). Some PKCS#11 implementations treat an invalid handle as an error or may assert. Guard these calls with if (session != CK_INVALID_HANDLE) (and only logout if login succeeded).

Suggested change
(void)wolfpkcs11nsFunctionList.C_Logout(session);
(void)wolfpkcs11nsFunctionList.C_CloseSession(session);
if (session != CK_INVALID_HANDLE) {
(void)wolfpkcs11nsFunctionList.C_Logout(session);
(void)wolfpkcs11nsFunctionList.C_CloseSession(session);
}

Copilot uses AI. Check for mistakes.
Comment on lines 207 to 218
if(WOLFCRYPT_TZ_PKCS11)
list(APPEND TEST_APP_COMPILE_DEFINITIONS WOLFBOOT_PKCS11_APP SECURE_PKCS11 WOLFPKCS11_USER_SETTINGS)
list(APPEND TEST_APP_COMPILE_DEFINITIONS
WOLFBOOT_PKCS11_APP
SECURE_PKCS11
WOLFBOOT_TZ_PKCS11
WOLFPKCS11_USER_SETTINGS)
if(PKCS11_TESTAPP)
list(APPEND TEST_APP_COMPILE_DEFINITIONS WOLFBOOT_PKCS11_TESTAPP)
endif()
set(WOLFSSL_PKCS11_SOURCES
test_pkcs11.c
wcs/pkcs11_stub.c
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WOLFCRYPT_TZ_PKCS11 block adds PKCS#11 sources/defines even when TZEN is OFF, but test_pkcs11.c includes user_settings.h which is provided via the wcs include directory that you only add under if(TZEN). This makes the CMake build inconsistent with the Makefile (which only builds PKCS#11 test code when TZEN=1) and can break configurations that enable WOLFCRYPT_TZ_PKCS11 without TZEN. Consider nesting this block under if(TZEN AND WOLFCRYPT_TZ_PKCS11) or emitting a FATAL_ERROR when WOLFCRYPT_TZ_PKCS11 is set without TZEN.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants