From e3b3a5aa5bd1d15d00bc1142136494397ed67a42 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Sun, 16 Nov 2014 23:26:14 +0100 Subject: [PATCH] move ZRTP management from oRTP to Mediastreamer2 using transport modifier --- coreapi/linphonecall.c | 24 ++++++++++++------------ coreapi/linphonecore.c | 6 +++--- mediastreamer2 | 2 +- oRTP | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a7d114ecc..d017d3b4b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -183,7 +183,7 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr { const LinphoneCallParams *params=linphone_call_get_current_params(call); if (params->has_video) { - OrtpZrtpParams params; + MSZrtpParams params; ms_message("Trying to enable encryption on video stream"); params.zid_file=NULL; //unused video_stream_enable_zrtp(call->videostream,call->audiostream,¶ms); @@ -219,9 +219,9 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t ms_error("linphone_call_set_authentication_token_verified(): No zrtp context."); } if (!call->auth_token_verified && verified){ - ortp_zrtp_sas_verified(call->audiostream->ms.sessions.zrtp_context); + ms_zrtp_sas_verified(call->audiostream->ms.sessions.zrtp_context); }else if (call->auth_token_verified && !verified){ - ortp_zrtp_sas_reset_verified(call->audiostream->ms.sessions.zrtp_context); + ms_zrtp_sas_reset_verified(call->audiostream->ms.sessions.zrtp_context); } call->auth_token_verified=verified; propagate_encryption_changed(call); @@ -2001,8 +2001,8 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag); if (crypto_idx >= 0) { - media_stream_set_srtp_recv_key(&call->audiostream->ms,stream->crypto[0].algo,stream->crypto[0].master_key); - media_stream_set_srtp_send_key(&call->audiostream->ms,stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key); + media_stream_set_srtp_recv_key(&call->audiostream->ms,stream->crypto[0].algo,stream->crypto[0].master_key, TRUE); + media_stream_set_srtp_send_key(&call->audiostream->ms,stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key, TRUE); } else { ms_warning("Failed to find local crypto algo with tag: %d", stream->crypto_local_tag); } @@ -2123,8 +2123,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna if (sal_stream_description_has_srtp(vstream) == TRUE) { int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, vstream->crypto_local_tag); if (crypto_idx >= 0) { - media_stream_set_srtp_recv_key(&call->videostream->ms,vstream->crypto[0].algo,vstream->crypto[0].master_key); - media_stream_set_srtp_send_key(&call->videostream->ms,vstream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key); + media_stream_set_srtp_recv_key(&call->videostream->ms,vstream->crypto[0].algo,vstream->crypto[0].master_key, TRUE); + media_stream_set_srtp_send_key(&call->videostream->ms,vstream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key, TRUE); } } configure_rtp_session_for_rtcp_xr(lc, call, SalVideo); @@ -2204,15 +2204,15 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->up_bw=linphone_core_get_upload_bandwidth(lc); if (call->params->media_encryption==LinphoneMediaEncryptionZRTP) { - OrtpZrtpParams params; - memset(¶ms,0,sizeof(OrtpZrtpParams)); + MSZrtpParams params; + memset(¶ms,0,sizeof(MSZrtpParams)); /*call->current_params.media_encryption will be set later when zrtp is activated*/ params.zid_file=lc->zrtp_secrets_cache; audio_stream_enable_zrtp(call->audiostream,¶ms); #if VIDEO_ENABLED if (media_stream_secured((MediaStream *)call->audiostream) && media_stream_get_state((MediaStream *)call->videostream) == MSStreamStarted) { /*audio stream is already encrypted and video stream is active*/ - memset(¶ms,0,sizeof(OrtpZrtpParams)); + memset(¶ms,0,sizeof(MSZrtpParams)); video_stream_enable_zrtp(call->videostream,call->audiostream,¶ms); } #endif @@ -2244,9 +2244,9 @@ static bool_t update_stream_crypto_params(LinphoneCall *call, const SalStreamDes int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag); if (crypto_idx >= 0) { if (call->localdesc_changed & SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED) - media_stream_set_srtp_send_key(ms,new_stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key); + media_stream_set_srtp_send_key(ms,new_stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key, TRUE); if (strcmp(old_stream->crypto[0].master_key,new_stream->crypto[0].master_key)!=0){ - media_stream_set_srtp_recv_key(ms,new_stream->crypto[0].algo,new_stream->crypto[0].master_key); + media_stream_set_srtp_recv_key(ms,new_stream->crypto[0].algo,new_stream->crypto[0].master_key,TRUE); } return TRUE; } else { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a476ab3e8..9905fdee7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include +#include #include "mediastreamer2/mediastream.h" #include "mediastreamer2/mseventqueue.h" #include "mediastreamer2/msvolume.h" @@ -6761,7 +6761,7 @@ bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, Linphone case LinphoneMediaEncryptionSRTP: return media_stream_srtp_supported(); case LinphoneMediaEncryptionZRTP: - return ortp_zrtp_available(); + return ms_zrtp_available(); case LinphoneMediaEncryptionNone: return TRUE; } @@ -6778,7 +6778,7 @@ int linphone_core_set_media_encryption(LinphoneCore *lc, LinphoneMediaEncryption ret=-1; }else type="srtp"; }else if (menc == LinphoneMediaEncryptionZRTP){ - if (!ortp_zrtp_available()){ + if (!ms_zrtp_available()){ ms_warning("ZRTP not supported by library."); type="none"; ret=-1; diff --git a/mediastreamer2 b/mediastreamer2 index 5581a7cdf..5c5f7c826 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5581a7cdfdbe0c27d1485c7191977ff12e6cface +Subproject commit 5c5f7c82645a76ea700553eca4416197e895b966 diff --git a/oRTP b/oRTP index 497960634..15f1e5f89 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 497960634594593bd5441804fc548587b06389c6 +Subproject commit 15f1e5f89c7381f580190432f33a7f9e86c32e7f