Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
8cebec98
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,发现更多精彩内容 >>
提交
8cebec98
编写于
8月 01, 2006
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch to compact S-box when generating AES key schedule.
上级
0209d160
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
16 deletion
+45
-16
crypto/aes/aes_x86core.c
crypto/aes/aes_x86core.c
+45
-16
未找到文件。
crypto/aes/aes_x86core.c
浏览文件 @
8cebec98
...
...
@@ -496,10 +496,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
while
(
1
)
{
temp
=
rk
[
3
];
rk
[
4
]
=
rk
[
0
]
^
(
Te
2
[(
temp
>>
8
)
&
0xff
]
&
0x000000ffU
)
^
(
Te
3
[(
temp
>>
16
)
&
0xff
]
&
0x0000ff00U
)
^
(
Te
0
[(
temp
>>
24
)
]
&
0x00ff0000U
)
^
(
Te
1
[(
temp
)
&
0xff
]
&
0xff000000U
)
^
(
Te
4
[(
temp
>>
8
)
&
0xff
]
)
^
(
Te
4
[(
temp
>>
16
)
&
0xff
]
<<
8
)
^
(
Te
4
[(
temp
>>
24
)
]
<<
16
)
^
(
Te
4
[(
temp
)
&
0xff
]
<<
24
)
^
rcon
[
i
];
rk
[
5
]
=
rk
[
1
]
^
rk
[
4
];
rk
[
6
]
=
rk
[
2
]
^
rk
[
5
];
...
...
@@ -516,10 +516,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
while
(
1
)
{
temp
=
rk
[
5
];
rk
[
6
]
=
rk
[
0
]
^
(
Te
2
[(
temp
>>
8
)
&
0xff
]
&
0x000000ffU
)
^
(
Te
3
[(
temp
>>
16
)
&
0xff
]
&
0x0000ff00U
)
^
(
Te
0
[(
temp
>>
24
)
]
&
0x00ff0000U
)
^
(
Te
1
[(
temp
)
&
0xff
]
&
0xff000000U
)
^
(
Te
4
[(
temp
>>
8
)
&
0xff
]
)
^
(
Te
4
[(
temp
>>
16
)
&
0xff
]
<<
8
)
^
(
Te
4
[(
temp
>>
24
)
]
<<
16
)
^
(
Te
4
[(
temp
)
&
0xff
]
<<
24
)
^
rcon
[
i
];
rk
[
7
]
=
rk
[
1
]
^
rk
[
6
];
rk
[
8
]
=
rk
[
2
]
^
rk
[
7
];
...
...
@@ -538,10 +538,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
while
(
1
)
{
temp
=
rk
[
7
];
rk
[
8
]
=
rk
[
0
]
^
(
Te
2
[(
temp
>>
8
)
&
0xff
]
&
0x000000ffU
)
^
(
Te
3
[(
temp
>>
16
)
&
0xff
]
&
0x0000ff00U
)
^
(
Te
0
[(
temp
>>
24
)
]
&
0x00ff0000U
)
^
(
Te
1
[(
temp
)
&
0xff
]
&
0xff000000U
)
^
(
Te
4
[(
temp
>>
8
)
&
0xff
]
)
^
(
Te
4
[(
temp
>>
16
)
&
0xff
]
<<
8
)
^
(
Te
4
[(
temp
>>
24
)
]
<<
16
)
^
(
Te
4
[(
temp
)
&
0xff
]
<<
24
)
^
rcon
[
i
];
rk
[
9
]
=
rk
[
1
]
^
rk
[
8
];
rk
[
10
]
=
rk
[
2
]
^
rk
[
9
];
...
...
@@ -551,10 +551,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
}
temp
=
rk
[
11
];
rk
[
12
]
=
rk
[
4
]
^
(
Te
2
[(
temp
)
&
0xff
]
&
0x000000ffU
)
^
(
Te
3
[(
temp
>>
8
)
&
0xff
]
&
0x0000ff00U
)
^
(
Te
0
[(
temp
>>
16
)
&
0xff
]
&
0x00ff0000U
)
^
(
Te
1
[(
temp
>>
24
)
]
&
0xff000000U
);
(
Te
4
[(
temp
)
&
0xff
]
)
^
(
Te
4
[(
temp
>>
8
)
&
0xff
]
<<
8
)
^
(
Te
4
[(
temp
>>
16
)
&
0xff
]
<<
16
)
^
(
Te
4
[(
temp
>>
24
)
]
<<
24
);
rk
[
13
]
=
rk
[
5
]
^
rk
[
12
];
rk
[
14
]
=
rk
[
6
]
^
rk
[
13
];
rk
[
15
]
=
rk
[
7
]
^
rk
[
14
];
...
...
@@ -592,6 +592,34 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
/* apply the inverse MixColumn transform to all round keys but the first and the last: */
for
(
i
=
1
;
i
<
(
key
->
rounds
);
i
++
)
{
rk
+=
4
;
#if 1
for
(
j
=
0
;
j
<
4
;
j
++
)
{
u32
tp1
,
tp2
,
tp4
,
tp8
,
tp9
,
tpb
,
tpd
,
tpe
,
m
;
tp1
=
rk
[
j
];
m
=
tp1
&
0x80808080
;
tp2
=
((
tp1
&
0x7f7f7f7f
)
<<
1
)
^
((
m
-
(
m
>>
7
))
&
0x1b1b1b1b
);
m
=
tp2
&
0x80808080
;
tp4
=
((
tp2
&
0x7f7f7f7f
)
<<
1
)
^
((
m
-
(
m
>>
7
))
&
0x1b1b1b1b
);
m
=
tp4
&
0x80808080
;
tp8
=
((
tp4
&
0x7f7f7f7f
)
<<
1
)
^
((
m
-
(
m
>>
7
))
&
0x1b1b1b1b
);
tp9
=
tp8
^
tp1
;
tpb
=
tp9
^
tp2
;
tpd
=
tp9
^
tp4
;
tpe
=
tp8
^
tp4
^
tp2
;
#if defined(ROTATE)
rk
[
j
]
=
tpe
^
ROTATE
(
tpd
,
16
)
^
ROTATE
(
tp9
,
8
)
^
ROTATE
(
tpb
,
24
);
#else
rk
[
j
]
=
tpe
^
(
tpd
>>
16
)
^
(
tpd
<<
16
)
^
(
tp9
>>
24
)
^
(
tp9
<<
8
)
^
(
tpb
>>
8
)
^
(
tpb
<<
24
);
#endif
}
#else
rk
[
0
]
=
Td0
[
Te2
[(
rk
[
0
]
)
&
0xff
]
&
0xff
]
^
Td1
[
Te2
[(
rk
[
0
]
>>
8
)
&
0xff
]
&
0xff
]
^
...
...
@@ -612,6 +640,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
Td1
[
Te2
[(
rk
[
3
]
>>
8
)
&
0xff
]
&
0xff
]
^
Td2
[
Te2
[(
rk
[
3
]
>>
16
)
&
0xff
]
&
0xff
]
^
Td3
[
Te2
[(
rk
[
3
]
>>
24
)
]
&
0xff
];
#endif
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录