Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
34f1f2a8
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看板
提交
34f1f2a8
编写于
8月 26, 2002
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
less specific interface for EC_GROUP_get_basis_type
Submitted by: Nils Larsch, Bodo Moeller
上级
c96f0fd2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
29 deletion
+75
-29
crypto/asn1/t_pkey.c
crypto/asn1/t_pkey.c
+1
-2
crypto/ec/ec.h
crypto/ec/ec.h
+8
-3
crypto/ec/ec2_smpl.c
crypto/ec/ec2_smpl.c
+5
-1
crypto/ec/ec_asn1.c
crypto/ec/ec_asn1.c
+55
-23
crypto/ec/ec_err.c
crypto/ec/ec_err.c
+4
-0
util/libeay.num
util/libeay.num
+2
-0
未找到文件。
crypto/asn1/t_pkey.c
浏览文件 @
34f1f2a8
...
...
@@ -420,8 +420,7 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
if
(
is_char_two
)
{
/* print the 'short name' of the base type OID */
int
basis_type
=
EC_GROUP_get_basis_type
(
x
,
NULL
,
NULL
,
NULL
);
int
basis_type
=
EC_GROUP_get_basis_type
(
x
);
if
(
basis_type
==
0
)
goto
err
;
...
...
crypto/ec/ec.h
浏览文件 @
34f1f2a8
...
...
@@ -257,9 +257,10 @@ int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
/* ASN1 stuff */
/* EC_GROUP_get_basis_type() returns the NID of the basis type
* used to represent the field elements (in case of a pentanomial or trinomial
* basis the coefficient are returned in the k? arguments) */
int
EC_GROUP_get_basis_type
(
const
EC_GROUP
*
,
unsigned
int
*
k1
,
* used to represent the field elements */
int
EC_GROUP_get_basis_type
(
const
EC_GROUP
*
);
int
EC_GROUP_get_trinomial_basis
(
const
EC_GROUP
*
,
unsigned
int
*
k
);
int
EC_GROUP_get_pentanomial_basis
(
const
EC_GROUP
*
,
unsigned
int
*
k1
,
unsigned
int
*
k2
,
unsigned
int
*
k3
);
#define OPENSSL_EC_NAMED_CURVE 0x001
...
...
@@ -372,6 +373,7 @@ void ERR_load_EC_strings(void);
#define EC_F_EC_ASN1_PARAMETERS2GROUP 157
#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158
#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159
#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195
#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160
#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161
#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
...
...
@@ -405,6 +407,8 @@ void ERR_load_EC_strings(void);
#define EC_F_EC_GROUP_GET_DEGREE 173
#define EC_F_EC_GROUP_GET_EXTRA_DATA 107
#define EC_F_EC_GROUP_GET_ORDER 141
#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193
#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
#define EC_F_EC_GROUP_GROUP2NID 147
#define EC_F_EC_GROUP_NEW 108
#define EC_F_EC_GROUP_NEW_BY_NID 174
...
...
@@ -481,6 +485,7 @@ void ERR_load_EC_strings(void);
#define EC_R_UNDEFINED_ORDER 128
#define EC_R_UNKNOWN_GROUP 129
#define EC_R_UNKNOWN_ORDER 114
#define EC_R_UNSUPPORTED_FIELD 131
#define EC_R_WRONG_ORDER 130
#ifdef __cplusplus
...
...
crypto/ec/ec2_smpl.c
浏览文件 @
34f1f2a8
...
...
@@ -200,7 +200,11 @@ int ec_GF2m_simple_group_set_curve(EC_GROUP *group,
/* group->field */
if
(
!
BN_copy
(
&
group
->
field
,
p
))
goto
err
;
i
=
BN_GF2m_poly2arr
(
&
group
->
field
,
group
->
poly
,
5
);
if
((
i
!=
5
)
&&
(
i
!=
3
))
goto
err
;
if
((
i
!=
5
)
&&
(
i
!=
3
))
{
ECerr
(
EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE
,
EC_R_UNSUPPORTED_FIELD
);
goto
err
;
}
/* group->a */
if
(
!
BN_GF2m_mod_arr
(
&
group
->
a
,
a
,
group
->
poly
))
goto
err
;
...
...
crypto/ec/ec_asn1.c
浏览文件 @
34f1f2a8
...
...
@@ -63,13 +63,9 @@
#include <openssl/objects.h>
int
EC_GROUP_get_basis_type
(
const
EC_GROUP
*
group
,
unsigned
int
*
k1
,
unsigned
int
*
k2
,
unsigned
int
*
k3
)
int
EC_GROUP_get_basis_type
(
const
EC_GROUP
*
group
)
{
int
i
=
0
;
if
(
group
==
NULL
)
return
0
;
int
i
=
0
;
if
(
EC_METHOD_get_field_type
(
EC_GROUP_method_of
(
group
))
!=
NID_X9_62_characteristic_two_field
)
...
...
@@ -80,28 +76,55 @@ int EC_GROUP_get_basis_type(const EC_GROUP *group, unsigned int *k1,
i
++
;
if
(
i
==
4
)
{
if
(
k1
)
*
k1
=
group
->
poly
[
3
];
if
(
k2
)
*
k2
=
group
->
poly
[
2
];
if
(
k3
)
*
k3
=
group
->
poly
[
1
];
return
NID_X9_62_ppBasis
;
}
else
if
(
i
==
2
)
{
if
(
k1
)
*
k1
=
group
->
poly
[
1
];
return
NID_X9_62_tpBasis
;
}
else
/* everything else is currently not supported */
return
0
;
}
int
EC_GROUP_get_trinomial_basis
(
const
EC_GROUP
*
group
,
unsigned
int
*
k
)
{
if
(
group
==
NULL
)
return
0
;
if
(
EC_GROUP_method_of
(
group
)
->
group_set_curve
!=
ec_GF2m_simple_group_set_curve
||
!
((
group
->
poly
[
0
]
!=
0
)
&&
(
group
->
poly
[
1
]
!=
0
)
&&
(
group
->
poly
[
2
]
==
0
)))
{
ECerr
(
EC_F_EC_GROUP_GET_TRINOMIAL_BASIS
,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
return
0
;
}
if
(
k
)
*
k
=
group
->
poly
[
1
];
return
1
;
}
int
EC_GROUP_get_pentanomial_basis
(
const
EC_GROUP
*
group
,
unsigned
int
*
k1
,
unsigned
int
*
k2
,
unsigned
int
*
k3
)
{
if
(
group
==
NULL
)
return
0
;
if
(
EC_GROUP_method_of
(
group
)
->
group_set_curve
!=
ec_GF2m_simple_group_set_curve
||
!
((
group
->
poly
[
0
]
!=
0
)
&&
(
group
->
poly
[
1
]
!=
0
)
&&
(
group
->
poly
[
2
]
!=
0
)
&&
(
group
->
poly
[
3
]
!=
0
)
&&
(
group
->
poly
[
4
]
==
0
)))
{
ECerr
(
EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS
,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
return
0
;
}
if
(
k1
)
*
k1
=
group
->
poly
[
3
];
if
(
k2
)
*
k2
=
group
->
poly
[
2
];
if
(
k3
)
*
k3
=
group
->
poly
[
1
];
return
1
;
}
/* some structures needed for the asn1 encoding */
...
...
@@ -323,7 +346,6 @@ static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *group,
else
/* nid == NID_X9_62_characteristic_two_field */
{
int
field_type
;
unsigned
int
k1
,
k2
,
k3
;
char_two
=
X9_62_CHARACTERISTIC_TWO_new
();
if
(
char_two
==
NULL
)
...
...
@@ -334,7 +356,7 @@ static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *group,
char_two
->
m
=
(
long
)
EC_GROUP_get_degree
(
group
);
field_type
=
EC_GROUP_get_basis_type
(
group
,
&
k1
,
&
k2
,
&
k3
);
field_type
=
EC_GROUP_get_basis_type
(
group
);
if
(
field_type
==
0
)
{
...
...
@@ -350,6 +372,11 @@ static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *group,
if
(
field_type
==
NID_X9_62_tpBasis
)
{
unsigned
int
k
;
if
(
!
EC_GROUP_get_trinomial_basis
(
group
,
&
k
))
goto
err
;
char_two
->
parameters
->
type
=
V_ASN1_INTEGER
;
char_two
->
parameters
->
value
.
integer
=
ASN1_INTEGER_new
();
...
...
@@ -359,7 +386,7 @@ static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *group,
ERR_R_ASN1_LIB
);
goto
err
;
}
if
(
!
ASN1_INTEGER_set
(
char_two
->
parameters
->
value
.
integer
,
(
long
)
k
1
))
if
(
!
ASN1_INTEGER_set
(
char_two
->
parameters
->
value
.
integer
,
(
long
)
k
))
{
ECerr
(
EC_F_EC_ASN1_GROUP2PARAMETERS
,
ERR_R_ASN1_LIB
);
...
...
@@ -368,6 +395,11 @@ static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *group,
}
else
if
(
field_type
==
NID_X9_62_ppBasis
)
{
unsigned
int
k1
,
k2
,
k3
;
if
(
!
EC_GROUP_get_pentanomial_basis
(
group
,
&
k1
,
&
k2
,
&
k3
))
goto
err
;
penta
=
X9_62_PENTANOMIAL_new
();
/* set k? values */
penta
->
k1
=
(
long
)
k1
;
...
...
crypto/ec/ec_err.c
浏览文件 @
34f1f2a8
...
...
@@ -83,6 +83,7 @@ static ERR_STRING_DATA EC_str_functs[]=
{
ERR_PACK
(
0
,
EC_F_EC_ASN1_PARAMETERS2GROUP
,
0
),
"EC_ASN1_PARAMETERS2GROUP"
},
{
ERR_PACK
(
0
,
EC_F_EC_ASN1_PKPARAMETERS2GROUP
,
0
),
"EC_ASN1_PKPARAMETERS2GROUP"
},
{
ERR_PACK
(
0
,
EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT
,
0
),
"ec_GF2m_simple_group_check_discriminant"
},
{
ERR_PACK
(
0
,
EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE
,
0
),
"ec_GF2m_simple_group_set_curve"
},
{
ERR_PACK
(
0
,
EC_F_EC_GF2M_SIMPLE_OCT2POINT
,
0
),
"ec_GF2m_simple_oct2point"
},
{
ERR_PACK
(
0
,
EC_F_EC_GF2M_SIMPLE_POINT2OCT
,
0
),
"ec_GF2m_simple_point2oct"
},
{
ERR_PACK
(
0
,
EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES
,
0
),
"ec_GF2m_simple_point_get_affine_coordinates"
},
...
...
@@ -116,6 +117,8 @@ static ERR_STRING_DATA EC_str_functs[]=
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GET_DEGREE
,
0
),
"EC_GROUP_get_degree"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GET_EXTRA_DATA
,
0
),
"EC_GROUP_get_extra_data"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GET_ORDER
,
0
),
"EC_GROUP_get_order"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS
,
0
),
"EC_GROUP_get_pentanomial_basis"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GET_TRINOMIAL_BASIS
,
0
),
"EC_GROUP_get_trinomial_basis"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_GROUP2NID
,
0
),
"EC_GROUP_GROUP2NID"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_NEW
,
0
),
"EC_GROUP_new"
},
{
ERR_PACK
(
0
,
EC_F_EC_GROUP_NEW_BY_NID
,
0
),
"EC_GROUP_new_by_nid"
},
...
...
@@ -195,6 +198,7 @@ static ERR_STRING_DATA EC_str_reasons[]=
{
EC_R_UNDEFINED_ORDER
,
"undefined order"
},
{
EC_R_UNKNOWN_GROUP
,
"unknown group"
},
{
EC_R_UNKNOWN_ORDER
,
"unknown order"
},
{
EC_R_UNSUPPORTED_FIELD
,
"unsupported field"
},
{
EC_R_WRONG_ORDER
,
"wrong order"
},
{
0
,
NULL
}
};
...
...
util/libeay.num
浏览文件 @
34f1f2a8
...
...
@@ -3007,3 +3007,5 @@ EC_GROUP_get0_comment 3440 EXIST::FUNCTION:EC
ec_group_index2nid 3441 EXIST::FUNCTION:EC
EC_GROUP_get_basis_type 3442 EXIST::FUNCTION:EC
X509_REQ_print_ex 3443 EXIST::FUNCTION:BIO
EC_GROUP_get_pentanomial_basis 3444 EXIST::FUNCTION:EC
EC_GROUP_get_trinomial_basis 3445 EXIST::FUNCTION:EC
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录