Skip to content

Commit b94a0b8

Browse files
committed
Solves synchronizing multiple GOPs signing
The final test has been adjusted and activated. Version bumped to v2.2.2.
1 parent 4d0f725 commit b94a0b8

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

lib/src/sv_auth.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,12 @@ validate_authenticity(signed_video_t *self, bu_list_item_t *sei)
804804
valid = SV_AUTH_RESULT_SIGNATURE_PRESENT;
805805
num_expected = -1;
806806
num_received = -1;
807+
if (sei && !sei->bu->is_signed) {
808+
// Reset the newly added |linked_hash| if this SEI is not signed, because
809+
// otherwise it will be added once again in the next round.
810+
uint8_t *computed_linked_hash = gop_info->linked_hashes;
811+
memcpy(computed_linked_hash + hash_size, computed_linked_hash, hash_size);
812+
}
807813
// If no valid Bitstream Units were found, reset validation to be able to make more
808814
// attepts to synchronize the SEIs.
809815
validation_flags->reset_first_validation = true;

lib/src/sv_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#define DEFAULT_HASH_SIZE (256 / 8)
5151

5252
#define SV_VERSION_BYTES 3
53-
#define SIGNED_VIDEO_VERSION "v2.2.1"
53+
#define SIGNED_VIDEO_VERSION "v2.2.2"
5454
#define SV_VERSION_MAX_STRLEN 19 // Longest possible string including 'ONVIF' prefix
5555

5656
#define DEFAULT_AUTHENTICITY_LEVEL SV_AUTHENTICITY_LEVEL_FRAME

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('signed-video-framework', 'c',
2-
version : '2.2.1',
2+
version : '2.2.2',
33
meson_version : '>= 0.53.0',
44
default_options : [ 'warning_level=2',
55
'werror=true',

tests/check/check_signed_video_auth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,8 +2860,6 @@ END_TEST
28602860

28612861
START_TEST(file_export_and_scrubbing_multiple_gops)
28622862
{
2863-
// Enable when validation can be made without dead lock.
2864-
return;
28652863
// Device side
28662864
struct sv_setting setting = settings[_i];
28672865
const unsigned signing_frequency = 3;
@@ -2899,15 +2897,16 @@ START_TEST(file_export_and_scrubbing_multiple_gops)
28992897
// Get the first two GOPs.
29002898
test_stream_t *first_list = test_stream_pop_gops(list, 2);
29012899
// IsPPPPPIsPP
2902-
// No report triggered.
2903-
signed_video_accumulated_validation_t tmp_final_validation = {
2904-
SV_AUTH_RESULT_NOT_SIGNED, false, 11, 0, 11, SV_PUBKEY_VALIDATION_NOT_FEASIBLE, true, 0, 0};
2900+
// No report triggered. No timestamps in report.
2901+
signed_video_accumulated_validation_t tmp_final_validation = {SV_AUTH_RESULT_SIGNATURE_PRESENT,
2902+
false, 11, 0, 11, SV_PUBKEY_VALIDATION_NOT_FEASIBLE, false, 0, 0};
29052903
expected.final_validation = &tmp_final_validation;
29062904
expected.valid_gops = 0;
29072905
expected.pending_bu = 0; // No report triggered.
29082906
expected.has_signature = 0;
2909-
ck_assert_int_eq(signed_video_reset(sv), SV_OK);
2907+
expected.has_no_timestamp = true;
29102908
// 5) Reset and validate the first two GOPs.
2909+
ck_assert_int_eq(signed_video_reset(sv), SV_OK);
29112910
validate_stream(sv, first_list, expected, true);
29122911
test_stream_free(first_list);
29132912
// 6) Scrub forward one GOP.
@@ -2921,8 +2920,9 @@ START_TEST(file_export_and_scrubbing_multiple_gops)
29212920
expected.valid_gops = 1;
29222921
expected.pending_bu = 1; // No report on the first unsigned SEI.
29232922
expected.has_signature = 0;
2924-
ck_assert_int_eq(signed_video_reset(sv), SV_OK);
2923+
expected.has_no_timestamp = false;
29252924
// 7) Reset and validate the rest of the file.
2925+
ck_assert_int_eq(signed_video_reset(sv), SV_OK);
29262926
validate_stream(sv, list, expected, true);
29272927

29282928
test_stream_free(list);

0 commit comments

Comments
 (0)