Skip to content

Latest commit

 

History

History
397 lines (283 loc) · 14.5 KB

8.KeyExchangeRsp.md

File metadata and controls

397 lines (283 loc) · 14.5 KB

8. Test Case for KEY_EXCHANGE_RSP

Case 8.1

Description: SPDM responder shall return valid KEY_EXCHANGE_RSP, if it receives a KEY_EXCHANGE with negotiated version 1.1.

SPDM Version: 1.1

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=0, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.1.1: sizeof(SpdmMessage) >= sizeof(KEY_EXCHANGE_RSP) + SpdmMessage.OpaqueDataLength

Assertion 8.1.2: SpdmMessage.RequestResponseCode == KEY_EXCHANGE_RSP

Assertion 8.1.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.1.4: SpdmMessage.MutAuthRequested == 0 && SpdmMessage.SlotIDParam == 0

Assertion 8.1.5: SPDMsignatureVerify (PubKey, SpdmMessage.Signature, TH.SIG.KEY_EXCHANGE_RSP) version 1.1 success

Assertion 8.1.6: HMACVerify (finished_key, SpdmMessage.ResponderVerifyData, TH.HMAC.KEY_EXCHANGE_RSP) version 1.1 success

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=TcbMeasurements}, if Flags.MEAS_CAP != 0.

Assertion 8.1.*.

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=AllMeasurement}, if Flags.MEAS_CAP != 0.

Assertion 8.1.*.

Case 8.2

Description: SPDM responder shall return valid KEY_EXCHANGE_RSP with HANDSHAKE_IN_THE_CLEAR, if it receives a KEY_EXCHANGE with HANDSHAKE_IN_THE_CLEAR_CAP and negotiated version 1.1.

SPDM Version: 1.1

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=1, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0 || Flags.HANDSHAKE_IN_THE_CLEAR_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.2.1: sizeof(SpdmMessage) >= sizeof(KEY_EXCHANGE_RSP) + SpdmMessage.OpaqueDataLength - HMAC size

Assertion 8.2.2: SpdmMessage.RequestResponseCode == KEY_EXCHANGE_RSP

Assertion 8.2.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.2.4: SpdmMessage.MutAuthRequested == 0 && SpdmMessage.SlotIDParam == 0

Assertion 8.2.5: SPDMsignatureVerify (PubKey, SpdmMessage.Signature, TH.SIG.KEY_EXCHANGE_RSP) version 1.1 success

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=TcbMeasurements}, if Flags.MEAS_CAP != 0.

Assertion 8.2.*.

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=AllMeasurement}, if Flags.MEAS_CAP != 0.

Assertion 8.2.*.

Case 8.3

Description: SPDM responder shall return ERROR(VersionMismatch), if it receives a KEY_EXCHANGE with non negotiated version.

SPDM Version: 1.1+

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 or above is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=0, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=(NegotiatedVersion+1), Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.3.1: sizeof(SpdmMessage) >= sizeof(ERROR)

Assertion 8.3.2: SpdmMessage.RequestResponseCode == ERROR

Assertion 8.3.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.3.4: SpdmMessage.Param1 == VersionMismatch.

Assertion 8.3.5: SpdmMessage.Param2 == 0.

  1. Requester -> KEY_EXCHANGE {SPDMVersion=(NegotiatedVersion-1), Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.3.*.

Case 8.4

Description: SPDM responder shall return ERROR(UnexpectedRequest), if it receives a KEY_EXCHANGE before NEGOTIATE_ALGORITHMS.

SPDM Version: 1.1+

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 or above is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0, then skip this case.

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.4.1: sizeof(SpdmMessage) >= sizeof(ERROR)

Assertion 8.4.2: SpdmMessage.RequestResponseCode == ERROR

Assertion 8.4.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.4.4: SpdmMessage.Param1 == UnexpectedRequest.

Assertion 8.4.5: SpdmMessage.Param2 == 0.

Case 8.5

Description: SPDM responder shall return ERROR(UnexpectedRequest), if it receives a KEY_EXCHANGE in a session application.

SPDM Version: 1.1+

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 or above is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder
  14. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, ...}
  15. KEY_EXCHANGE_RSP <- Responder
  16. Requester -> FINISH {SPDMVersion=NegotiatedVersion, ...} in session-X
  17. FINISH_RSP <- Responder in session-X

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData} in session-X
  2. SpdmMessage <- Responder in session-X

Assertion 8.5.1: sizeof(SpdmMessage) >= sizeof(ERROR)

Assertion 8.5.2: SpdmMessage.RequestResponseCode == ERROR

Assertion 8.5.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.5.4: SpdmMessage.Param1 == UnexpectedRequest.

Assertion 8.5.5: SpdmMessage.Param2 == 0.

Case 8.6

Description: SPDM responder shall return ERROR(InvalidRequest), if it receives a KEY_EXCHANGE with invalid field.

SPDM Version: 1.1+

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.1 or above is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=0, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. InvalidSlotID[] = array of bit-index that SlotMask[bit-index]=0 from DIGEST.Param2.SlotMask + {0x8 ~ 0xF, 0xFF}
  13. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  14. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=InvalidSlotID[i], ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.6.1: sizeof(SpdmMessage) >= sizeof(ERROR)

Assertion 8.6.2: SpdmMessage.RequestResponseCode == ERROR

Assertion 8.6.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.6.4: SpdmMessage.Param1 == InvalidRequest.

Assertion 8.6.5: SpdmMessage.Param2 == 0.

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=(TcbMeasurements+1), Param2.SlotID=0, ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.6.*.

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=(AllMeasurements-1), Param2.SlotID=0, ReqSessionID, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.6.*.

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=0, ReqSessionID, RandomData, ExchangeData, OpaqueDataLength=0xFFFF}
  2. SpdmMessage <- Responder

Assertion 8.6.*.

Case 8.7

Description: SPDM responder shall return valid KEY_EXCHANGE_RSP, if it receives a KEY_EXCHANGE with negotiated version 1.2.

SPDM Version: 1.2

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.2 is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=0, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, SessionPolicy.TerminationPolicy=1, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.7.1: sizeof(SpdmMessage) >= sizeof(KEY_EXCHANGE_RSP) + SpdmMessage.OpaqueDataLength

Assertion 8.7.2: SpdmMessage.RequestResponseCode == KEY_EXCHANGE_RSP

Assertion 8.7.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.7.4: SpdmMessage.MutAuthRequested == 0 && SpdmMessage.SlotIDParam == 0

Assertion 8.7.5: SPDMsignatureVerify (PubKey, SpdmMessage.Signature, TH.SIG.KEY_EXCHANGE_RSP) version 1.2 success

Assertion 8.7.6: HMACVerify (finished_key, SpdmMessage.ResponderVerifyData, TH.HMAC.KEY_EXCHANGE_RSP) version 1.2 success

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=TcbMeasurements}, if Flags.MEAS_CAP != 0.

Assertion 8.7.*.

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=AllMeasurement}, if Flags.MEAS_CAP != 0.

Assertion 8.7.*.

Case 8.8

Description: SPDM responder shall return valid KEY_EXCHANGE_RSP with HANDSHAKE_IN_THE_CLEAR, if it receives a KEY_EXCHANGE with HANDSHAKE_IN_THE_CLEAR_CAP and negotiated version 1.2.

SPDM Version: 1.2

TestSetup:

  1. Requester -> GET_VERSION {SPDMVersion=0x10}
  2. VERSION <- Responder
  3. If 1.2 is not in VERSION.VersionNumberEntry, then skip this case.
  4. Requester -> GET_CAPABILITIES {SPDMVersion=NegotiatedVersion, Flags.MUT_AUTH_CAP=0, Flags.HANDSHAKE_IN_THE_CLEAR_CAP=1, ...}
  5. CAPABILITIES <- Responder
  6. If Flags.KEY_EX_CAP == 0 || Flags.CERT_CAP == 0 || Flags.HANDSHAKE_IN_THE_CLEAR_CAP == 0, then skip this case.
  7. Requester -> NEGOTIATE_ALGORITHMS {SPDMVersion=NegotiatedVersion, ...}
  8. ALGORITHMS <- Responder
  9. Requester -> GET_DIGESTS {SPDMVersion=NegotiatedVersion, ...}
  10. DIGESTS <- Responder
  11. ValidSlotID[] = array of bit-index that SlotMask[bit-index]=1 from DIGEST.Param2.SlotMask
  12. Requester -> GET_CERTIFICATE {SPDMVersion=NegotiatedVersion, Param1.SlotID=ValidSlotID[i], ...}
  13. CERTIFICATE <- Responder

TestTeardown: None

Steps:

  1. Requester -> KEY_EXCHANGE {SPDMVersion=NegotiatedVersion, Param1=NoMeasurement, Param2.SlotID=ValidSlotID[i], ReqSessionID, SessionPolicy.TerminationPolicy=1, RandomData, ExchangeData, OpaqueData}
  2. SpdmMessage <- Responder

Assertion 8.8.1: sizeof(SpdmMessage) >= sizeof(KEY_EXCHANGE_RSP) + SpdmMessage.OpaqueDataLength - HMAC size

Assertion 8.8.2: SpdmMessage.RequestResponseCode == KEY_EXCHANGE_RSP

Assertion 8.8.3: SpdmMessage.SPDMVersion == NegotiatedVersion

Assertion 8.8.4: SpdmMessage.MutAuthRequested == 0 && SpdmMessage.SlotIDParam == 0

Assertion 8.8.5: SPDMsignatureVerify (PubKey, SpdmMessage.Signature, TH.SIG.KEY_EXCHANGE_RSP) version 1.2 success

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=TcbMeasurements}, if Flags.MEAS_CAP != 0.

Assertion 8.8.*.

  1. Repeat (1~2) and use KEY_EXCHANGE {Param1=AllMeasurement}, if Flags.MEAS_CAP != 0.

Assertion 8.8.*.