Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-08-13 18:09:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b15ee26a488ae82c35d9aeb61c3e0301a17bbc83
b15ee26a
1 parent
67ab0fb5
fix the ssl dh key size assert error, key size maybe 127, not always 128. 0.9.195
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
26 行增加
和
11 行删除
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/core/srs_core.hpp
查看文件 @
b15ee26
...
...
@@ -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 "19
4
"
#define VERSION_REVISION "19
5
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
b15ee26
...
...
@@ -198,9 +198,9 @@ namespace _srs_internal
}
// copy public key to bytes.
//
TODO: FIXME: please finger it out
.
//
sometimes, the key_size is 127, seems ok
.
int32_t
key_size
=
BN_num_bytes
(
pdh
->
pub_key
);
srs_assert
(
key_size
==
size
);
srs_assert
(
key_size
>
0
);
if
(
BN_bn2bin
(
pdh
->
pub_key
,
(
unsigned
char
*
)
public_key
)
!=
size
)
{
//("Unable to copy key"); return ret;
...
...
@@ -211,18 +211,13 @@ namespace _srs_internal
return
ret
;
}
/**
* create DH and copy the 128bytes public key,
* generate and copy the shared key.
* use exists DH to create and copy the 128bytes shared key.
* the peer public key used to generate the shared key.
*/
int
__openssl_co
mpute_key
(
DH
*
pdh
,
const
char
*
peer_pub_key
,
int
ppk_size
,
char
*
public_key
,
char
*
shared_key
)
int
__openssl_co
py_shared_key
(
DH
*
pdh
,
const
char
*
peer_pub_key
,
int
ppk_size
,
char
*
shared_key
)
{
int
ret
=
ERROR_SUCCESS
;
// create DH and copy the 128bytes public key
if
((
ret
=
__openssl_copy_key
(
pdh
,
public_key
,
ppk_size
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
BIGNUM
*
ppk
=
NULL
;
if
((
ppk
=
BN_bin2bn
((
const
unsigned
char
*
)
peer_pub_key
,
ppk_size
,
0
))
==
NULL
)
{
ret
=
ERROR_OpenSslGetPeerPublicKey
;
...
...
@@ -240,6 +235,26 @@ namespace _srs_internal
return
ret
;
}
/**
* create DH and copy the 128bytes public key,
* generate and copy the shared key.
*/
int
__openssl_compute_key
(
DH
*
pdh
,
const
char
*
peer_pub_key
,
int
ppk_size
,
char
*
public_key
,
char
*
shared_key
)
{
int
ret
=
ERROR_SUCCESS
;
// create DH and copy the 128bytes public key
if
((
ret
=
__openssl_copy_key
(
pdh
,
public_key
,
ppk_size
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// generate and copy the shared key
if
((
ret
=
__openssl_copy_shared_key
(
pdh
,
peer_pub_key
,
ppk_size
,
shared_key
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
void
__openssl_free
(
DH
*
pdh
)
{
if
(
pdh
!=
NULL
)
{
...
...
请
注册
或
登录
后发表评论