Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
f768be81
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看板
提交
f768be81
编写于
10月 31, 2008
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
size_t-fy AES, Camellia and RC4.
上级
91173829
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
58 addition
and
58 deletion
+58
-58
crypto/aes/aes.h
crypto/aes/aes.h
+10
-8
crypto/aes/aes_cbc.c
crypto/aes/aes_cbc.c
+2
-3
crypto/aes/aes_cfb.c
crypto/aes/aes_cfb.c
+6
-6
crypto/aes/aes_ctr.c
crypto/aes/aes_ctr.c
+2
-3
crypto/aes/aes_ige.c
crypto/aes/aes_ige.c
+6
-6
crypto/aes/aes_ofb.c
crypto/aes/aes_ofb.c
+2
-2
crypto/camellia/camellia.h
crypto/camellia/camellia.h
+8
-6
crypto/camellia/cmll_cbc.c
crypto/camellia/cmll_cbc.c
+2
-3
crypto/camellia/cmll_cfb.c
crypto/camellia/cmll_cfb.c
+7
-8
crypto/camellia/cmll_ctr.c
crypto/camellia/cmll_ctr.c
+2
-3
crypto/camellia/cmll_ofb.c
crypto/camellia/cmll_ofb.c
+2
-3
crypto/rc4/rc4.h
crypto/rc4/rc4.h
+3
-1
crypto/rc4/rc4_enc.c
crypto/rc4/rc4_enc.c
+6
-6
未找到文件。
crypto/aes/aes.h
浏览文件 @
f768be81
...
...
@@ -58,6 +58,8 @@
#error AES is disabled.
#endif
#include <stddef.h>
#define AES_ENCRYPT 1
#define AES_DECRYPT 0
...
...
@@ -96,35 +98,35 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
void
AES_ecb_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
AES_KEY
*
key
,
const
int
enc
);
void
AES_cbc_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
);
void
AES_cfb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
AES_cfb1_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
AES_cfb8_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
AES_cfbr_encrypt_block
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
int
nbits
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
);
void
AES_ofb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
);
void
AES_ctr128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
ivec
[
AES_BLOCK_SIZE
],
unsigned
char
ecount_buf
[
AES_BLOCK_SIZE
],
unsigned
int
*
num
);
/* NB: the IV is _two_ blocks long */
void
AES_ige_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
);
/* NB: the IV is _four_ blocks long */
void
AES_bi_ige_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
const
AES_KEY
*
key2
,
const
unsigned
char
*
ivec
,
const
int
enc
);
...
...
crypto/aes/aes_cbc.c
浏览文件 @
f768be81
...
...
@@ -60,11 +60,10 @@
#include "aes_locl.h"
void
AES_cbc_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
len
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
)
{
unsigned
long
n
;
unsigned
long
len
=
length
;
size_t
n
;
unsigned
char
tmp
[
AES_BLOCK_SIZE
];
const
unsigned
char
*
iv
=
ivec
;
...
...
crypto/aes/aes_cfb.c
浏览文件 @
f768be81
...
...
@@ -73,11 +73,11 @@
*/
void
AES_cfb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
int
n
;
unsigned
long
l
=
0
;
size_t
l
=
0
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
...
...
@@ -219,10 +219,10 @@ void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
/* N.B. This expects the input to be packed, MS bit first */
void
AES_cfb1_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
in
t
n
;
size_
t
n
;
unsigned
char
c
[
1
],
d
[
1
];
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
...
...
@@ -238,10 +238,10 @@ void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
}
void
AES_cfb8_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
in
t
n
;
size_
t
n
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
assert
(
*
num
==
0
);
...
...
crypto/aes/aes_ctr.c
浏览文件 @
f768be81
...
...
@@ -113,20 +113,19 @@ static void AES_ctr128_inc(unsigned char *counter) {
* into the rest of the IV when incremented.
*/
void
AES_ctr128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
ivec
[
AES_BLOCK_SIZE
],
unsigned
char
ecount_buf
[
AES_BLOCK_SIZE
],
unsigned
int
*
num
)
{
unsigned
int
n
;
unsigned
long
l
=
length
;
assert
(
in
&&
out
&&
key
&&
counter
&&
num
);
assert
(
*
num
<
AES_BLOCK_SIZE
);
n
=
*
num
;
while
(
l
--
)
{
while
(
l
ength
--
)
{
if
(
n
==
0
)
{
AES_encrypt
(
ivec
,
ecount_buf
,
key
);
AES_ctr128_inc
(
ivec
);
...
...
crypto/aes/aes_ige.c
浏览文件 @
f768be81
...
...
@@ -77,11 +77,11 @@ typedef struct {
/* N.B. The IV for this mode is _twice_ the block size */
void
AES_ige_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
)
{
unsigned
long
n
;
unsigned
long
len
;
size_t
n
;
size_t
len
=
length
;
OPENSSL_assert
(
in
&&
out
&&
key
&&
ivec
);
OPENSSL_assert
((
AES_ENCRYPT
==
enc
)
||
(
AES_DECRYPT
==
enc
));
...
...
@@ -211,12 +211,12 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
/* N.B. The IV for this mode is _four times_ the block size */
void
AES_bi_ige_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
const
AES_KEY
*
key2
,
const
unsigned
char
*
ivec
,
const
int
enc
)
{
unsigned
long
n
;
unsigned
long
len
=
length
;
size_t
n
;
size_t
len
=
length
;
unsigned
char
tmp
[
AES_BLOCK_SIZE
];
unsigned
char
tmp2
[
AES_BLOCK_SIZE
];
unsigned
char
tmp3
[
AES_BLOCK_SIZE
];
...
...
crypto/aes/aes_ofb.c
浏览文件 @
f768be81
...
...
@@ -71,11 +71,11 @@
* 128bit block we have used is contained in *num;
*/
void
AES_ofb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
unsigned
long
length
,
const
AES_KEY
*
key
,
size_t
length
,
const
AES_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
)
{
unsigned
int
n
;
unsigned
long
l
=
0
;
size_t
l
=
0
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
...
...
crypto/camellia/camellia.h
浏览文件 @
f768be81
...
...
@@ -58,6 +58,8 @@
#error CAMELLIA is disabled.
#endif
#include <stddef.h>
#define CAMELLIA_ENCRYPT 1
#define CAMELLIA_DECRYPT 0
...
...
@@ -97,25 +99,25 @@ void Camellia_decrypt(const unsigned char *in, unsigned char *out,
void
Camellia_ecb_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
CAMELLIA_KEY
*
key
,
const
int
enc
);
void
Camellia_cbc_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
);
void
Camellia_cfb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
Camellia_cfb1_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
Camellia_cfb8_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
);
void
Camellia_cfbr_encrypt_block
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
int
nbits
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
);
void
Camellia_ofb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
);
void
Camellia_ctr128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
ivec
[
CAMELLIA_BLOCK_SIZE
],
unsigned
char
ecount_buf
[
CAMELLIA_BLOCK_SIZE
],
unsigned
int
*
num
);
...
...
crypto/camellia/cmll_cbc.c
浏览文件 @
f768be81
...
...
@@ -60,12 +60,11 @@
#include <openssl/camellia.h>
#include "cmll_locl.h"
void
Camellia_cbc_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
len
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
const
int
enc
)
{
unsigned
long
n
;
unsigned
long
len
=
length
;
size_t
n
;
unsigned
char
tmp
[
CAMELLIA_BLOCK_SIZE
];
const
unsigned
char
*
iv
=
ivec
;
...
...
crypto/camellia/cmll_cfb.c
浏览文件 @
f768be81
...
...
@@ -124,12 +124,11 @@
*/
void
Camellia_cfb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
int
n
;
unsigned
long
l
=
length
;
unsigned
char
c
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
...
...
@@ -138,7 +137,7 @@ void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
if
(
enc
)
{
while
(
l
--
)
while
(
l
ength
--
)
{
if
(
n
==
0
)
{
...
...
@@ -150,7 +149,7 @@ void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
}
else
{
while
(
l
--
)
while
(
l
ength
--
)
{
if
(
n
==
0
)
{
...
...
@@ -202,10 +201,10 @@ void Camellia_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
/* N.B. This expects the input to be packed, MS bit first */
void
Camellia_cfb1_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
in
t
n
;
size_
t
n
;
unsigned
char
c
[
1
],
d
[
1
];
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
...
...
@@ -221,10 +220,10 @@ void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
}
void
Camellia_cfb8_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
,
const
int
enc
)
{
unsigned
in
t
n
;
size_
t
n
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
assert
(
*
num
==
0
);
...
...
crypto/camellia/cmll_ctr.c
浏览文件 @
f768be81
...
...
@@ -113,21 +113,20 @@ static void Camellia_ctr128_inc(unsigned char *counter)
* into the rest of the IV when incremented.
*/
void
Camellia_ctr128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
ivec
[
CAMELLIA_BLOCK_SIZE
],
unsigned
char
ecount_buf
[
CAMELLIA_BLOCK_SIZE
],
unsigned
int
*
num
)
{
unsigned
int
n
;
unsigned
long
l
=
length
;
assert
(
in
&&
out
&&
key
&&
counter
&&
num
);
assert
(
*
num
<
CAMELLIA_BLOCK_SIZE
);
n
=
*
num
;
while
(
l
--
)
while
(
l
ength
--
)
{
if
(
n
==
0
)
{
...
...
crypto/camellia/cmll_ofb.c
浏览文件 @
f768be81
...
...
@@ -119,17 +119,16 @@
* 128bit block we have used is contained in *num;
*/
void
Camellia_ofb128_encrypt
(
const
unsigned
char
*
in
,
unsigned
char
*
out
,
const
unsigned
long
length
,
const
CAMELLIA_KEY
*
key
,
size_t
length
,
const
CAMELLIA_KEY
*
key
,
unsigned
char
*
ivec
,
int
*
num
)
{
unsigned
int
n
;
unsigned
long
l
=
length
;
assert
(
in
&&
out
&&
key
&&
ivec
&&
num
);
n
=
*
num
;
while
(
l
--
)
{
while
(
l
ength
--
)
{
if
(
n
==
0
)
{
Camellia_encrypt
(
ivec
,
ivec
,
key
);
}
...
...
crypto/rc4/rc4.h
浏览文件 @
f768be81
...
...
@@ -64,6 +64,8 @@
#error RC4 is disabled.
#endif
#include <stddef.h>
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -77,7 +79,7 @@ typedef struct rc4_key_st
const
char
*
RC4_options
(
void
);
void
RC4_set_key
(
RC4_KEY
*
key
,
int
len
,
const
unsigned
char
*
data
);
void
RC4
(
RC4_KEY
*
key
,
unsigned
long
len
,
const
unsigned
char
*
indata
,
void
RC4
(
RC4_KEY
*
key
,
size_t
len
,
const
unsigned
char
*
indata
,
unsigned
char
*
outdata
);
#ifdef __cplusplus
...
...
crypto/rc4/rc4_enc.c
浏览文件 @
f768be81
...
...
@@ -67,12 +67,12 @@
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
void
RC4
(
RC4_KEY
*
key
,
unsigned
long
len
,
const
unsigned
char
*
indata
,
void
RC4
(
RC4_KEY
*
key
,
size_t
len
,
const
unsigned
char
*
indata
,
unsigned
char
*
outdata
)
{
register
RC4_INT
*
d
;
register
RC4_INT
x
,
y
,
tx
,
ty
;
in
t
i
;
size_
t
i
;
x
=
key
->
x
;
y
=
key
->
y
;
...
...
@@ -120,8 +120,8 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
(RC4_CHUNK)d[(tx+ty)&0xff]\
)
if
(
(
((
unsigned
long
)
indata
&
(
sizeof
(
RC4_CHUNK
)
-
1
))
|
((
unsigned
long
)
outdata
&
(
sizeof
(
RC4_CHUNK
)
-
1
))
)
==
0
)
if
(
(
((
size_t
)
indata
&
(
sizeof
(
RC4_CHUNK
)
-
1
))
|
((
size_t
)
outdata
&
(
sizeof
(
RC4_CHUNK
)
-
1
))
)
==
0
)
{
RC4_CHUNK
ichunk
,
otp
;
const
union
{
long
one
;
char
little
;
}
is_endian
=
{
1
};
...
...
@@ -276,7 +276,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
#define RC4_LOOP(a,b,i) LOOP(a[i],b[i])
#endif
i
=
(
int
)(
len
>>
3L
)
;
i
=
len
>>
3
;
if
(
i
)
{
for
(;;)
...
...
@@ -296,7 +296,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
if
(
--
i
==
0
)
break
;
}
}
i
=
(
int
)
len
&
0x07
;
i
=
len
&
0x07
;
if
(
i
)
{
for
(;;)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录