mirror of https://github.com/ossrs/srs.git
add rtmp handshake utest, for arm to finger out the bug
parent
1c055e7424
commit
b58ab508f9
@ -1,88 +1,90 @@
|
||||
file
|
||||
main readonly separator,
|
||||
..\main\srs_main_server.cpp,
|
||||
..\main\srs_main_bandcheck.cpp,
|
||||
auto readonly separator,
|
||||
..\..\objs\srs_auto_headers.hpp,
|
||||
libs readonly separator,
|
||||
..\libs\srs_librtmp.hpp,
|
||||
..\libs\srs_librtmp.cpp,
|
||||
..\libs\srs_lib_simple_socket.hpp,
|
||||
..\libs\srs_lib_simple_socket.cpp,
|
||||
core readonly separator,
|
||||
..\core\srs_core.hpp,
|
||||
..\core\srs_core.cpp,
|
||||
..\core\srs_core_autofree.hpp,
|
||||
..\core\srs_core_autofree.cpp,
|
||||
kernel readonly separator,
|
||||
..\kernel\srs_kernel_buffer.hpp,
|
||||
..\kernel\srs_kernel_buffer.cpp,
|
||||
..\kernel\srs_kernel_error.hpp,
|
||||
..\kernel\srs_kernel_error.cpp,
|
||||
..\kernel\srs_kernel_log.hpp,
|
||||
..\kernel\srs_kernel_log.cpp,
|
||||
..\kernel\srs_kernel_stream.hpp,
|
||||
..\kernel\srs_kernel_stream.cpp,
|
||||
rtmp-protocol readonly separator,
|
||||
..\rtmp\srs_protocol_amf0.hpp,
|
||||
..\rtmp\srs_protocol_amf0.cpp,
|
||||
..\rtmp\srs_protocol_handshake.hpp,
|
||||
..\rtmp\srs_protocol_handshake.cpp,
|
||||
..\rtmp\srs_protocol_io.hpp,
|
||||
..\rtmp\srs_protocol_io.cpp,
|
||||
..\rtmp\srs_protocol_rtmp.hpp,
|
||||
..\rtmp\srs_protocol_rtmp.cpp,
|
||||
..\rtmp\srs_protocol_rtmp_stack.hpp,
|
||||
..\rtmp\srs_protocol_rtmp_stack.cpp,
|
||||
..\rtmp\srs_protocol_utility.hpp,
|
||||
..\rtmp\srs_protocol_utility.cpp,
|
||||
app readonly separator,
|
||||
..\app\srs_app_bandwidth.hpp,
|
||||
..\app\srs_app_bandwidth.cpp,
|
||||
..\app\srs_app_client.hpp,
|
||||
..\app\srs_app_client.cpp,
|
||||
..\app\srs_app_codec.hpp,
|
||||
..\app\srs_app_codec.cpp,
|
||||
..\app\srs_app_conn.hpp,
|
||||
..\app\srs_app_conn.cpp,
|
||||
..\app\srs_app_config.hpp,
|
||||
..\app\srs_app_config.cpp,
|
||||
..\app\srs_app_encoder.hpp,
|
||||
..\app\srs_app_encoder.cpp,
|
||||
..\app\srs_app_forward.hpp,
|
||||
..\app\srs_app_forward.cpp,
|
||||
..\app\srs_app_hls.hpp,
|
||||
..\app\srs_app_hls.cpp,
|
||||
..\app\srs_app_http.hpp,
|
||||
..\app\srs_app_http.cpp,
|
||||
..\app\srs_app_log.hpp,
|
||||
..\app\srs_app_log.cpp,
|
||||
..\app\srs_app_refer.hpp,
|
||||
..\app\srs_app_refer.cpp,
|
||||
..\app\srs_app_reload.hpp,
|
||||
..\app\srs_app_reload.cpp,
|
||||
..\app\srs_app_pithy_print.hpp,
|
||||
..\app\srs_app_pithy_print.cpp,
|
||||
..\app\srs_app_thread.hpp,
|
||||
..\app\srs_app_thread.cpp,
|
||||
..\app\srs_app_server.hpp,
|
||||
..\app\srs_app_server.cpp,
|
||||
..\app\srs_app_st.hpp,
|
||||
..\app\srs_app_st.cpp,
|
||||
..\app\srs_app_socket.hpp,
|
||||
..\app\srs_app_socket.cpp,
|
||||
..\app\srs_app_source.hpp,
|
||||
..\app\srs_app_source.cpp,
|
||||
utest readonly separator,
|
||||
..\utest\srs_utest.hpp,
|
||||
..\utest\srs_utest.cpp,
|
||||
..\utest\srs_utest_amf0.hpp,
|
||||
..\utest\srs_utest_amf0.cpp,
|
||||
research readonly separator,
|
||||
..\..\research\librtmp\srs_play.c,
|
||||
..\..\research\librtmp\srs_publish.c,
|
||||
..\..\research\hls\ts_info.cc;
|
||||
main readonly separator,
|
||||
..\main\srs_main_server.cpp,
|
||||
..\main\srs_main_bandcheck.cpp,
|
||||
auto readonly separator,
|
||||
..\..\objs\srs_auto_headers.hpp,
|
||||
libs readonly separator,
|
||||
..\libs\srs_librtmp.hpp,
|
||||
..\libs\srs_librtmp.cpp,
|
||||
..\libs\srs_lib_simple_socket.hpp,
|
||||
..\libs\srs_lib_simple_socket.cpp,
|
||||
core readonly separator,
|
||||
..\core\srs_core.hpp,
|
||||
..\core\srs_core.cpp,
|
||||
..\core\srs_core_autofree.hpp,
|
||||
..\core\srs_core_autofree.cpp,
|
||||
kernel readonly separator,
|
||||
..\kernel\srs_kernel_buffer.hpp,
|
||||
..\kernel\srs_kernel_buffer.cpp,
|
||||
..\kernel\srs_kernel_error.hpp,
|
||||
..\kernel\srs_kernel_error.cpp,
|
||||
..\kernel\srs_kernel_log.hpp,
|
||||
..\kernel\srs_kernel_log.cpp,
|
||||
..\kernel\srs_kernel_stream.hpp,
|
||||
..\kernel\srs_kernel_stream.cpp,
|
||||
rtmp-protocol readonly separator,
|
||||
..\rtmp\srs_protocol_amf0.hpp,
|
||||
..\rtmp\srs_protocol_amf0.cpp,
|
||||
..\rtmp\srs_protocol_handshake.hpp,
|
||||
..\rtmp\srs_protocol_handshake.cpp,
|
||||
..\rtmp\srs_protocol_io.hpp,
|
||||
..\rtmp\srs_protocol_io.cpp,
|
||||
..\rtmp\srs_protocol_rtmp.hpp,
|
||||
..\rtmp\srs_protocol_rtmp.cpp,
|
||||
..\rtmp\srs_protocol_rtmp_stack.hpp,
|
||||
..\rtmp\srs_protocol_rtmp_stack.cpp,
|
||||
..\rtmp\srs_protocol_utility.hpp,
|
||||
..\rtmp\srs_protocol_utility.cpp,
|
||||
app readonly separator,
|
||||
..\app\srs_app_bandwidth.hpp,
|
||||
..\app\srs_app_bandwidth.cpp,
|
||||
..\app\srs_app_client.hpp,
|
||||
..\app\srs_app_client.cpp,
|
||||
..\app\srs_app_codec.hpp,
|
||||
..\app\srs_app_codec.cpp,
|
||||
..\app\srs_app_conn.hpp,
|
||||
..\app\srs_app_conn.cpp,
|
||||
..\app\srs_app_config.hpp,
|
||||
..\app\srs_app_config.cpp,
|
||||
..\app\srs_app_encoder.hpp,
|
||||
..\app\srs_app_encoder.cpp,
|
||||
..\app\srs_app_forward.hpp,
|
||||
..\app\srs_app_forward.cpp,
|
||||
..\app\srs_app_hls.hpp,
|
||||
..\app\srs_app_hls.cpp,
|
||||
..\app\srs_app_http.hpp,
|
||||
..\app\srs_app_http.cpp,
|
||||
..\app\srs_app_log.hpp,
|
||||
..\app\srs_app_log.cpp,
|
||||
..\app\srs_app_refer.hpp,
|
||||
..\app\srs_app_refer.cpp,
|
||||
..\app\srs_app_reload.hpp,
|
||||
..\app\srs_app_reload.cpp,
|
||||
..\app\srs_app_pithy_print.hpp,
|
||||
..\app\srs_app_pithy_print.cpp,
|
||||
..\app\srs_app_thread.hpp,
|
||||
..\app\srs_app_thread.cpp,
|
||||
..\app\srs_app_server.hpp,
|
||||
..\app\srs_app_server.cpp,
|
||||
..\app\srs_app_st.hpp,
|
||||
..\app\srs_app_st.cpp,
|
||||
..\app\srs_app_socket.hpp,
|
||||
..\app\srs_app_socket.cpp,
|
||||
..\app\srs_app_source.hpp,
|
||||
..\app\srs_app_source.cpp,
|
||||
utest readonly separator,
|
||||
..\utest\srs_utest.hpp,
|
||||
..\utest\srs_utest.cpp,
|
||||
..\utest\srs_utest_amf0.hpp,
|
||||
..\utest\srs_utest_amf0.cpp,
|
||||
..\utest\srs_utest_handshake.hpp,
|
||||
..\utest\srs_utest_handshake.cpp,
|
||||
research readonly separator,
|
||||
..\..\research\librtmp\srs_play.c,
|
||||
..\..\research\librtmp\srs_publish.c,
|
||||
..\..\research\hls\ts_info.cc;
|
||||
|
||||
mainconfig
|
||||
"" = "MAIN";
|
||||
"" = "MAIN";
|
||||
|
||||
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2014 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <srs_utest_handshake.hpp>
|
||||
|
||||
#include <srs_kernel_error.hpp>
|
||||
#include <srs_core_autofree.hpp>
|
||||
|
||||
// verify the sha256
|
||||
VOID TEST(HandshakeTest, OpensslSha256)
|
||||
{
|
||||
// randome bytes to ensure the openssl sha256 is ok.
|
||||
char random_bytes[] = {
|
||||
0x8b, 0x1c, 0x5c, 0x5c, 0x3b, 0x98, 0x60, 0x80, 0x3c, 0x97, 0x43, 0x79, 0x9c, 0x94, 0xec, 0x63, 0xaa, 0xd9, 0x10, 0xd7, 0x0d, 0x91, 0xfb, 0x1f, 0xbf, 0xe0, 0x29, 0xde, 0x77, 0x09, 0x21, 0x34, 0xa5, 0x7d, 0xdf, 0xe3, 0xdf, 0x11, 0xdf, 0xd4, 0x00, 0x57, 0x38, 0x5b, 0xae, 0x9e, 0x89, 0x35, 0xcf, 0x07, 0x48, 0xca, 0xc8, 0x25, 0x46, 0x3c,
|
||||
0xb6, 0xdb, 0x9b, 0x39, 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0x07, 0x6e, 0xaf, 0xbf, 0xfe, 0x34, 0x1e, 0x1e, 0x19, 0xfc, 0xb5, 0x8a, 0x4f, 0x3c, 0xb4, 0xcf, 0xde, 0x24, 0x79, 0x65, 0x17, 0x22, 0x3f, 0xc0, 0x06, 0x76, 0x4e, 0x3c, 0xfb, 0xc3, 0xd0, 0x7f, 0x7b, 0x87, 0x5c, 0xeb, 0x97, 0x87,
|
||||
};
|
||||
|
||||
char digest[OpensslHashSize];
|
||||
ASSERT_EQ(ERROR_SUCCESS,
|
||||
openssl_HMACsha256(
|
||||
random_bytes, sizeof(random_bytes),
|
||||
SrsGenuineFPKey, 30,
|
||||
digest
|
||||
)
|
||||
);
|
||||
|
||||
char expect_digest[] = {
|
||||
0x1b, 0xc7, 0xe6, 0x14, 0xd5, 0x19, 0x8d, 0x99, 0x42, 0x0a, 0x21, 0x95, 0x26, 0x9a, 0x8a, 0x56,
|
||||
0xb4, 0x82, 0x2a, 0x7f, 0xd3, 0x1d, 0xc3, 0xd8, 0x92, 0x97, 0xc4, 0x61, 0xb7, 0x4d, 0x5d, 0xd2
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(digest, expect_digest, 32));
|
||||
}
|
||||
|
||||
// flash will sendout a c0c1 encrypt by ssl.
|
||||
VOID TEST(HandshakeTest, VerifyFPC0C1)
|
||||
{
|
||||
char c0c1[] = {
|
||||
0x03, 0x00, 0x0f, 0x64, 0xd0, 0x80, 0x00, 0x07, 0x02, 0xe6, 0x42, 0xe5, 0x2b, 0xf1, 0x1d, 0x0f, 0x6c, 0xc8, 0x50, 0xf2, 0x06, 0xae, 0xd5, 0x4f, 0xdb, 0xfe, 0x79, 0xc2, 0xef, 0xf5, 0x01, 0x74, 0x4b, 0x5b, 0xe7, 0x37, 0xa3, 0xe0, 0xca, 0xe1, 0x97, 0x07, 0xdb, 0x54, 0x1d, 0x4c, 0x4b, 0xa3, 0xc3, 0x3e, 0xa9, 0xeb, 0xa9, 0x5b, 0x2f, 0x38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0xe6, 0x40, 0xeb, 0xd8, 0x7a, 0x1f, 0x63, 0x56, 0xc1, 0x4d, 0xa0, 0xf8
|
||||
};
|
||||
ASSERT_EQ(1537, (int)sizeof(c0c1));
|
||||
|
||||
// c0
|
||||
EXPECT_EQ(0x03, c0c1[0]);
|
||||
|
||||
// c1
|
||||
c1s1 c1;
|
||||
|
||||
// the schema of data must be schema0: key-digest.
|
||||
ASSERT_EQ(ERROR_SUCCESS, c1.c1_parse(c0c1 + 1, srs_schema0));
|
||||
EXPECT_EQ((int32_t)0xd0640f00, c1.time);
|
||||
EXPECT_EQ((int32_t)0x2070080, c1.version);
|
||||
|
||||
// manually validate the c1
|
||||
// @see: calc_c1_digest
|
||||
char* c1s1_joined_bytes = srs_bytes_join_schema0(c1.time, c1.version, &c1.block0.key, &c1.block1.digest);
|
||||
SrsAutoFree(char, c1s1_joined_bytes, true);
|
||||
|
||||
bool is_valid;
|
||||
ASSERT_EQ(ERROR_SUCCESS, c1.c1_validate_digest(is_valid));
|
||||
ASSERT_TRUE(is_valid);
|
||||
|
||||
// 128bytes key
|
||||
char key[] = {
|
||||
0x01, 0xc6, 0xba, 0xe4, 0xb8, 0xd5, 0xbd, 0x7b, 0x43, 0xc9, 0x69, 0x6b, 0x40, 0xf7, 0xdc, 0x65, 0xa4, 0xf7, 0xca, 0x1f, 0xd8, 0xe5, 0xba, 0x4c, 0xdf, 0xe4, 0x64, 0x9e, 0x7d, 0xbd, 0x54, 0x13, 0x13, 0xc6, 0x0c, 0xb8, 0x1d, 0x31, 0x0a, 0x49, 0xe2, 0x43, 0xb6, 0x95, 0x5f, 0x05, 0x6e, 0x66,
|
||||
0xf4, 0x21, 0xa8, 0x65, 0xce, 0xf8, 0x8e, 0xcc, 0x16, 0x1e, 0xbb, 0xd8, 0x0e, 0xcb, 0xd2, 0x48, 0x37, 0xaf, 0x4e, 0x67, 0x45, 0xf1, 0x79, 0x69, 0xd2, 0xee, 0xa4, 0xb5, 0x01, 0xbf, 0x57, 0x0f, 0x68, 0x37, 0xbe, 0x4e, 0xff, 0xc9, 0xb9, 0x92, 0x23, 0x06, 0x75, 0xa0, 0x42, 0xe4, 0x0a, 0x30,
|
||||
0xf0, 0xaf, 0xb0, 0x54, 0x88, 0x7c, 0xc0, 0xc1, 0x0c, 0x6d, 0x01, 0x36, 0x63, 0xf3, 0x3d, 0xbc, 0x72, 0xf6, 0x96, 0xc8, 0x87, 0xab, 0x8b, 0x0c, 0x91, 0x2f, 0x42, 0x2a, 0x11, 0xf6, 0x2d, 0x5e
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(c1.block0.key.key, key, 128));
|
||||
|
||||
// 32bytes digest
|
||||
char digest[] = {
|
||||
0x6c, 0x96, 0x9f, 0x26, 0xeb, 0xdc, 0x61, 0xc4, 0x8f, 0xd3, 0x2b, 0x81, 0x86, 0x6c, 0x9c, 0xc2,
|
||||
0xb1, 0xb5, 0xbc, 0xa6, 0xd6, 0xd6, 0x1d, 0xce, 0x93, 0x78, 0xb3, 0xec, 0xa8, 0x64, 0x19, 0x13
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(c1.block1.digest.digest, digest, 32));
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2014 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_UTEST_HANDSHAKE_HPP
|
||||
#define SRS_UTEST_HANDSHAKE_HPP
|
||||
|
||||
/*
|
||||
#include <srs_utest_handshake.hpp>
|
||||
*/
|
||||
#include <srs_utest.hpp>
|
||||
|
||||
#include <srs_protocol_handshake.hpp>
|
||||
using namespace srs;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue