Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
5fc77684
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
10 个月 前同步成功
通知
8
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5fc77684
编写于
6月 20, 2016
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
evp/evp_enc.c: refine partial buffer overlap detection.
Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
c3a73daf
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
9 deletion
+21
-9
crypto/evp/evp_enc.c
crypto/evp/evp_enc.c
+21
-9
未找到文件。
crypto/evp/evp_enc.c
浏览文件 @
5fc77684
...
...
@@ -265,7 +265,11 @@ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
#if defined(OPENSSL_SYS_VMS) && __INITIAL_POINTER_SIZE==64
/*
* Then we have VMS that distinguishes itself by adhering to
* sizeof(size_t)==4 even in 64-bit builds...
* sizeof(size_t)==4 even in 64-bit builds, which means that
* difference between two pointers might be truncated to 32 bits.
* In the context one can even wonder how comparison for
* equality is implemented. To be on the safe side we adhere to
* PTRDIFF_T even for comparison for equality.
*/
# define PTRDIFF_T uint64_t
#else
...
...
@@ -292,10 +296,10 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
{
int
i
,
j
,
bl
;
if
(
is_partially_overlapping
(
out
,
in
,
inl
))
return
0
;
if
(
ctx
->
cipher
->
flags
&
EVP_CIPH_FLAG_CUSTOM_CIPHER
)
{
if
(
is_partially_overlapping
(
out
,
in
,
inl
))
return
0
;
i
=
ctx
->
cipher
->
do_cipher
(
ctx
,
out
,
in
,
inl
);
if
(
i
<
0
)
return
0
;
...
...
@@ -308,6 +312,8 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
*
outl
=
0
;
return
inl
==
0
;
}
if
(
is_partially_overlapping
(
out
,
in
,
inl
))
return
0
;
if
(
ctx
->
buf_len
==
0
&&
(
inl
&
(
ctx
->
block_mask
))
==
0
)
{
if
(
ctx
->
cipher
->
do_cipher
(
ctx
,
out
,
in
,
inl
))
{
...
...
@@ -330,10 +336,12 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
}
else
{
j
=
bl
-
i
;
memcpy
(
&
(
ctx
->
buf
[
i
]),
in
,
j
);
if
(
!
ctx
->
cipher
->
do_cipher
(
ctx
,
out
,
ctx
->
buf
,
bl
))
return
0
;
inl
-=
j
;
in
+=
j
;
if
(
is_partially_overlapping
(
out
,
in
,
bl
))
return
0
;
if
(
!
ctx
->
cipher
->
do_cipher
(
ctx
,
out
,
ctx
->
buf
,
bl
))
return
0
;
out
+=
bl
;
*
outl
=
bl
;
}
...
...
@@ -408,10 +416,10 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
int
fix_len
;
unsigned
int
b
;
if
(
is_partially_overlapping
(
out
,
in
,
inl
))
return
0
;
if
(
ctx
->
cipher
->
flags
&
EVP_CIPH_FLAG_CUSTOM_CIPHER
)
{
if
(
is_partially_overlapping
(
out
,
in
,
inl
))
return
0
;
fix_len
=
ctx
->
cipher
->
do_cipher
(
ctx
,
out
,
in
,
inl
);
if
(
fix_len
<
0
)
{
*
outl
=
0
;
...
...
@@ -433,6 +441,10 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
OPENSSL_assert
(
b
<=
sizeof
ctx
->
final
);
if
(
ctx
->
final_used
)
{
/* see comment about PTRDIFF_T comparison above */
if
(((
PTRDIFF_T
)
out
==
(
PTRDIFF_T
)
in
)
||
is_partially_overlapping
(
out
,
in
,
b
))
return
0
;
memcpy
(
out
,
ctx
->
final
,
b
);
out
+=
b
;
fix_len
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录