Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
82516e3b
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,发现更多精彩内容 >>
提交
82516e3b
编写于
1月 25, 2003
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cofactor is optional in parameter encodings
Submitted by: Nils Larsch
上级
c1862f91
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
26 deletion
+38
-26
crypto/ec/ec_asn1.c
crypto/ec/ec_asn1.c
+38
-26
未找到文件。
crypto/ec/ec_asn1.c
浏览文件 @
82516e3b
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* Written by Nils Larsch for the OpenSSL project.
* Written by Nils Larsch for the OpenSSL project.
*/
*/
/* ====================================================================
/* ====================================================================
* Copyright (c) 2000-200
2
The OpenSSL Project. All rights reserved.
* Copyright (c) 2000-200
3
The OpenSSL Project. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* modification, are permitted provided that the following conditions
...
@@ -224,7 +224,7 @@ ASN1_SEQUENCE(ECPARAMETERS) = {
...
@@ -224,7 +224,7 @@ ASN1_SEQUENCE(ECPARAMETERS) = {
ASN1_SIMPLE
(
ECPARAMETERS
,
curve
,
X9_62_CURVE
),
ASN1_SIMPLE
(
ECPARAMETERS
,
curve
,
X9_62_CURVE
),
ASN1_SIMPLE
(
ECPARAMETERS
,
base
,
ASN1_OCTET_STRING
),
ASN1_SIMPLE
(
ECPARAMETERS
,
base
,
ASN1_OCTET_STRING
),
ASN1_SIMPLE
(
ECPARAMETERS
,
order
,
ASN1_INTEGER
),
ASN1_SIMPLE
(
ECPARAMETERS
,
order
,
ASN1_INTEGER
),
ASN1_
SIMPLE
(
ECPARAMETERS
,
cofactor
,
ASN1_INTEGER
)
ASN1_
OPT
(
ECPARAMETERS
,
cofactor
,
ASN1_INTEGER
)
}
ASN1_SEQUENCE_END
(
ECPARAMETERS
)
}
ASN1_SEQUENCE_END
(
ECPARAMETERS
)
DECLARE_ASN1_FUNCTIONS_const
(
ECPARAMETERS
)
DECLARE_ASN1_FUNCTIONS_const
(
ECPARAMETERS
)
...
@@ -715,17 +715,15 @@ static ECPARAMETERS *ec_asn1_group2parameters(const EC_GROUP *group,
...
@@ -715,17 +715,15 @@ static ECPARAMETERS *ec_asn1_group2parameters(const EC_GROUP *group,
goto
err
;
goto
err
;
}
}
/* set the cofactor */
/* set the cofactor
(optional)
*/
if
(
!
EC_GROUP_get_cofactor
(
group
,
tmp
,
NULL
))
if
(
EC_GROUP_get_cofactor
(
group
,
tmp
,
NULL
))
{
{
ECerr
(
EC_F_EC_ASN1_GROUP2PARAMETERS
,
ERR_R_EC_LIB
);
ret
->
cofactor
=
BN_to_ASN1_INTEGER
(
tmp
,
ret
->
cofactor
);
goto
err
;
if
(
ret
->
cofactor
==
NULL
)
}
{
ret
->
cofactor
=
BN_to_ASN1_INTEGER
(
tmp
,
ret
->
cofactor
);
ECerr
(
EC_F_EC_ASN1_GROUP2PARAMETERS
,
ERR_R_ASN1_LIB
);
if
(
ret
->
cofactor
==
NULL
)
goto
err
;
{
}
ECerr
(
EC_F_EC_ASN1_GROUP2PARAMETERS
,
ERR_R_ASN1_LIB
);
goto
err
;
}
}
ok
=
1
;
ok
=
1
;
...
@@ -978,9 +976,7 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
...
@@ -978,9 +976,7 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
ret
->
seed_len
=
params
->
curve
->
seed
->
length
;
ret
->
seed_len
=
params
->
curve
->
seed
->
length
;
}
}
/* extract the order, cofactor and generator */
if
(
!
params
->
order
||
!
params
->
base
||
!
params
->
base
->
data
)
if
(
!
params
->
order
||
!
params
->
cofactor
||
!
params
->
base
||
!
params
->
base
->
data
)
{
{
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
EC_R_ASN1_ERROR
);
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
EC_R_ASN1_ERROR
);
goto
err
;
goto
err
;
...
@@ -988,14 +984,11 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
...
@@ -988,14 +984,11 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
if
((
point
=
EC_POINT_new
(
ret
))
==
NULL
)
goto
err
;
if
((
point
=
EC_POINT_new
(
ret
))
==
NULL
)
goto
err
;
a
=
ASN1_INTEGER_to_BN
(
params
->
order
,
a
);
/* set the point conversion form */
b
=
ASN1_INTEGER_to_BN
(
params
->
cofactor
,
b
);
EC_GROUP_set_point_conversion_form
(
ret
,
(
point_conversion_form_t
)
if
(
!
a
||
!
b
)
(
params
->
base
->
data
[
0
]
&
~
0x01
));
{
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
ERR_R_ASN1_LIB
);
goto
err
;
}
/* extract the ec point */
if
(
!
EC_POINT_oct2point
(
ret
,
point
,
params
->
base
->
data
,
if
(
!
EC_POINT_oct2point
(
ret
,
point
,
params
->
base
->
data
,
params
->
base
->
length
,
NULL
))
params
->
base
->
length
,
NULL
))
{
{
...
@@ -1003,10 +996,29 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
...
@@ -1003,10 +996,29 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
goto
err
;
goto
err
;
}
}
/* set the point conversion form */
/* extract the order */
EC_GROUP_set_point_conversion_form
(
ret
,
(
point_conversion_form_t
)
if
((
a
=
ASN1_INTEGER_to_BN
(
params
->
order
,
a
))
==
NULL
)
(
params
->
base
->
data
[
0
]
&
~
0x01
));
{
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
ERR_R_ASN1_LIB
);
goto
err
;
}
/* extract the cofactor (optional) */
if
(
params
->
cofactor
==
NULL
)
{
if
(
b
)
{
BN_free
(
b
);
b
=
NULL
;
}
}
else
if
((
b
=
ASN1_INTEGER_to_BN
(
params
->
cofactor
,
b
))
==
NULL
)
{
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
ERR_R_ASN1_LIB
);
goto
err
;
}
/* set the generator, order and cofactor (if present) */
if
(
!
EC_GROUP_set_generator
(
ret
,
point
,
a
,
b
))
if
(
!
EC_GROUP_set_generator
(
ret
,
point
,
a
,
b
))
{
{
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
ERR_R_EC_LIB
);
ECerr
(
EC_F_EC_ASN1_PARAMETERS2GROUP
,
ERR_R_EC_LIB
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录