Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
13744514
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看板
提交
13744514
编写于
11月 20, 2002
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make ec_GFp_simple_point_get_affine_coordinates() faster
for Montgomery representations. Submitted by: Sheueling Chang, Bodo Moeller
上级
6a8afe22
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
25 deletion
+26
-25
crypto/ec/ecp_smpl.c
crypto/ec/ecp_smpl.c
+26
-25
未找到文件。
crypto/ec/ecp_smpl.c
浏览文件 @
13744514
...
...
@@ -505,8 +505,8 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_P
BIGNUM
*
x
,
BIGNUM
*
y
,
BN_CTX
*
ctx
)
{
BN_CTX
*
new_ctx
=
NULL
;
BIGNUM
*
X
,
*
Y
,
*
Z
,
*
Z_1
,
*
Z_2
,
*
Z_3
;
const
BIGNUM
*
X_
,
*
Y_
,
*
Z_
;
BIGNUM
*
Z
,
*
Z_1
,
*
Z_2
,
*
Z_3
;
const
BIGNUM
*
Z_
;
int
ret
=
0
;
if
(
EC_POINT_is_at_infinity
(
group
,
point
))
...
...
@@ -523,8 +523,6 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_P
}
BN_CTX_start
(
ctx
);
X
=
BN_CTX_get
(
ctx
);
Y
=
BN_CTX_get
(
ctx
);
Z
=
BN_CTX_get
(
ctx
);
Z_1
=
BN_CTX_get
(
ctx
);
Z_2
=
BN_CTX_get
(
ctx
);
...
...
@@ -535,27 +533,37 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_P
if
(
group
->
meth
->
field_decode
)
{
if
(
!
group
->
meth
->
field_decode
(
group
,
X
,
&
point
->
X
,
ctx
))
goto
err
;
if
(
!
group
->
meth
->
field_decode
(
group
,
Y
,
&
point
->
Y
,
ctx
))
goto
err
;
if
(
!
group
->
meth
->
field_decode
(
group
,
Z
,
&
point
->
Z
,
ctx
))
goto
err
;
X_
=
X
;
Y_
=
Y
;
Z_
=
Z
;
Z_
=
Z
;
}
else
{
X_
=
&
point
->
X
;
Y_
=
&
point
->
Y
;
Z_
=
&
point
->
Z
;
}
if
(
BN_is_one
(
Z_
))
{
if
(
x
!=
NULL
)
if
(
group
->
meth
->
field_decode
)
{
if
(
!
BN_copy
(
x
,
X_
))
goto
err
;
if
(
x
!=
NULL
)
{
if
(
!
group
->
meth
->
field_decode
(
group
,
x
,
&
point
->
X
,
ctx
))
goto
err
;
}
if
(
y
!=
NULL
)
{
if
(
!
group
->
meth
->
field_decode
(
group
,
y
,
&
point
->
Y
,
ctx
))
goto
err
;
}
}
if
(
y
!=
NULL
)
else
{
if
(
!
BN_copy
(
y
,
Y_
))
goto
err
;
if
(
x
!=
NULL
)
{
if
(
!
BN_copy
(
x
,
&
point
->
X
))
goto
err
;
}
if
(
y
!=
NULL
)
{
if
(
!
BN_copy
(
y
,
&
point
->
Y
))
goto
err
;
}
}
}
else
...
...
@@ -578,15 +586,8 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_P
if
(
x
!=
NULL
)
{
if
(
group
->
meth
->
field_encode
==
0
)
{
/* field_mul works on standard representation */
if
(
!
group
->
meth
->
field_mul
(
group
,
x
,
X_
,
Z_2
,
ctx
))
goto
err
;
}
else
{
if
(
!
BN_mod_mul
(
x
,
X_
,
Z_2
,
&
group
->
field
,
ctx
))
goto
err
;
}
/* in the Montgomery case, field_mul will cancel out Montgomery factor in X: */
if
(
!
group
->
meth
->
field_mul
(
group
,
x
,
&
point
->
X
,
Z_2
,
ctx
))
goto
err
;
}
if
(
y
!=
NULL
)
...
...
@@ -595,14 +596,14 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_P
{
/* field_mul works on standard representation */
if
(
!
group
->
meth
->
field_mul
(
group
,
Z_3
,
Z_2
,
Z_1
,
ctx
))
goto
err
;
if
(
!
group
->
meth
->
field_mul
(
group
,
y
,
Y_
,
Z_3
,
ctx
))
goto
err
;
}
else
{
if
(
!
BN_mod_mul
(
Z_3
,
Z_2
,
Z_1
,
&
group
->
field
,
ctx
))
goto
err
;
if
(
!
BN_mod_mul
(
y
,
Y_
,
Z_3
,
&
group
->
field
,
ctx
))
goto
err
;
}
/* in the Montgomery case, field_mul will cancel out Montgomery factor in Y: */
if
(
!
group
->
meth
->
field_mul
(
group
,
y
,
&
point
->
Y
,
Z_3
,
ctx
))
goto
err
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录