Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
254ef80d
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看板
提交
254ef80d
编写于
6月 12, 2002
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify asn1_flag
Submitted by: Nils Larsch Reviewed by: Bodo Moeller
上级
f9de8446
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
53 addition
and
47 deletion
+53
-47
CHANGES
CHANGES
+16
-8
apps/ecdsaparam.c
apps/ecdsaparam.c
+1
-2
crypto/asn1/x_pubkey.c
crypto/asn1/x_pubkey.c
+3
-3
crypto/ec/ec.h
crypto/ec/ec.h
+4
-5
crypto/ec/ec_asn1.c
crypto/ec/ec_asn1.c
+6
-22
crypto/ec/ec_lcl.h
crypto/ec/ec_lcl.h
+2
-1
crypto/ec/ec_lib.c
crypto/ec/ec_lib.c
+21
-6
未找到文件。
CHANGES
浏览文件 @
254ef80d
...
...
@@ -4,12 +4,20 @@
Changes between 0.9.7 and 0.9.8 [xx XXX 2002]
*) Add 'nid' and 'asn1_flag' members to EC_GROUP, and functions
EC_GROUP_get_nid()
EC_GROUP_get_set_asn1_flag()
EC_GROUP_get_get_asn1_flag()
'nid' is an optional NID for named curves. 'asn1_flag'
determines the encoding to be used for ASN1 purposes.
*) Add 'asn1_flag' and 'asn1_form' member to EC_GROUP with access
functions
EC_GROUP_set_asn1_flag()
EC_GROUP_get_asn1_flag()
EC_GROUP_set_point_conversion_form()
EC_GROUP_get_point_conversion_form()
These control ASN1 encoding details:
- Curve are encoded explicitly unless asn1_flag has been set to
OPENSSL_EC_NAMED_CURVE.
- Points are encoded in compressed form by default; options for
asn1_for are as for point2oct, namely
POINT_CONVERSION_COMPRESSED
POINT_CONVERSION_UNCOMPRESSED
POINT_CONVERSION_HYBRID
[Nils Larsch <nla@trustcenter.de>]
*) Add 'field_type' member to EC_METHOD, which holds the NID
...
...
@@ -69,8 +77,8 @@
functions
EC_GROUP_new_by_nid()
EC_GROUP_new_by_name()
Also add a '
nid' field to EC_GROUP objects, which can be accessed
via
Also add a '
curve_name' member to EC_GROUP objects, which can be
accessed
via
EC_GROUP_set_nid()
EC_GROUP_get_nid()
[Nils Larsch <nla@trustcenter.de, Bodo Moeller]
...
...
apps/ecdsaparam.c
浏览文件 @
254ef80d
...
...
@@ -432,8 +432,7 @@ bad:
ecdsa
->
group
=
EC_GROUP_new_by_name
(
curve_type
);
if
(
named_curve
)
EC_GROUP_set_asn1_flag
(
ecdsa
->
group
,
OPENSSL_EC_NAMED_CURVE
|
(
EC_GROUP_get_asn1_flag
(
ecdsa
->
group
)
&
~
0x3
));
OPENSSL_EC_NAMED_CURVE
);
}
else
if
(
informat
==
FORMAT_ASN1
)
ecdsa
=
d2i_ECDSAParameters_bio
(
in
,
NULL
);
...
...
crypto/asn1/x_pubkey.c
浏览文件 @
254ef80d
...
...
@@ -145,7 +145,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
goto
err
;
}
if
(
(
EC_GROUP_get_asn1_flag
(
ecdsa
->
group
)
&
OPENSSL_EC_NAMED_CURVE
)
if
(
EC_GROUP_get_asn1_flag
(
ecdsa
->
group
)
&&
(
nid
=
EC_GROUP_get_nid
(
ecdsa
->
group
)))
{
/* just set the OID */
...
...
@@ -312,8 +312,8 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
if
((
ecdsa
->
group
=
EC_GROUP_new_by_name
(
OBJ_obj2nid
(
a
->
parameter
->
value
.
object
)))
==
NULL
)
goto
err
;
EC_GROUP_set_asn1_flag
(
ecdsa
->
group
,
OPENSSL_EC_NAMED_CURVE
|
(
EC_GROUP_get_asn1_flag
(
ecdsa
->
group
)
&
~
0x03
)
);
EC_GROUP_set_asn1_flag
(
ecdsa
->
group
,
OPENSSL_EC_NAMED_CURVE
);
}
/* the case implicitlyCA is currently not implemented */
ret
->
save_parameters
=
1
;
...
...
crypto/ec/ec.h
浏览文件 @
254ef80d
...
...
@@ -229,11 +229,7 @@ int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
/* ASN1 stuff */
#define OPENSSL_EC_EXPLICIT 0x001
#define OPENSSL_EC_NAMED_CURVE 0x002
#define OPENSSL_EC_COMPRESSED 0x010
#define OPENSSL_EC_UNCOMPRESSED 0x020
#define OPENSSL_EC_HYBRID 0x040
#define OPENSSL_EC_NAMED_CURVE 0x001
typedef
struct
ec_parameters_st
ECPARAMETERS
;
typedef
struct
ecpk_parameters_st
ECPKPARAMETERS
;
...
...
@@ -249,6 +245,9 @@ ECPKPARAMETERS *EC_ASN1_group2pkparameters(const EC_GROUP *, ECPKPARAMETERS *);
void
EC_GROUP_set_asn1_flag
(
EC_GROUP
*
,
int
flag
);
int
EC_GROUP_get_asn1_flag
(
const
EC_GROUP
*
);
void
EC_GROUP_set_point_conversion_form
(
EC_GROUP
*
,
point_conversion_form_t
);
point_conversion_form_t
EC_GROUP_get_point_conversion_form
(
const
EC_GROUP
*
);
EC_GROUP
*
d2i_ECParameters
(
EC_GROUP
**
,
const
unsigned
char
**
in
,
long
len
);
int
i2d_ECParameters
(
const
EC_GROUP
*
,
unsigned
char
**
out
);
...
...
crypto/ec/ec_asn1.c
浏览文件 @
254ef80d
...
...
@@ -394,7 +394,7 @@ err : if (!ok)
static
ECPARAMETERS
*
ec_asn1_group2parameters
(
const
EC_GROUP
*
group
,
ECPARAMETERS
*
param
)
{
int
ok
=
0
,
i
;
int
ok
=
0
;
size_t
len
=
0
;
ECPARAMETERS
*
ret
=
NULL
;
BIGNUM
*
tmp
=
NULL
;
...
...
@@ -455,15 +455,7 @@ static ECPARAMETERS *ec_asn1_group2parameters(const EC_GROUP *group,
goto
err
;
}
i
=
EC_GROUP_get_asn1_flag
(
group
);
if
(
i
|
OPENSSL_EC_COMPRESSED
)
form
=
POINT_CONVERSION_COMPRESSED
;
else
if
(
i
|
OPENSSL_EC_UNCOMPRESSED
)
form
=
POINT_CONVERSION_UNCOMPRESSED
;
else
if
(
i
|
OPENSSL_EC_HYBRID
)
form
=
POINT_CONVERSION_HYBRID
;
else
goto
err
;
form
=
EC_GROUP_get_point_conversion_form
(
group
);
len
=
EC_POINT_point2oct
(
group
,
point
,
form
,
NULL
,
len
,
NULL
);
if
(
len
==
0
)
...
...
@@ -556,9 +548,7 @@ ECPKPARAMETERS *EC_ASN1_group2pkparameters(const EC_GROUP *group,
ECPARAMETERS_free
(
ret
->
value
.
parameters
);
}
tmp
=
EC_GROUP_get_asn1_flag
(
group
);
if
(
tmp
&
OPENSSL_EC_NAMED_CURVE
)
if
(
EC_GROUP_get_asn1_flag
(
group
))
{
/* use the asn1 OID to describe the
* the elliptic curve parameters
...
...
@@ -581,7 +571,7 @@ ECPKPARAMETERS *EC_ASN1_group2pkparameters(const EC_GROUP *group,
ok
=
0
;
}
}
else
if
(
tmp
&
OPENSSL_EC_EXPLICIT
)
else
{
/* use the ECPARAMETERS structure */
ret
->
type
=
1
;
...
...
@@ -589,8 +579,6 @@ ECPKPARAMETERS *EC_ASN1_group2pkparameters(const EC_GROUP *group,
group
,
NULL
))
==
NULL
)
ok
=
0
;
}
else
ok
=
0
;
if
(
!
ok
)
{
...
...
@@ -759,9 +747,7 @@ EC_GROUP *EC_ASN1_pkparameters2group(const ECPKPARAMETERS *params)
EC_R_EC_GROUP_NEW_BY_NAME_FAILURE
);
return
NULL
;
}
tmp
=
EC_GROUP_get_asn1_flag
(
ret
);
tmp
=
(
tmp
&
~
0x03
)
|
OPENSSL_EC_NAMED_CURVE
;
EC_GROUP_set_asn1_flag
(
ret
,
tmp
);
EC_GROUP_set_asn1_flag
(
ret
,
OPENSSL_EC_NAMED_CURVE
);
}
else
if
(
params
->
type
==
1
)
{
/* the parameters are given by a ECPARAMETERS
...
...
@@ -772,9 +758,7 @@ EC_GROUP *EC_ASN1_pkparameters2group(const ECPKPARAMETERS *params)
ECerr
(
EC_F_EC_ASN1_PKPARAMETERS2GROUP
,
ERR_R_EC_LIB
);
return
NULL
;
}
tmp
=
EC_GROUP_get_asn1_flag
(
ret
);
tmp
=
(
tmp
&
~
0x03
)
|
OPENSSL_EC_EXPLICIT
;
EC_GROUP_set_asn1_flag
(
ret
,
tmp
);
EC_GROUP_set_asn1_flag
(
ret
,
0x0
);
}
else
if
(
params
->
type
==
2
)
{
/* implicitlyCA */
...
...
crypto/ec/ec_lcl.h
浏览文件 @
254ef80d
...
...
@@ -144,8 +144,9 @@ struct ec_group_st {
EC_POINT
*
generator
;
/* optional */
BIGNUM
order
,
cofactor
;
int
nid
;
/* optional NID for named curve */
int
curve_name
;
/* optional NID for named curve */
int
asn1_flag
;
/* flag to control the asn1 encoding */
point_conversion_form_t
asn1_form
;
void
*
extra_data
;
void
*
(
*
extra_data_dup_func
)(
void
*
);
...
...
crypto/ec/ec_lib.c
浏览文件 @
254ef80d
...
...
@@ -98,8 +98,9 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
BN_init
(
&
ret
->
order
);
BN_init
(
&
ret
->
cofactor
);
ret
->
nid
=
0
;
ret
->
asn1_flag
=
OPENSSL_EC_EXPLICIT
|
OPENSSL_EC_COMPRESSED
;
ret
->
curve_name
=
0
;
ret
->
asn1_flag
=
0
;
ret
->
asn1_form
=
POINT_CONVERSION_COMPRESSED
;
ret
->
seed
=
NULL
;
ret
->
seed_len
=
0
;
...
...
@@ -214,8 +215,9 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src)
if
(
!
BN_copy
(
&
dest
->
order
,
&
src
->
order
))
return
0
;
if
(
!
BN_copy
(
&
dest
->
cofactor
,
&
src
->
cofactor
))
return
0
;
dest
->
nid
=
src
->
nid
;
dest
->
asn1_flag
=
src
->
asn1_flag
;
dest
->
curve_name
=
src
->
curve_name
;
dest
->
asn1_flag
=
src
->
asn1_flag
;
dest
->
asn1_form
=
src
->
asn1_form
;
if
(
src
->
seed
)
{
...
...
@@ -308,13 +310,13 @@ int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx)
void
EC_GROUP_set_nid
(
EC_GROUP
*
group
,
int
nid
)
{
group
->
nid
=
nid
;
group
->
curve_name
=
nid
;
}
int
EC_GROUP_get_nid
(
const
EC_GROUP
*
group
)
{
return
group
->
nid
;
return
group
->
curve_name
;
}
...
...
@@ -330,6 +332,19 @@ int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
}
void
EC_GROUP_set_point_conversion_form
(
EC_GROUP
*
group
,
point_conversion_form_t
form
)
{
group
->
asn1_form
=
form
;
}
point_conversion_form_t
EC_GROUP_get_point_conversion_form
(
const
EC_GROUP
*
group
)
{
return
group
->
asn1_form
;
}
int
EC_GROUP_set_curve_GFp
(
EC_GROUP
*
group
,
const
BIGNUM
*
p
,
const
BIGNUM
*
a
,
const
BIGNUM
*
b
,
BN_CTX
*
ctx
)
{
if
(
group
->
meth
->
group_set_curve_GFp
==
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录