Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
506a3d1f
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
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看板
提交
506a3d1f
编写于
8月 27, 2014
作者:
R
Rich Salz
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git.openssl.org:openssl
Gah, I hate when I forget to pull before merging. Reviewed-by: rsalz
上级
17e80c6b
f34a5720
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
17 deletion
+42
-17
crypto/ec/ec_ameth.c
crypto/ec/ec_ameth.c
+8
-6
crypto/ec/ec_asn1.c
crypto/ec/ec_asn1.c
+29
-11
doc/crypto/EC_KEY_new.pod
doc/crypto/EC_KEY_new.pod
+5
-0
未找到文件。
crypto/ec/ec_ameth.c
浏览文件 @
506a3d1f
...
...
@@ -473,14 +473,16 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
if
(
ktype
>
0
)
{
public_key
=
EC_KEY_get0_public_key
(
x
);
if
((
pub_key
=
EC_POINT_point2bn
(
group
,
public_key
,
EC_KEY_get_conv_form
(
x
),
NULL
,
ctx
))
==
NULL
)
if
(
public_key
!=
NULL
)
{
reason
=
ERR_R_EC_LIB
;
goto
err
;
}
if
(
pub_key
)
if
((
pub_key
=
EC_POINT_point2bn
(
group
,
public_key
,
EC_KEY_get_conv_form
(
x
),
NULL
,
ctx
))
==
NULL
)
{
reason
=
ERR_R_EC_LIB
;
goto
err
;
}
buf_len
=
(
size_t
)
BN_num_bytes
(
pub_key
);
}
}
if
(
ktype
==
2
)
...
...
crypto/ec/ec_asn1.c
浏览文件 @
506a3d1f
...
...
@@ -1183,29 +1183,46 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
goto
err
;
}
if
(
ret
->
pub_key
)
EC_POINT_clear_free
(
ret
->
pub_key
);
ret
->
pub_key
=
EC_POINT_new
(
ret
->
group
);
if
(
ret
->
pub_key
==
NULL
)
{
ECerr
(
EC_F_D2I_ECPRIVATEKEY
,
ERR_R_EC_LIB
);
goto
err
;
}
if
(
priv_key
->
publicKey
)
{
const
unsigned
char
*
pub_oct
;
size_
t
pub_oct_len
;
in
t
pub_oct_len
;
if
(
ret
->
pub_key
)
EC_POINT_clear_free
(
ret
->
pub_k
ey
);
ret
->
pub_key
=
EC_POINT_new
(
ret
->
group
);
if
(
ret
->
pub_key
==
NULL
)
pub_oct
=
M_ASN1_STRING_data
(
priv_key
->
publicKey
);
pub_oct_len
=
M_ASN1_STRING_length
(
priv_key
->
publicK
ey
);
/* The first byte - point conversion form - must be present. */
if
(
pub_oct_len
<=
0
)
{
ECerr
(
EC_F_D2I_ECPRIVATEKEY
,
E
RR_R_EC_LIB
);
ECerr
(
EC_F_D2I_ECPRIVATEKEY
,
E
C_R_BUFFER_TOO_SMALL
);
goto
err
;
}
pub_oct
=
M_ASN1_STRING_data
(
priv_key
->
publicKey
);
pub_oct_len
=
M_ASN1_STRING_length
(
priv_key
->
publicKey
);
/* save the point conversion form */
/* Save the point conversion form. */
ret
->
conv_form
=
(
point_conversion_form_t
)(
pub_oct
[
0
]
&
~
0x01
);
if
(
!
EC_POINT_oct2point
(
ret
->
group
,
ret
->
pub_key
,
pub_oct
,
pub_oct_len
,
NULL
))
pub_oct
,
(
size_t
)(
pub_oct_len
),
NULL
))
{
ECerr
(
EC_F_D2I_ECPRIVATEKEY
,
ERR_R_EC_LIB
);
goto
err
;
}
}
else
{
if
(
!
EC_POINT_mul
(
ret
->
group
,
ret
->
pub_key
,
ret
->
priv_key
,
NULL
,
NULL
,
NULL
))
{
ECerr
(
EC_F_D2I_ECPRIVATEKEY
,
ERR_R_EC_LIB
);
goto
err
;
}
/* Remember the original private-key-only encoding. */
ret
->
enc_flag
|=
EC_PKEY_NO_PUBKEY
;
}
ok
=
1
;
...
...
@@ -1230,7 +1247,8 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out)
size_t
buf_len
=
0
,
tmp_len
;
EC_PRIVATEKEY
*
priv_key
=
NULL
;
if
(
a
==
NULL
||
a
->
group
==
NULL
||
a
->
priv_key
==
NULL
)
if
(
a
==
NULL
||
a
->
group
==
NULL
||
a
->
priv_key
==
NULL
||
(
!
(
a
->
enc_flag
&
EC_PKEY_NO_PUBKEY
)
&&
a
->
pub_key
==
NULL
))
{
ECerr
(
EC_F_I2D_ECPRIVATEKEY
,
ERR_R_PASSED_NULL_PARAMETER
);
...
...
doc/crypto/EC_KEY_new.pod
浏览文件 @
506a3d1f
...
...
@@ -74,6 +74,11 @@ flags currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These fl
converted into ASN1 in a call to i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for the curve are not encoded
along with the private key. If EC_PKEY_NO_PUBKEY is set then the public key is not encoded along with the private key.
When reading a private key encoded with EC_PKEY_NO_PUBKEY,
d2i_ECPrivateKey generates the missing public key
automatically. Private keys encoded with EC_PKEY_NO_PARAMETERS cannot
be loaded using d2i_ECPrivateKey.
The functions EC_KEY_get_conv_form and EC_KEY_set_conv_form get and set the point_conversion_form for the B<key>. For a description
of point_conversion_forms please refer to L<EC_POINT_new(3)|EC_POINT_new(3)>.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录