Skip to content

Commit 72f68c5

Browse files
authored
Handles reset on camera (#495)
A reset made on the camera will rewind the GOP counter which on the validation side will be detected as an old SEI. If an old SEI is detected, but the GOP hash is correct return success. Co-authored-by: bjornvolcker <bjornvolcker@users.noreply.github.com>
1 parent e4bb709 commit 72f68c5

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/src/sv_auth.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,18 @@ validate_authenticity(signed_video_t *self, bu_list_item_t *sei)
719719
num_expected = -1;
720720
} else if (validation_flags->num_lost_seis < 0) {
721721
DEBUG_LOG("Found an old SEI. Mark (partial) GOP as not authentic.");
722-
remove_sei_association(self->bu_list, sei);
723-
sei = NULL;
724-
verify_success = verify_hashes_without_sei(self, 0);
725-
num_expected = -1;
722+
// If the number of lost SEIs is negative it either indicates a re-order of SEIs or
723+
// if the signing side reset the session. For the latter case, the GOP hash should be
724+
// correct, only the link is off.
725+
bool gop_hash_ok = verify_gop_hash(self);
726+
if (gop_hash_ok) {
727+
verify_success = verify_hashes_with_sei(self, sei);
728+
} else {
729+
remove_sei_association(self->bu_list, sei);
730+
sei = NULL;
731+
verify_success = verify_hashes_without_sei(self, 0);
732+
num_expected = -1;
733+
}
726734
} else {
727735
verify_success = verify_hashes_with_sei(self, sei);
728736
}

tests/check/check_signed_video_auth.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,8 +1093,6 @@ END_TEST
10931093
*/
10941094
START_TEST(camera_reset_on_signing_side)
10951095
{
1096-
// TODO: Enable when solved
1097-
return;
10981096
// Generate 2 GOPs
10991097
test_stream_t *list = create_signed_stream("IPPIPPIP", settings[_i]);
11001098
test_stream_check_types(list, "IPPISPPISP");

0 commit comments

Comments
 (0)