@@ -159,16 +159,16 @@ hash_is_empty(const uint8_t *hash, size_t hash_size)
159159 * SEI.
160160 */
161161bool
162- verify_linked_hash (signed_video_t * self )
162+ verify_linked_hash (signed_video_t * self , bool check_empty_hash )
163163{
164- gop_info_t * gop_info = self -> gop_info ;
165164 const size_t hash_size = self -> verify_data -> hash_size ;
166- const uint8_t linked_hash [MAX_HASH_SIZE ] = {0 };
165+ const uint8_t * computed_link = self -> gop_info -> linked_hashes ;
166+ const uint8_t * received_link = self -> received_linked_hash ;
167167 // The linked hash is used to validate the sequence of GOPs. Verification is only possible
168168 // after receiving two complete GOPs, which is indicated by the presence of all-zero
169169 // hashes in |linked_hashes|.
170- return ((memcmp (gop_info -> linked_hashes , linked_hash , hash_size ) == 0 ) ||
171- (memcmp ( gop_info -> linked_hashes , self -> received_linked_hash , hash_size ) == 0 ));
170+ return ((memcmp (computed_link , received_link , hash_size ) == 0 ) ||
171+ (check_empty_hash && hash_is_empty ( computed_link , hash_size )));
172172}
173173
174174/**
@@ -562,7 +562,7 @@ verify_hashes_with_sei(signed_video_t *self, bu_list_item_t *sei)
562562 bool sei_is_maybe_ok =
563563 (!sei -> bu -> is_signed || (sei -> bu -> is_signed && sei -> verified_signature == 1 ));
564564 bool gop_hash_ok = verify_gop_hash (self );
565- bool linked_hash_ok = verify_linked_hash (self );
565+ bool linked_hash_ok = verify_linked_hash (self , true );
566566 self -> validation_flags .sei_in_sync |= linked_hash_ok ;
567567 // For complete and successful validation both the GOP hash and the linked hash have
568568 // to be correct (given that the signature could be verified successfully of course).
0 commit comments