Commit e3b3a5aa authored by johan's avatar johan
Browse files

move ZRTP management from oRTP to Mediastreamer2 using transport modifier

parent 89ac4101
......@@ -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,&params);
......@@ -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(&params,0,sizeof(OrtpZrtpParams));
MSZrtpParams params;
memset(&params,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,&params);
#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(&params,0,sizeof(OrtpZrtpParams));
memset(&params,0,sizeof(MSZrtpParams));
video_stream_enable_zrtp(call->videostream,call->audiostream,&params);
}
#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 {
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/types.h>
#include <sys/stat.h>
#include <ortp/telephonyevents.h>
#include <ortp/zrtp.h>
#include <mediastreamer2/zrtp.h>
#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;
......
mediastreamer2 @ 5c5f7c82
Subproject commit 5581a7cdfdbe0c27d1485c7191977ff12e6cface
Subproject commit 5c5f7c82645a76ea700553eca4416197e895b966
oRTP @ 15f1e5f8
Subproject commit 497960634594593bd5441804fc548587b06389c6
Subproject commit 15f1e5f89c7381f580190432f33a7f9e86c32e7f
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