mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #165, refine dh wrapper, ensure public key is 128bytes. 0.9.206.
This commit is contained in:
parent
5e66546f8b
commit
cb311d998e
5 changed files with 185 additions and 122 deletions
|
@ -238,11 +238,24 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256)
|
|||
// verify the dh key
|
||||
VOID TEST(ProtocolHandshakeTest, DHKey)
|
||||
{
|
||||
_srs_internal::SrsDH dh;
|
||||
|
||||
ASSERT_TRUE(ERROR_SUCCESS == dh.initialize(true));
|
||||
|
||||
char pub_key1[128];
|
||||
openssl_generate_key(pub_key1, 128);
|
||||
EXPECT_TRUE(ERROR_SUCCESS == dh.copy_public_key(pub_key1, NULL));
|
||||
|
||||
char pub_key2[128];
|
||||
openssl_generate_key(pub_key2, 128);
|
||||
EXPECT_TRUE(ERROR_SUCCESS == dh.copy_public_key(pub_key2, NULL));
|
||||
|
||||
EXPECT_TRUE(srs_bytes_equals(pub_key1, pub_key2, 128));
|
||||
|
||||
// another dh
|
||||
_srs_internal::SrsDH dh0;
|
||||
|
||||
ASSERT_TRUE(ERROR_SUCCESS == dh0.initialize(true));
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == dh0.copy_public_key(pub_key2, NULL));
|
||||
|
||||
EXPECT_FALSE(srs_bytes_equals(pub_key1, pub_key2, 128));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue