Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-29 18:41:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
efb73c548793b6c6c5c75070d1a67c766d983f79
efb73c54
1 parent
abb0fce3
fix #235, refine handshake, replace union with template method. 2.0.38.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
31 行增加
和
23 行删除
README.md
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/rtmp/srs_protocol_handshake.hpp
README.md
查看文件 @
efb73c5
...
...
@@ -485,7 +485,8 @@ Supported operating systems and hardware:
*
2013-10-17, Created.
<br/>
## History
*
v2.0, 2014-11-28, fix
[
#215
](
https://github.com/winlinvip/simple-rtmp-server/issues/215
)
, for bug #215, add srs_rtmp_dump tool. 2.0.37.
*
v2.0, 2014-11-29, fix
[
#235
](
https://github.com/winlinvip/simple-rtmp-server/issues/235
)
, refine handshake, replace union with template method. 2.0.38.
*
v2.0, 2014-11-28, fix
[
#215
](
https://github.com/winlinvip/simple-rtmp-server/issues/215
)
, add srs_rtmp_dump tool. 2.0.37.
*
v2.0, 2014-11-25, update PRIMARY, AUTHORS, CONTRIBUTORS rule. 2.0.32.
*
v2.0, 2014-11-24, fix
[
#212
](
https://github.com/winlinvip/simple-rtmp-server/issues/212
)
, support publish aac adts raw stream. 2.0.31.
*
v2.0, 2014-11-22, fix
[
#217
](
https://github.com/winlinvip/simple-rtmp-server/issues/217
)
, remove timeout recv, support 7.5k+ 250kbps clients. 2.0.30.
...
...
trunk/src/core/srs_core.hpp
查看文件 @
efb73c5
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 3
7
#define VERSION_REVISION 3
8
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
efb73c5
...
...
@@ -514,7 +514,7 @@ namespace _srs_internal
return
ret
;
}
int
c1s1_strategy
::
s1_create
(
c1s1
*
owner
)
int
c1s1_strategy
::
s1_create
(
c1s1
*
owner
,
c1s1
*
c1
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -528,8 +528,7 @@ namespace _srs_internal
// directly generate the public key.
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/148
int
pkey_size
=
128
;
// TODO: FIXME: use c1 public key to calc the shared key.
if
((
ret
=
dh
.
copy_public_key
(
key
.
key
,
pkey_size
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
dh
.
copy_shared_key
(
c1
->
get_key
(),
128
,
key
.
key
,
pkey_size
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"calc s1 key failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -827,7 +826,6 @@ namespace _srs_internal
return
ret
;
}
// TODO: FIXME: move to the right position.
c1s1
::
c1s1
()
{
payload
=
NULL
;
...
...
@@ -835,21 +833,6 @@ namespace _srs_internal
c1s1
::~
c1s1
()
{
srs_freep
(
payload
);
/*
void c1s1::destroy_blocks()
{
if (schema == srs_schema_invalid) {
return;
}
if (schema == srs_schema0) {
block0.key.free();
block1.digest.free();
} else {
block0.digest.free();
block1.key.free();
}
}*/
}
srs_schema_type
c1s1
::
schema
()
...
...
@@ -960,7 +943,7 @@ namespace _srs_internal
payload
=
new
c1s1_strategy_schema1
();
}
return
payload
->
s1_create
(
this
);
return
payload
->
s1_create
(
this
,
c1
);
}
int
c1s1
::
s1_validate_digest
(
bool
&
is_valid
)
...
...
trunk/src/rtmp/srs_protocol_handshake.hpp
查看文件 @
efb73c5
...
...
@@ -245,8 +245,32 @@ namespace _srs_internal
virtual
int
c1_validate_digest
(
c1s1
*
owner
,
bool
&
is_valid
);
/**
* server: create and sign the s1 from c1.
* // decode c1 try schema0 then schema1
* c1-digest-data = get-c1-digest-data(schema0)
* if c1-digest-data equals to calc_c1_digest(c1, schema0) {
* c1-key-data = get-c1-key-data(schema0)
* schema = schema0
* } else {
* c1-digest-data = get-c1-digest-data(schema1)
* if c1-digest-data not equals to calc_c1_digest(c1, schema1) {
* switch to simple handshake.
* return
* }
* c1-key-data = get-c1-key-data(schema1)
* schema = schema1
* }
*
* // generate s1
* random fill 1536bytes s1
* time = time() // c1[0-3]
* version = [0x04, 0x05, 0x00, 0x01] // s1[4-7]
* s1-key-data=shared_key=DH_compute_key(peer_pub_key=c1-key-data)
* get c1s1-joined by specified schema
* s1-digest-data = HMACsha256(c1s1-joined, FMSKey, 36)
* copy s1-digest-data and s1-key-data to s1.
* @param c1, to get the peer_pub_key of client.
*/
virtual
int
s1_create
(
c1s1
*
owner
);
virtual
int
s1_create
(
c1s1
*
owner
,
c1s1
*
c1
);
/**
* server: validate the parsed s1 schema
*/
...
...
请
注册
或
登录
后发表评论