OLD | NEW |
1 /* apps/ecparam.c */ | 1 /* apps/ecparam.c */ |
2 /* | 2 /* |
3 * Written by Nils Larsch for the OpenSSL project. | 3 * Written by Nils Larsch for the OpenSSL project. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; | 122 point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; |
123 int new_form = 0; | 123 int new_form = 0; |
124 int asn1_flag = OPENSSL_EC_NAMED_CURVE; | 124 int asn1_flag = OPENSSL_EC_NAMED_CURVE; |
125 int new_asn1_flag = 0; | 125 int new_asn1_flag = 0; |
126 char *curve_name = NULL, *inrand = NULL; | 126 char *curve_name = NULL, *inrand = NULL; |
127 int list_curves = 0, no_seed = 0, check = 0, | 127 int list_curves = 0, no_seed = 0, check = 0, |
128 badops = 0, text = 0, i, need_rand = 0, genkey = 0; | 128 badops = 0, text = 0, i, need_rand = 0, genkey = 0; |
129 char *infile = NULL, *outfile = NULL, *prog; | 129 char *infile = NULL, *outfile = NULL, *prog; |
130 BIO *in = NULL, *out = NULL; | 130 BIO *in = NULL, *out = NULL; |
131 int informat, outformat, noout = 0, C = 0, ret = 1; | 131 int informat, outformat, noout = 0, C = 0, ret = 1; |
132 #ifndef OPENSSL_NO_ENGINE | |
133 ENGINE *e = NULL; | |
134 #endif | |
135 char *engine = NULL; | 132 char *engine = NULL; |
136 | 133 |
137 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, | 134 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, |
138 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; | 135 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; |
139 unsigned char *buffer = NULL; | 136 unsigned char *buffer = NULL; |
140 | 137 |
141 apps_startup(); | 138 apps_startup(); |
142 | 139 |
143 if (bio_err == NULL) | 140 if (bio_err == NULL) |
144 if ((bio_err=BIO_new(BIO_s_file())) != NULL) | 141 if ((bio_err=BIO_new(BIO_s_file())) != NULL) |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 else | 330 else |
334 { | 331 { |
335 if (BIO_write_filename(out,outfile) <= 0) | 332 if (BIO_write_filename(out,outfile) <= 0) |
336 { | 333 { |
337 perror(outfile); | 334 perror(outfile); |
338 goto end; | 335 goto end; |
339 } | 336 } |
340 } | 337 } |
341 | 338 |
342 #ifndef OPENSSL_NO_ENGINE | 339 #ifndef OPENSSL_NO_ENGINE |
343 » e = setup_engine(bio_err, engine, 0); | 340 » setup_engine(bio_err, engine, 0); |
344 #endif | 341 #endif |
345 | 342 |
346 if (list_curves) | 343 if (list_curves) |
347 { | 344 { |
348 EC_builtin_curve *curves = NULL; | 345 EC_builtin_curve *curves = NULL; |
349 size_t crv_len = 0; | 346 size_t crv_len = 0; |
350 size_t n = 0; | 347 size_t n = 0; |
351 | 348 |
352 crv_len = EC_get_builtin_curves(NULL, 0); | 349 crv_len = EC_get_builtin_curves(NULL, 0); |
353 | 350 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 BIO_printf(out, "\n\t"); | 715 BIO_printf(out, "\n\t"); |
719 BIO_printf(out, "0x%02X,", buffer[i]); | 716 BIO_printf(out, "0x%02X,", buffer[i]); |
720 } | 717 } |
721 if ((i%12) == 0) | 718 if ((i%12) == 0) |
722 BIO_printf(out, "\n\t"); | 719 BIO_printf(out, "\n\t"); |
723 BIO_printf(out, "0x%02X", buffer[i]); | 720 BIO_printf(out, "0x%02X", buffer[i]); |
724 } | 721 } |
725 BIO_printf(out, "\n\t};\n\n"); | 722 BIO_printf(out, "\n\t};\n\n"); |
726 return 1; | 723 return 1; |
727 } | 724 } |
| 725 #else /* !OPENSSL_NO_EC */ |
| 726 |
| 727 # if PEDANTIC |
| 728 static void *dummy=&dummy; |
| 729 # endif |
| 730 |
728 #endif | 731 #endif |
OLD | NEW |