@@ -229,6 +229,29 @@ static libspdm_return_t libspdm_try_get_certificate(libspdm_context_t *spdm_cont
229
229
status = LIBSPDM_STATUS_INVALID_MSG_FIELD ;
230
230
goto done ;
231
231
}
232
+ if (spdm_request -> header .spdm_version >= SPDM_MESSAGE_VERSION_13 ) {
233
+ LIBSPDM_DEBUG ((LIBSPDM_DEBUG_INFO , "cert_info - 0x%02x\n" ,
234
+ spdm_response -> header .param2 ));
235
+ if ((spdm_response -> header .param2 &
236
+ SPDM_CERTIFICATE_RESPONSE_ATTRIBUTES_CERTIFICATE_INFO_MASK ) ==
237
+ SPDM_CERTIFICATE_INFO_CERT_MODEL_NONE ) {
238
+ libspdm_release_receiver_buffer (spdm_context );
239
+ status = LIBSPDM_STATUS_INVALID_MSG_FIELD ;
240
+ goto done ;
241
+ }
242
+ if (spdm_context -> connection_info .peer_cert_info [slot_id ] ==
243
+ SPDM_CERTIFICATE_INFO_CERT_MODEL_NONE ) {
244
+ spdm_context -> connection_info .peer_cert_info [slot_id ] =
245
+ (spdm_response -> header .param2 &
246
+ SPDM_CERTIFICATE_RESPONSE_ATTRIBUTES_CERTIFICATE_INFO_MASK );
247
+ } else if (spdm_context -> connection_info .peer_cert_info [slot_id ] !=
248
+ (spdm_response -> header .param2 &
249
+ SPDM_CERTIFICATE_RESPONSE_ATTRIBUTES_CERTIFICATE_INFO_MASK )) {
250
+ libspdm_release_receiver_buffer (spdm_context );
251
+ status = LIBSPDM_STATUS_INVALID_MSG_FIELD ;
252
+ goto done ;
253
+ }
254
+ }
232
255
if (spdm_response_size < sizeof (spdm_certificate_response_t ) +
233
256
spdm_response -> portion_length ) {
234
257
libspdm_release_receiver_buffer (spdm_context );
0 commit comments