1/* apps/ecparam.c */
2/*
3 * Written by Nils Larsch for the OpenSSL project.
4 */
5/* ====================================================================
6 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 117 unchanged lines hidden (view full) ---
126 int new_asn1_flag = 0;
127 char *curve_name = NULL, *inrand = NULL;
128 int list_curves = 0, no_seed = 0, check = 0,
129 badops = 0, text = 0, i, need_rand = 0, genkey = 0;
130 char *infile = NULL, *outfile = NULL, *prog;
131 BIO *in = NULL, *out = NULL;
132 int informat, outformat, noout = 0, C = 0, ret = 1;
133 char *engine = NULL;
134 ENGINE *e = NULL;
135
136 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
137 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
138 unsigned char *buffer = NULL;
139
140 apps_startup();
141
142 if (bio_err == NULL)
--- 164 unchanged lines hidden (view full) ---
307# endif
308 } else {
309 if (BIO_write_filename(out, outfile) <= 0) {
310 perror(outfile);
311 goto end;
312 }
313 }
314
315 e = setup_engine(bio_err, engine, 0);
316
317 if (list_curves) {
318 EC_builtin_curve *curves = NULL;
319 size_t crv_len = 0;
320 size_t n = 0;
321
322 crv_len = EC_get_builtin_curves(NULL, 0);
323
--- 290 unchanged lines hidden (view full) ---
614 if (ec_gen)
615 BN_free(ec_gen);
616 if (ec_order)
617 BN_free(ec_order);
618 if (ec_cofactor)
619 BN_free(ec_cofactor);
620 if (buffer)
621 OPENSSL_free(buffer);
622 if (group != NULL)
623 EC_GROUP_free(group);
624 release_engine(e);
625 if (in != NULL)
626 BIO_free(in);
627 if (out != NULL)
628 BIO_free_all(out);
629 apps_shutdown();
630 OPENSSL_EXIT(ret);
631}
632
633static int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
634 int len, unsigned char *buffer)
635{
636 BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);
--- 25 unchanged lines hidden ---
2/*
3 * Written by Nils Larsch for the OpenSSL project.
4 */
5/* ====================================================================
6 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 117 unchanged lines hidden (view full) ---
126 int new_asn1_flag = 0;
127 char *curve_name = NULL, *inrand = NULL;
128 int list_curves = 0, no_seed = 0, check = 0,
129 badops = 0, text = 0, i, need_rand = 0, genkey = 0;
130 char *infile = NULL, *outfile = NULL, *prog;
131 BIO *in = NULL, *out = NULL;
132 int informat, outformat, noout = 0, C = 0, ret = 1;
133 char *engine = NULL;
134 ENGINE *e = NULL;
135
136 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
137 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
138 unsigned char *buffer = NULL;
139
140 apps_startup();
141
142 if (bio_err == NULL)
--- 164 unchanged lines hidden (view full) ---
307# endif
308 } else {
309 if (BIO_write_filename(out, outfile) <= 0) {
310 perror(outfile);
311 goto end;
312 }
313 }
314
315 e = setup_engine(bio_err, engine, 0);
316
317 if (list_curves) {
318 EC_builtin_curve *curves = NULL;
319 size_t crv_len = 0;
320 size_t n = 0;
321
322 crv_len = EC_get_builtin_curves(NULL, 0);
323
--- 290 unchanged lines hidden (view full) ---
614 if (ec_gen)
615 BN_free(ec_gen);
616 if (ec_order)
617 BN_free(ec_order);
618 if (ec_cofactor)
619 BN_free(ec_cofactor);
620 if (buffer)
621 OPENSSL_free(buffer);
622 if (group != NULL)
623 EC_GROUP_free(group);
624 release_engine(e);
625 if (in != NULL)
626 BIO_free(in);
627 if (out != NULL)
628 BIO_free_all(out);
629 apps_shutdown();
630 OPENSSL_EXIT(ret);
631}
632
633static int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
634 int len, unsigned char *buffer)
635{
636 BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);
--- 25 unchanged lines hidden ---