@@ -112,7 +112,6 @@ decode_sei_data(signed_video_t *self, const uint8_t *payload, size_t payload_siz
112
112
gop_info -> num_partial_gop_wraparounds ++ ;
113
113
}
114
114
}
115
- detect_lost_sei (self );
116
115
117
116
return status ;
118
117
}
@@ -232,7 +231,7 @@ mark_associated_items(bu_list_t *bu_list, bool set_valid, bool link_ok, bu_list_
232
231
* linked hash with the first BU hash and marks it as used.
233
232
*/
234
233
static void
235
- update_link_hash_for_auth (signed_video_t * self , const bu_list_item_t * sei )
234
+ update_link_hash (signed_video_t * self , const bu_list_item_t * sei )
236
235
{
237
236
const size_t hash_size = self -> verify_data -> hash_size ;
238
237
bu_list_item_t * item = self -> bu_list -> first_item ;
@@ -264,14 +263,13 @@ reset_linked_hash(signed_video_t *self)
264
263
memset (self -> gop_info -> linked_hashes , 0 , 2 * MAX_HASH_SIZE );
265
264
}
266
265
267
- /* Marks the Bitstream Units (BU) that are used in GOP hash and computes the GOP hash.
266
+ /* Computes the GOP hash from Bitstream Units (BU) in the |bu_list|
268
267
*
269
268
* This function iterates through the BU list, identifies the BUs that belong to the
270
- * current GOP, and marks them as used in the GOP hash. It initializes the GOP hash and
271
- * updates it with each incoming BU that belongs to the GOP.
269
+ * current partial GOP, and associates them with the current |sei|.
272
270
*/
273
271
static svrc_t
274
- prepare_for_link_and_gop_hash_verification (signed_video_t * self , bu_list_item_t * sei )
272
+ compute_gop_hash (signed_video_t * self , bu_list_item_t * sei )
275
273
{
276
274
// Ensure the `self` pointer is valid
277
275
assert (self );
@@ -975,7 +973,6 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
975
973
(* sei )-> in_validation = true;
976
974
if (!(* sei )-> has_been_decoded ) {
977
975
// Decode the SEI and set signature->hash
978
- self -> latest_validation -> public_key_has_changed = false;
979
976
const uint8_t * tlv_data = (* sei )-> bu -> tlv_data ;
980
977
size_t tlv_size = (* sei )-> bu -> tlv_size ;
981
978
SV_THROW (decode_sei_data (self , tlv_data , tlv_size ));
@@ -984,7 +981,7 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
984
981
}
985
982
detect_lost_sei (self );
986
983
// Mark status of |sei| based on signature verification.
987
- if (! validation_flags -> has_lost_sei ) {
984
+ if (validation_flags -> num_lost_seis == 0 ) {
988
985
if ((* sei )-> bu -> is_signed ) {
989
986
switch ((* sei )-> verified_signature ) {
990
987
case 1 :
@@ -1001,12 +998,27 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
1001
998
} else {
1002
999
(* sei )-> validation_status_if_sei_ok = '.' ;
1003
1000
}
1001
+ } else if (validation_flags -> num_lost_seis < 0 ) {
1002
+ if ((* sei )-> bu -> is_signed ) {
1003
+ (* sei )-> tmp_validation_status = 'N' ;
1004
+ } else {
1005
+ (* sei )-> validation_status_if_sei_ok = 'N' ;
1006
+ }
1004
1007
}
1005
- SV_THROW (prepare_for_link_and_gop_hash_verification (self , * sei ));
1008
+ SV_THROW (compute_gop_hash (self , * sei ));
1009
+ update_link_hash (self , * sei );
1006
1010
1007
1011
SV_THROW_IF_WITH_MSG (validation_flags -> signing_present && !self -> has_public_key ,
1008
1012
SV_NOT_SUPPORTED , "No public key present" );
1009
1013
1014
+ // For SEIs, transfer the result of the signature verification.
1015
+ if ((* sei )-> bu -> is_signed ) {
1016
+ self -> gop_info -> verified_signature_hash = (* sei )-> verified_signature ;
1017
+ } else {
1018
+ self -> gop_info -> verified_signature_hash = 1 ;
1019
+ }
1020
+ validation_flags -> waiting_for_signature = !(* sei )-> bu -> is_signed ;
1021
+
1010
1022
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
1011
1023
// If "Axis Communications AB" can be identified from the |product_info|, get
1012
1024
// |supplemental_authenticity| from |vendor_handle|.
@@ -1035,14 +1047,6 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
1035
1047
}
1036
1048
#endif
1037
1049
1038
- // For SEIs, transfer the result of the signature verification.
1039
- if ((* sei )-> bu -> is_signed ) {
1040
- self -> gop_info -> verified_signature_hash = (* sei )-> verified_signature ;
1041
- } else {
1042
- self -> gop_info -> verified_signature_hash = 1 ;
1043
- }
1044
- validation_flags -> waiting_for_signature = !(* sei )-> bu -> is_signed ;
1045
-
1046
1050
SV_CATCH ()
1047
1051
SV_DONE (status )
1048
1052
@@ -1232,7 +1236,6 @@ maybe_validate_gop(signed_video_t *self, bu_info_t *bu)
1232
1236
}
1233
1237
1234
1238
SV_THROW (prepare_for_validation (self , & sei ));
1235
- update_link_hash_for_auth (self , sei );
1236
1239
1237
1240
if (!validation_flags -> signing_present ) {
1238
1241
latest -> authenticity = SV_AUTH_RESULT_NOT_SIGNED ;
0 commit comments