Bsdkm cleanup - #11119
Open
philljj wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs cleanup and robustness improvements in the BSD kernel module integration, focusing on safer macro wrapping and better AES session lifecycle handling (including cipher lifecycle debug initialization and avoiding frees of unused contexts).
Changes:
- Wrap
wolfkmod_fpu_kern_enter/leavemacros indo { ... } while (0)to behave safely in all statement contexts. - Refine AES context cleanup so GCM sessions don’t free the never-initialized
aes_decryptcontext. - Initialize
wc_debug_CipherLifecycleInitfor local AES copies used in CBC/GCM work paths (when enabled).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
bsdkm/x86_vecreg.c |
Wraps FPU enter/leave wrapper macros to be safe as single statements. |
bsdkm/wolfkmod.c |
Adjusts AES context cleanup behavior and adds cipher lifecycle debug initialization in CBC/GCM paths. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+681
to
+684
| case CRYPTO_AES_CBC: | ||
| wolfkdriv_aes_ctx_clear(&session->aes_ctx, 1); | ||
| default: | ||
| break; |
Comment on lines
+386
to
+390
| /* clean up allocated km_aes_ctx struct. | ||
| * - cbc allocates both encrypt and decrypt, and frees both. | ||
| * - gcm uses only aes_encrypt. | ||
| * */ | ||
| static void wolfkdriv_aes_ctx_clear(km_aes_ctx * ctx, int free_decrypt) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
bsdkm cleanup:
Testing