Skip to content
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

Enforce non-zero CertModel #2745

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Enforce non-zero CertModel #2745

merged 1 commit into from
Jul 3, 2024

Conversation

steven-bellock
Copy link
Contributor

Fix #2581.

Signed-off-by: Steven Bellock [email protected]

@steven-bellock
Copy link
Contributor Author

I'll add the unit tests for CSR in a subsequent push.

if (key_pair_id == 0) {
return LIBSPDM_STATUS_INVALID_PARAMETER;
}
if ((csr_cert_model != SPDM_CERTIFICATE_INFO_CERT_MODEL_DEVICE_CERT) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. It is better to use:
req_cert_model >= SPDM_GET_CSR_REQUEST_ATTRIBUTES_MAX_CSR_CERT_MODEL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be 0 either. I'll make a helper function in common_lib and then this logic can be consolidated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't make a helper function for now.

unit_test/test_spdm_responder/set_certificate_rsp.c Outdated Show resolved Hide resolved
@steven-bellock steven-bellock force-pushed the fix-2581 branch 2 times, most recently from f150e8a to 5fd0328 Compare July 2, 2024 19:24
Fix DMTF#2581.

Signed-off-by: Steven Bellock <[email protected]>
@steven-bellock
Copy link
Contributor Author

I'll add the unit tests for CSR in a subsequent push.

The unit test has been added.

@jyao1 jyao1 merged commit 4f61c2b into DMTF:main Jul 3, 2024
97 checks passed
@jyao1
Copy link
Member

jyao1 commented Jul 3, 2024

@steven-bellock , have you validated spdm-emu?

I notice spdm-emu failed on set_cert with latest libspdm. Would you please take a look?

libspdm_set_certificate - 80010001
do_certificate_provising_via_spdm - 80010001
do_session_via_spdm - 80010001

@steven-bellock steven-bellock deleted the fix-2581 branch July 3, 2024 15:27
@steven-bellock
Copy link
Contributor Author

have you validated spdm-emu?

I have not. I'll have a look at it.

@steven-bellock
Copy link
Contributor Author

@jyao1 the spdm-emu issue is due to the Requester using the illegal combination

  • MULTI_KEY_CONN_RSP is true.
  • Erase is false.
  • CertModel is 0.

In particular if MULTI_KEY_CONN_RSP is true then the Integrator needs to use the libspdm_set_certificate_ex function.

@steven-bellock
Copy link
Contributor Author

steven-bellock commented Jul 4, 2024

As an aside, after re-reading the specification and looking at this pull request, it might be too aggressive with the key_pair_id check. For SET_CERTIFICATE it currently has

        if (spdm_context->connection_info.multi_key_conn_rsp) {
            if (key_pair_id == 0) {
                return LIBSPDM_STATUS_INVALID_PARAMETER;
            }

But maybe this should only be checked if Erase is false? I'll make a follow-up issue and pull request.

@jyao1
Copy link
Member

jyao1 commented Jul 5, 2024

Yes, please submit PR to fix. We need this patch for Q2 release.

@steven-bellock
Copy link
Contributor Author

I have a fix for spdm-emu but #2746 needs to be fixed on the libspdm side first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legal CSRCertModel and SetCertModel when MULTI_KEY_CONN_RSP is true
3 participants