Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
26999898
提交
26999898
authored
7月 27, 2016
作者:
Markus von Arx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9387 [libzrtp] bugfix for hash calculation of the auxiliary secret
上级
0dc59995
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
53 行增加
和
1 行删除
+53
-1
zrtp_protocol.c
libs/libzrtp/src/zrtp_protocol.c
+53
-1
没有找到文件。
libs/libzrtp/src/zrtp_protocol.c
浏览文件 @
26999898
...
...
@@ -65,6 +65,54 @@ static zrtp_status_t _attach_secret( zrtp_session_t *session,
return
zrtp_status_ok
;
}
static
zrtp_status_t
_attach_auxs_secret
(
zrtp_stream_t
*
stream
,
zrtp_proto_secret_t
*
psec
,
zrtp_shared_secret_t
*
sec
,
uint8_t
is_initiator
)
{
zrtp_uchar32_t
buff
;
zrtp_string32_t
myH3
;
ZSTR_SET_EMPTY
(
myH3
);
zrtp_zstrncpyc
(
ZSTR_GV
(
myH3
),
stream
->
messages
.
hello
.
hash
,
sizeof
(
stream
->
messages
.
hello
.
hash
));
zrtp_string32_t
peerH3
;
ZSTR_SET_EMPTY
(
peerH3
);
zrtp_zstrncpyc
(
ZSTR_GV
(
peerH3
),
stream
->
messages
.
peer_hello
.
hash
,
sizeof
(
stream
->
messages
.
peer_hello
.
hash
));
ZSTR_SET_EMPTY
(
psec
->
id
);
ZSTR_SET_EMPTY
(
psec
->
peer_id
);
psec
->
secret
=
sec
;
if
(
psec
->
secret
)
{
stream
->
session
->
hash
->
hmac_truncated
(
stream
->
session
->
hash
,
ZSTR_GV
(
sec
->
value
),
ZSTR_GV
(
myH3
),
ZRTP_RSID_SIZE
,
ZSTR_GV
(
psec
->
id
));
stream
->
session
->
hash
->
hmac_truncated
(
stream
->
session
->
hash
,
ZSTR_GV
(
sec
->
value
),
ZSTR_GV
(
peerH3
),
ZRTP_RSID_SIZE
,
ZSTR_GV
(
psec
->
peer_id
));
}
else
{
psec
->
id
.
length
=
ZRTP_RSID_SIZE
;
zrtp_memset
(
psec
->
id
.
buffer
,
0
,
psec
->
id
.
length
);
psec
->
peer_id
.
length
=
ZRTP_RSID_SIZE
;
zrtp_memset
(
psec
->
peer_id
.
buffer
,
0
,
psec
->
peer_id
.
length
);
}
ZRTP_LOG
(
3
,
(
_ZTU_
,
"
\t
Attach RS/auxs id=%s.
\n
"
,
hex2str
((
const
char
*
)
psec
->
id
.
buffer
,
psec
->
id
.
length
,
(
char
*
)
buff
,
sizeof
(
buff
))));
ZRTP_LOG
(
3
,
(
_ZTU_
,
"
\t
Attach RS/auxs peer_id=%s.
\n
"
,
hex2str
((
const
char
*
)
psec
->
peer_id
.
buffer
,
psec
->
peer_id
.
length
,
(
char
*
)
buff
,
sizeof
(
buff
))));
return
zrtp_status_ok
;
}
zrtp_status_t
_zrtp_protocol_init
(
zrtp_stream_t
*
stream
,
uint8_t
is_initiator
,
zrtp_protocol_t
**
protocol
)
{
zrtp_protocol_t
*
new_proto
=
NULL
;
...
...
@@ -118,7 +166,7 @@ zrtp_status_t _zrtp_protocol_init(zrtp_stream_t *stream, uint8_t is_initiator, z
if
(
ZRTP_IS_STREAM_DH
(
stream
))
{
_attach_secret
(
stream
->
session
,
&
new_proto
->
cc
->
rs1
,
stream
->
session
->
secrets
.
rs1
,
is_initiator
);
_attach_secret
(
stream
->
session
,
&
new_proto
->
cc
->
rs2
,
stream
->
session
->
secrets
.
rs2
,
is_initiator
);
_attach_
secret
(
stream
->
session
,
&
new_proto
->
cc
->
auxs
,
stream
->
session
->
secrets
.
auxs
,
is_initiator
);
_attach_
auxs_secret
(
stream
,
&
new_proto
->
cc
->
auxs
,
stream
->
session
->
secrets
.
auxs
,
is_initiator
);
_attach_secret
(
stream
->
session
,
&
new_proto
->
cc
->
pbxs
,
stream
->
session
->
secrets
.
pbxs
,
is_initiator
);
}
...
...
@@ -300,6 +348,10 @@ static zrtp_status_t _derive_s0(zrtp_stream_t* stream, int is_initiator)
ZRTP_LOG
(
3
,(
_ZTU_
,
"
\t
his pbxsID:%s
\n
"
,
hex2str
((
const
char
*
)
stream
->
messages
.
peer_dhpart
.
pbxsID
,
ZRTP_RSID_SIZE
,
print_buff
,
sizeof
(
print_buff
))));
ZRTP_LOG
(
3
,(
_ZTU_
,
"
\t
his pbxsID comp:%s
\n
"
,
hex2str
(
cc
->
pbxs
.
peer_id
.
buffer
,
cc
->
pbxs
.
peer_id
.
length
,
print_buff
,
sizeof
(
print_buff
))));
ZRTP_LOG
(
3
,
(
_ZTU_
,
"
\t
my auxsID:%s
\n
"
,
hex2str
(
cc
->
auxs
.
id
.
buffer
,
cc
->
auxs
.
id
.
length
,
print_buff
,
sizeof
(
print_buff
))));
ZRTP_LOG
(
3
,
(
_ZTU_
,
"
\t
his auxsID:%s
\n
"
,
hex2str
((
const
char
*
)
stream
->
messages
.
peer_dhpart
.
auxsID
,
ZRTP_RSID_SIZE
,
print_buff
,
sizeof
(
print_buff
))));
ZRTP_LOG
(
3
,
(
_ZTU_
,
"
\t
his auxsID comp:%s
\n
"
,
hex2str
(
cc
->
auxs
.
peer_id
.
buffer
,
cc
->
auxs
.
peer_id
.
length
,
print_buff
,
sizeof
(
print_buff
))));
hash_ctx
=
session
->
hash
->
hash_begin
(
session
->
hash
);
if
(
0
==
hash_ctx
)
{
ZRTP_LOG
(
1
,(
_ZTU_
,
"
\t
ERROR! can't start hash calculation for S0 computing. ID=%u.
\n
"
,
stream
->
id
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论