Commit bf18ff84 authored by jehan's avatar jehan

fix srtp case where recv key is sent first

parent 1f05ff7d
......@@ -34,7 +34,7 @@
<tool id="cdt.managedbuild.tool.gnu.archiver.macosx.base.1639679087" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.1401593352" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1973640523" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.base">
<option id="gnu.c.compiler.option.preprocessor.def.symbols.369096869" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<option id="gnu.c.compiler.option.preprocessor.def.symbols.369096869" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="VIDEO_ENABLED=1"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1596178168" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
......@@ -42,9 +42,10 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="src/otherfilters|tester|src/utils|src/voip|src/audiofilters|src/videofilters|src/base" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="src/crypto|src/otherfilters|tester|src/utils|src/voip|src/audiofilters|src/videofilters|src/base" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/audiofilters"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/base"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/crypto"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/otherfilters"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/utils"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src/videofilters"/>
......
......@@ -347,7 +347,7 @@ static int ms_add_srtp_stream(srtp_t srtp, MSCryptoSuite suite, uint32_t ssrc, c
policy.ssrc = ssrc_conf;
policy.key = (uint8_t *)key;
policy.next = NULL;
if (srtp->stream_template) {
if (inbound && srtp->stream_template) {
/* deallocate stream template, if there is one to be still be able to have late ssrc*/
/* auth_dealloc(srtp->stream_template->rtcp_auth);
cipher_dealloc(srtp->stream_template->rtcp_cipher);
......
......@@ -28,17 +28,20 @@ extern int apple_main(int argc, char **argv);
@public
int argc;
char **argv;
id activity;
}
@property (strong) id activity;
-(void)applicationWillFinishLaunching: (NSNotification*) aNotification;
-(void)applicationDidFinishLaunching: (NSNotification*) aNotification;
-(BOOL)applicationShouldTerminateAfterLastWindowClosed: (NSApplication *)theApplication;
@end
@implementation MyApplicationDelegate
-(void) runLoop {
exit(apple_main(argc,argv));
}
......@@ -48,7 +51,7 @@ extern int apple_main(int argc, char **argv);
if( [[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions:reason:)] ){
//NSActivityOptions options = NSActivityAutomaticTerminationDisabled & NSActivityIdleSystemSleepDisabled;
NSLog(@"Disabling App nap for tester");
self.activity = [[NSProcessInfo processInfo] beginActivityWithOptions:0x00FFFFFF reason:@"No app nap for ms2 tester"];
self->activity = [[[NSProcessInfo processInfo] beginActivityWithOptions:0x00FFFFFF reason:@"No app nap for ms2 tester"] retain];
}
[self performSelectorInBackground:@selector(runLoop) withObject:nil];
}
......@@ -59,9 +62,10 @@ extern int apple_main(int argc, char **argv);
- (void)applicationWillTerminate:(NSNotification *)aNotification {
NSLog(@"applicationWillTerminate");
if( self.activity ){
[[NSProcessInfo processInfo] endActivity:self.activity];
self.activity = nil;
if( self->activity ){
[[NSProcessInfo processInfo] endActivity:self->activity];
[self->activity release];
self->activity = nil;
}
}
......
......@@ -171,7 +171,10 @@ static void multicast_audio_stream() {
,MULTICAST_IP, MARGAUX_RTP_PORT, 0);
}
static void encrypted_audio_stream_base(bool_t change_ssrc, bool_t change_send_key_in_the_middle) {
static void encrypted_audio_stream_base( bool_t change_ssrc,
bool_t change_send_key_in_the_middle
,bool_t set_both_send_recv_key
,bool_t send_key_first) {
AudioStream * marielle = audio_stream_new (MARIELLE_RTP_PORT, MARIELLE_RTCP_PORT,FALSE);
AudioStream * margaux = audio_stream_new (MARGAUX_RTP_PORT,MARGAUX_RTCP_PORT, FALSE);
RtpProfile* profile = rtp_profile_new("default profile");
......@@ -213,8 +216,25 @@ static void encrypted_audio_stream_base(bool_t change_ssrc, bool_t change_send_k
, NULL
, 0),0);
CU_ASSERT_TRUE(media_stream_set_srtp_send_key_b64(&(marielle->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
CU_ASSERT_TRUE(media_stream_set_srtp_recv_key_b64(&(margaux->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") ==0);
if (send_key_first) {
CU_ASSERT_TRUE(media_stream_set_srtp_send_key_b64(&(marielle->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
if (set_both_send_recv_key)
CU_ASSERT_TRUE(media_stream_set_srtp_send_key_b64(&(margaux->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") == 0);
CU_ASSERT_TRUE(media_stream_set_srtp_recv_key_b64(&(margaux->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") ==0);
if (set_both_send_recv_key)
CU_ASSERT_TRUE(media_stream_set_srtp_recv_key_b64(&(marielle->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") ==0);
} else {
CU_ASSERT_TRUE(media_stream_set_srtp_recv_key_b64(&(margaux->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") ==0);
if (set_both_send_recv_key)
CU_ASSERT_TRUE(media_stream_set_srtp_recv_key_b64(&(marielle->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") ==0);
CU_ASSERT_TRUE(media_stream_set_srtp_send_key_b64(&(marielle->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
if (set_both_send_recv_key)
CU_ASSERT_TRUE(media_stream_set_srtp_send_key_b64(&(margaux->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") == 0);
}
ms_filter_add_notify_callback(marielle->soundread, notify_cb, &marielle_stats,TRUE);
if (change_send_key_in_the_middle) {
......@@ -273,15 +293,23 @@ static void encrypted_audio_stream_base(bool_t change_ssrc, bool_t change_send_k
}
static void encrypted_audio_stream() {
encrypted_audio_stream_base(FALSE,FALSE);
encrypted_audio_stream_base(FALSE,FALSE,FALSE,TRUE);
}
static void encrypted_audio_stream_with_2_srtp_stream() {
encrypted_audio_stream_base(FALSE,FALSE,TRUE,TRUE);
}
static void encrypted_audio_stream_with_2_srtp_stream_recv_first() {
encrypted_audio_stream_base(FALSE,FALSE,TRUE,FALSE);
}
static void encrypted_audio_stream_with_key_change() {
encrypted_audio_stream_base(FALSE,TRUE);
encrypted_audio_stream_base(FALSE,TRUE,FALSE,TRUE);
}
static void encrypted_audio_stream_with_ssrc_change() {
encrypted_audio_stream_base(TRUE,FALSE);
encrypted_audio_stream_base(TRUE,FALSE,FALSE,TRUE);
}
#if 0
static void audio_stream_dtmf(int codec_payload, int initial_bitrate,int target_bw, int max_recv_rtcp_packet) {
......@@ -328,6 +356,8 @@ static test_t tests[] = {
{ "Basic audio stream", basic_audio_stream },
{ "Multicast audio stream", multicast_audio_stream },
{ "Encrypted audio stream", encrypted_audio_stream },
{ "Encrypted audio stream with 2 srtp context",encrypted_audio_stream_with_2_srtp_stream},
{ "Encrypted audio stream with 2 srtp context, recv first",encrypted_audio_stream_with_2_srtp_stream_recv_first},
{ "Encrypted audio stream with ssrc changes", encrypted_audio_stream_with_ssrc_change},
{ "Encrypted audio stream with key change",encrypted_audio_stream_with_key_change},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment