Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
c09ec5d2
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,发现更多精彩内容 >>
提交
c09ec5d2
编写于
5月 27, 2014
作者:
F
Felix Laurie von Massenbach
提交者:
Ben Laurie
6月 01, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Generate safe primes not divisible by 3, 5 or 7.
~2% speed improvement on trial division.
上级
b0513819
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
21 addition
and
11 deletion
+21
-11
apps/speed.c
apps/speed.c
+4
-4
crypto/bn/bn_lcl.h
crypto/bn/bn_lcl.h
+1
-1
crypto/bn/bn_prime.c
crypto/bn/bn_prime.c
+16
-6
未找到文件。
apps/speed.c
浏览文件 @
c09ec5d2
...
...
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
* Copyright 2002
-2014
Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
* Portions of the attached software ("Contribution") are developed by
* SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
...
...
@@ -2054,7 +2054,7 @@ int MAIN(int argc, char **argv)
Time_F
(
START
);
for
(
count
=
0
,
run
=
1
;
COND
(
prime_c
[
D_PRIME_COPRIME
]);
count
++
)
bn_probable_prime_dh_coprime
(
rnd
,
1024
,
add
,
NULL
,
ctx
);
bn_probable_prime_dh_coprime
_safe
(
rnd
,
1024
,
add
,
NULL
,
ctx
);
d
=
Time_F
(
STOP
);
prime_print_result
(
D_PRIME_COPRIME
,
count
,
d
);
...
...
@@ -2700,9 +2700,9 @@ static void print_result(int alg,int run_no,int count,double time_used)
static
void
prime_print_result
(
int
alg
,
int
count
,
double
time_used
)
{
BIO_printf
(
bio_err
,
mr
?
"+R:%d:%s:%f:%f
\n
"
:
"%d %s's in %.2fs (%.2f
ms/
run)
\n
"
,
mr
?
"+R:%d:%s:%f:%f
\n
"
:
"%d %s's in %.2fs (%.2f
microseconds /
run)
\n
"
,
count
,
prime_names
[
alg
],
time_used
,
time_used
/
((
double
)
count
)
*
1000
);
time_used
/
((
double
)
count
)
*
1000
000
);
}
#ifndef NO_FORK
...
...
crypto/bn/bn_lcl.h
浏览文件 @
c09ec5d2
...
...
@@ -536,7 +536,7 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in,
int
bn_probable_prime_dh
(
BIGNUM
*
rnd
,
int
bits
,
const
BIGNUM
*
add
,
const
BIGNUM
*
rem
,
BN_CTX
*
ctx
);
int
bn_probable_prime_dh_coprime
(
BIGNUM
*
rnd
,
int
bits
,
int
bn_probable_prime_dh_coprime
_safe
(
BIGNUM
*
rnd
,
int
bits
,
const
BIGNUM
*
add
,
const
BIGNUM
*
rem
,
BN_CTX
*
ctx
);
#ifdef __cplusplus
...
...
crypto/bn/bn_prime.c
浏览文件 @
c09ec5d2
...
...
@@ -134,7 +134,10 @@ static int probable_prime_dh(BIGNUM *rnd, const BIGNUM *add,
static
int
probable_prime_dh_safe
(
BIGNUM
*
rnd
,
int
bits
,
const
BIGNUM
*
add
,
const
BIGNUM
*
rem
,
BN_CTX
*
ctx
);
static
int
prime_offsets
[
8
]
=
{
7
,
11
,
13
,
17
,
19
,
23
,
29
,
31
};
static
int
prime_multiplier
=
210
;
static
int
prime_offsets
[
8
]
=
{
23
,
47
,
59
,
83
,
107
,
143
,
167
,
179
};
static
int
prime_offset_count
=
8
;
static
int
prime_offset_count_exponent
=
3
;
int
BN_GENCB_call
(
BN_GENCB
*
cb
,
int
a
,
int
b
)
{
...
...
@@ -372,20 +375,27 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits,
return
(
probable_prime_dh
(
rnd
,
add
,
rem
,
ctx
,
1
));
}
int
bn_probable_prime_dh_coprime
(
BIGNUM
*
rnd
,
int
bits
,
int
bn_probable_prime_dh_coprime
_safe
(
BIGNUM
*
rnd
,
int
bits
,
const
BIGNUM
*
add
,
const
BIGNUM
*
rem
,
BN_CTX
*
ctx
)
{
int
i
=
prime_offset_count
;
BIGNUM
*
offset_index
=
BN_new
();
if
(
!
BN_rand
(
rnd
,
bits
,
0
,
1
))
return
(
0
);
if
(
!
BN_rand
(
offset_index
,
3
,
-
1
,
-
1
))
return
(
0
);
BN_mul_word
(
rnd
,
30
);
BN_add_word
(
rnd
,
prime_offsets
[
BN_get_word
(
offset_index
)]);
while
(
i
>=
prime_offset_count
)
{
if
(
!
BN_rand
(
offset_index
,
prime_offset_count_exponent
,
-
1
,
-
1
))
return
(
0
);
i
=
BN_get_word
(
offset_index
);
}
BN_mul_word
(
rnd
,
prime_multiplier
);
BN_add_word
(
rnd
,
prime_offsets
[
i
]);
BN_free
(
offset_index
);
return
(
probable_prime_dh
(
rnd
,
add
,
rem
,
ctx
,
3
));
return
(
probable_prime_dh
(
rnd
,
add
,
rem
,
ctx
,
4
));
}
static
int
witness
(
BIGNUM
*
w
,
const
BIGNUM
*
a
,
const
BIGNUM
*
a1
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录