From 72f4bdd96c10ad2f2226e4ab10fdca5114ec4f1c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 15 Dec 2011 10:04:11 +0100 Subject: [PATCH] fix usage of non default srtp key --- .cproject | 8 ++++++++ coreapi/linphonecall.c | 13 ++++++++++--- coreapi/offeranswer.c | 4 ++-- oRTP | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.cproject b/.cproject index 52dd1639..0b797781 100644 --- a/.cproject +++ b/.cproject @@ -238,6 +238,14 @@ true true + + make + + all + true + true + true + diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 45932f36..c53d534f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1039,7 +1039,15 @@ static bool_t linphone_call_sound_resources_available(LinphoneCall *call){ return !linphone_core_is_in_conference(lc) && (current==NULL || current==call); } - +static int find_crypto_index_from_tag(SalSrtpCryptoAlgo crypto[],unsigned char tag) { + int i; + for(i=0; icore; int jitt_comp=lc->rtp_conf.audio_jitt_comp; @@ -1130,11 +1138,10 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (stream->proto == SalProtoRtpSavp) { const SalStreamDescription *local_st_desc=sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp,SalAudio); - audio_stream_enable_strp( call->audiostream, stream->crypto[0].algo, - local_st_desc->crypto[0].master_key, + local_st_desc->crypto[find_crypto_index_from_tag(local_st_desc->crypto,stream->crypto[0].tag)].master_key, stream->crypto[0].master_key); call->audiostream_encrypted=TRUE; }else call->audiostream_encrypted=FALSE; diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index ae0fda94..4010e20b 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -142,8 +142,8 @@ static bool_t match_crypto_algo(const SalSrtpCryptoAlgo* local, const SalSrtpCry strncpy(result->master_key, local[j].master_key, 41); result->tag = local[j].tag; } else { - strncpy(result->master_key, remote[j].master_key, 41); - result->tag = remote[j].tag; + strncpy(result->master_key, remote[i].master_key, 41); + result->tag = remote[i].tag; } result->master_key[40] = '\0'; return TRUE; diff --git a/oRTP b/oRTP index 070d30dd..758150c3 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 070d30dd75940b8c2e5898246437e213a47e834c +Subproject commit 758150c3cd0f5a3a7a087247d6ff2dd198435fe7 -- 2.39.2