正在显示
3 个修改的文件
包含
12 行增加
和
12 行删除
| @@ -583,14 +583,14 @@ namespace _srs_internal | @@ -583,14 +583,14 @@ namespace _srs_internal | ||
| 583 | { | 583 | { |
| 584 | int ret = ERROR_SUCCESS; | 584 | int ret = ERROR_SUCCESS; |
| 585 | 585 | ||
| 586 | - char temp_key[SRS_CONSTS_OpensslHashSize]; | 586 | + char temp_key[__SRS_OpensslHashSize]; |
| 587 | if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) { | 587 | if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) { |
| 588 | srs_error("create c2 temp key failed. ret=%d", ret); | 588 | srs_error("create c2 temp key failed. ret=%d", ret); |
| 589 | return ret; | 589 | return ret; |
| 590 | } | 590 | } |
| 591 | srs_verbose("generate c2 temp key success."); | 591 | srs_verbose("generate c2 temp key success."); |
| 592 | 592 | ||
| 593 | - char _digest[SRS_CONSTS_OpensslHashSize]; | 593 | + char _digest[__SRS_OpensslHashSize]; |
| 594 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { | 594 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { |
| 595 | srs_error("create c2 digest failed. ret=%d", ret); | 595 | srs_error("create c2 digest failed. ret=%d", ret); |
| 596 | return ret; | 596 | return ret; |
| @@ -607,14 +607,14 @@ namespace _srs_internal | @@ -607,14 +607,14 @@ namespace _srs_internal | ||
| 607 | is_valid = false; | 607 | is_valid = false; |
| 608 | int ret = ERROR_SUCCESS; | 608 | int ret = ERROR_SUCCESS; |
| 609 | 609 | ||
| 610 | - char temp_key[SRS_CONSTS_OpensslHashSize]; | 610 | + char temp_key[__SRS_OpensslHashSize]; |
| 611 | if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) { | 611 | if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) { |
| 612 | srs_error("create c2 temp key failed. ret=%d", ret); | 612 | srs_error("create c2 temp key failed. ret=%d", ret); |
| 613 | return ret; | 613 | return ret; |
| 614 | } | 614 | } |
| 615 | srs_verbose("generate c2 temp key success."); | 615 | srs_verbose("generate c2 temp key success."); |
| 616 | 616 | ||
| 617 | - char _digest[SRS_CONSTS_OpensslHashSize]; | 617 | + char _digest[__SRS_OpensslHashSize]; |
| 618 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { | 618 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { |
| 619 | srs_error("create c2 digest failed. ret=%d", ret); | 619 | srs_error("create c2 digest failed. ret=%d", ret); |
| 620 | return ret; | 620 | return ret; |
| @@ -630,14 +630,14 @@ namespace _srs_internal | @@ -630,14 +630,14 @@ namespace _srs_internal | ||
| 630 | { | 630 | { |
| 631 | int ret = ERROR_SUCCESS; | 631 | int ret = ERROR_SUCCESS; |
| 632 | 632 | ||
| 633 | - char temp_key[SRS_CONSTS_OpensslHashSize]; | 633 | + char temp_key[__SRS_OpensslHashSize]; |
| 634 | if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) { | 634 | if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) { |
| 635 | srs_error("create s2 temp key failed. ret=%d", ret); | 635 | srs_error("create s2 temp key failed. ret=%d", ret); |
| 636 | return ret; | 636 | return ret; |
| 637 | } | 637 | } |
| 638 | srs_verbose("generate s2 temp key success."); | 638 | srs_verbose("generate s2 temp key success."); |
| 639 | 639 | ||
| 640 | - char _digest[SRS_CONSTS_OpensslHashSize]; | 640 | + char _digest[__SRS_OpensslHashSize]; |
| 641 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { | 641 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { |
| 642 | srs_error("create s2 digest failed. ret=%d", ret); | 642 | srs_error("create s2 digest failed. ret=%d", ret); |
| 643 | return ret; | 643 | return ret; |
| @@ -654,14 +654,14 @@ namespace _srs_internal | @@ -654,14 +654,14 @@ namespace _srs_internal | ||
| 654 | is_valid = false; | 654 | is_valid = false; |
| 655 | int ret = ERROR_SUCCESS; | 655 | int ret = ERROR_SUCCESS; |
| 656 | 656 | ||
| 657 | - char temp_key[SRS_CONSTS_OpensslHashSize]; | 657 | + char temp_key[__SRS_OpensslHashSize]; |
| 658 | if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) { | 658 | if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) { |
| 659 | srs_error("create s2 temp key failed. ret=%d", ret); | 659 | srs_error("create s2 temp key failed. ret=%d", ret); |
| 660 | return ret; | 660 | return ret; |
| 661 | } | 661 | } |
| 662 | srs_verbose("generate s2 temp key success."); | 662 | srs_verbose("generate s2 temp key success."); |
| 663 | 663 | ||
| 664 | - char _digest[SRS_CONSTS_OpensslHashSize]; | 664 | + char _digest[__SRS_OpensslHashSize]; |
| 665 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { | 665 | if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) { |
| 666 | srs_error("create s2 digest failed. ret=%d", ret); | 666 | srs_error("create s2 digest failed. ret=%d", ret); |
| 667 | return ret; | 667 | return ret; |
| @@ -921,7 +921,7 @@ namespace _srs_internal | @@ -921,7 +921,7 @@ namespace _srs_internal | ||
| 921 | srs_assert(c1s1_joined_bytes != NULL); | 921 | srs_assert(c1s1_joined_bytes != NULL); |
| 922 | SrsAutoFree(char, c1s1_joined_bytes); | 922 | SrsAutoFree(char, c1s1_joined_bytes); |
| 923 | 923 | ||
| 924 | - digest = new char[SRS_CONSTS_OpensslHashSize]; | 924 | + digest = new char[__SRS_OpensslHashSize]; |
| 925 | if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFMSKey, 36, digest)) != ERROR_SUCCESS) { | 925 | if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFMSKey, 36, digest)) != ERROR_SUCCESS) { |
| 926 | srs_error("calc digest for s1 failed. ret=%d", ret); | 926 | srs_error("calc digest for s1 failed. ret=%d", ret); |
| 927 | return ret; | 927 | return ret; |
| @@ -948,7 +948,7 @@ namespace _srs_internal | @@ -948,7 +948,7 @@ namespace _srs_internal | ||
| 948 | srs_assert(c1s1_joined_bytes != NULL); | 948 | srs_assert(c1s1_joined_bytes != NULL); |
| 949 | SrsAutoFree(char, c1s1_joined_bytes); | 949 | SrsAutoFree(char, c1s1_joined_bytes); |
| 950 | 950 | ||
| 951 | - digest = new char[SRS_CONSTS_OpensslHashSize]; | 951 | + digest = new char[__SRS_OpensslHashSize]; |
| 952 | if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFPKey, 30, digest)) != ERROR_SUCCESS) { | 952 | if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFPKey, 30, digest)) != ERROR_SUCCESS) { |
| 953 | srs_error("calc digest for c1 failed. ret=%d", ret); | 953 | srs_error("calc digest for c1 failed. ret=%d", ret); |
| 954 | return ret; | 954 | return ret; |
| @@ -111,7 +111,7 @@ namespace _srs_internal | @@ -111,7 +111,7 @@ namespace _srs_internal | ||
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | // the digest key generate size. | 113 | // the digest key generate size. |
| 114 | - #define SRS_CONSTS_OpensslHashSize 512 | 114 | + #define __SRS_OpensslHashSize 512 |
| 115 | extern u_int8_t SrsGenuineFMSKey[]; | 115 | extern u_int8_t SrsGenuineFMSKey[]; |
| 116 | extern u_int8_t SrsGenuineFPKey[]; | 116 | extern u_int8_t SrsGenuineFPKey[]; |
| 117 | int openssl_HMACsha256(const void* data, int data_size, const void* key, int key_size, void* digest); | 117 | int openssl_HMACsha256(const void* data, int data_size, const void* key, int key_size, void* digest); |
| @@ -217,7 +217,7 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256) | @@ -217,7 +217,7 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256) | ||
| 217 | (char)0xfd, (char)0x48, (char)0xaa, (char)0xc1, (char)0xfa, (char)0xbf, (char)0x33, (char)0x87, (char)0x5c, (char)0x0d, (char)0xe5, (char)0x34, (char)0x24, (char)0x70, (char)0x14, (char)0x1e, (char)0x4a, (char)0x48, (char)0x07, (char)0x6e, (char)0xaf, (char)0xbf, (char)0xfe, (char)0x34, (char)0x1e, (char)0x1e, (char)0x19, (char)0xfc, (char)0xb5, (char)0x8a, (char)0x4f, (char)0x3c, (char)0xb4, (char)0xcf, (char)0xde, (char)0x24, (char)0x79, (char)0x65, (char)0x17, (char)0x22, (char)0x3f, (char)0xc0, (char)0x06, (char)0x76, (char)0x4e, (char)0x3c, (char)0xfb, (char)0xc3, (char)0xd0, (char)0x7f, (char)0x7b, (char)0x87, (char)0x5c, (char)0xeb, (char)0x97, (char)0x87, | 217 | (char)0xfd, (char)0x48, (char)0xaa, (char)0xc1, (char)0xfa, (char)0xbf, (char)0x33, (char)0x87, (char)0x5c, (char)0x0d, (char)0xe5, (char)0x34, (char)0x24, (char)0x70, (char)0x14, (char)0x1e, (char)0x4a, (char)0x48, (char)0x07, (char)0x6e, (char)0xaf, (char)0xbf, (char)0xfe, (char)0x34, (char)0x1e, (char)0x1e, (char)0x19, (char)0xfc, (char)0xb5, (char)0x8a, (char)0x4f, (char)0x3c, (char)0xb4, (char)0xcf, (char)0xde, (char)0x24, (char)0x79, (char)0x65, (char)0x17, (char)0x22, (char)0x3f, (char)0xc0, (char)0x06, (char)0x76, (char)0x4e, (char)0x3c, (char)0xfb, (char)0xc3, (char)0xd0, (char)0x7f, (char)0x7b, (char)0x87, (char)0x5c, (char)0xeb, (char)0x97, (char)0x87, |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | - char digest[SRS_CONSTS_OpensslHashSize]; | 220 | + char digest[__SRS_OpensslHashSize]; |
| 221 | ASSERT_EQ(ERROR_SUCCESS, | 221 | ASSERT_EQ(ERROR_SUCCESS, |
| 222 | openssl_HMACsha256( | 222 | openssl_HMACsha256( |
| 223 | random_bytes, sizeof(random_bytes), | 223 | random_bytes, sizeof(random_bytes), |
-
请 注册 或 登录 后发表评论