Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
997d1aac
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
997d1aac
编写于
4月 06, 2014
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
crypto/modes/gcm128.c: more strict aliasing fixes.
上级
6eebcf34
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
88 addition
and
0 deletion
+88
-0
crypto/modes/gcm128.c
crypto/modes/gcm128.c
+88
-0
未找到文件。
crypto/modes/gcm128.c
浏览文件 @
997d1aac
...
...
@@ -847,7 +847,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)
GCM_MUL
(
ctx
,
Yi
);
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctr
=
BSWAP4
(
ctx
->
Yi
.
d
[
3
]);
#else
ctr
=
GETU32
(
ctx
->
Yi
.
c
+
12
);
#endif
else
ctr
=
ctx
->
Yi
.
d
[
3
];
}
...
...
@@ -855,7 +859,11 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)
(
*
ctx
->
block
)(
ctx
->
Yi
.
c
,
ctx
->
EK0
.
c
,
ctx
->
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
}
...
...
@@ -950,7 +958,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
}
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctr
=
BSWAP4
(
ctx
->
Yi
.
d
[
3
]);
#else
ctr
=
GETU32
(
ctx
->
Yi
.
c
+
12
);
#endif
else
ctr
=
ctx
->
Yi
.
d
[
3
];
...
...
@@ -984,7 +996,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
...
...
@@ -1006,7 +1022,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
...
...
@@ -1025,7 +1045,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
...
...
@@ -1041,7 +1065,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
while
(
len
--
)
{
...
...
@@ -1059,7 +1087,11 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
}
...
...
@@ -1103,7 +1135,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
}
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctr
=
BSWAP4
(
ctx
->
Yi
.
d
[
3
]);
#else
ctr
=
GETU32
(
ctx
->
Yi
.
c
+
12
);
#endif
else
ctr
=
ctx
->
Yi
.
d
[
3
];
...
...
@@ -1140,7 +1176,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
...
...
@@ -1160,7 +1200,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
...
...
@@ -1178,7 +1222,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
for
(
i
=
0
;
i
<
16
/
sizeof
(
size_t
);
++
i
)
{
...
...
@@ -1196,7 +1244,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
while
(
len
--
)
{
...
...
@@ -1217,7 +1269,11 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
(
*
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
}
...
...
@@ -1262,7 +1318,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
}
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctr
=
BSWAP4
(
ctx
->
Yi
.
d
[
3
]);
#else
ctr
=
GETU32
(
ctx
->
Yi
.
c
+
12
);
#endif
else
ctr
=
ctx
->
Yi
.
d
[
3
];
...
...
@@ -1284,7 +1344,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
stream
)(
in
,
out
,
GHASH_CHUNK
/
16
,
key
,
ctx
->
Yi
.
c
);
ctr
+=
GHASH_CHUNK
/
16
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
GHASH
(
ctx
,
out
,
GHASH_CHUNK
);
...
...
@@ -1299,7 +1363,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
stream
)(
in
,
out
,
j
,
key
,
ctx
->
Yi
.
c
);
ctr
+=
(
unsigned
int
)
j
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
in
+=
i
;
...
...
@@ -1319,7 +1387,11 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
ctx
->
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
while
(
len
--
)
{
...
...
@@ -1361,7 +1433,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
}
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctr
=
BSWAP4
(
ctx
->
Yi
.
d
[
3
]);
#else
ctr
=
GETU32
(
ctx
->
Yi
.
c
+
12
);
#endif
else
ctr
=
ctx
->
Yi
.
d
[
3
];
...
...
@@ -1386,7 +1462,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
stream
)(
in
,
out
,
GHASH_CHUNK
/
16
,
key
,
ctx
->
Yi
.
c
);
ctr
+=
GHASH_CHUNK
/
16
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
out
+=
GHASH_CHUNK
;
...
...
@@ -1412,7 +1492,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
stream
)(
in
,
out
,
j
,
key
,
ctx
->
Yi
.
c
);
ctr
+=
(
unsigned
int
)
j
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
out
+=
i
;
...
...
@@ -1423,7 +1507,11 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
(
*
ctx
->
block
)(
ctx
->
Yi
.
c
,
ctx
->
EKi
.
c
,
key
);
++
ctr
;
if
(
is_endian
.
little
)
#ifdef BSWAP4
ctx
->
Yi
.
d
[
3
]
=
BSWAP4
(
ctr
);
#else
PUTU32
(
ctx
->
Yi
.
c
+
12
,
ctr
);
#endif
else
ctx
->
Yi
.
d
[
3
]
=
ctr
;
while
(
len
--
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录