Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f97a3266
提交
f97a3266
authored
12月 18, 2011
作者:
Marc Olivier Chouinard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3071 I've commited the upstream passphrase backport
上级
663699f4
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
47 行增加
和
0 行删除
+47
-0
tport_tag.h
libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
+6
-0
tport_tag.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
+10
-0
tport_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
+27
-0
tport_tls.h
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h
+1
-0
tport_type_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
+3
-0
没有找到文件。
libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
浏览文件 @
f97a3266
...
...
@@ -198,6 +198,12 @@ enum tport_tls_verify_policy {
TPTLS_VERIFY_SUBJECTS_ALL
=
0xF
,
};
TPORT_DLL
extern
tag_typedef_t
tptag_tls_passphrase
;
#define TPTAG_TLS_PASSPHRASE(x) tptag_tls_passphrase, tag_str_v(x)
TPORT_DLL
extern
tag_typedef_t
tptag_tls_passphrase_ref
;
#define TPTAG_TLS_PASSPHRASE_REF(x) tptag_tls_passphrase_ref, tag_str_vr(&(x))
TPORT_DLL
extern
tag_typedef_t
tptag_tls_verify_policy
;
#define TPTAG_TLS_VERIFY_POLICY(x) tptag_tls_verify_policy, tag_uint_v((x))
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
浏览文件 @
f97a3266
...
...
@@ -288,6 +288,16 @@ tag_typedef_t tptag_tls_version = UINTTAG_TYPEDEF(tls_version);
*/
tag_typedef_t
tptag_tls_verify_peer
=
UINTTAG_TYPEDEF
(
tls_verify_peer
);
/**@def TPTAG_TLS_PASSPHRASE(x)
*
* Sets the passphrase password to be used by openSSL to encrypt/decrypt
* private key files.
*
* @NEW_1_12_11.
*/
tag_typedef_t
tptag_tls_passphrase
=
STRTAG_TYPEDEF
(
tls_passphrase
);
/**@def TPTAG_TLS_VERIFY_POLICY(x)
*
* The verification of certificates can be controlled:
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
浏览文件 @
f97a3266
...
...
@@ -160,6 +160,27 @@ void tls_log_errors(unsigned level, char const *s, unsigned long e)
}
}
/*
* This callback hands back the password to be used during decryption.
*
* buf : the function will write the password into this buffer
* size : the size of "buf"
* rwflag : indicates whether the callback is being used for reading/
* decryption (0) or writing/encryption (1)
* userdata : pointer tls_issues_t where the passphrase is stored
*/
static
int
passwd_cb
(
char
*
buf
,
int
size
,
int
rwflag
,
void
*
userdata
)
{
if
(
rwflag
==
0
)
{
// reading/decryption
tls_issues_t
*
tlsi
=
(
tls_issues_t
*
)
userdata
;
strncpy
(
buf
,
tlsi
->
passphrase
,
size
);
buf
[
size
-
1
]
=
'\0'
;
return
strlen
(
tlsi
->
passphrase
);
}
return
0
;
}
static
tls_t
*
tls_create
(
int
type
)
...
...
@@ -290,6 +311,12 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
return
-
1
;
}
/* Set callback if we have a passphrase */
if
(
ti
->
passphrase
!=
NULL
)
{
SSL_CTX_set_default_passwd_cb
(
tls
->
ctx
,
passwd_cb
);
SSL_CTX_set_default_passwd_cb_userdata
(
tls
->
ctx
,
(
void
*
)
ti
);
}
if
(
!
SSL_CTX_use_certificate_file
(
tls
->
ctx
,
ti
->
cert
,
SSL_FILETYPE_PEM
))
{
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h
浏览文件 @
f97a3266
...
...
@@ -56,6 +56,7 @@ typedef struct tls_issues_s {
int
configured
;
/* If non-zero, complain about certificate errors */
char
*
cert
;
/* CERT file name. File format is PEM */
char
*
key
;
/* Private key file. PEM format */
char
*
passphrase
;
/* Passphrase for password protected private key */
char
*
randFile
;
/* Seed file for the PRNG (default: tls_seed.dat) */
char
*
CAfile
;
/* PEM file of CA's */
char
*
CApath
;
/* PEM file path of CA's */
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
浏览文件 @
f97a3266
...
...
@@ -182,6 +182,7 @@ static int tport_tls_init_master(tport_primary_t *pri,
char
const
*
path
=
NULL
;
unsigned
tls_version
=
1
;
unsigned
tls_verify
=
0
;
char
const
*
passphrase
=
NULL
;
unsigned
tls_policy
=
TPTLS_VERIFY_NONE
;
unsigned
tls_depth
=
0
;
unsigned
tls_date
=
1
;
...
...
@@ -198,6 +199,7 @@ static int tport_tls_init_master(tport_primary_t *pri,
TPTAG_CERTIFICATE_REF
(
path
),
TPTAG_TLS_VERSION_REF
(
tls_version
),
TPTAG_TLS_VERIFY_PEER_REF
(
tls_verify
),
TPTAG_TLS_PASSPHRASE_REF
(
passphrase
),
TPTAG_TLS_VERIFY_POLICY_REF
(
tls_policy
),
TPTAG_TLS_VERIFY_DEPTH_REF
(
tls_depth
),
TPTAG_TLS_VERIFY_DATE_REF
(
tls_date
),
...
...
@@ -218,6 +220,7 @@ static int tport_tls_init_master(tport_primary_t *pri,
ti
.
configured
=
path
!=
tbf
;
ti
.
randFile
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"tls_seed.dat"
);
ti
.
key
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"agent.pem"
);
ti
.
passphrase
=
su_strdup
(
autohome
,
passphrase
);
ti
.
cert
=
ti
.
key
;
ti
.
CAfile
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"cafile.pem"
);
ti
.
version
=
tls_version
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论