-
Notifications
You must be signed in to change notification settings - Fork 24
Add debug messaging system to wolfPKCS11 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
48a1ead
Add debug messaging system to wolfPKCS11
devin-ai-integration[bot] 9cc8396
Address user feedback on debug messaging system
devin-ai-integration[bot] 5a1fd04
Address user feedback: add varargs support to WOLFPKCS11_MSG, replace…
devin-ai-integration[bot] 85cf875
Fix MSVC compilation errors by removing ##__VA_ARGS__ from WOLFPKCS11…
devin-ai-integration[bot] 90f5b9c
Improve debug_test.c with build integration and output verification
devin-ai-integration[bot] 0e1c009
Fix debug_test.c compilation errors
devin-ai-integration[bot] 5e8c72a
Fix debug_test.c unused variables and linking issues
devin-ai-integration[bot] 12fee46
Address dgarske's code style review comments
devin-ai-integration[bot] f9a51d2
Address dgarske's latest review comments
devin-ai-integration[bot] 227a2e2
Fix WOLFPKCS11_MSG macro to handle cases with no arguments
devin-ai-integration[bot] cd8fc4a
Make debug control functions available in non-debug builds
devin-ai-integration[bot] 2ae9564
Declare debug control functions in header for all builds
devin-ai-integration[bot] de458ff
Add --enable-debug to CI test matrix
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #include <stdio.h> | ||
| #include "wolfpkcs11/pkcs11.h" | ||
|
|
||
| int main() { | ||
| CK_RV rv; | ||
| CK_FUNCTION_LIST_PTR pFunctionList; | ||
|
|
||
| printf("=== wolfPKCS11 Debug Test Program ===\n"); | ||
|
|
||
| #ifdef DEBUG_WOLFPKCS11 | ||
| printf("Debug mode is ENABLED (DEBUG_WOLFPKCS11 defined)\n"); | ||
|
|
||
| printf("\nTesting debug control functions:\n"); | ||
| wolfPKCS11_Debugging_On(); | ||
| printf("Debug enabled\n"); | ||
|
|
||
| wolfPKCS11_Debugging_Off(); | ||
| printf("Debug disabled\n"); | ||
|
|
||
| wolfPKCS11_Debugging_On(); | ||
| printf("Debug re-enabled\n"); | ||
|
|
||
| printf("\nTesting PKCS#11 functions with debug output:\n"); | ||
| rv = C_GetFunctionList(&pFunctionList); | ||
| printf("C_GetFunctionList returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| if (rv == CKR_OK && pFunctionList != NULL) { | ||
| rv = pFunctionList->C_Initialize(NULL); | ||
| printf("C_Initialize returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| if (rv == CKR_OK) { | ||
| CK_INFO info; | ||
| rv = pFunctionList->C_GetInfo(&info); | ||
| printf("C_GetInfo returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| pFunctionList->C_Finalize(NULL); | ||
| printf("C_Finalize called\n"); | ||
| } | ||
| } | ||
|
|
||
| wolfPKCS11_Debugging_Off(); | ||
| printf("Debug disabled at end\n"); | ||
|
|
||
| #else | ||
| printf("Debug mode is DISABLED (DEBUG_WOLFPKCS11 not defined)\n"); | ||
| printf("Debug functions and macros are compiled out\n"); | ||
|
|
||
| printf("\nTesting PKCS#11 functions without debug output:\n"); | ||
| rv = C_GetFunctionList(&pFunctionList); | ||
| printf("C_GetFunctionList returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| if (rv == CKR_OK && pFunctionList != NULL) { | ||
| rv = pFunctionList->C_Initialize(NULL); | ||
| printf("C_Initialize returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| if (rv == CKR_OK) { | ||
| CK_INFO info; | ||
| rv = pFunctionList->C_GetInfo(&info); | ||
| printf("C_GetInfo returned: %lu\n", (unsigned long)rv); | ||
|
|
||
| pFunctionList->C_Finalize(NULL); | ||
| printf("C_Finalize called\n"); | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| printf("\n=== Test Complete ===\n"); | ||
| return 0; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.