Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
b975183c
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b975183c
编写于
4月 12, 2002
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ECDSA representation bugfixes
Submitted by: Nils Larsch
上级
083100e2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
24 deletion
+53
-24
crypto/asn1/x_pubkey.c
crypto/asn1/x_pubkey.c
+52
-23
crypto/ecdsa/ecs_asn1.c
crypto/ecdsa/ecs_asn1.c
+1
-1
未找到文件。
crypto/asn1/x_pubkey.c
浏览文件 @
b975183c
...
@@ -132,43 +132,55 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
...
@@ -132,43 +132,55 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
#ifndef OPENSSL_NO_ECDSA
#ifndef OPENSSL_NO_ECDSA
else
if
(
pkey
->
type
==
EVP_PKEY_ECDSA
)
else
if
(
pkey
->
type
==
EVP_PKEY_ECDSA
)
{
{
int
nid
=
0
;
unsigned
char
*
pp
;
unsigned
char
*
pp
;
ECDSA
*
ecdsa
;
ECDSA
*
ecdsa
;
ecdsa
=
pkey
->
pkey
.
ecdsa
;
ecdsa
=
pkey
->
pkey
.
ecdsa
;
ASN1_TYPE_free
(
a
->
parameter
);
ASN1_TYPE_free
(
a
->
parameter
);
if
((
i
=
i2d_ECDSAParameters
(
ecdsa
,
NULL
))
==
0
)
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ECDSA_LIB
);
goto
err
;
}
if
((
p
=
(
unsigned
char
*
)
OPENSSL_malloc
(
i
))
==
NULL
)
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_MALLOC_FAILURE
);
goto
err
;
}
pp
=
p
;
if
(
!
i2d_ECDSAParameters
(
ecdsa
,
&
pp
))
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ECDSA_LIB
);
OPENSSL_free
(
p
);
goto
err
;
}
if
((
a
->
parameter
=
ASN1_TYPE_new
())
==
NULL
)
if
((
a
->
parameter
=
ASN1_TYPE_new
())
==
NULL
)
{
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ASN1_LIB
);
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ASN1_LIB
);
OPENSSL_free
(
p
);
OPENSSL_free
(
p
);
goto
err
;
goto
err
;
}
}
a
->
parameter
->
type
=
V_ASN1_SEQUENCE
;
if
((
a
->
parameter
->
value
.
sequence
=
ASN1_STRING_new
())
==
NULL
)
if
((
ECDSA_get_parameter_flags
(
ecdsa
)
&
ECDSA_FLAG_NAMED_CURVE
)
&&
(
nid
=
EC_GROUP_get_nid
(
ecdsa
->
group
))
)
{
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ASN1_LIB
);
/* just set the OID */
a
->
parameter
->
type
=
V_ASN1_OBJECT
;
a
->
parameter
->
value
.
object
=
OBJ_nid2obj
(
nid
);
}
else
/* explicit parameters */
{
if
((
i
=
i2d_ECDSAParameters
(
ecdsa
,
NULL
))
==
0
)
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ECDSA_LIB
);
goto
err
;
}
if
((
p
=
(
unsigned
char
*
)
OPENSSL_malloc
(
i
))
==
NULL
)
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_MALLOC_FAILURE
);
goto
err
;
}
pp
=
p
;
if
(
!
i2d_ECDSAParameters
(
ecdsa
,
&
pp
))
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ECDSA_LIB
);
OPENSSL_free
(
p
);
goto
err
;
}
a
->
parameter
->
type
=
V_ASN1_SEQUENCE
;
if
((
a
->
parameter
->
value
.
sequence
=
ASN1_STRING_new
())
==
NULL
)
{
X509err
(
X509_F_X509_PUBKEY_SET
,
ERR_R_ASN1_LIB
);
OPENSSL_free
(
p
);
goto
err
;
}
ASN1_STRING_set
(
a
->
parameter
->
value
.
sequence
,
p
,
i
);
OPENSSL_free
(
p
);
OPENSSL_free
(
p
);
goto
err
;
}
}
ASN1_STRING_set
(
a
->
parameter
->
value
.
sequence
,
p
,
i
);
OPENSSL_free
(
p
);
}
}
#endif
#endif
else
if
(
1
)
else
if
(
1
)
...
@@ -266,6 +278,9 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
...
@@ -266,6 +278,9 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
{
{
if
(
a
->
parameter
&&
(
a
->
parameter
->
type
==
V_ASN1_SEQUENCE
))
if
(
a
->
parameter
&&
(
a
->
parameter
->
type
==
V_ASN1_SEQUENCE
))
{
{
/* type == V_ASN1_SEQUENCE => we have explicit parameters
* (e.g. parameters in the X9_62_EC_PARAMETERS-structure )
*/
if
((
ret
->
pkey
.
ecdsa
=
ECDSA_new
())
==
NULL
)
if
((
ret
->
pkey
.
ecdsa
=
ECDSA_new
())
==
NULL
)
{
{
X509err
(
X509_F_X509_PUBKEY_GET
,
ERR_R_MALLOC_FAILURE
);
X509err
(
X509_F_X509_PUBKEY_GET
,
ERR_R_MALLOC_FAILURE
);
...
@@ -279,6 +294,20 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
...
@@ -279,6 +294,20 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
goto
err
;
goto
err
;
}
}
}
}
else
if
(
a
->
parameter
&&
(
a
->
parameter
->
type
==
V_ASN1_OBJECT
))
{
/* type == V_ASN1_OBJECT => the parameters are given
* by an asn1 OID
*/
if
(
ret
->
pkey
.
ecdsa
==
NULL
)
ret
->
pkey
.
ecdsa
=
ECDSA_new
();
if
(
ret
->
pkey
.
ecdsa
->
group
)
EC_GROUP_free
(
ret
->
pkey
.
ecdsa
->
group
);
ret
->
pkey
.
ecdsa
->
parameter_flags
|=
ECDSA_FLAG_NAMED_CURVE
;
if
((
ret
->
pkey
.
ecdsa
->
group
=
EC_GROUP_new_by_name
(
OBJ_obj2nid
(
a
->
parameter
->
value
.
object
)))
==
NULL
)
goto
err
;
}
/* the case implicitlyCA is currently not implemented */
ret
->
save_parameters
=
1
;
ret
->
save_parameters
=
1
;
}
}
#endif
#endif
...
...
crypto/ecdsa/ecs_asn1.c
浏览文件 @
b975183c
...
@@ -647,7 +647,7 @@ ECDSA *ECDSAPublicKey_set_octet_string(ECDSA **a, const unsigned char **in, lon
...
@@ -647,7 +647,7 @@ ECDSA *ECDSAPublicKey_set_octet_string(ECDSA **a, const unsigned char **in, lon
ECDSAerr
(
ECDSA_F_D2I_ECDSAPRIVATEKEY
,
ERR_R_EC_LIB
);
ECDSAerr
(
ECDSA_F_D2I_ECDSAPRIVATEKEY
,
ERR_R_EC_LIB
);
return
0
;
return
0
;
}
}
ECDSA_set_conversion_form
(
ret
,
(
point_conversion_form_t
)
*
in
[
0
]
);
ECDSA_set_conversion_form
(
ret
,
(
point_conversion_form_t
)
(
*
in
[
0
]
&
~
0x01
)
);
return
ret
;
return
ret
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录