winlin

refine the handshake random data, fill with value in [0x0f, 0xf0], 0.9.205

... ... @@ -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 "204"
#define VERSION_REVISION "205"
#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,
... ...
... ... @@ -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);
}
... ...
... ... @@ -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));
}
}
... ...