Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
2b3aeffb
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,发现更多精彩内容 >>
提交
2b3aeffb
编写于
3月 05, 2002
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix 'ecdsaparam -C' output
Submitted by: Nils Larsch
上级
2c2f9e2c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
31 deletion
+22
-31
apps/ecdsaparam.c
apps/ecdsaparam.c
+22
-31
未找到文件。
apps/ecdsaparam.c
浏览文件 @
2b3aeffb
...
...
@@ -470,39 +470,30 @@ bad:
}
printf
(
"
\n\t
};
\n\n
"
);
/* FIXME:
* the generated code does not make much sense
*
* TODO:
* use EC_GROUP_new_curve_GFp instead of using EC_GFp_mont_method directly
*/
printf
(
"ECDSA *get_ecdsa%d()
\n\t
{
\n
"
,
bits_p
);
printf
(
"
\t
int ok=1;
\n
"
);
printf
(
"ECDSA *get_ecdsa%d(void)
\n\t
{
\n
"
,
bits_p
);
printf
(
"
\t
ECDSA *ecdsa=NULL;
\n
"
);
printf
(
"
\t
EC_POINT *point=NULL;
\n
"
);
printf
(
"
\t
BIGNUM *tmp_1=NULL,*tmp_2=NULL,*tmp_3=NULL;
\n
"
);
printf
(
"
\t
BN_CTX *ctx=NULL;
\n\n
"
);
printf
(
"
\t
ecdsa=ECDSA_new();
\n
"
);
printf
(
"
\t
tmp_1=BN_new();
\n
"
);
printf
(
"
\t
tmp_2=BN_new();
\n
"
);
printf
(
"
\t
tmp_3=BN_new();
\n
"
);
printf
(
"
\t
ctx=BN_CTX_new();
\n
"
);
printf
(
"
\t
if (!ecdsa || !tmp_1 || !tmp_2 || !tmp_3 || !ctx) ok=0;
\n
"
);
printf
(
"
\t
if (ok && !ecdsa->group=EC_GROUP_new(EC_GFp_mont_method())) == NULL) ok=0;"
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_p,sizeof(ecdsa%d_p),tmp_1)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_a,sizeof(ecdsa%d_a),tmp_2)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_b,sizeof(ecdsa%d_b),tmp_3)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !EC_GROUP_set_curve_GFp(ecdsa->group,tmp_1,tmp_2,tmp_3,ctx)) ok=0;
\n
"
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_x,sizeof(ecdsa%d_p),tmp_1)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_y,sizeof(ecdsa%d_a),tmp_2)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && (point = EC_POINT_new(ecdsa->group)) == NULL) ok=0;
\n
"
);
printf
(
"
\t
if (ok && !EC_POINT_set_affine_coordinates_GFp(ecdsa->group,point,tmp_1,tmp_2,ctx)) ok=0:
\n
"
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_o,sizeof(ecdsa%d_b),tmp_1)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !BN_bin2bn(ecdsa%d_c,sizeof(ecdsa%d_b),tmp_2)) ok=0;
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if (ok && !EC_GROUP_set_generator(ecdsa->group,point,tmp_1,tmp_2)) ok=0;
\n
"
);
printf
(
"
\t
if ((ecdsa->group == NULL) || (ecdsa->pub_key == NULL) || (ecdsa->priv_key == NULL))
\n
"
);
printf
(
"
\t\t
{ ECDSA_free(ecdsa); return(NULL); }
\n
"
);
printf
(
"
\t
BIGNUM *tmp_1=NULL,*tmp_2=NULL,*tmp_3=NULL;
\n\n
"
);
printf
(
"
\t
if ((ecdsa=ECDSA_new()) == NULL)
\n
"
);
printf
(
"
\t\t
return(NULL);
\n
"
);
printf
(
"
\t
/* first : generate EC_GROUP-structure */
\n
"
);
printf
(
"
\t
tmp_1 = BN_bin2bn(ecdsa%d_p, sizeof(ecdsa%d_p), NULL);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
tmp_2 = BN_bin2bn(ecdsa%d_a, sizeof(ecdsa%d_a), NULL);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
tmp_3 = BN_bin2bn(ecdsa%d_b, sizeof(ecdsa%d_b), NULL);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
ecdsa->group = EC_GROUP_new_curve_GFp(tmp_1, tmp_2, tmp_3, NULL);
\n
"
);
printf
(
"
\t
/* second : set coordinates of the generating point */
\n
"
);
printf
(
"
\t
BN_bin2bn(ecdsa%d_x, sizeof(ecdsa%d_x), tmp_1);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
BN_bin2bn(ecdsa%d_y, sizeof(ecdsa%d_y), tmp_2);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
if ((point = EC_POINT_new(ecdsa->group)) == NULL)
\n
"
);
printf
(
"
\t
{
\n\t\t
ECDSA_free(ecdsa); BN_free(tmp_1); BN_free(tmp_2); BN_free(tmp_3);
\n
"
);
printf
(
"
\t\t
return(NULL);
\n\t
}
\n
"
);
printf
(
"
\t
EC_POINT_set_affine_coordinates_GFp(ecdsa->group, point, tmp_1, tmp_2, NULL);
\n
"
);
printf
(
"
\t
/* and finally : insert the generating point and its order in the EC_GROUP-structure */
\n
"
);
printf
(
"
\t
BN_bin2bn(ecdsa%d_o, sizeof(ecdsa%d_o), tmp_1);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
BN_bin2bn(ecdsa%d_c, sizeof(ecdsa%d_c), tmp_2);
\n
"
,
bits_p
,
bits_p
);
printf
(
"
\t
EC_GROUP_set_generator(ecdsa->group, point, tmp_1, tmp_2);
\n
"
);
printf
(
"
\t
BN_free(tmp_1); BN_free(tmp_2); BN_free(tmp_3);
\n
"
);
printf
(
"
\t
EC_POINT_free(point);
\n
"
);
printf
(
"
\t
return(ecdsa);
\n\t
}
\n
"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录