Skip to content

Commit

Permalink
just two
Browse files Browse the repository at this point in the history
  • Loading branch information
pabuhler committed Dec 28, 2024
1 parent d756779 commit c1ceb09
Showing 1 changed file with 3 additions and 141 deletions.
144 changes: 3 additions & 141 deletions test/srtp_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2412,140 +2412,16 @@ srtp_err_status_t srtp_validate_cryptex(void)
"5fbce381"
"94a5";

/* Plaintext packet with 1-byte header extension and CSRC fields. */
const char *srtp_1bytehdrext_cc_ref =
"920f1238"
"decafbad"
"cafebabe"
"0001e240"
"0000b26e"
"bede0001"
"51000200"
"abababab"
"abababab"
"abababab"
"abababab";

const char *srtp_1bytehdrext_cc_cryptex =
"920f1238"
"decafbad"
"cafebabe"
"8bb6e12b"
"5cff16dd"
"c0de0001"
"92838c8c"
"09e58393"
"e1de3a9a"
"74734d67"
"45671338"
"c3acf11d"
"a2df8423"
"bee0";

/* Plaintext packet with 2-byte header extension and CSRC fields. */
const char *srtp_2bytehdrext_cc_ref =
"920f1239"
"decafbad"
"cafebabe"
"0001e240"
"0000b26e"
"10000001"
"05020002"
"abababab"
"abababab"
"abababab"
"abababab";

const char *srtp_2bytehdrext_cc_cryptex =
"920f1239"
"decafbad"
"cafebabe"
"f70e513e"
"b90b9b25"
"c2de0001"
"bbed4848"
"faa64466"
"5f3d7f34"
"125914e9"
"f4d0ae92"
"3c6f479b"
"95a0f7b5"
"3133";

/* Plaintext packet with empty 1-byte header extension and CSRC fields. */
const char *srtp_1byte_empty_hdrext_cc_ref =
"920f123a"
"decafbad"
"cafebabe"
"0001e240"
"0000b26e"
"bede0000"
"abababab"
"abababab"
"abababab"
"abababab";

const char *srtp_1byte_empty_hdrext_cc_cryptex =
"920f123a"
"decafbad"
"cafebabe"
"7130b6ab"
"fe2ab0e3"
"c0de0000"
"e3d9f64b"
"25c9e74c"
"b4cf8e43"
"fb92e378"
"1c2c0cea"
"b6b3a499"
"a14c";

/* Plaintext packet with empty 2-byte header extension and CSRC fields. */
const char *srtp_2byte_empty_hdrext_cc_ref =
"920f123b"
"decafbad"
"cafebabe"
"0001e240"
"0000b26e"
"10000000"
"abababab"
"abababab"
"abababab"
"abababab";

const char *srtp_2byte_empty_hdrext_cc_cryptex =
"920f123b"
"decafbad"
"cafebabe"
"cbf24c12"
"4330e1c8"
"c2de0000"
"599dd45b"
"c9d687b6"
"03e8b59d"
"771fd38e"
"88b170e0"
"cd31e125"
"eabe";

// clang-format on

struct test_vectors_t vectors[6] = {
struct test_vectors_t vectors[2] = {
{ "Plaintext packet with 1-byte header extension", srtp_1bytehdrext_ref,
srtp_1bytehdrext_cryptex },
{ "Plaintext packet with 2-byte header extension", srtp_2bytehdrext_ref,
srtp_2bytehdrext_cryptex },
{ "Plaintext packet with 1-byte header extension and CSRC fields",
srtp_1bytehdrext_cc_ref, srtp_1bytehdrext_cc_cryptex },
{ "Plaintext packet with 2-byte header extension and CSRC fields",
srtp_2bytehdrext_cc_ref, srtp_2bytehdrext_cc_cryptex },
{ "Plaintext packet with empty 1-byte header extension and CSRC fields",
srtp_1byte_empty_hdrext_cc_ref, srtp_1byte_empty_hdrext_cc_cryptex },
{ "Plaintext packet with empty 2-byte header extension and CSRC fields",
srtp_2byte_empty_hdrext_cc_ref, srtp_2byte_empty_hdrext_cc_cryptex },
};

srtp_t srtp_snd, srtp_recv;
srtp_t srtp_snd;
size_t len, ref_len, enc_len;
srtp_policy_t policy;

Expand All @@ -2566,7 +2442,7 @@ srtp_err_status_t srtp_validate_cryptex(void)

CHECK_OK(srtp_create(&srtp_snd, &policy));

for (size_t i = 0; i < 6; ++i) {
for (size_t i = 0; i < 2; ++i) {
uint8_t packet[1400];
uint8_t reference[1400];
uint8_t ciphertext[1400];
Expand All @@ -2588,8 +2464,6 @@ srtp_err_status_t srtp_validate_cryptex(void)
*/
debug_print(mod_driver, "test vector: %s\n", vectors[i].name);



CHECK_OK(call_srtp_protect(srtp_snd, packet, &len, 0));
CHECK(len == enc_len);

Expand All @@ -2599,18 +2473,6 @@ srtp_err_status_t srtp_validate_cryptex(void)
octet_string_hex_string(ciphertext, len));

CHECK_BUFFER_EQUAL(packet, ciphertext, len);

CHECK_OK(srtp_create(&srtp_recv, &policy));

/*
* unprotect ciphertext, then compare with plaintext
*/
CHECK_OK(call_srtp_unprotect(srtp_recv, packet, &len));
CHECK(len == ref_len);

CHECK_BUFFER_EQUAL(packet, reference, len);

CHECK_OK(srtp_dealloc(srtp_recv));
}

CHECK_OK(srtp_dealloc(srtp_snd));
Expand Down

0 comments on commit c1ceb09

Please sign in to comment.