Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
f826bf77
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看板
提交
f826bf77
编写于
12月 16, 2008
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SEED to support OPENSSL_SMALL_FOOTPRINT: ~2x size decrease on x86.
上级
3ebbe885
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
41 addition
and
2 deletion
+41
-2
crypto/seed/seed.c
crypto/seed/seed.c
+41
-2
未找到文件。
crypto/seed/seed.c
浏览文件 @
f826bf77
...
...
@@ -187,6 +187,11 @@ static const seed_word SS[4][256] = { {
#define KC14 0xde6e678d
#define KC15 0xbcdccf1b
#if defined(OPENSSL_SMALL_FOOTPRINT)
static
const
seed_word
KC
[]
=
{
KC0
,
KC1
,
KC2
,
KC3
,
KC4
,
KC5
,
KC6
,
KC7
,
KC8
,
KC9
,
KC10
,
KC11
,
KC12
,
KC13
,
KC14
,
KC15
};
#endif
void
SEED_set_key
(
const
unsigned
char
rawkey
[
SEED_KEY_LENGTH
],
SEED_KEY_SCHEDULE
*
ks
)
{
...
...
@@ -201,6 +206,8 @@ void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE
t0
=
(
x1
+
x3
-
KC0
)
&
0xffffffff
;
t1
=
(
x2
-
x4
+
KC0
)
&
0xffffffff
;
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
0
]);
KEYSCHEDULE_UPDATE1
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC1
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
2
]);
#if !defined(OPENSSL_SMALL_FOOTPRINT)
KEYSCHEDULE_UPDATE0
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC2
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
4
]);
KEYSCHEDULE_UPDATE1
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC3
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
6
]);
KEYSCHEDULE_UPDATE0
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC4
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
8
]);
...
...
@@ -215,6 +222,17 @@ void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE
KEYSCHEDULE_UPDATE1
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC13
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
26
]);
KEYSCHEDULE_UPDATE0
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC14
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
28
]);
KEYSCHEDULE_UPDATE1
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC15
);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
30
]);
#else
{
int
i
;
for
(
i
=
2
;
i
<
16
;
i
+=
2
)
{
KEYSCHEDULE_UPDATE0
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC
[
i
]);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
i
*
2
]);
KEYSCHEDULE_UPDATE1
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
KC
[
i
+
1
]);
KEYUPDATE_TEMP
(
t0
,
t1
,
&
ks
->
data
[
i
*
2
+
2
]);
}
}
#endif
}
void
SEED_encrypt
(
const
unsigned
char
s
[
SEED_BLOCK_SIZE
],
unsigned
char
d
[
SEED_BLOCK_SIZE
],
const
SEED_KEY_SCHEDULE
*
ks
)
...
...
@@ -227,6 +245,7 @@ void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B
char2word
(
s
+
8
,
x3
);
char2word
(
s
+
12
,
x4
);
#if !defined(OPENSSL_SMALL_FOOTPRINT)
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
0
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
2
);
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
4
);
...
...
@@ -243,6 +262,15 @@ void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
26
);
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
28
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
30
);
#else
{
int
i
;
for
(
i
=
0
;
i
<
30
;
i
+=
4
)
{
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
i
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
i
+
2
);
}
}
#endif
word2char
(
x3
,
d
);
word2char
(
x4
,
d
+
4
);
...
...
@@ -260,6 +288,7 @@ void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B
char2word
(
s
+
8
,
x3
);
char2word
(
s
+
12
,
x4
);
#if !defined(OPENSSL_SMALL_FOOTPRINT)
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
30
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
28
);
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
26
);
...
...
@@ -276,6 +305,16 @@ void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
4
);
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
2
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
0
);
#else
{
int
i
;
for
(
i
=
30
;
i
>
0
;
i
-=
4
)
{
E_SEED
(
t0
,
t1
,
x1
,
x2
,
x3
,
x4
,
i
);
E_SEED
(
t0
,
t1
,
x3
,
x4
,
x1
,
x2
,
i
-
2
);
}
}
#endif
word2char
(
x3
,
d
);
word2char
(
x4
,
d
+
4
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录