Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
cbd48ba6
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看板
提交
cbd48ba6
编写于
11月 16, 2000
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More constification of the BN library.
上级
67d93e6f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
33 addition
and
29 deletion
+33
-29
crypto/bn/bn.h
crypto/bn/bn.h
+12
-9
crypto/bn/bn_asm.c
crypto/bn/bn_asm.c
+10
-10
crypto/bn/bn_gcd.c
crypto/bn/bn_gcd.c
+1
-1
crypto/bn/bn_lcl.h
crypto/bn/bn_lcl.h
+6
-5
crypto/bn/bn_lib.c
crypto/bn/bn_lib.c
+1
-1
crypto/bn/bn_mont.c
crypto/bn/bn_mont.c
+2
-2
crypto/bn/bn_mpi.c
crypto/bn/bn_mpi.c
+1
-1
未找到文件。
crypto/bn/bn.h
浏览文件 @
cbd48ba6
...
...
@@ -336,7 +336,7 @@ void BN_clear_free(BIGNUM *a);
BIGNUM
*
BN_copy
(
BIGNUM
*
a
,
const
BIGNUM
*
b
);
BIGNUM
*
BN_bin2bn
(
const
unsigned
char
*
s
,
int
len
,
BIGNUM
*
ret
);
int
BN_bn2bin
(
const
BIGNUM
*
a
,
unsigned
char
*
to
);
BIGNUM
*
BN_mpi2bn
(
unsigned
char
*
s
,
int
len
,
BIGNUM
*
ret
);
BIGNUM
*
BN_mpi2bn
(
const
unsigned
char
*
s
,
int
len
,
BIGNUM
*
ret
);
int
BN_bn2mpi
(
const
BIGNUM
*
a
,
unsigned
char
*
to
);
int
BN_sub
(
BIGNUM
*
r
,
const
BIGNUM
*
a
,
const
BIGNUM
*
b
);
int
BN_usub
(
BIGNUM
*
r
,
const
BIGNUM
*
a
,
const
BIGNUM
*
b
);
...
...
@@ -394,7 +394,7 @@ char * BN_bn2hex(const BIGNUM *a);
char
*
BN_bn2dec
(
const
BIGNUM
*
a
);
int
BN_hex2bn
(
BIGNUM
**
a
,
const
char
*
str
);
int
BN_dec2bn
(
BIGNUM
**
a
,
const
char
*
str
);
int
BN_gcd
(
BIGNUM
*
r
,
BIGNUM
*
in_a
,
BIGNUM
*
in_b
,
BN_CTX
*
ctx
);
int
BN_gcd
(
BIGNUM
*
r
,
const
BIGNUM
*
in_a
,
const
BIGNUM
*
in_b
,
BN_CTX
*
ctx
);
BIGNUM
*
BN_mod_inverse
(
BIGNUM
*
ret
,
const
BIGNUM
*
a
,
const
BIGNUM
*
n
,
BN_CTX
*
ctx
);
BIGNUM
*
BN_generate_prime
(
BIGNUM
*
ret
,
int
bits
,
int
safe
,
...
...
@@ -412,7 +412,8 @@ BN_MONT_CTX *BN_MONT_CTX_new(void );
void
BN_MONT_CTX_init
(
BN_MONT_CTX
*
ctx
);
int
BN_mod_mul_montgomery
(
BIGNUM
*
r
,
const
BIGNUM
*
a
,
const
BIGNUM
*
b
,
BN_MONT_CTX
*
mont
,
BN_CTX
*
ctx
);
int
BN_from_montgomery
(
BIGNUM
*
r
,
BIGNUM
*
a
,
BN_MONT_CTX
*
mont
,
BN_CTX
*
ctx
);
int
BN_from_montgomery
(
BIGNUM
*
r
,
const
BIGNUM
*
a
,
BN_MONT_CTX
*
mont
,
BN_CTX
*
ctx
);
void
BN_MONT_CTX_free
(
BN_MONT_CTX
*
mont
);
int
BN_MONT_CTX_set
(
BN_MONT_CTX
*
mont
,
const
BIGNUM
*
modulus
,
BN_CTX
*
ctx
);
BN_MONT_CTX
*
BN_MONT_CTX_copy
(
BN_MONT_CTX
*
to
,
BN_MONT_CTX
*
from
);
...
...
@@ -455,15 +456,17 @@ BIGNUM *bn_dup_expand(const BIGNUM *a, int words);
} \
}
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
);
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
);
void
bn_sqr_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
);
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
);
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
);
void
bn_sqr_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
);
BN_ULONG
bn_div_words
(
BN_ULONG
h
,
BN_ULONG
l
,
BN_ULONG
d
);
BN_ULONG
bn_add_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
BN_ULONG
*
bp
,
int
num
);
BN_ULONG
bn_sub_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
BN_ULONG
*
bp
,
int
num
);
BN_ULONG
bn_add_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
const
BN_ULONG
*
bp
,
int
num
);
BN_ULONG
bn_sub_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
const
BN_ULONG
*
bp
,
int
num
);
BN_ULONG
bn_add_part_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
const
BN_ULONG
*
bp
,
int
num
,
int
delta
);
BN_ULONG
bn_sub_part_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
const
BN_ULONG
*
bp
,
int
num
,
int
delta
);
#ifdef BN_DEBUG
void
bn_dump1
(
FILE
*
o
,
const
char
*
a
,
BN_ULONG
*
b
,
int
n
);
void
bn_dump1
(
FILE
*
o
,
const
char
*
a
,
const
BN_ULONG
*
b
,
int
n
);
# define bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \
fprintf(stderr,"\n");}
# define bn_dump(a,n) bn_dump1(stderr,#a,a,n);
...
...
crypto/bn/bn_asm.c
浏览文件 @
cbd48ba6
...
...
@@ -68,7 +68,7 @@
#if defined(BN_LLONG) || defined(BN_UMULT_HIGH)
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
{
BN_ULONG
c1
=
0
;
...
...
@@ -93,7 +93,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
return
(
c1
);
}
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
{
BN_ULONG
c1
=
0
;
...
...
@@ -117,7 +117,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
return
(
c1
);
}
void
bn_sqr_words
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
int
n
)
void
bn_sqr_words
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
int
n
)
{
assert
(
n
>=
0
);
if
(
n
<=
0
)
return
;
...
...
@@ -139,7 +139,7 @@ void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
#else
/* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
BN_ULONG
bn_mul_add_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
{
BN_ULONG
c
=
0
;
BN_ULONG
bl
,
bh
;
...
...
@@ -166,7 +166,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
return
(
c
);
}
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
BN_ULONG
bn_mul_words
(
BN_ULONG
*
rp
,
const
BN_ULONG
*
ap
,
int
num
,
BN_ULONG
w
)
{
BN_ULONG
carry
=
0
;
BN_ULONG
bl
,
bh
;
...
...
@@ -193,7 +193,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
return
(
carry
);
}
void
bn_sqr_words
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
int
n
)
void
bn_sqr_words
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
int
n
)
{
assert
(
n
>=
0
);
if
(
n
<=
0
)
return
;
...
...
@@ -332,7 +332,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
return
((
BN_ULONG
)
ll
);
}
#else
/* !BN_LLONG */
BN_ULONG
bn_add_words
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n
)
BN_ULONG
bn_add_words
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
int
n
)
{
BN_ULONG
c
,
l
,
t
;
...
...
@@ -382,7 +382,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
}
#endif
/* !BN_LLONG */
BN_ULONG
bn_sub_words
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n
)
BN_ULONG
bn_sub_words
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
int
n
)
{
BN_ULONG
t1
,
t2
;
int
c
=
0
;
...
...
@@ -673,7 +673,7 @@ void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
r
[
7
]
=
c2
;
}
void
bn_sqr_comba8
(
BN_ULONG
*
r
,
BN_ULONG
*
a
)
void
bn_sqr_comba8
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
)
{
#ifdef BN_LLONG
BN_ULLONG
t
,
tt
;
...
...
@@ -754,7 +754,7 @@ void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
r
[
15
]
=
c1
;
}
void
bn_sqr_comba4
(
BN_ULONG
*
r
,
BN_ULONG
*
a
)
void
bn_sqr_comba4
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
)
{
#ifdef BN_LLONG
BN_ULLONG
t
,
tt
;
...
...
crypto/bn/bn_gcd.c
浏览文件 @
cbd48ba6
...
...
@@ -62,7 +62,7 @@
static
BIGNUM
*
euclid
(
BIGNUM
*
a
,
BIGNUM
*
b
);
int
BN_gcd
(
BIGNUM
*
r
,
BIGNUM
*
in_a
,
BIGNUM
*
in_b
,
BN_CTX
*
ctx
)
int
BN_gcd
(
BIGNUM
*
r
,
const
BIGNUM
*
in_a
,
const
BIGNUM
*
in_b
,
BN_CTX
*
ctx
)
{
BIGNUM
*
a
,
*
b
,
*
t
;
int
ret
=
0
;
...
...
crypto/bn/bn_lcl.h
浏览文件 @
cbd48ba6
...
...
@@ -398,14 +398,15 @@ extern "C" {
void
bn_mul_normal
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
int
na
,
BN_ULONG
*
b
,
int
nb
);
void
bn_mul_comba8
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
);
void
bn_mul_comba4
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
);
void
bn_sqr_normal
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
int
n
,
BN_ULONG
*
tmp
);
void
bn_sqr_comba8
(
BN_ULONG
*
r
,
BN_ULONG
*
a
);
void
bn_sqr_comba4
(
BN_ULONG
*
r
,
BN_ULONG
*
a
);
int
bn_cmp_words
(
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n
);
void
bn_sqr_normal
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
int
n
,
BN_ULONG
*
tmp
);
void
bn_sqr_comba8
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
);
void
bn_sqr_comba4
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
);
int
bn_cmp_words
(
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
int
n
);
int
bn_cmp_part_words
(
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
int
cl
,
int
dl
);
void
bn_mul_recursive
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n2
,
BN_ULONG
*
t
);
void
bn_mul_part_recursive
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
tn
,
int
n
,
BN_ULONG
*
t
);
void
bn_sqr_recursive
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
int
n2
,
BN_ULONG
*
t
);
void
bn_sqr_recursive
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
int
n2
,
BN_ULONG
*
t
);
void
bn_mul_low_normal
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n
);
void
bn_mul_low_recursive
(
BN_ULONG
*
r
,
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n2
,
BN_ULONG
*
t
);
...
...
crypto/bn/bn_lib.c
浏览文件 @
cbd48ba6
...
...
@@ -792,7 +792,7 @@ int BN_mask_bits(BIGNUM *a, int n)
return
(
1
);
}
int
bn_cmp_words
(
BN_ULONG
*
a
,
BN_ULONG
*
b
,
int
n
)
int
bn_cmp_words
(
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
int
n
)
{
int
i
;
BN_ULONG
aa
,
bb
;
...
...
crypto/bn/bn_mont.c
浏览文件 @
cbd48ba6
...
...
@@ -96,7 +96,7 @@ err:
return
(
ret
);
}
int
BN_from_montgomery
(
BIGNUM
*
ret
,
BIGNUM
*
a
,
BN_MONT_CTX
*
mont
,
int
BN_from_montgomery
(
BIGNUM
*
ret
,
const
BIGNUM
*
a
,
BN_MONT_CTX
*
mont
,
BN_CTX
*
ctx
)
{
int
retn
=
0
;
...
...
@@ -141,7 +141,7 @@ int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,
n0
=
mont
->
n0
;
#ifdef BN_COUNT
printf
(
"word BN_from_montgomery %d * %d
\n
"
,
nl
,
nl
);
fprintf
(
stderr
,
"word BN_from_montgomery %d * %d
\n
"
,
nl
,
nl
);
#endif
for
(
i
=
0
;
i
<
nl
;
i
++
)
{
...
...
crypto/bn/bn_mpi.c
浏览文件 @
cbd48ba6
...
...
@@ -88,7 +88,7 @@ int BN_bn2mpi(const BIGNUM *a, unsigned char *d)
return
(
num
+
4
+
ext
);
}
BIGNUM
*
BN_mpi2bn
(
unsigned
char
*
d
,
int
n
,
BIGNUM
*
a
)
BIGNUM
*
BN_mpi2bn
(
const
unsigned
char
*
d
,
int
n
,
BIGNUM
*
a
)
{
long
len
;
int
neg
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录