Skip to content

spdm_requester: spdm_negotiate_algs: conformance #3

@twilfredo

Description

@twilfredo

Hey!

I'm running into issue in spdm_negotiate_algs()
https://github.com/l1k/linux/blob/62b225cf0f3fb87e9e737b342c45fad5cb356bfd/lib/spdm_requester.c#L855
where if the responder for example doesn't support SPDM_MUT_AUTH_CAP but supports SPDM_KEY_EX_CAP, then the expected rsp_sz is subsequently calculated with i = 3. However, a responder may send back all 4xspdm_req_alg_struct although we were expecting only 3.

Meaning that length < sizeof(*rsp) + rsp->param1 * sizeof(*req_alg_struct) is true and we error out with "Truncated algorithms response"

For example a libspdm responder would send back all supported AlgTypes which use up all 4 AlgStructs. Which could trigger the case above. The spec is a bit vague on this situation. From SPDM 1.3: 10.3.1 Supported algorithms block, "When constructing the
Supported Algorithms Block, the Responder shall follow all requirements for the Requester, and shall set all bits and
values that reflect algorithms that the Responder supports
." The last part seems to imply that it may send all that it supports, but the first part seems to contradict a little?

What could we do about this?

Also, I'm not entirely following why we are checking the responder_caps before creating a req_alg_struct as from my interpretation of the spec, it should just be Requester supported AlgTypes? That's based on "The algorithm structure table shall
be present only if the Requester supports that AlgType . AlgType shall monotonically increase for subsequent
entries" [SPDM 1.3 - 291]

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions