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
135 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
136 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
137 unsigned char *buffer = NULL;
138
139 apps_startup();
140
141 if (bio_err == NULL)
--- 164 unchanged lines hidden (view full) ---
306# endif
307 } else {
308 if (BIO_write_filename(out, outfile) <= 0) {
309 perror(outfile);
310 goto end;
311 }
312 }
313
314# ifndef OPENSSL_NO_ENGINE
315 setup_engine(bio_err, engine, 0);
316# endif
317
318 if (list_curves) {
319 EC_builtin_curve *curves = NULL;
320 size_t crv_len = 0;
321 size_t n = 0;
322
323 crv_len = EC_get_builtin_curves(NULL, 0);
324
--- 290 unchanged lines hidden (view full) ---
615 if (ec_gen)
616 BN_free(ec_gen);
617 if (ec_order)
618 BN_free(ec_order);
619 if (ec_cofactor)
620 BN_free(ec_cofactor);
621 if (buffer)
622 OPENSSL_free(buffer);
623 if (in != NULL)
624 BIO_free(in);
625 if (out != NULL)
626 BIO_free_all(out);
627 if (group != NULL)
628 EC_GROUP_free(group);
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
135 BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
136 *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
137 unsigned char *buffer = NULL;
138
139 apps_startup();
140
141 if (bio_err == NULL)
--- 164 unchanged lines hidden (view full) ---
306# endif
307 } else {
308 if (BIO_write_filename(out, outfile) <= 0) {
309 perror(outfile);
310 goto end;
311 }
312 }
313
314# ifndef OPENSSL_NO_ENGINE
315 setup_engine(bio_err, engine, 0);
316# endif
317
318 if (list_curves) {
319 EC_builtin_curve *curves = NULL;
320 size_t crv_len = 0;
321 size_t n = 0;
322
323 crv_len = EC_get_builtin_curves(NULL, 0);
324
--- 290 unchanged lines hidden (view full) ---
615 if (ec_gen)
616 BN_free(ec_gen);
617 if (ec_order)
618 BN_free(ec_order);
619 if (ec_cofactor)
620 BN_free(ec_cofactor);
621 if (buffer)
622 OPENSSL_free(buffer);
623 if (in != NULL)
624 BIO_free(in);
625 if (out != NULL)
626 BIO_free_all(out);
627 if (group != NULL)
628 EC_GROUP_free(group);
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 ---