Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
4c3e3414
提交
4c3e3414
authored
9月 06, 2017
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10604: [core] Segfault in libcrypto / dtls #resolve
上级
3ada6bd3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
44 行增加
和
15 行删除
+44
-15
switch_rtp.c
src/switch_rtp.c
+44
-15
没有找到文件。
src/switch_rtp.c
浏览文件 @
4c3e3414
...
@@ -3224,6 +3224,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
...
@@ -3224,6 +3224,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
int
pending
;
int
pending
;
if
(
!
dtls
->
bytes
&&
!
ready
)
{
if
(
!
dtls
->
bytes
&&
!
ready
)
{
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
return
0
;
return
0
;
}
}
...
@@ -3248,8 +3249,6 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
...
@@ -3248,8 +3249,6 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
}
}
}
}
return
r
;
return
r
;
}
}
...
@@ -3467,26 +3466,39 @@ SWITCH_DECLARE(int) switch_rtp_has_dtls(void) {
...
@@ -3467,26 +3466,39 @@ SWITCH_DECLARE(int) switch_rtp_has_dtls(void) {
SWITCH_DECLARE
(
dtls_state_t
)
switch_rtp_dtls_state
(
switch_rtp_t
*
rtp_session
,
dtls_type_t
type
)
SWITCH_DECLARE
(
dtls_state_t
)
switch_rtp_dtls_state
(
switch_rtp_t
*
rtp_session
,
dtls_type_t
type
)
{
{
dtls_state_t
s
=
DS_OFF
;
switch_mutex_lock
(
rtp_session
->
ice_mutex
);
if
(
!
rtp_session
||
(
!
rtp_session
->
dtls
&&
!
rtp_session
->
rtcp_dtls
))
{
if
(
!
rtp_session
||
(
!
rtp_session
->
dtls
&&
!
rtp_session
->
rtcp_dtls
))
{
return
DS_OFF
;
s
=
DS_OFF
;
goto
done
;
}
}
if
((
type
==
DTLS_TYPE_RTP
)
&&
rtp_session
->
dtls
)
{
if
((
type
==
DTLS_TYPE_RTP
)
&&
rtp_session
->
dtls
)
{
return
rtp_session
->
dtls
->
state
;
s
=
rtp_session
->
dtls
->
state
;
goto
done
;
}
}
if
((
type
==
DTLS_TYPE_RTCP
)
&&
rtp_session
->
rtcp_dtls
)
{
if
((
type
==
DTLS_TYPE_RTCP
)
&&
rtp_session
->
rtcp_dtls
)
{
return
rtp_session
->
rtcp_dtls
->
state
;
s
=
rtp_session
->
rtcp_dtls
->
state
;
}
}
return
DS_OFF
;
done
:
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
return
s
;
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_del_dtls
(
switch_rtp_t
*
rtp_session
,
dtls_type_t
type
)
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_del_dtls
(
switch_rtp_t
*
rtp_session
,
dtls_type_t
type
)
{
{
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_mutex_lock
(
rtp_session
->
ice_mutex
);
if
(
!
rtp_session
||
(
!
rtp_session
->
dtls
&&
!
rtp_session
->
rtcp_dtls
))
{
if
(
!
rtp_session
||
(
!
rtp_session
->
dtls
&&
!
rtp_session
->
rtcp_dtls
))
{
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
if
((
type
&
DTLS_TYPE_RTP
))
{
if
((
type
&
DTLS_TYPE_RTP
))
{
...
@@ -3541,7 +3553,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
...
@@ -3541,7 +3553,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
}
}
#endif
#endif
return
SWITCH_STATUS_SUCCESS
;
done
:
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
return
status
;
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_add_dtls
(
switch_rtp_t
*
rtp_session
,
dtls_fingerprint_t
*
local_fp
,
dtls_fingerprint_t
*
remote_fp
,
dtls_type_t
type
)
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_add_dtls
(
switch_rtp_t
*
rtp_session
,
dtls_fingerprint_t
*
local_fp
,
dtls_fingerprint_t
*
remote_fp
,
dtls_type_t
type
)
...
@@ -3552,6 +3568,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3552,6 +3568,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
const
char
*
kind
=
""
;
const
char
*
kind
=
""
;
BIO
*
bio
;
BIO
*
bio
;
DH
*
dh
;
DH
*
dh
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
#ifndef OPENSSL_NO_EC
#ifndef OPENSSL_NO_EC
EC_KEY
*
ecdh
;
EC_KEY
*
ecdh
;
#endif
#endif
...
@@ -3564,6 +3581,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3564,6 +3581,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
switch_mutex_lock
(
rtp_session
->
ice_mutex
);
if
(
!
((
type
&
DTLS_TYPE_RTP
)
||
(
type
&
DTLS_TYPE_RTCP
))
||
!
((
type
&
DTLS_TYPE_CLIENT
)
||
(
type
&
DTLS_TYPE_SERVER
)))
{
if
(
!
((
type
&
DTLS_TYPE_RTP
)
||
(
type
&
DTLS_TYPE_RTCP
))
||
!
((
type
&
DTLS_TYPE_CLIENT
)
||
(
type
&
DTLS_TYPE_SERVER
)))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_CRIT
,
"INVALID TYPE!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_CRIT
,
"INVALID TYPE!
\n
"
);
}
}
...
@@ -3583,7 +3602,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3583,7 +3602,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
if
(((
type
&
DTLS_TYPE_RTP
)
&&
rtp_session
->
dtls
)
||
((
type
&
DTLS_TYPE_RTCP
)
&&
rtp_session
->
rtcp_dtls
))
{
if
(((
type
&
DTLS_TYPE_RTP
)
&&
rtp_session
->
dtls
)
||
((
type
&
DTLS_TYPE_RTCP
)
&&
rtp_session
->
rtcp_dtls
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_WARNING
,
"DTLS ALREADY INIT
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_WARNING
,
"DTLS ALREADY INIT
\n
"
);
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
dtls
=
switch_core_alloc
(
rtp_session
->
pool
,
sizeof
(
*
dtls
));
dtls
=
switch_core_alloc
(
rtp_session
->
pool
,
sizeof
(
*
dtls
));
...
@@ -3637,17 +3656,17 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3637,17 +3656,17 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
if
((
ret
=
SSL_CTX_use_certificate_file
(
dtls
->
ssl_ctx
,
dtls
->
rsa
,
SSL_FILETYPE_PEM
))
!=
1
)
{
if
((
ret
=
SSL_CTX_use_certificate_file
(
dtls
->
ssl_ctx
,
dtls
->
rsa
,
SSL_FILETYPE_PEM
))
!=
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS cert err [%d]
\n
"
,
rtp_type
(
rtp_session
),
SSL_get_error
(
dtls
->
ssl
,
ret
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS cert err [%d]
\n
"
,
rtp_type
(
rtp_session
),
SSL_get_error
(
dtls
->
ssl
,
ret
));
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
if
((
ret
=
SSL_CTX_use_PrivateKey_file
(
dtls
->
ssl_ctx
,
dtls
->
pvt
,
SSL_FILETYPE_PEM
))
!=
1
)
{
if
((
ret
=
SSL_CTX_use_PrivateKey_file
(
dtls
->
ssl_ctx
,
dtls
->
pvt
,
SSL_FILETYPE_PEM
))
!=
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS key err [%d]
\n
"
,
rtp_type
(
rtp_session
),
SSL_get_error
(
dtls
->
ssl
,
ret
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS key err [%d]
\n
"
,
rtp_type
(
rtp_session
),
SSL_get_error
(
dtls
->
ssl
,
ret
));
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
if
(
SSL_CTX_check_private_key
(
dtls
->
ssl_ctx
)
==
0
)
{
if
(
SSL_CTX_check_private_key
(
dtls
->
ssl_ctx
)
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS check key failed
\n
"
,
rtp_type
(
rtp_session
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS check key failed
\n
"
,
rtp_type
(
rtp_session
));
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
if
(
!
zstr
(
dtls
->
ca
)
&&
switch_file_exists
(
dtls
->
ca
,
rtp_session
->
pool
)
==
SWITCH_STATUS_SUCCESS
if
(
!
zstr
(
dtls
->
ca
)
&&
switch_file_exists
(
dtls
->
ca
,
rtp_session
->
pool
)
==
SWITCH_STATUS_SUCCESS
...
@@ -3655,7 +3674,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3655,7 +3674,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS check chain cert failed [%d]
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_ERROR
,
"%s DTLS check chain cert failed [%d]
\n
"
,
rtp_type
(
rtp_session
)
,
rtp_type
(
rtp_session
)
,
SSL_get_error
(
dtls
->
ssl
,
ret
));
SSL_get_error
(
dtls
->
ssl
,
ret
));
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
dtls
->
ssl
=
SSL_new
(
dtls
->
ssl_ctx
);
dtls
->
ssl
=
SSL_new
(
dtls
->
ssl_ctx
);
...
@@ -3676,7 +3695,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3676,7 +3695,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
#ifndef OPENSSL_NO_EC
#ifndef OPENSSL_NO_EC
ecdh
=
EC_KEY_new_by_curve_name
(
NID_X9_62_prime256v1
);
ecdh
=
EC_KEY_new_by_curve_name
(
NID_X9_62_prime256v1
);
if
(
!
ecdh
)
{
if
(
!
ecdh
)
{
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
)
;
}
}
SSL_set_options
(
dtls
->
ssl
,
SSL_OP_SINGLE_ECDH_USE
);
SSL_set_options
(
dtls
->
ssl
,
SSL_OP_SINGLE_ECDH_USE
);
SSL_set_tmp_ecdh
(
dtls
->
ssl
,
ecdh
);
SSL_set_tmp_ecdh
(
dtls
->
ssl
,
ecdh
);
...
@@ -3732,7 +3751,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3732,7 +3751,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO_BREAK
]
=
1
;
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO_BREAK
]
=
1
;
switch_rtp_break
(
rtp_session
);
switch_rtp_break
(
rtp_session
);
return
SWITCH_STATUS_SUCCESS
;
done
:
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
return
status
;
}
}
...
@@ -5669,6 +5692,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5669,6 +5692,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
}
}
}
}
switch_mutex_lock
(
rtp_session
->
ice_mutex
);
if
(
rtp_session
->
dtls
)
{
if
(
rtp_session
->
dtls
)
{
if
(
rtp_session
->
rtcp_dtls
&&
rtp_session
->
rtcp_dtls
!=
rtp_session
->
dtls
)
{
if
(
rtp_session
->
rtcp_dtls
&&
rtp_session
->
rtcp_dtls
!=
rtp_session
->
dtls
)
{
...
@@ -5685,6 +5710,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5685,6 +5710,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
}
}
}
}
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
*
bytes
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
*
bytes
)
{
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_RTCP_MUX
])
{
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_RTCP_MUX
])
{
*
flags
&=
~
SFF_RTCP
;
*
flags
&=
~
SFF_RTCP
;
...
@@ -6608,6 +6635,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -6608,6 +6635,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
*
bytes
=
0
;
*
bytes
=
0
;
}
}
switch_mutex_lock
(
rtp_session
->
ice_mutex
);
if
(
rtp_session
->
rtcp_dtls
)
{
if
(
rtp_session
->
rtcp_dtls
)
{
char
*
b
=
(
char
*
)
rtp_session
->
rtcp_recv_msg_p
;
char
*
b
=
(
char
*
)
rtp_session
->
rtcp_recv_msg_p
;
...
@@ -6633,6 +6661,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -6633,6 +6661,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
*
bytes
=
0
;
*
bytes
=
0
;
}
}
}
}
switch_mutex_unlock
(
rtp_session
->
ice_mutex
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论