@@ -784,29 +784,14 @@ validate_authenticity(signed_video_t *self, bu_list_item_t *sei)
784784 }
785785 }
786786
787- // If we lose an entire GOP (part from the associated SEI) it will be seen as valid. Here we fix
788- // it afterwards.
789- // TODO: Move this inside the verify_hashes_ functions. We should not need to perform any special
790- // actions on the output.
791- // TODO: Investigate if this part is actually needed.
792- // if (!validation_flags->is_first_validation) {
793- // if ((valid == SV_AUTH_RESULT_OK) && (num_expected > 1) && (num_missed >= num_expected)) {
794- // valid = SV_AUTH_RESULT_NOT_OK;
795- // }
796- // }
797787 // The very first validation needs to be handled separately. If this is truly the start of a
798788 // stream we have all necessary information to successfully validate the authenticity. It can be
799789 // interpreted as being in sync with its signing counterpart. If this session validates the
800790 // authenticity of a segment of a stream, e.g., an exported file, we start out of sync. The first
801791 // SEI may be associated with a GOP prior to this segment.
802- if (validation_flags -> is_first_validation ) {
803- // Change status from SV_AUTH_RESULT_OK to SV_AUTH_RESULT_SIGNATURE_PRESENT if no valid BUs
804- // were found when collecting stats.
805- if ((valid == SV_AUTH_RESULT_OK ) && !has_valid_bu && (sei && sei -> bu -> is_signed )) {
806- valid = SV_AUTH_RESULT_SIGNATURE_PRESENT ;
807- }
792+ if (validation_flags -> is_first_validation && !validation_flags -> sei_in_sync ) {
808793 // If validation was successful, the |current_partial_gop| is in sync.
809- if (valid != SV_AUTH_RESULT_OK ) {
794+ if (valid != SV_AUTH_RESULT_OK && ! has_valid_bu ) {
810795 // We have validated the authenticity based on one single BU, but failed. A success can only
811796 // happen if we are at the beginning of the original stream. For all other cases, for example,
812797 // if we validate the authenticity of an exported file, the first SEI may be associated with a
@@ -821,7 +806,7 @@ validate_authenticity(signed_video_t *self, bu_list_item_t *sei)
821806 num_received = -1 ;
822807 // If no valid Bitstream Units were found, reset validation to be able to make more
823808 // attepts to synchronize the SEIs.
824- validation_flags -> reset_first_validation = ! has_valid_bu ;
809+ validation_flags -> reset_first_validation = true ;
825810 }
826811 }
827812 if (latest -> public_key_has_changed ) valid = SV_AUTH_RESULT_NOT_OK ;
@@ -869,7 +854,7 @@ remove_sei_association(bu_list_t *bu_list, const bu_list_item_t *sei)
869854 bu_list_item_t * item = bu_list -> first_item ;
870855 while (item ) {
871856 if (sei && item -> associated_sei == sei ) {
872- if (item -> validation_status == 'M' ) {
857+ if (item -> tmp_validation_status == 'M' ) {
873858 const bu_list_item_t * item_to_remove = item ;
874859 item = item -> next ;
875860 bu_list_remove_and_free_item (bu_list , item_to_remove );
@@ -1200,8 +1185,7 @@ maybe_validate_gop(signed_video_t *self, bu_info_t *bu)
12001185 while (has_pending_partial_gop (self ) && !stop_validating && max_loop > 0 ) {
12011186 bu_list_item_t * sei = NULL ;
12021187 // Initialize latest validation if not validating intermediate GOPs.
1203- if (!validation_flags -> waiting_for_signature &&
1204- (!validation_flags -> has_auth_result || validation_flags -> is_first_validation )) {
1188+ if (!validation_flags -> waiting_for_signature && !validation_flags -> has_auth_result ) {
12051189 latest -> authenticity = SV_AUTH_RESULT_SIGNATURE_PRESENT ;
12061190 latest -> number_of_expected_picture_nalus = 0 ;
12071191 latest -> number_of_received_picture_nalus = 0 ;
@@ -1223,7 +1207,7 @@ maybe_validate_gop(signed_video_t *self, bu_info_t *bu)
12231207 validate_authenticity (self , sei );
12241208 }
12251209
1226- if (validation_flags -> is_first_validation && ( latest -> authenticity != SV_AUTH_RESULT_OK ) ) {
1210+ if (validation_flags -> is_first_validation && ! validation_flags -> sei_in_sync ) {
12271211 // Fetch the |tmp_validation_status| for later use.
12281212 update_sei_in_validation (self , false, & sei_validation_status , NULL );
12291213 }
0 commit comments