提交 b3280ae2 authored 作者: Viktor Krikun's avatar Viktor Krikun 提交者: Travis Cross

Send empty SAS during enrollment and other improvements

(refs #25)
上级 9cd14090
...@@ -831,6 +831,10 @@ zrtp_status_t zrtp_profile_check(const zrtp_profile_t* profile, zrtp_global_t* z ...@@ -831,6 +831,10 @@ zrtp_status_t zrtp_profile_check(const zrtp_profile_t* profile, zrtp_global_t* z
{ {
uint8_t i = 0; uint8_t i = 0;
if (!profile || !zrtp) {
return zrtp_status_bad_param;
}
/* /*
* Fail if the required base components are not present in the profile. * Fail if the required base components are not present in the profile.
*/ */
......
...@@ -912,8 +912,8 @@ void zrtp_def_cache_foreach( zrtp_global_t *global, ...@@ -912,8 +912,8 @@ void zrtp_def_cache_foreach( zrtp_global_t *global,
if (delete) { if (delete) {
{ {
char idstr[24*2+1]; char idstr[24*2+1];
ZRTP_LOG(3,(_ZTU_,"\zrtp_def_cache_foreach() Delete element id=%s index=%u\n", ZRTP_LOG(3,(_ZTU_,"\trtp_def_cache_foreach() Delete element id=%s index=%u\n",
hex2str(elem->id, sizeof(elem->id), idstr, sizeof(idstr)), hex2str((const char*)elem->id, sizeof(elem->id), idstr, sizeof(idstr)),
elem->_index)); elem->_index));
} }
......
...@@ -299,6 +299,10 @@ zrtp_status_t _zrtp_machine_process_while_in_sasrelaying( zrtp_stream_t* stream, ...@@ -299,6 +299,10 @@ zrtp_status_t _zrtp_machine_process_while_in_sasrelaying( zrtp_stream_t* stream,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssrc) zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssrc)
{ {
if (!stream) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"START REGISTRATION STREAM ID=%u mode=%s state=%s.\n", ZRTP_LOG(3,(_ZTU_,"START REGISTRATION STREAM ID=%u mode=%s state=%s.\n",
stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state)));
...@@ -313,6 +317,10 @@ zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssr ...@@ -313,6 +317,10 @@ zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssr
zrtp_status_t zrtp_stream_registration_secure(zrtp_stream_t* stream) zrtp_status_t zrtp_stream_registration_secure(zrtp_stream_t* stream)
{ {
if (!stream) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"SECURE REGISTRATION STREAM ID=%u mode=%s state=%s.\n", ZRTP_LOG(3,(_ZTU_,"SECURE REGISTRATION STREAM ID=%u mode=%s state=%s.\n",
stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state)));
...@@ -331,6 +339,10 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream) ...@@ -331,6 +339,10 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream)
zrtp_session_t *session = stream->session; zrtp_session_t *session = stream->session;
zrtp_status_t s = zrtp_status_bad_param; zrtp_status_t s = zrtp_status_bad_param;
if (!stream) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"MARKING this call as REGISTRATION ID=%u\n", stream->id)); ZRTP_LOG(3,(_ZTU_,"MARKING this call as REGISTRATION ID=%u\n", stream->id));
if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) { if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) {
...@@ -399,7 +411,11 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream) ...@@ -399,7 +411,11 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
zrtp_status_t zrtp_link_mitm_calls(zrtp_stream_t *stream1, zrtp_stream_t *stream2) zrtp_status_t zrtp_link_mitm_calls(zrtp_stream_t *stream1, zrtp_stream_t *stream2)
{ {
ZRTP_LOG(3,(_ZTU_,"Link to MiTM call together stream1=%u stream2=%u.\n", stream1->id, stream2->id)); if (!stream1 || !stream2) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"Link to MiTM call together stream1=%u stream2=%u.\n", stream1->id, stream2->id));
/* This APi is for MiTM endpoints only. */ /* This APi is for MiTM endpoints only. */
if (stream1->zrtp->is_mitm) { if (stream1->zrtp->is_mitm) {
...@@ -452,6 +468,10 @@ zrtp_status_t zrtp_update_remote_options( zrtp_stream_t* stream, ...@@ -452,6 +468,10 @@ zrtp_status_t zrtp_update_remote_options( zrtp_stream_t* stream,
zrtp_status_t s = zrtp_status_ok; zrtp_status_t s = zrtp_status_ok;
char buff[256]; char buff[256];
if (!stream) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"UPDATE REMOTE SAS OPTIONS mode. ID=%u\n", stream->id)); ZRTP_LOG(3,(_ZTU_,"UPDATE REMOTE SAS OPTIONS mode. ID=%u\n", stream->id));
ZRTP_LOG(3,(_ZTU_,"transf_sas=%s scheme=%d.\n", transf_sas_value ? ZRTP_LOG(3,(_ZTU_,"transf_sas=%s scheme=%d.\n", transf_sas_value ?
hex2str((const char*)transf_sas_value->buffer, transf_sas_value->length, (char*)buff, sizeof(buff)) : "NULL", hex2str((const char*)transf_sas_value->buffer, transf_sas_value->length, (char*)buff, sizeof(buff)) : "NULL",
...@@ -515,6 +535,10 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1, ...@@ -515,6 +535,10 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1,
zrtp_stream_t* non_enrolled = NULL; zrtp_stream_t* non_enrolled = NULL;
zrtp_sas_id_t mitm_sas_scheme = ZRTP_COMP_UNKN; zrtp_sas_id_t mitm_sas_scheme = ZRTP_COMP_UNKN;
zrtp_status_t s = zrtp_status_ok; zrtp_status_t s = zrtp_status_ok;
if (!stream1 || !stream2) {
return zrtp_status_bad_param;
}
ZRTP_LOG(3,(_ZTU_,"RESOLVE MITM CALL s1=%u, s2=%u...\n", stream1->id, stream2->id)); ZRTP_LOG(3,(_ZTU_,"RESOLVE MITM CALL s1=%u, s2=%u...\n", stream1->id, stream2->id));
...@@ -605,8 +629,9 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1, ...@@ -605,8 +629,9 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1,
return s; return s;
} }
/* NOTE: new request from Philip Zimmermann - always send SASRelay to BOTH parties. */
/* If non-enrolled party has SAS scheme different from chosen one - update */ /* If non-enrolled party has SAS scheme different from chosen one - update */
if (non_enrolled->session->sasscheme->base.id != mitm_sas_scheme) { /*if (non_enrolled->session->sasscheme->base.id != mitm_sas_scheme) { */
s = zrtp_update_remote_options( non_enrolled, s = zrtp_update_remote_options( non_enrolled,
mitm_sas_scheme, mitm_sas_scheme,
NULL, NULL,
...@@ -615,7 +640,7 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1, ...@@ -615,7 +640,7 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1,
if (zrtp_status_ok != s) { if (zrtp_status_ok != s) {
return s; return s;
} }
} /*}*/
return s; return s;
} }
...@@ -623,12 +648,20 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1, ...@@ -623,12 +648,20 @@ zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t zrtp_is_user_enrolled(zrtp_stream_t* stream) uint8_t zrtp_is_user_enrolled(zrtp_stream_t* stream)
{ {
if (!stream) {
return zrtp_status_bad_param;
}
return ( (stream->session->secrets.cached & ZRTP_BIT_PBX) && return ( (stream->session->secrets.cached & ZRTP_BIT_PBX) &&
(stream->session->secrets.matches & ZRTP_BIT_PBX) ); (stream->session->secrets.matches & ZRTP_BIT_PBX) );
} }
zrtp_stream_t* zrtp_choose_one_enrolled(zrtp_stream_t* stream1, zrtp_stream_t* stream2) zrtp_stream_t* zrtp_choose_one_enrolled(zrtp_stream_t* stream1, zrtp_stream_t* stream2)
{ {
if (!stream1 || !stream2) {
return NULL;
}
if (zrtp_memcmp( stream1->session->zid.buffer, if (zrtp_memcmp( stream1->session->zid.buffer,
stream2->session->zid.buffer, stream2->session->zid.buffer,
stream1->session->zid.length) > 0) { stream1->session->zid.length) > 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论