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

The OpaqueData offset in libspdm_req_get_csr.c and libspdm_rsp_csr.c not match with the Byte offset of OpaqueData Field in GET_CSR request message format #2039

Closed
Zhiqiang520 opened this issue May 11, 2023 · 4 comments · Fixed by #2045
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Zhiqiang520
Copy link
Contributor

The OpaqueData offset in libspdm_req_get_csr.c and libspdm_rsp_csr.c does not match with the Byte offset of OpaqueData Field in Table 79 — GET_CSR request message format in DSP0274_1.2.1.pdf.

  1. The OpaqueData offset in libspdm_req_get_csr.c should be 8 + RequesterInfoLength, following the spec.
    GET_CSR request message format
    image

  2. But now the OpaqueData offset in libspdm_req_get_csr.c is spdm_request + 1(=8) at the following line 97, it is actually RequesterInfo Field, not OpaqueData Field.

    if (opaque_data_length != 0) {
    libspdm_copy_mem(spdm_request + 1,
    spdm_request_size - sizeof(spdm_get_csr_request_t),
    (uint8_t *)opaque_data, opaque_data_length);
    }
    if (requester_info_length != 0) {
    libspdm_copy_mem((uint8_t *)(spdm_request + 1) + opaque_data_length,
    spdm_request_size - sizeof(spdm_get_csr_request_t),
    (uint8_t *)requester_info, requester_info_length);
    }

  3. The same issue is also in libspdm_rsp_csr.c at the following line 116.

    opaque_data = (void*)((size_t)(spdm_request + 1));

@Zhiqiang520 Zhiqiang520 changed the title The **OpaqueData offset** in libspdm_req_get_csr.c and libspdm_rsp_csr.c not match with the Byte offset of OpaqueData Field in GET_CSR request message format. The OpaqueData offset in libspdm_req_get_csr.c and libspdm_rsp_csr.c not match with the Byte offset of OpaqueData Field in GET_CSR request message format May 11, 2023
@steven-bellock steven-bellock added the bug Something isn't working label May 11, 2023
@steven-bellock steven-bellock added this to the Q1 2023 milestone May 11, 2023
@steven-bellock
Copy link
Contributor

steven-bellock commented May 11, 2023

Looks like that's been there since the very beginning : 0ab2787 Nobody has complained probably because

  1. Nobody has a use for those fields.
  2. Nobody is using GET_CSR.

But this highlights a deficiency in the unit tests, as they aren't checking the values of those fields.

@jyao1
Copy link
Member

jyao1 commented May 12, 2023

I think probably we also need to fix in 2.3 branch.

Also need to check unit test.

@Xiaohanjlll
Copy link

I can take this issue

@steven-bellock
Copy link
Contributor

I think probably we also need to fix in 2.3 branch.

Also need to check unit test.

We can bundle it with the other fix.

Xiaohanjlll pushed a commit to Xiaohanjlll/libspdm that referenced this issue May 23, 2023
Xiaohanjlll pushed a commit to Xiaohanjlll/libspdm that referenced this issue May 23, 2023
jyao1 pushed a commit that referenced this issue May 23, 2023
Xiaohanjlll pushed a commit to Xiaohanjlll/libspdm that referenced this issue May 23, 2023
steven-bellock pushed a commit that referenced this issue May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants