Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
2abaa9ca
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看板
提交
2abaa9ca
编写于
8月 27, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for DSA2 PQG generation of g parameter.
上级
f55f5f77
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
79 addition
and
21 deletion
+79
-21
crypto/dsa/dsa_gen.c
crypto/dsa/dsa_gen.c
+17
-12
fips/dsa/fips_dssvs.c
fips/dsa/fips_dssvs.c
+62
-9
未找到文件。
crypto/dsa/dsa_gen.c
浏览文件 @
2abaa9ca
...
...
@@ -494,7 +494,9 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
}
mdsize
=
M_EVP_MD_size
(
evpmd
);
/* If unverificable g generation only don't need seed */
if
(
!
ret
->
p
||
!
ret
->
q
||
idx
>=
0
)
{
if
(
seed_len
==
0
)
seed_len
=
mdsize
;
...
...
@@ -511,6 +513,8 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
if
(
seed_in
)
memcpy
(
seed
,
seed_in
,
seed_len
);
}
if
((
ctx
=
BN_CTX_new
())
==
NULL
)
goto
err
;
...
...
@@ -530,6 +534,7 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
{
p
=
ret
->
p
;
q
=
ret
->
q
;
if
(
idx
>=
0
)
memcpy
(
seed_tmp
,
seed
,
seed_len
);
goto
g_only
;
}
...
...
fips/dsa/fips_dssvs.c
浏览文件 @
2abaa9ca
...
...
@@ -123,30 +123,44 @@ static void pqg(FILE *in, FILE *out)
char
*
keyword
,
*
value
;
int
dsa2
,
L
,
N
;
const
EVP_MD
*
md
=
NULL
;
BIGNUM
*
p
=
NULL
,
*
q
=
NULL
;
enum
pqtype
{
PQG_NONE
,
PQG_PQ
,
PQG_G
,
PQG_GCANON
}
pqg_type
=
PQG_NONE
;
int
seedlen
=-
1
,
idxlen
,
idx
=
-
1
;
unsigned
char
seed
[
1024
],
idtmp
[
1024
];
while
(
fgets
(
buf
,
sizeof
buf
,
in
)
!=
NULL
)
{
if
(
buf
[
0
]
==
'['
)
{
if
(
strstr
(
buf
,
"Probable"
))
pqg_type
=
PQG_PQ
;
else
if
(
strstr
(
buf
,
"Unverifiable"
))
pqg_type
=
PQG_G
;
else
if
(
strstr
(
buf
,
"Canonical"
))
pqg_type
=
PQG_GCANON
;
}
if
(
!
parse_line
(
&
keyword
,
&
value
,
lbuf
,
buf
))
{
fputs
(
buf
,
out
);
continue
;
}
fputs
(
buf
,
out
);
if
(
!
strcmp
(
keyword
,
"[mod"
))
{
fputs
(
buf
,
out
);
if
(
!
parse_mod
(
value
,
&
dsa2
,
&
L
,
&
N
,
&
md
))
{
fprintf
(
stderr
,
"Mod Parse Error
\n
"
);
exit
(
1
);
}
}
else
if
(
!
strcmp
(
keyword
,
"N"
))
else
if
(
!
strcmp
(
keyword
,
"N"
)
||
(
!
strcmp
(
keyword
,
"Num"
)
&&
pqg_type
==
PQG_PQ
))
{
int
n
=
atoi
(
value
);
while
(
n
--
)
{
unsigned
char
seed
[
EVP_MAX_MD_SIZE
];
DSA
*
dsa
;
int
counter
;
unsigned
long
h
;
...
...
@@ -169,14 +183,53 @@ static void pqg(FILE *in, FILE *out)
do_bn_print_name
(
out
,
"P"
,
dsa
->
p
);
do_bn_print_name
(
out
,
"Q"
,
dsa
->
q
);
if
(
!
dsa2
)
do_bn_print_name
(
out
,
"G"
,
dsa
->
g
);
OutputValue
(
"Seed"
,
seed
,
M_EVP_MD_size
(
md
),
out
,
0
);
OutputValue
(
dsa2
?
"domain_parameter_seed"
:
"Seed"
,
seed
,
M_EVP_MD_size
(
md
),
out
,
0
);
if
(
!
dsa2
)
{
fprintf
(
out
,
"c = %d
\n
"
,
counter
);
fprintf
(
out
,
"H = %lx
\n\n
"
,
h
);
}
}
else
fputs
(
buf
,
out
);
fputs
(
"
\n
"
,
out
);
}
}
else
if
(
!
strcmp
(
keyword
,
"P"
))
p
=
hex2bn
(
value
);
else
if
(
!
strcmp
(
keyword
,
"Q"
))
q
=
hex2bn
(
value
);
else
if
(
!
strcmp
(
keyword
,
"domain_parameter_seed"
))
seedlen
=
hex2bin
(
value
,
seed
);
else
if
(
!
strcmp
(
keyword
,
"index"
))
{
idxlen
=
hex2bin
(
value
,
idtmp
);
if
(
idxlen
!=
1
)
{
fprintf
(
stderr
,
"Index value error
\n
"
);
exit
(
1
);
}
idx
=
idtmp
[
0
];
}
if
((
idx
>=
0
&&
pqg_type
==
PQG_GCANON
)
||
(
q
&&
pqg_type
==
PQG_G
))
{
DSA
*
dsa
;
dsa
=
FIPS_dsa_new
();
dsa
->
p
=
p
;
dsa
->
q
=
q
;
p
=
q
=
NULL
;
if
(
dsa_builtin_paramgen2
(
dsa
,
L
,
N
,
md
,
seed
,
seedlen
,
idx
,
NULL
,
NULL
,
NULL
,
NULL
)
<=
0
)
{
fprintf
(
stderr
,
"Parameter Generation error
\n
"
);
exit
(
1
);
}
do_bn_print_name
(
out
,
"G"
,
dsa
->
g
);
FIPS_dsa_free
(
dsa
);
idx
=
-
1
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录