@@ -43,23 +43,29 @@ impl TryFrom<u8> for MeasurementSummaryHashType {
4343
4444#[ derive( FromBytes , IntoBytes , Immutable ) ]
4545#[ repr( C ) ]
46- // TODO: check backwards compatibility of this struct with the original ChallengeReq struct
46+ /// CHALLENGE request message base
47+ ///
48+ /// # Version specific fields for CHALLENGE:
49+ /// Following fields have to be appended, depending on the SPDM version.
50+ /// ## >= v1.3
51+ /// - `Context`: 8-byte application specific context.
52+ /// Should be all zeros if no context is provided.
4753struct ChallengeReq {
54+ /// `Param1`: `SlotID`
55+ ///
4856 /// Slot number of the Responder certificate chain that shall be used for authentication.
4957 /// If the public key of the Responder was provisioned to the Requester in a
5058 /// trusted environment, the value in this field shall be 0xFF ; otherwise it
5159 /// shall be between 0 and 7 inclusive.
5260 slot_id : u8 ,
5361
62+ /// `Param2`: Requested measurement summary hash
63+ ///
5464 /// Shall be the type of measurement summary hash requested.
5565 measurement_hash_type : u8 ,
5666
5767 /// The Requester should choose a random value.
5868 nonce : [ u8 ; NONCE_LEN ] ,
59-
60- /// The Requester can include application-specific information in Context.
61- /// The Requester should fill this field with zeros if it has no context to provide.
62- context : [ u8 ; CONTEXT_LEN ] ,
6369}
6470impl CommonCodec for ChallengeReq { }
6571
@@ -74,19 +80,15 @@ impl ChallengeReq {
7480 /// * `measurement_hash_type` - The type of measurement summary hash requested from the
7581 /// Responder.
7682 /// * `nonce` - A random 32-byte value chosen by the Requester for freshness.
77- /// * `context` - Optional 8-byte application-specific context. Defaults to all zeros when
78- /// `None`.
7983 pub fn new (
8084 slot_id : u8 ,
8185 measurement_hash_type : MeasurementSummaryHashType ,
8286 nonce : [ u8 ; NONCE_LEN ] ,
83- context : Option < [ u8 ; CONTEXT_LEN ] > ,
8487 ) -> Self {
8588 Self {
8689 slot_id,
8790 measurement_hash_type : measurement_hash_type as u8 ,
8891 nonce,
89- context : context. unwrap_or ( [ 0 ; CONTEXT_LEN ] ) ,
9092 }
9193 }
9294}
0 commit comments