-
Notifications
You must be signed in to change notification settings - Fork 26
Global keystore #224
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
Global keystore #224
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0170b93
Add global keys feature with comprehensive multi-client testing and k…
bigbrett e8663e3
support cache probe on freshen
bigbrett 37f0c8b
keyId flag preservation
bigbrett 12348d8
Merge branch 'main' into global-keys
bigbrett d026f0c
fixes for NOCRYPTO after scan-build PR
bigbrett 4da2aaf
Review feedback:
bigbrett 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
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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright (C) 2025 wolfSSL Inc. | ||
| * | ||
| * This file is part of wolfHSM. | ||
| * | ||
| * wolfHSM is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * wolfHSM is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with wolfHSM. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
| /* | ||
| * src/wh_keyid.c | ||
| * | ||
| * KeyId helper function implementations for wolfHSM | ||
| */ | ||
|
|
||
| #include "wolfhsm/wh_keyid.h" | ||
|
|
||
| whKeyId wh_KeyId_TranslateFromClient(uint16_t type, uint16_t clientId, | ||
| whKeyId reqId) | ||
| { | ||
| uint16_t user = clientId; | ||
| whKeyId id = reqId & WH_KEYID_MASK; | ||
|
|
||
| #ifdef WOLFHSM_CFG_GLOBAL_KEYS | ||
| /* Convert global flag to USER=0 */ | ||
| if ((reqId & WH_KEYID_CLIENT_GLOBAL_FLAG) != 0) { | ||
| user = WH_KEYUSER_GLOBAL; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef WOLFHSM_CFG_KEYWRAP | ||
| /* Convert wrapped flag to TYPE=WH_KETYPE_WRAPPED */ | ||
| if ((reqId & WH_KEYID_CLIENT_WRAPPED_FLAG) != 0) { | ||
| type = WH_KEYTYPE_WRAPPED; | ||
| } | ||
| #endif | ||
|
|
||
| return WH_MAKE_KEYID(type, user, id); | ||
| } | ||
|
|
||
| whKeyId wh_KeyId_TranslateToClient(whKeyId serverId) | ||
| { | ||
| whKeyId clientId = WH_KEYID_ID(serverId); | ||
|
|
||
| #ifdef WOLFHSM_CFG_GLOBAL_KEYS | ||
| /* Convert USER=0 to global flag */ | ||
| if (WH_KEYID_USER(serverId) == WH_KEYUSER_GLOBAL) { | ||
| clientId |= WH_KEYID_CLIENT_GLOBAL_FLAG; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef WOLFHSM_CFG_KEYWRAP | ||
| /* Convert TYPE=WRAPPED to wrapped flag */ | ||
| if (WH_KEYID_TYPE(serverId) == WH_KEYTYPE_WRAPPED) { | ||
| clientId |= WH_KEYID_CLIENT_WRAPPED_FLAG; | ||
| } | ||
| #endif | ||
|
|
||
| return clientId; | ||
| } |
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
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.