From 870694b3da75d0757b400e802caea9d98510b8a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Tue, 5 Mar 2002 15:17:17 +0000 Subject: [PATCH] fix 'ecdsaparam -C' --- apps/ecdsaparam.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/apps/ecdsaparam.c b/apps/ecdsaparam.c index 8dd30a02aa..cf293eae20 100644 --- a/apps/ecdsaparam.c +++ b/apps/ecdsaparam.c @@ -378,7 +378,7 @@ bad: } if (C) - { /* TODO : characteristic two */ + { /* TODO : characteristic two */ int l, len, bits_p; if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL || (tmp_3 = BN_new()) == NULL || (tmp_4 = BN_new()) == NULL || @@ -414,7 +414,7 @@ bad: if ((i%12) == 0) printf("\n\t"); printf("0x%02X,",data[i]); } - printf("\n\t};\n"); + printf("\n\t};\n\n"); l = BN_bn2bin(tmp_2, data); printf("static unsigned char ecdsa%d_a[]={",bits_p); @@ -434,34 +434,34 @@ bad: } printf("\n\t};\n\n"); - l = BN_bn2bin(tmp_3, data); + l = BN_bn2bin(tmp_4, data); printf("static unsigned char ecdsa%d_x[]={", bits_p); for (i=0; igroup = EC_GROUP_new_curve_GFp(tmp_1, tmp_2, tmp_3, NULL);\n"); - printf("\t/* second : set coordinates of the generating point */\n"); + printf("\tecdsa->group = EC_GROUP_new_curve_GFp(tmp_1, tmp_2, tmp_3, NULL);\n\n"); + printf("\t/* build generator */\n"); printf("\tBN_bin2bn(ecdsa%d_x, sizeof(ecdsa%d_x), tmp_1);\n", bits_p, bits_p); printf("\tBN_bin2bn(ecdsa%d_y, sizeof(ecdsa%d_y), tmp_2);\n", bits_p, bits_p); printf("\tif ((point = EC_POINT_new(ecdsa->group)) == NULL)\n"); - printf("\t{\n\t\tECDSA_free(ecdsa); BN_free(tmp_1); BN_free(tmp_2); BN_free(tmp_3);\n"); - printf("\t\treturn(NULL);\n\t}\n"); + printf("\t\t{\n\t\tECDSA_free(ecdsa); BN_free(tmp_1); BN_free(tmp_2); BN_free(tmp_3);\n"); + printf("\t\treturn(NULL);\n\t\t}\n"); printf("\tEC_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/* set generator, order and cofactor */\n"); printf("\tBN_bin2bn(ecdsa%d_o, sizeof(ecdsa%d_o), tmp_1);\n", bits_p, bits_p); printf("\tBN_bin2bn(ecdsa%d_c, sizeof(ecdsa%d_c), tmp_2);\n", bits_p, bits_p); printf("\tEC_GROUP_set_generator(ecdsa->group, point, tmp_1, tmp_2);\n"); printf("\tBN_free(tmp_1); BN_free(tmp_2); BN_free(tmp_3);\n"); - printf("\tEC_POINT_free(point);\n"); + printf("\tEC_POINT_free(point);\n\n"); printf("\treturn(ecdsa);\n\t}\n"); } -- 2.25.1