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-08-21 09:48:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
01ae8c478794dc744213ba53ad628f6c6b863931
01ae8c47
1 parent
bda12e32
refine the handshake random data, fill with value in [0x0f, 0xf0], 0.9.205
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
13 行增加
和
8 行删除
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/rtmp/srs_protocol_utility.cpp
trunk/src/core/srs_core.hpp
查看文件 @
01ae8c4
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "20
4
"
#define VERSION_REVISION "20
5
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
@@ -45,6 +45,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin"
#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao"
#define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt"
#define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")"
/**
* the core provides the common defined macros, utilities,
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
01ae8c4
...
...
@@ -343,6 +343,7 @@ namespace _srs_internal
if
(
key
->
random0_size
>
0
)
{
key
->
random0
=
new
char
[
key
->
random0_size
];
srs_random_generate
(
key
->
random0
,
key
->
random0_size
);
snprintf
(
key
->
random0
,
key
->
random0_size
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
}
srs_random_generate
(
key
->
key
,
sizeof
(
key
->
key
));
...
...
@@ -351,6 +352,7 @@ namespace _srs_internal
if
(
key
->
random1_size
>
0
)
{
key
->
random1
=
new
char
[
key
->
random1_size
];
srs_random_generate
(
key
->
random1
,
key
->
random1_size
);
snprintf
(
key
->
random1
,
key
->
random1_size
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
}
}
...
...
@@ -435,6 +437,7 @@ namespace _srs_internal
if
(
digest
->
random0_size
>
0
)
{
digest
->
random0
=
new
char
[
digest
->
random0_size
];
srs_random_generate
(
digest
->
random0
,
digest
->
random0_size
);
snprintf
(
digest
->
random0
,
digest
->
random0_size
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
}
srs_random_generate
(
digest
->
digest
,
sizeof
(
digest
->
digest
));
...
...
@@ -443,6 +446,7 @@ namespace _srs_internal
if
(
digest
->
random1_size
>
0
)
{
digest
->
random1
=
new
char
[
digest
->
random1_size
];
srs_random_generate
(
digest
->
random1
,
digest
->
random1_size
);
snprintf
(
digest
->
random1
,
digest
->
random1_size
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
}
}
...
...
@@ -621,6 +625,11 @@ namespace _srs_internal
c2s2
::
c2s2
()
{
srs_random_generate
(
random
,
1504
);
int
size
=
snprintf
(
random
,
1504
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
srs_assert
(
++
size
<
1504
);
snprintf
(
random
+
1504
-
size
,
size
,
"%s"
,
RTMP_SIG_SRS_HANDSHAKE
);
srs_random_generate
(
digest
,
32
);
}
...
...
trunk/src/rtmp/srs_protocol_utility.cpp
查看文件 @
01ae8c4
...
...
@@ -102,14 +102,9 @@ void srs_random_generate(char* bytes, int size)
srs_trace
(
"srand initialized the random."
);
}
static
char
cdata
[]
=
{
0x73
,
0x69
,
0x6d
,
0x70
,
0x6c
,
0x65
,
0x2d
,
0x72
,
0x74
,
0x6d
,
0x70
,
0x2d
,
0x73
,
0x65
,
0x72
,
0x76
,
0x65
,
0x72
,
0x2d
,
0x77
,
0x69
,
0x6e
,
0x6c
,
0x69
,
0x6e
,
0x2d
,
0x77
,
0x69
,
0x6e
,
0x74
,
0x65
,
0x72
,
0x73
,
0x65
,
0x72
,
0x76
,
0x65
,
0x72
,
0x40
,
0x31
,
0x32
,
0x36
,
0x2e
,
0x63
,
0x6f
,
0x6d
};
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
bytes
[
i
]
=
cdata
[
rand
()
%
(
sizeof
(
cdata
)
-
1
)];
// the common value in [0x0f, 0xf0]
bytes
[
i
]
=
0x0f
+
(
rand
()
%
(
256
-
0x0f
-
0x0f
));
}
}
...
...
请
注册
或
登录
后发表评论