-
Notifications
You must be signed in to change notification settings - Fork 38
Global SHE keys #478
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
Draft
bigbrett
wants to merge
1
commit into
wolfSSL:main
Choose a base branch
from
bigbrett:she-global
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Global SHE keys #478
Changes from all commits
Commits
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -1945,6 +1945,16 @@ _HandleKeyWrapExportRequest(whServerContext* server, | |
| return WH_ERROR_BADARGS; | ||
| } | ||
|
|
||
| #ifdef WOLFHSM_CFG_SHE_GLOBAL_KEYS | ||
| /* Route SHE targets to the global namespace so wrap-export names slots | ||
| * the same way the SHE commands do, whether or not the client passed the | ||
| * global flag. */ | ||
| if (targetKeyType == WH_KEYTYPE_SHE) { | ||
| targetKeyId = WH_MAKE_KEYID(WH_KEYTYPE_SHE, WH_KEYUSER_GLOBAL, | ||
| WH_KEYID_ID(targetKeyId)); | ||
| } | ||
| #endif | ||
|
|
||
| /* Read the key and its real metadata, enforcing export policy | ||
| * (NONEXPORTABLE). For wrapped keys this is a cache-only probe. */ | ||
| ret = wh_Server_KeystoreReadKeyChecked(server, targetKeyId, &metadata, key, | ||
|
|
@@ -2256,6 +2266,26 @@ static int _HandleKeyUnwrapAndCacheRequest( | |
| } | ||
| #endif /* WOLFHSM_CFG_GLOBAL_KEYS */ | ||
|
|
||
| #ifdef WOLFHSM_CFG_SHE_GLOBAL_KEYS | ||
| /* Move the blob's id to the global namespace where the SHE commands look; | ||
| * blobs minted by per-client builds would otherwise cache under an id no | ||
| * SHE command uses and no client request can evict. Do this before the | ||
| * in-cache check and counter guard below so both see the final id. */ | ||
|
Comment on lines
+2270
to
+2273
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comment is all jargon and unintelligible. Simplify into something human readible. |
||
| if (wrappedKeyType == WH_KEYTYPE_SHE) { | ||
| metadata.id = WH_MAKE_KEYID(WH_KEYTYPE_SHE, WH_KEYUSER_GLOBAL, | ||
| WH_KEYID_ID(metadata.id)); | ||
| } | ||
| #elif defined(WOLFHSM_CFG_SHE_EXTENSION) && defined(WOLFHSM_CFG_GLOBAL_KEYS) | ||
| /* SHE slots are per-client on this build, so a blob minted by a global-SHE | ||
| * build would cache under an id no SHE command reads and no client request | ||
| * can evict, pinning the cache slot until reboot. Reject it instead. */ | ||
|
Comment on lines
+2279
to
+2281
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jargon, unintelligible. Simplify and make human readible |
||
| if (wrappedKeyType == WH_KEYTYPE_SHE && | ||
| wrappedKeyUser == WH_KEYUSER_GLOBAL) { | ||
| ret = WH_ERROR_ACCESS; | ||
| goto out; | ||
| } | ||
| #endif | ||
|
|
||
| /* Ensure a key with the unwrapped ID does not already exist in cache */ | ||
| if (_ExistsInCache(server, metadata.id)) { | ||
| ret = WH_ERROR_ABORTED; | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would we not include this in the above swtich statement?