Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
a42abde6
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
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看板
提交
a42abde6
编写于
4月 04, 2013
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
e_aes.c: reserve for future extensions.
上级
64f7e2c4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
84 addition
and
4 deletion
+84
-4
crypto/evp/e_aes.c
crypto/evp/e_aes.c
+84
-4
未找到文件。
crypto/evp/e_aes.c
浏览文件 @
a42abde6
...
...
@@ -245,6 +245,9 @@ size_t aesni_gcm_decrypt(const unsigned char *in,
void
gcm_ghash_avx
(
u64
Xi
[
2
],
const
u128
Htable
[
16
],
const
u8
*
in
,
size_t
len
);
#define AES_GCM_ASM(gctx) (gctx->ctr==aesni_ctr32_encrypt_blocks && \
gctx->gcm.ghash==gcm_ghash_avx)
#define AES_GCM_ASM2(gctx) (gctx->gcm.block==(block128_f)aesni_encrypt && \
gctx->gcm.ghash==gcm_ghash_avx)
#undef AES_GCM_ASM2
/* minor size optimization */
#endif
static
int
aesni_init_key
(
EVP_CIPHER_CTX
*
ctx
,
const
unsigned
char
*
key
,
...
...
@@ -1339,7 +1342,24 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
goto
err
;
}
else
{
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
in
,
out
,
len
))
size_t
bulk
=
0
;
#if defined(AES_GCM_ASM2)
if
(
len
>=
32
&&
AES_GCM_ASM2
(
gctx
))
{
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
NULL
,
NULL
,
0
))
return
-
1
;
bulk
=
AES_gcm_encrypt
(
in
,
out
,
len
,
gctx
->
gcm
.
key
,
gctx
->
gcm
.
Yi
.
c
,
gctx
->
gcm
.
Xi
.
u
);
gctx
->
gcm
.
len
.
u
[
1
]
+=
bulk
;
}
#endif
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
in
+
bulk
,
out
+
bulk
,
len
-
bulk
))
goto
err
;
}
out
+=
len
;
...
...
@@ -1374,7 +1394,24 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
goto
err
;
}
else
{
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
in
,
out
,
len
))
size_t
bulk
=
0
;
#if defined(AES_GCM_ASM2)
if
(
len
>=
16
&&
AES_GCM_ASM2
(
gctx
))
{
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
NULL
,
NULL
,
0
))
return
-
1
;
bulk
=
AES_gcm_decrypt
(
in
,
out
,
len
,
gctx
->
gcm
.
key
,
gctx
->
gcm
.
Yi
.
c
,
gctx
->
gcm
.
Xi
.
u
);
gctx
->
gcm
.
len
.
u
[
1
]
+=
bulk
;
}
#endif
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
in
+
bulk
,
out
+
bulk
,
len
-
bulk
))
goto
err
;
}
/* Retrieve tag */
...
...
@@ -1445,7 +1482,28 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
return
-
1
;
}
else
{
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
in
,
out
,
len
))
size_t
bulk
=
0
;
#if defined(AES_GCM_ASM2)
if
(
len
>=
32
&&
AES_GCM_ASM2
(
gctx
))
{
size_t
res
=
(
16
-
gctx
->
gcm
.
mres
)
%
16
;
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
in
,
out
,
res
))
return
-
1
;
bulk
=
AES_gcm_encrypt
(
in
+
res
,
out
+
res
,
len
-
res
,
gctx
->
gcm
.
key
,
gctx
->
gcm
.
Yi
.
c
,
gctx
->
gcm
.
Xi
.
u
);
gctx
->
gcm
.
len
.
u
[
1
]
+=
bulk
;
bulk
+=
res
;
}
#endif
if
(
CRYPTO_gcm128_encrypt
(
&
gctx
->
gcm
,
in
+
bulk
,
out
+
bulk
,
len
-
bulk
))
return
-
1
;
}
}
...
...
@@ -1480,7 +1538,29 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
return
-
1
;
}
else
{
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
in
,
out
,
len
))
size_t
bulk
=
0
;
#if defined(AES_GCM_ASM2)
if
(
len
>=
16
&&
AES_GCM_ASM2
(
gctx
))
{
size_t
res
=
(
16
-
gctx
->
gcm
.
mres
)
%
16
;
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
in
,
out
,
res
))
return
-
1
;
bulk
=
AES_gcm_decrypt
(
in
+
res
,
out
+
res
,
len
-
res
,
gctx
->
gcm
.
key
,
gctx
->
gcm
.
Yi
.
c
,
gctx
->
gcm
.
Xi
.
u
);
gctx
->
gcm
.
len
.
u
[
1
]
+=
bulk
;
bulk
+=
res
;
}
#endif
if
(
CRYPTO_gcm128_decrypt
(
&
gctx
->
gcm
,
in
+
bulk
,
out
+
bulk
,
len
-
bulk
))
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录