Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/src/sv_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,18 +649,24 @@ verify_hashes_without_sei(signed_video_t *self, int num_skips)
// Determine number of items to mark given number of BUs to skip.
int num_marked_items = 0;
int max_marked_items = num_bu_in_first_gop;
int extra_marked_item = 0;
if (num_bu_in_all_gops == num_bu_in_first_gop) {
// Only one GOP present. Skip BUs from first GOP.
max_marked_items -= num_skips;
if (max_marked_items < 0) {
max_marked_items = 0;
// By definition, at least one BU needs to be validated to be able to synchronize
// the SEI.
if (!self->validation_flags.sei_in_sync) {
extra_marked_item = 1;
}
}
}

// Start from the oldest item and mark all pending items as NOT OK ('N') until
// |max_marked_items| have been marked.
item = bu_list->first_item;
while (item && (num_marked_items < max_marked_items)) {
while (item && (num_marked_items < max_marked_items + extra_marked_item)) {
// Skip non-pending items and items already associated with a SEI.
if (item->tmp_validation_status != 'P' || item->associated_sei) {
item = item->next;
Expand All @@ -682,7 +688,7 @@ verify_hashes_without_sei(signed_video_t *self, int num_skips)
item = item->next;
}

return (num_marked_items > 0);
return (num_marked_items - extra_marked_item > 0);
}

/* Validates the authenticity using hashes in the |bu_list|.
Expand Down
10 changes: 7 additions & 3 deletions tests/check/check_signed_video_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,13 @@ START_TEST(fast_forward_stream_without_reset)
//
// ISP -> (invalid)
signed_video_accumulated_validation_t final_validation = {SV_AUTH_RESULT_NOT_OK, false, 8 + 13,
8 + 10, 3, SV_PUBKEY_VALIDATION_NOT_FEASIBLE, true, 0, 0};
const struct validation_stats expected = {
.valid_gops = 1, .invalid_gops = 2, .pending_bu = 3, .final_validation = &final_validation};
8 + 1, // 10,
12, // 3,
SV_PUBKEY_VALIDATION_NOT_FEASIBLE, true, 0, 0};
const struct validation_stats expected = {.valid_gops = 0, // 1,
.invalid_gops = 3, // 2,
.pending_bu = 4, // 3,
.final_validation = &final_validation};
validate_stream(sv, list, expected, true);

// Free list and session.
Expand Down