From: Sylvain Berfini Date: Fri, 22 Mar 2013 15:34:09 +0000 (+0100) Subject: Revert "Send ZRTP hello hash in SIP SDP." X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=824c0e89f2c34298c6c6e749e9dcfbff4265a73f Revert "Send ZRTP hello hash in SIP SDP." This reverts commit 71f31347fcddaa5f0e9e329a7320efe60bc7c281. Conflicts: coreapi/linphonecall.c mediastreamer2 --- diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2770d4ad..6c01c65b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -254,14 +254,6 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * l=ms_list_append(l,pt); md->streams[0].payloads=l; - // if ZRTP is enabled, put the hello hash into the audiostream's desc - if (call->audiostream && call->audiostream->ms.zrtp_context!=NULL){ - ortp_zrtp_get_hello_hash(call->audiostream->ms.zrtp_context, - md->streams[0].zrtp_hello_hash, - sizeof(md->streams[0].zrtp_hello_hash)); - ms_message("Audio stream zrtp hash: %s", md->streams[0].zrtp_hello_hash); - } - if (call->params.has_video){ md->n_active_streams++; md->streams[1].rtp_port=call->video_port; @@ -270,13 +262,6 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * md->streams[1].type=SalVideo; l=make_codec_list(lc,lc->codecs_conf.video_codecs,0,NULL,-1); md->streams[1].payloads=l; - // if ZRTP is enabled, put the hello hash into the audiostream's desc - if (call->videostream && call->videostream->ms.zrtp_context!=NULL){ - ortp_zrtp_get_hello_hash(call->videostream->ms.zrtp_context, - md->streams[1].zrtp_hello_hash, - sizeof(md->streams[1].zrtp_hello_hash)); - ms_message("Video stream zrtp hash: %s", md->streams[1].zrtp_hello_hash); - } } if (md->n_total_streams < md->n_active_streams) md->n_total_streams = md->n_active_streams; @@ -1309,20 +1294,6 @@ void linphone_call_init_video_stream(LinphoneCall *call){ void linphone_call_init_media_streams(LinphoneCall *call){ linphone_call_init_audio_stream(call); linphone_call_init_video_stream(call); - - // moved from linphone_call_start_media_streams, because ZRTP needs to be - // at least partially initialized so that the SDP can contain 'zrtp-hash' - if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) { - OrtpZrtpParams params; - /*will be set later when zrtp is activated*/ - call->current_params.media_encryption=LinphoneMediaEncryptionNone; - - params.zid_file=call->core->zrtp_secrets_cache; - audio_stream_enable_zrtp(call->audiostream,¶ms); - } else if (call->params.media_encryption==LinphoneMediaEncryptionSRTP){ - call->current_params.media_encryption=linphone_call_are_all_streams_encrypted(call) ? - LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone; - } } @@ -1765,10 +1736,16 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->playing_ringbacktone=send_ringbacktone; call->up_bw=linphone_core_get_upload_bandwidth(lc); - // ZRTP was initialized in linphone_call_init_media_streams with a - // partially iniitalized RtpSession, and now needs to get an update if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) { - ortp_zrtp_start_engine(call->audiostream->ms.zrtp_context,call->audiostream->ms.session); + OrtpZrtpParams params; + /*will be set later when zrtp is activated*/ + call->current_params.media_encryption=LinphoneMediaEncryptionNone; + + params.zid_file=lc->zrtp_secrets_cache; + audio_stream_enable_zrtp(call->audiostream,¶ms); + }else if (call->params.media_encryption==LinphoneMediaEncryptionSRTP){ + call->current_params.media_encryption=linphone_call_are_all_streams_encrypted(call) ? + LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone; } /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 54224126..0089dd0f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3126,14 +3126,8 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, sal_call_set_local_media_description(call->op,call->localdesc); } - if (call->audiostream==NULL){ + if (call->audiostream==NULL) linphone_call_init_media_streams(call); - // the local media description must be regenerated after the audiostream - // is initialized, otherwise the ZRTP hello hash will not be available - linphone_call_make_local_media_description(lc,call); - sal_call_set_local_media_description(call->op,call->localdesc); - } - if (!was_ringing && call->audiostream->ms.ticker==NULL){ audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index eefe34d4..9823c24a 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -261,7 +261,6 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->ice_completed = local_cap->ice_completed; memcpy(result->ice_candidates, local_cap->ice_candidates, sizeof(result->ice_candidates)); memcpy(result->ice_remote_candidates, local_cap->ice_remote_candidates, sizeof(result->ice_remote_candidates)); - memcpy(result->zrtp_hello_hash,local_cap->zrtp_hello_hash, sizeof(result->zrtp_hello_hash)); } /** diff --git a/coreapi/sal.h b/coreapi/sal.h index 5f38c15a..25d8d20b 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -140,7 +140,7 @@ typedef struct SalIceRemoteCandidate { } SalIceRemoteCandidate; #define SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES 2 -#define SAL_MEDIA_DESCRIPTION_MAX_ZRTP_HELLO_HASH 128 + #define SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN 256 #define SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN 256 @@ -172,7 +172,6 @@ typedef struct SalStreamDescription{ SalIceRemoteCandidate ice_remote_candidates[SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES]; char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; - char zrtp_hello_hash[SAL_MEDIA_DESCRIPTION_MAX_ZRTP_HELLO_HASH]; bool_t ice_mismatch; bool_t ice_completed; } SalStreamDescription; diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 13944644..debd8550 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -108,17 +108,6 @@ static int _sdp_message_get_a_ptime(sdp_message_t *sdp, int mline){ return 0; } -static char * _sdp_message_get_a_zrtp_hash(sdp_message_t *sdp, int mline){ - int i; - sdp_attribute_t *attr; - for (i=0;(attr=sdp_message_attribute_get(sdp,mline,i))!=NULL;i++){ - if (keywordcmp("zrtp-hash",attr->a_att_field)==0){ - return attr->a_att_value; - } - } - return NULL; -} - static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){ int i; sdp_attribute_t *attr; @@ -348,11 +337,6 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription int_2char(desc->bandwidth)); if (desc->ptime>0) sdp_message_a_attribute_add(msg,lineno,osip_strdup("ptime"), int_2char(desc->ptime)); - - // if the ZRTP hello hash is available, create an a attribute for it - if (desc->zrtp_hello_hash[0]) - sdp_message_a_attribute_add(msg,lineno,osip_strdup("zrtp-hash"), osip_strdup(desc->zrtp_hello_hash)); - strip_well_known_rtpmaps=ms_list_size(desc->payloads)>5; if (desc->payloads){ for(elem=desc->payloads;elem!=NULL;elem=elem->next){ @@ -449,7 +433,7 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ int i,j; - const char *mtype,*proto,*rtp_port,*rtp_addr,*number,*zrtp_info; + const char *mtype,*proto,*rtp_port,*rtp_addr,*number; const char *sess; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; @@ -506,12 +490,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ stream->rtp_port=atoi(rtp_port); if (stream->rtp_port > 0) desc->n_active_streams++; - - // if the SDP contains a zrtp-hash, add it to the StreamDesc - zrtp_info = _sdp_message_get_a_zrtp_hash(msg, i); - if (zrtp_info != NULL) - strncpy(stream->zrtp_hello_hash, zrtp_info, sizeof(stream->zrtp_hello_hash)); - + stream->ptime=_sdp_message_get_a_ptime(msg,i); if (strcasecmp("audio", mtype) == 0){ stream->type=SalAudio; @@ -549,8 +528,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ for (j = 0; ((attr = sdp_message_attribute_get(msg, i, j)) != NULL); j++) { if ((keywordcmp("rtcp", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { char tmp[256]; - // added bounds check - int nb = sscanf(attr->a_att_value, "%d IN IP4 %256s", &stream->rtcp_port, tmp); + int nb = sscanf(attr->a_att_value, "%d IN IP4 %s", &stream->rtcp_port, tmp); if (nb == 1) { /* SDP rtcp attribute only contains the port */ } else if (nb == 2) { diff --git a/oRTP b/oRTP index c702c0ea..dbb75fb0 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit c702c0ea0e66bbe1f27c79690003d9748b01560f +Subproject commit dbb75fb00c65ce0102385f235c1da2873e9f6c2e