refine the handshake random data, fill with value in [0x0f, 0xf0], 0.9.205
正在显示
3 个修改的文件
包含
13 行增加
和
8 行删除
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
31 | // current release version | 31 | // current release version |
32 | #define VERSION_MAJOR "0" | 32 | #define VERSION_MAJOR "0" |
33 | #define VERSION_MINOR "9" | 33 | #define VERSION_MINOR "9" |
34 | -#define VERSION_REVISION "204" | 34 | +#define VERSION_REVISION "205" |
35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION |
36 | // server info. | 36 | // server info. |
37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
@@ -45,6 +45,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -45,6 +45,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
45 | #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" | 45 | #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" |
46 | #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" | 46 | #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" |
47 | #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" | 47 | #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" |
48 | +#define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" | ||
48 | 49 | ||
49 | /** | 50 | /** |
50 | * the core provides the common defined macros, utilities, | 51 | * the core provides the common defined macros, utilities, |
@@ -343,6 +343,7 @@ namespace _srs_internal | @@ -343,6 +343,7 @@ namespace _srs_internal | ||
343 | if (key->random0_size > 0) { | 343 | if (key->random0_size > 0) { |
344 | key->random0 = new char[key->random0_size]; | 344 | key->random0 = new char[key->random0_size]; |
345 | srs_random_generate(key->random0, key->random0_size); | 345 | srs_random_generate(key->random0, key->random0_size); |
346 | + snprintf(key->random0, key->random0_size, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
346 | } | 347 | } |
347 | 348 | ||
348 | srs_random_generate(key->key, sizeof(key->key)); | 349 | srs_random_generate(key->key, sizeof(key->key)); |
@@ -351,6 +352,7 @@ namespace _srs_internal | @@ -351,6 +352,7 @@ namespace _srs_internal | ||
351 | if (key->random1_size > 0) { | 352 | if (key->random1_size > 0) { |
352 | key->random1 = new char[key->random1_size]; | 353 | key->random1 = new char[key->random1_size]; |
353 | srs_random_generate(key->random1, key->random1_size); | 354 | srs_random_generate(key->random1, key->random1_size); |
355 | + snprintf(key->random1, key->random1_size, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
354 | } | 356 | } |
355 | } | 357 | } |
356 | 358 | ||
@@ -435,6 +437,7 @@ namespace _srs_internal | @@ -435,6 +437,7 @@ namespace _srs_internal | ||
435 | if (digest->random0_size > 0) { | 437 | if (digest->random0_size > 0) { |
436 | digest->random0 = new char[digest->random0_size]; | 438 | digest->random0 = new char[digest->random0_size]; |
437 | srs_random_generate(digest->random0, digest->random0_size); | 439 | srs_random_generate(digest->random0, digest->random0_size); |
440 | + snprintf(digest->random0, digest->random0_size, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
438 | } | 441 | } |
439 | 442 | ||
440 | srs_random_generate(digest->digest, sizeof(digest->digest)); | 443 | srs_random_generate(digest->digest, sizeof(digest->digest)); |
@@ -443,6 +446,7 @@ namespace _srs_internal | @@ -443,6 +446,7 @@ namespace _srs_internal | ||
443 | if (digest->random1_size > 0) { | 446 | if (digest->random1_size > 0) { |
444 | digest->random1 = new char[digest->random1_size]; | 447 | digest->random1 = new char[digest->random1_size]; |
445 | srs_random_generate(digest->random1, digest->random1_size); | 448 | srs_random_generate(digest->random1, digest->random1_size); |
449 | + snprintf(digest->random1, digest->random1_size, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
446 | } | 450 | } |
447 | } | 451 | } |
448 | 452 | ||
@@ -621,6 +625,11 @@ namespace _srs_internal | @@ -621,6 +625,11 @@ namespace _srs_internal | ||
621 | c2s2::c2s2() | 625 | c2s2::c2s2() |
622 | { | 626 | { |
623 | srs_random_generate(random, 1504); | 627 | srs_random_generate(random, 1504); |
628 | + | ||
629 | + int size = snprintf(random, 1504, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
630 | + srs_assert(++size < 1504); | ||
631 | + snprintf(random + 1504 - size, size, "%s", RTMP_SIG_SRS_HANDSHAKE); | ||
632 | + | ||
624 | srs_random_generate(digest, 32); | 633 | srs_random_generate(digest, 32); |
625 | } | 634 | } |
626 | 635 |
@@ -102,14 +102,9 @@ void srs_random_generate(char* bytes, int size) | @@ -102,14 +102,9 @@ void srs_random_generate(char* bytes, int size) | ||
102 | srs_trace("srand initialized the random."); | 102 | srs_trace("srand initialized the random."); |
103 | } | 103 | } |
104 | 104 | ||
105 | - static char cdata[] = { | ||
106 | - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2d, 0x72, 0x74, 0x6d, 0x70, 0x2d, 0x73, 0x65, | ||
107 | - 0x72, 0x76, 0x65, 0x72, 0x2d, 0x77, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x2d, 0x77, 0x69, | ||
108 | - 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x40, 0x31, 0x32, 0x36, | ||
109 | - 0x2e, 0x63, 0x6f, 0x6d | ||
110 | - }; | ||
111 | for (int i = 0; i < size; i++) { | 105 | for (int i = 0; i < size; i++) { |
112 | - bytes[i] = cdata[rand() % (sizeof(cdata) - 1)]; | 106 | + // the common value in [0x0f, 0xf0] |
107 | + bytes[i] = 0x0f + (rand() % (256 - 0x0f - 0x0f)); | ||
113 | } | 108 | } |
114 | } | 109 | } |
115 | 110 |
-
请 注册 或 登录 后发表评论