Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
6a983d42
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,发现更多精彩内容 >>
提交
6a983d42
编写于
6月 14, 2006
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a bug recently introduced when updating this file to use the new
keygen API: make sure that 'pkey_type' is actually visible to MAIN().
上级
1a159e08
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
15 addition
and
16 deletion
+15
-16
apps/req.c
apps/req.c
+15
-16
未找到文件。
apps/req.c
浏览文件 @
6a983d42
...
@@ -144,7 +144,7 @@ static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
...
@@ -144,7 +144,7 @@ static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
static
int
genpkey_cb
(
EVP_PKEY_CTX
*
ctx
);
static
int
genpkey_cb
(
EVP_PKEY_CTX
*
ctx
);
static
int
req_check_len
(
int
len
,
int
n_min
,
int
n_max
);
static
int
req_check_len
(
int
len
,
int
n_min
,
int
n_max
);
static
int
check_end
(
const
char
*
str
,
const
char
*
end
);
static
int
check_end
(
const
char
*
str
,
const
char
*
end
);
static
EVP_PKEY_CTX
*
set_keygen_ctx
(
BIO
*
err
,
const
char
*
gstr
,
static
EVP_PKEY_CTX
*
set_keygen_ctx
(
BIO
*
err
,
const
char
*
gstr
,
int
*
pkey_type
,
long
*
pkeylen
,
char
**
palgnam
,
long
*
pkeylen
,
char
**
palgnam
,
ENGINE
*
keygen_engine
);
ENGINE
*
keygen_engine
);
#ifndef MONOLITH
#ifndef MONOLITH
...
@@ -167,7 +167,7 @@ int MAIN(int argc, char **argv)
...
@@ -167,7 +167,7 @@ int MAIN(int argc, char **argv)
char
*
keyalgstr
=
NULL
;
char
*
keyalgstr
=
NULL
;
STACK
*
pkeyopts
=
NULL
;
STACK
*
pkeyopts
=
NULL
;
EVP_PKEY
*
pkey
=
NULL
;
EVP_PKEY
*
pkey
=
NULL
;
int
i
=
0
,
badops
=
0
,
newreq
=
0
,
verbose
=
0
,
pkey_type
=
EVP_PKEY_RSA
;
int
i
=
0
,
badops
=
0
,
newreq
=
0
,
verbose
=
0
,
pkey_type
=
-
1
;
long
newkey
=
-
1
;
long
newkey
=
-
1
;
BIO
*
in
=
NULL
,
*
out
=
NULL
;
BIO
*
in
=
NULL
,
*
out
=
NULL
;
int
informat
,
outformat
,
verify
=
0
,
noout
=
0
,
text
=
0
,
keyform
=
FORMAT_PEM
;
int
informat
,
outformat
,
verify
=
0
,
noout
=
0
,
text
=
0
,
keyform
=
FORMAT_PEM
;
...
@@ -638,7 +638,7 @@ bad:
...
@@ -638,7 +638,7 @@ bad:
if
(
keyalg
)
if
(
keyalg
)
{
{
genctx
=
set_keygen_ctx
(
bio_err
,
keyalg
,
&
newkey
,
genctx
=
set_keygen_ctx
(
bio_err
,
keyalg
,
&
pkey_type
,
&
newkey
,
&
keyalgstr
,
gen_eng
);
&
keyalgstr
,
gen_eng
);
if
(
!
genctx
)
if
(
!
genctx
)
goto
end
;
goto
end
;
...
@@ -659,7 +659,7 @@ bad:
...
@@ -659,7 +659,7 @@ bad:
if
(
!
genctx
)
if
(
!
genctx
)
{
{
genctx
=
set_keygen_ctx
(
bio_err
,
NULL
,
&
newkey
,
genctx
=
set_keygen_ctx
(
bio_err
,
NULL
,
&
pkey_type
,
&
newkey
,
&
keyalgstr
,
gen_eng
);
&
keyalgstr
,
gen_eng
);
if
(
!
genctx
)
if
(
!
genctx
)
goto
end
;
goto
end
;
...
@@ -1570,25 +1570,24 @@ static int check_end(const char *str, const char *end)
...
@@ -1570,25 +1570,24 @@ static int check_end(const char *str, const char *end)
return
strcmp
(
tmp
,
end
);
return
strcmp
(
tmp
,
end
);
}
}
static
EVP_PKEY_CTX
*
set_keygen_ctx
(
BIO
*
err
,
const
char
*
gstr
,
static
EVP_PKEY_CTX
*
set_keygen_ctx
(
BIO
*
err
,
const
char
*
gstr
,
int
*
pkey_type
,
long
*
pkeylen
,
char
**
palgnam
,
long
*
pkeylen
,
char
**
palgnam
,
ENGINE
*
keygen_engine
)
ENGINE
*
keygen_engine
)
{
{
EVP_PKEY_CTX
*
gctx
=
NULL
;
EVP_PKEY_CTX
*
gctx
=
NULL
;
EVP_PKEY
*
param
=
NULL
;
EVP_PKEY
*
param
=
NULL
;
long
keylen
=
-
1
;
long
keylen
=
-
1
;
int
pkey_type
=
-
1
;
BIO
*
pbio
=
NULL
;
BIO
*
pbio
=
NULL
;
const
char
*
paramfile
=
NULL
;
const
char
*
paramfile
=
NULL
;
if
(
gstr
==
NULL
)
if
(
gstr
==
NULL
)
{
{
pkey_type
=
EVP_PKEY_RSA
;
*
pkey_type
=
EVP_PKEY_RSA
;
keylen
=
*
pkeylen
;
keylen
=
*
pkeylen
;
}
}
else
if
(
gstr
[
0
]
>=
'0'
&&
gstr
[
0
]
<=
'9'
)
else
if
(
gstr
[
0
]
>=
'0'
&&
gstr
[
0
]
<=
'9'
)
{
{
pkey_type
=
EVP_PKEY_RSA
;
*
pkey_type
=
EVP_PKEY_RSA
;
keylen
=
atol
(
gstr
);
keylen
=
atol
(
gstr
);
*
pkeylen
=
keylen
;
*
pkeylen
=
keylen
;
}
}
...
@@ -1617,13 +1616,13 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
...
@@ -1617,13 +1616,13 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
return
NULL
;
return
NULL
;
}
}
EVP_PKEY_asn1_get0_info
(
NULL
,
&
pkey_type
,
NULL
,
NULL
,
NULL
,
EVP_PKEY_asn1_get0_info
(
NULL
,
pkey_type
,
NULL
,
NULL
,
NULL
,
ameth
);
ameth
);
#ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE
if
(
tmpeng
)
if
(
tmpeng
)
ENGINE_finish
(
tmpeng
);
ENGINE_finish
(
tmpeng
);
#endif
#endif
if
(
pkey_type
==
EVP_PKEY_RSA
)
if
(
*
pkey_type
==
EVP_PKEY_RSA
)
{
{
if
(
p
)
if
(
p
)
{
{
...
@@ -1666,9 +1665,9 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
...
@@ -1666,9 +1665,9 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
paramfile
);
paramfile
);
return
NULL
;
return
NULL
;
}
}
if
(
pkey_type
==
-
1
)
if
(
*
pkey_type
==
-
1
)
pkey_type
=
EVP_PKEY_id
(
param
);
*
pkey_type
=
EVP_PKEY_id
(
param
);
else
if
(
pkey_type
!=
EVP_PKEY_base_id
(
param
))
else
if
(
*
pkey_type
!=
EVP_PKEY_base_id
(
param
))
{
{
BIO_printf
(
err
,
"Key Type does not match parameters
\n
"
);
BIO_printf
(
err
,
"Key Type does not match parameters
\n
"
);
EVP_PKEY_free
(
param
);
EVP_PKEY_free
(
param
);
...
@@ -1681,7 +1680,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
...
@@ -1681,7 +1680,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
const
EVP_PKEY_ASN1_METHOD
*
ameth
;
const
EVP_PKEY_ASN1_METHOD
*
ameth
;
ENGINE
*
tmpeng
;
ENGINE
*
tmpeng
;
const
char
*
anam
;
const
char
*
anam
;
ameth
=
EVP_PKEY_asn1_find
(
&
tmpeng
,
pkey_type
);
ameth
=
EVP_PKEY_asn1_find
(
&
tmpeng
,
*
pkey_type
);
if
(
!
ameth
)
if
(
!
ameth
)
{
{
BIO_puts
(
err
,
"Internal error: can't find key algorithm
\n
"
);
BIO_puts
(
err
,
"Internal error: can't find key algorithm
\n
"
);
...
@@ -1702,7 +1701,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
...
@@ -1702,7 +1701,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
EVP_PKEY_free
(
param
);
EVP_PKEY_free
(
param
);
}
}
else
else
gctx
=
EVP_PKEY_CTX_new_id
(
pkey_type
,
keygen_engine
);
gctx
=
EVP_PKEY_CTX_new_id
(
*
pkey_type
,
keygen_engine
);
if
(
!
gctx
)
if
(
!
gctx
)
{
{
...
@@ -1718,7 +1717,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
...
@@ -1718,7 +1717,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr,
return
NULL
;
return
NULL
;
}
}
if
((
pkey_type
==
EVP_PKEY_RSA
)
&&
(
keylen
!=
-
1
))
if
((
*
pkey_type
==
EVP_PKEY_RSA
)
&&
(
keylen
!=
-
1
))
{
{
if
(
EVP_PKEY_CTX_set_rsa_keygen_bits
(
gctx
,
keylen
)
<=
0
)
if
(
EVP_PKEY_CTX_set_rsa_keygen_bits
(
gctx
,
keylen
)
<=
0
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录