mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine all consts
This commit is contained in:
parent
8497b22d4a
commit
e47c0ae202
3 changed files with 12 additions and 12 deletions
|
@ -583,14 +583,14 @@ namespace _srs_internal
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
char temp_key[SRS_CONSTS_OpensslHashSize];
|
||||
char temp_key[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) {
|
||||
srs_error("create c2 temp key failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
srs_verbose("generate c2 temp key success.");
|
||||
|
||||
char _digest[SRS_CONSTS_OpensslHashSize];
|
||||
char _digest[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) {
|
||||
srs_error("create c2 digest failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
@ -607,14 +607,14 @@ namespace _srs_internal
|
|||
is_valid = false;
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
char temp_key[SRS_CONSTS_OpensslHashSize];
|
||||
char temp_key[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(s1->get_digest(), 32, SrsGenuineFPKey, 62, temp_key)) != ERROR_SUCCESS) {
|
||||
srs_error("create c2 temp key failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
srs_verbose("generate c2 temp key success.");
|
||||
|
||||
char _digest[SRS_CONSTS_OpensslHashSize];
|
||||
char _digest[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) {
|
||||
srs_error("create c2 digest failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
@ -630,14 +630,14 @@ namespace _srs_internal
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
char temp_key[SRS_CONSTS_OpensslHashSize];
|
||||
char temp_key[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) {
|
||||
srs_error("create s2 temp key failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
srs_verbose("generate s2 temp key success.");
|
||||
|
||||
char _digest[SRS_CONSTS_OpensslHashSize];
|
||||
char _digest[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) {
|
||||
srs_error("create s2 digest failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
@ -654,14 +654,14 @@ namespace _srs_internal
|
|||
is_valid = false;
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
char temp_key[SRS_CONSTS_OpensslHashSize];
|
||||
char temp_key[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(c1->get_digest(), 32, SrsGenuineFMSKey, 68, temp_key)) != ERROR_SUCCESS) {
|
||||
srs_error("create s2 temp key failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
srs_verbose("generate s2 temp key success.");
|
||||
|
||||
char _digest[SRS_CONSTS_OpensslHashSize];
|
||||
char _digest[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(random, 1504, temp_key, 32, _digest)) != ERROR_SUCCESS) {
|
||||
srs_error("create s2 digest failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
@ -921,7 +921,7 @@ namespace _srs_internal
|
|||
srs_assert(c1s1_joined_bytes != NULL);
|
||||
SrsAutoFree(char, c1s1_joined_bytes);
|
||||
|
||||
digest = new char[SRS_CONSTS_OpensslHashSize];
|
||||
digest = new char[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFMSKey, 36, digest)) != ERROR_SUCCESS) {
|
||||
srs_error("calc digest for s1 failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
@ -948,7 +948,7 @@ namespace _srs_internal
|
|||
srs_assert(c1s1_joined_bytes != NULL);
|
||||
SrsAutoFree(char, c1s1_joined_bytes);
|
||||
|
||||
digest = new char[SRS_CONSTS_OpensslHashSize];
|
||||
digest = new char[__SRS_OpensslHashSize];
|
||||
if ((ret = openssl_HMACsha256(c1s1_joined_bytes, 1536 - 32, SrsGenuineFPKey, 30, digest)) != ERROR_SUCCESS) {
|
||||
srs_error("calc digest for c1 failed. ret=%d", ret);
|
||||
return ret;
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace _srs_internal
|
|||
};
|
||||
|
||||
// the digest key generate size.
|
||||
#define SRS_CONSTS_OpensslHashSize 512
|
||||
#define __SRS_OpensslHashSize 512
|
||||
extern u_int8_t SrsGenuineFMSKey[];
|
||||
extern u_int8_t SrsGenuineFPKey[];
|
||||
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)
|
|||
(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,
|
||||
};
|
||||
|
||||
char digest[SRS_CONSTS_OpensslHashSize];
|
||||
char digest[__SRS_OpensslHashSize];
|
||||
ASSERT_EQ(ERROR_SUCCESS,
|
||||
openssl_HMACsha256(
|
||||
random_bytes, sizeof(random_bytes),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue