Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
e77ec2ba
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e77ec2ba
编写于
6月 11, 2012
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bss_dgram.c: make getsockopt work in cases when optlen is 64-bit value.
上级
195b9eee
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
23 deletion
+47
-23
crypto/bio/bss_dgram.c
crypto/bio/bss_dgram.c
+47
-23
未找到文件。
crypto/bio/bss_dgram.c
浏览文件 @
e77ec2ba
...
...
@@ -77,11 +77,11 @@
#define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0
#endif
#if
def OPENSSL_SYS_LINUX
#if
defined(OPENSSL_SYS_LINUX) && !defined(IP_MTU)
#define IP_MTU 14
/* linux is lame */
#endif
#if
def __FreeBSD__
#if
defined(__FreeBSD__) && defined(IN6_IS_ADDR_V4MAPPED)
/* Standard definition causes type-punning problems. */
#undef IN6_IS_ADDR_V4MAPPED
#define s6_addr32 __u6_addr.__u6_addr32
...
...
@@ -265,7 +265,7 @@ static void dgram_adjust_rcv_timeout(BIO *b)
{
#if defined(SO_RCVTIMEO)
bio_dgram_data
*
data
=
(
bio_dgram_data
*
)
b
->
ptr
;
int
sz
=
sizeof
(
int
)
;
union
{
size_t
s
;
int
i
;
}
sz
=
{
0
}
;
/* Is a timer active? */
if
(
data
->
next_timeout
.
tv_sec
>
0
||
data
->
next_timeout
.
tv_usec
>
0
)
...
...
@@ -275,6 +275,8 @@ static void dgram_adjust_rcv_timeout(BIO *b)
/* Read current socket timeout */
#ifdef OPENSSL_SYS_WINDOWS
int
timeout
;
sz
.
i
=
sizeof
(
timeout
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
void
*
)
&
timeout
,
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
}
...
...
@@ -284,9 +286,12 @@ static void dgram_adjust_rcv_timeout(BIO *b)
data
->
socket_timeout
.
tv_usec
=
(
timeout
%
1000
)
*
1000
;
}
#else
sz
.
i
=
sizeof
(
data
->
socket_timeout
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
(
data
->
socket_timeout
),
(
void
*
)
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
}
else
if
(
sizeof
(
sz
.
s
)
!=
sizeof
(
sz
.
i
)
&&
sz
.
i
==
0
)
OPENSSL_assert
(
sz
.
s
<=
sizeof
(
data
->
socket_timeout
));
#endif
/* Get current time */
...
...
@@ -455,11 +460,10 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
int
*
ip
;
struct
sockaddr
*
to
=
NULL
;
bio_dgram_data
*
data
=
NULL
;
#if defined(IP_MTU_DISCOVER) || defined(IP_MTU)
long
sockopt_val
=
0
;
unsigned
int
sockopt_len
=
0
;
#endif
#ifdef OPENSSL_SYS_LINUX
#if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) || defined(IP_MTU))
int
sockopt_val
=
0
;
socklen_t
sockopt_len
;
/* assume that system supporting IP_MTU is
* modern enough to define socklen_t */
socklen_t
addr_len
;
union
{
struct
sockaddr
sa
;
...
...
@@ -541,7 +545,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
break
;
/* (Linux)kernel sets DF bit on outgoing IP packets */
case
BIO_CTRL_DGRAM_MTU_DISCOVER
:
#if
def OPENSSL_SYS_LINUX
#if
defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
addr_len
=
(
socklen_t
)
sizeof
(
addr
);
memset
((
void
*
)
&
addr
,
0
,
sizeof
(
addr
));
if
(
getsockname
(
b
->
num
,
&
addr
.
sa
,
&
addr_len
)
<
0
)
...
...
@@ -549,7 +553,6 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
ret
=
0
;
break
;
}
sockopt_len
=
sizeof
(
sockopt_val
);
switch
(
addr
.
sa
.
sa_family
)
{
case
AF_INET
:
...
...
@@ -558,7 +561,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
&
sockopt_val
,
sizeof
(
sockopt_val
)))
<
0
)
perror
(
"setsockopt"
);
break
;
#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER)
#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER)
&& defined(IPV6_PMTUDISC_DO)
case
AF_INET6
:
sockopt_val
=
IPV6_PMTUDISC_DO
;
if
((
ret
=
setsockopt
(
b
->
num
,
IPPROTO_IPV6
,
IPV6_MTU_DISCOVER
,
...
...
@@ -575,7 +578,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
break
;
#endif
case
BIO_CTRL_DGRAM_QUERY_MTU
:
#if
def OPENSSL_SYS_LINUX
#if
defined(OPENSSL_SYS_LINUX) && defined(IP_MTU)
addr_len
=
(
socklen_t
)
sizeof
(
addr
);
memset
((
void
*
)
&
addr
,
0
,
sizeof
(
addr
));
if
(
getsockname
(
b
->
num
,
&
addr
.
sa
,
&
addr_len
)
<
0
)
...
...
@@ -737,10 +740,13 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
#endif
break
;
case
BIO_CTRL_DGRAM_GET_RECV_TIMEOUT
:
#ifdef OPENSSL_SYS_WINDOWS
{
int
timeout
,
sz
=
sizeof
(
timeout
);
union
{
size_t
s
;
int
i
;
}
sz
=
{
0
};
#ifdef OPENSSL_SYS_WINDOWS
int
timeout
;
struct
timeval
*
tv
=
(
struct
timeval
*
)
ptr
;
sz
.
i
=
sizeof
(
timeout
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
void
*
)
&
timeout
,
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
ret
=
-
1
;
}
...
...
@@ -750,12 +756,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
tv
->
tv_usec
=
(
timeout
%
1000
)
*
1000
;
ret
=
sizeof
(
*
tv
);
}
}
#else
sz
.
i
=
sizeof
(
struct
timeval
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_RCVTIMEO
,
ptr
,
(
void
*
)
&
ret
)
<
0
)
ptr
,
(
void
*
)
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
ret
=
-
1
;
}
else
if
(
sizeof
(
sz
.
s
)
!=
sizeof
(
sz
.
i
)
&&
sz
.
i
==
0
)
{
OPENSSL_assert
(
sz
.
s
<=
sizeof
(
struct
timeval
));
ret
=
(
int
)
sz
.
s
;
}
else
ret
=
sz
.
i
;
#endif
}
break
;
#endif
#if defined(SO_SNDTIMEO)
...
...
@@ -775,10 +789,13 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
#endif
break
;
case
BIO_CTRL_DGRAM_GET_SEND_TIMEOUT
:
#ifdef OPENSSL_SYS_WINDOWS
{
int
timeout
,
sz
=
sizeof
(
timeout
);
union
{
size_t
s
;
int
i
;
}
sz
=
{
0
};
#ifdef OPENSSL_SYS_WINDOWS
int
timeout
;
struct
timeval
*
tv
=
(
struct
timeval
*
)
ptr
;
sz
.
i
=
sizeof
(
timeout
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_SNDTIMEO
,
(
void
*
)
&
timeout
,
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
ret
=
-
1
;
}
...
...
@@ -790,10 +807,19 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
}
}
#else
sz
.
i
=
sizeof
(
struct
timeval
);
if
(
getsockopt
(
b
->
num
,
SOL_SOCKET
,
SO_SNDTIMEO
,
ptr
,
(
void
*
)
&
ret
)
<
0
)
ptr
,
(
void
*
)
&
sz
)
<
0
)
{
perror
(
"getsockopt"
);
ret
=
-
1
;
}
else
if
(
sizeof
(
sz
.
s
)
!=
sizeof
(
sz
.
i
)
&&
sz
.
i
==
0
)
{
OPENSSL_assert
(
sz
.
s
<=
sizeof
(
struct
timeval
));
ret
=
(
int
)
sz
.
s
;
}
else
ret
=
sz
.
i
;
#endif
}
break
;
#endif
case
BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP
:
...
...
@@ -965,7 +991,6 @@ static int dgram_sctp_free(BIO *a)
#ifdef SCTP_AUTHENTICATION_EVENT
void
dgram_sctp_handle_auth_free_key_event
(
BIO
*
b
,
union
sctp_notification
*
snp
)
{
unsigned
int
sockopt_len
=
0
;
int
ret
;
struct
sctp_authkey_event
*
authkeyevent
=
&
snp
->
sn_auth_event
;
...
...
@@ -975,9 +1000,8 @@ void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp)
/* delete key */
authkeyid
.
scact_keynumber
=
authkeyevent
->
auth_keynumber
;
sockopt_len
=
sizeof
(
struct
sctp_authkeyid
);
ret
=
setsockopt
(
b
->
num
,
IPPROTO_SCTP
,
SCTP_AUTH_DELETE_KEY
,
&
authkeyid
,
s
ockopt_len
);
&
authkeyid
,
s
izeof
(
struct
sctp_authkeyid
)
);
}
}
#endif
...
...
@@ -1308,7 +1332,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
{
long
ret
=
1
;
bio_dgram_sctp_data
*
data
=
NULL
;
unsigned
in
t
sockopt_len
=
0
;
socklen_
t
sockopt_len
=
0
;
struct
sctp_authkeyid
authkeyid
;
struct
sctp_authkey
*
authkey
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录