-
Notifications
You must be signed in to change notification settings - Fork 151
Harden SPDM 1.4 PSK_FINISH opaque handling with core unit test coverage
#3606
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
Open
czwolak
wants to merge
1
commit into
DMTF:main
Choose a base branch
from
czwolak:czwolak/issue-3592-psk-finish-opaque
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.
+320
−3
Open
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| /** | ||
| * Copyright Notice: | ||
| * Copyright 2021-2025 DMTF. All rights reserved. | ||
| * Copyright 2021-2026 DMTF. All rights reserved. | ||
| * License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md | ||
| **/ | ||
|
|
||
|
|
@@ -293,6 +293,7 @@ static libspdm_return_t libspdm_try_send_receive_psk_finish( | |
| status = LIBSPDM_STATUS_INVALID_MSG_FIELD; | ||
| goto receive_done; | ||
| } | ||
|
|
||
| /* this message can only be in secured session | ||
| * thus don't need to consider transport layer padding, just check its exact size */ | ||
| if (spdm_response_size != sizeof(spdm_psk_finish_response_t) + sizeof(uint16_t) + | ||
|
|
@@ -302,7 +303,7 @@ static libspdm_return_t libspdm_try_send_receive_psk_finish( | |
| } | ||
|
|
||
| if ((responder_opaque_data != NULL) && (responder_opaque_data_size != NULL)) { | ||
| if (opaque_data_size >= *responder_opaque_data_size) { | ||
| if (opaque_data_size > *responder_opaque_data_size) { | ||
| status = LIBSPDM_STATUS_BUFFER_TOO_SMALL; | ||
| goto receive_done; | ||
| } | ||
|
|
@@ -325,7 +326,7 @@ static libspdm_return_t libspdm_try_send_receive_psk_finish( | |
| } | ||
| opaque_data_entry_size = 0; | ||
| } | ||
| spdm_response_size = sizeof(spdm_finish_response_t) + opaque_data_entry_size; | ||
| spdm_response_size = sizeof(spdm_psk_finish_response_t) + opaque_data_entry_size; | ||
|
Member
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. Good catch! |
||
|
|
||
| status = libspdm_append_message_f(spdm_context, session_info, true, spdm_response, | ||
| spdm_response_size); | ||
|
|
||
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.
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.
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.
Good catch!
I notice finish has same issue.
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.
Thanks. Do you think we better create separate follow-up issue or propose "finish" fix within this PR ?
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.
I am OK to create another PR.
I just want to ensure 1) all issues are fixed, 2) the solution is consistent, especially the similar ones.
That is why I cross-check other commands.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thank you :) can we confirm also another cases?
libspdm/library/spdm_requester_lib/libspdm_req_finish.c
Lines 611 to 614 in 538d089
libspdm/library/spdm_requester_lib/libspdm_req_key_exchange.c
Lines 728 to 731 in 538d089
libspdm/library/spdm_requester_lib/libspdm_req_psk_exchange.c
Lines 459 to 462 in 538d089