Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d8fcb601
提交
d8fcb601
authored
6月 26, 2017
作者:
Mike Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9785: changes to support newer openssl
上级
b1237ffe
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
89 行增加
和
6 行删除
+89
-6
.update
libs/sofia-sip/.update
+1
-1
tport_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
+6
-2
handshake.h
src/mod/endpoints/mod_rtmp/handshake.h
+11
-1
switch_core_cert.c
src/switch_core_cert.c
+15
-0
switch_rtp.c
src/switch_rtp.c
+56
-2
没有找到文件。
libs/sofia-sip/.update
浏览文件 @
d8fcb601
Wed Jun 21 08:51:26
CDT 2017
Mon Jun 26 14:53:11
CDT 2017
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
浏览文件 @
d8fcb601
...
@@ -505,7 +505,7 @@ tls_t *tls_init_master(tls_issues_t *ti)
...
@@ -505,7 +505,7 @@ tls_t *tls_init_master(tls_issues_t *ti)
return
NULL
;
return
NULL
;
}
}
RAND_
pseudo_
bytes
(
sessionId
,
sizeof
(
sessionId
));
RAND_bytes
(
sessionId
,
sizeof
(
sessionId
));
if
(
!
SSL_CTX_set_session_id_context
(
tls
->
ctx
,
if
(
!
SSL_CTX_set_session_id_context
(
tls
->
ctx
,
(
void
*
)
sessionId
,
(
void
*
)
sessionId
,
...
@@ -516,7 +516,11 @@ tls_t *tls_init_master(tls_issues_t *ti)
...
@@ -516,7 +516,11 @@ tls_t *tls_init_master(tls_issues_t *ti)
if
(
ti
->
CAfile
!=
NULL
)
{
if
(
ti
->
CAfile
!=
NULL
)
{
SSL_CTX_set_client_CA_list
(
tls
->
ctx
,
SSL_CTX_set_client_CA_list
(
tls
->
ctx
,
SSL_load_client_CA_file
(
ti
->
CAfile
));
SSL_load_client_CA_file
(
ti
->
CAfile
));
if
(
tls
->
ctx
->
client_CA
==
NULL
)
#if OPENSSL_VERSION_NUMBER >= 0x10100000
if
(
SSL_CTX_get_client_CA_list
(
tls
->
ctx
)
==
NULL
)
#else
if
(
tls
->
ctx
->
client_CA
==
NULL
)
#endif
tls_log_errors
(
3
,
"tls_init_master"
,
0
);
tls_log_errors
(
3
,
"tls_init_master"
,
0
);
}
}
...
...
src/mod/endpoints/mod_rtmp/handshake.h
浏览文件 @
d8fcb601
...
@@ -42,9 +42,15 @@
...
@@ -42,9 +42,15 @@
#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH)
#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH)
#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256
#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256
#endif
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
#else
#define HMAC_setup(ctx, key, len)ctx=HMAC_CTX_new(); HMAC_Init_ex(ctx, key, len, EVP_sha256(), 0)
#define HMAC_crunch(ctx, buf, len)HMAC_Update(ctx, buf, len)
#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx)
#endif
#define FP10
#define FP10
#define RTMP_SIG_SIZE 1536
#define RTMP_SIG_SIZE 1536
...
@@ -152,8 +158,12 @@ static getoff *digoff[] = {GetDigestOffset1, GetDigestOffset2};
...
@@ -152,8 +158,12 @@ static getoff *digoff[] = {GetDigestOffset1, GetDigestOffset2};
static
void
HMACsha256
(
const
uint8_t
*
message
,
size_t
messageLen
,
const
uint8_t
*
key
,
size_t
keylen
,
uint8_t
*
digest
)
static
void
HMACsha256
(
const
uint8_t
*
message
,
size_t
messageLen
,
const
uint8_t
*
key
,
size_t
keylen
,
uint8_t
*
digest
)
{
{
unsigned
int
digestLen
;
unsigned
int
digestLen
;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
HMAC_CTX
ctx
;
HMAC_CTX
ctx
;
#else
HMAC_CTX
*
ctx
;
#endif
HMAC_setup
(
ctx
,
key
,
(
int
)
keylen
);
HMAC_setup
(
ctx
,
key
,
(
int
)
keylen
);
HMAC_crunch
(
ctx
,
message
,
messageLen
);
HMAC_crunch
(
ctx
,
message
,
messageLen
);
HMAC_finish
(
ctx
,
digest
,
digestLen
);
HMAC_finish
(
ctx
,
digest
,
digestLen
);
...
...
src/switch_core_cert.c
浏览文件 @
d8fcb601
...
@@ -359,7 +359,22 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
...
@@ -359,7 +359,22 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
x
=
*
x509p
;
x
=
*
x509p
;
}
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000
rsa
=
RSA_new
();
{
static
const
BN_ULONG
ULONG_RSA_F4
=
RSA_F4
;
BIGNUM
*
BN_value_RSA_F4
=
BN_new
();
if
(
!
BN_value_RSA_F4
)
{
abort
();
goto
err
;
}
BN_set_word
(
BN_value_RSA_F4
,
ULONG_RSA_F4
);
RSA_generate_key_ex
(
rsa
,
bits
,
BN_value_RSA_F4
,
NULL
);
BN_free
(
BN_value_RSA_F4
);
}
#else
rsa
=
RSA_generate_key
(
bits
,
RSA_F4
,
NULL
,
NULL
);
rsa
=
RSA_generate_key
(
bits
,
RSA_F4
,
NULL
,
NULL
);
#endif
if
(
!
EVP_PKEY_assign_RSA
(
pk
,
rsa
))
{
if
(
!
EVP_PKEY_assign_RSA
(
pk
,
rsa
))
{
abort
();
abort
();
...
...
src/switch_rtp.c
浏览文件 @
d8fcb601
...
@@ -3284,10 +3284,18 @@ static int cb_verify_peer(int preverify_ok, X509_STORE_CTX *ctx)
...
@@ -3284,10 +3284,18 @@ static int cb_verify_peer(int preverify_ok, X509_STORE_CTX *ctx)
////////////
////////////
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static
BIO_METHOD
dtls_bio_filter_methods
;
static
BIO_METHOD
dtls_bio_filter_methods
;
#else
static
BIO_METHOD
*
dtls_bio_filter_methods
;
#endif
BIO_METHOD
*
BIO_dtls_filter
(
void
)
{
BIO_METHOD
*
BIO_dtls_filter
(
void
)
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
return
(
&
dtls_bio_filter_methods
);
return
(
&
dtls_bio_filter_methods
);
#else
return
(
dtls_bio_filter_methods
);
#endif
}
}
typedef
struct
packet_list_s
{
typedef
struct
packet_list_s
{
...
@@ -3320,10 +3328,16 @@ static int dtls_bio_filter_new(BIO *bio) {
...
@@ -3320,10 +3328,16 @@ static int dtls_bio_filter_new(BIO *bio) {
switch_mutex_init
(
&
filter
->
mutex
,
SWITCH_MUTEX_NESTED
,
filter
->
pool
);
switch_mutex_init
(
&
filter
->
mutex
,
SWITCH_MUTEX_NESTED
,
filter
->
pool
);
/* Set the BIO as initialized */
/* Set the BIO as initialized */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
bio
->
init
=
1
;
bio
->
init
=
1
;
bio
->
ptr
=
filter
;
bio
->
ptr
=
filter
;
bio
->
flags
=
0
;
bio
->
flags
=
0
;
#else
BIO_set_init
(
bio
,
1
);
BIO_set_data
(
bio
,
filter
);
BIO_clear_flags
(
bio
,
~
0
);
#endif
return
1
;
return
1
;
}
}
...
@@ -3335,7 +3349,11 @@ static int dtls_bio_filter_free(BIO *bio) {
...
@@ -3335,7 +3349,11 @@ static int dtls_bio_filter_free(BIO *bio) {
}
}
/* Get rid of the filter state */
/* Get rid of the filter state */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
#else
filter
=
(
dtls_bio_filter
*
)
BIO_get_data
(
bio
);
#endif
if
(
filter
!=
NULL
)
{
if
(
filter
!=
NULL
)
{
switch_memory_pool_t
*
pool
=
filter
->
pool
;
switch_memory_pool_t
*
pool
=
filter
->
pool
;
...
@@ -3344,9 +3362,15 @@ static int dtls_bio_filter_free(BIO *bio) {
...
@@ -3344,9 +3362,15 @@ static int dtls_bio_filter_free(BIO *bio) {
filter
=
NULL
;
filter
=
NULL
;
}
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
bio
->
ptr
=
NULL
;
bio
->
ptr
=
NULL
;
bio
->
init
=
0
;
bio
->
init
=
0
;
bio
->
flags
=
0
;
bio
->
flags
=
0
;
#else
BIO_set_init
(
bio
,
0
);
BIO_set_data
(
bio
,
NULL
);
BIO_clear_flags
(
bio
,
~
0
);
#endif
return
1
;
return
1
;
}
}
...
@@ -3356,11 +3380,20 @@ static int dtls_bio_filter_write(BIO *bio, const char *in, int inl) {
...
@@ -3356,11 +3380,20 @@ static int dtls_bio_filter_write(BIO *bio, const char *in, int inl) {
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"dtls_bio_filter_write: %p, %d
\n
"
,
(
void
*
)
in
,
inl
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"dtls_bio_filter_write: %p, %d
\n
"
,
(
void
*
)
in
,
inl
);
/* Forward data to the write BIO */
/* Forward data to the write BIO */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ret
=
BIO_write
(
bio
->
next_bio
,
in
,
inl
);
ret
=
BIO_write
(
bio
->
next_bio
,
in
,
inl
);
#else
ret
=
BIO_write
(
BIO_next
(
bio
),
in
,
inl
);
#endif
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
" -- %ld
\n
"
,
ret
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
" -- %ld
\n
"
,
ret
);
/* Keep track of the packet, as we'll advertize them one by one after a pending check */
/* Keep track of the packet, as we'll advertize them one by one after a pending check */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
#else
filter
=
(
dtls_bio_filter
*
)
BIO_get_data
(
bio
);
#endif
if
(
filter
!=
NULL
)
{
if
(
filter
!=
NULL
)
{
packet_list_t
*
node
;
packet_list_t
*
node
;
...
@@ -3391,7 +3424,11 @@ static int dtls_bio_filter_write(BIO *bio, const char *in, int inl) {
...
@@ -3391,7 +3424,11 @@ static int dtls_bio_filter_write(BIO *bio, const char *in, int inl) {
}
}
static
long
dtls_bio_filter_ctrl
(
BIO
*
bio
,
int
cmd
,
long
num
,
void
*
ptr
)
{
static
long
dtls_bio_filter_ctrl
(
BIO
*
bio
,
int
cmd
,
long
num
,
void
*
ptr
)
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
dtls_bio_filter
*
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
dtls_bio_filter
*
filter
=
(
dtls_bio_filter
*
)
bio
->
ptr
;
#else
dtls_bio_filter
*
filter
=
(
dtls_bio_filter
*
)
BIO_get_data
(
bio
);
#endif
switch
(
cmd
)
{
switch
(
cmd
)
{
case
BIO_CTRL_DGRAM_GET_FALLBACK_MTU
:
case
BIO_CTRL_DGRAM_GET_FALLBACK_MTU
:
...
@@ -3438,6 +3475,7 @@ static long dtls_bio_filter_ctrl(BIO *bio, int cmd, long num, void *ptr) {
...
@@ -3438,6 +3475,7 @@ static long dtls_bio_filter_ctrl(BIO *bio, int cmd, long num, void *ptr) {
return
0
;
return
0
;
}
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static
BIO_METHOD
dtls_bio_filter_methods
=
{
static
BIO_METHOD
dtls_bio_filter_methods
=
{
BIO_TYPE_FILTER
,
BIO_TYPE_FILTER
,
"DTLS filter"
,
"DTLS filter"
,
...
@@ -3450,7 +3488,9 @@ static BIO_METHOD dtls_bio_filter_methods = {
...
@@ -3450,7 +3488,9 @@ static BIO_METHOD dtls_bio_filter_methods = {
dtls_bio_filter_free
,
dtls_bio_filter_free
,
NULL
NULL
};
};
#else
static
BIO_METHOD
*
dtls_bio_filter_methods
=
NULL
;
#endif
///////////
///////////
...
@@ -3598,7 +3638,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3598,7 +3638,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
dtls
->
ca
=
switch_core_sprintf
(
rtp_session
->
pool
,
"%s%sca-bundle.crt"
,
SWITCH_GLOBAL_dirs
.
certs_dir
,
SWITCH_PATH_SEPARATOR
);
dtls
->
ca
=
switch_core_sprintf
(
rtp_session
->
pool
,
"%s%sca-bundle.crt"
,
SWITCH_GLOBAL_dirs
.
certs_dir
,
SWITCH_PATH_SEPARATOR
);
#if OPENSSL_VERSION_NUMBER >= 0x10100000
dtls
->
ssl_ctx
=
SSL_CTX_new
((
type
&
DTLS_TYPE_SERVER
)
?
DTLS_server_method
()
:
DTLS_client_method
());
#else
dtls
->
ssl_ctx
=
SSL_CTX_new
((
type
&
DTLS_TYPE_SERVER
)
?
DTLSv1_server_method
()
:
DTLSv1_client_method
());
dtls
->
ssl_ctx
=
SSL_CTX_new
((
type
&
DTLS_TYPE_SERVER
)
?
DTLSv1_server_method
()
:
DTLSv1_client_method
());
#endif
switch_assert
(
dtls
->
ssl_ctx
);
switch_assert
(
dtls
->
ssl_ctx
);
bio
=
BIO_new_file
(
dtls
->
pem
,
"r"
);
bio
=
BIO_new_file
(
dtls
->
pem
,
"r"
);
...
@@ -3659,7 +3703,17 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
...
@@ -3659,7 +3703,17 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
dtls
->
ssl
=
SSL_new
(
dtls
->
ssl_ctx
);
dtls
->
ssl
=
SSL_new
(
dtls
->
ssl_ctx
);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
dtls
->
filter_bio
=
BIO_new
(
BIO_dtls_filter
());
dtls
->
filter_bio
=
BIO_new
(
BIO_dtls_filter
());
#else
dtls_bio_filter_methods
=
BIO_meth_new
(
BIO_TYPE_FILTER
|
BIO_get_new_index
(),
"DTLS filter"
);
BIO_meth_set_write
(
dtls_bio_filter_methods
,
dtls_bio_filter_write
);
BIO_meth_set_ctrl
(
dtls_bio_filter_methods
,
dtls_bio_filter_ctrl
);
BIO_meth_set_create
(
dtls_bio_filter_methods
,
dtls_bio_filter_new
);
BIO_meth_set_destroy
(
dtls_bio_filter_methods
,
dtls_bio_filter_free
);
dtls
->
filter_bio
=
BIO_new
(
dtls_bio_filter_methods
);
#endif
switch_assert
(
dtls
->
filter_bio
);
switch_assert
(
dtls
->
filter_bio
);
BIO_push
(
dtls
->
filter_bio
,
dtls
->
write_bio
);
BIO_push
(
dtls
->
filter_bio
,
dtls
->
write_bio
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论