projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR: 1833
[oweals/openssl.git]
/
apps
/
ecparam.c
diff --git
a/apps/ecparam.c
b/apps/ecparam.c
index 010e214e5711bb616ea08ff24a979333cf30f9ae..465480bedd01bf9d0607577ce3156bfdd61ef890 100644
(file)
--- a/
apps/ecparam.c
+++ b/
apps/ecparam.c
@@
-3,7
+3,7
@@
* Written by Nils Larsch for the OpenSSL project.
*/
/* ====================================================================
* Written by Nils Larsch for the OpenSSL project.
*/
/* ====================================================================
- * Copyright (c) 1998-200
2
The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-200
5
The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@
-68,6
+68,8
@@
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
*
*/
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
*
*/
+
+#include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_EC
#include <assert.h>
#include <stdio.h>
#ifndef OPENSSL_NO_EC
#include <assert.h>
#include <stdio.h>
@@
-127,7
+129,6
@@
int MAIN(int argc, char **argv)
char *infile = NULL, *outfile = NULL, *prog;
BIO *in = NULL, *out = NULL;
int informat, outformat, noout = 0, C = 0, ret = 1;
char *infile = NULL, *outfile = NULL, *prog;
BIO *in = NULL, *out = NULL;
int informat, outformat, noout = 0, C = 0, ret = 1;
- ENGINE *e = NULL;
char *engine = NULL;
BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
char *engine = NULL;
BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
@@
-335,18
+336,19
@@
bad:
}
}
}
}
- e = setup_engine(bio_err, engine, 0);
+#ifndef OPENSSL_NO_ENGINE
+ setup_engine(bio_err, engine, 0);
+#endif
if (list_curves)
{
EC_builtin_curve *curves = NULL;
size_t crv_len = 0;
size_t n = 0;
if (list_curves)
{
EC_builtin_curve *curves = NULL;
size_t crv_len = 0;
size_t n = 0;
- size_t len;
crv_len = EC_get_builtin_curves(NULL, 0);
crv_len = EC_get_builtin_curves(NULL, 0);
- curves = OPENSSL_malloc(
sizeof(EC_builtin_curve) * crv_len
);
+ curves = OPENSSL_malloc(
(int)(sizeof(EC_builtin_curve) * crv_len)
);
if (curves == NULL)
goto end;
if (curves == NULL)
goto end;
@@
-369,11
+371,8
@@
bad:
if (sname == NULL)
sname = "";
if (sname == NULL)
sname = "";
- len = BIO_printf(out, " %-10s: ", sname);
- if (len + strlen(comment) > 80)
- BIO_printf(out, "\n%80s\n", comment);
- else
- BIO_printf(out, "%s\n", comment);
+ BIO_printf(out, " %-10s: ", sname);
+ BIO_printf(out, "%s\n", comment);
}
OPENSSL_free(curves);
}
OPENSSL_free(curves);
@@
-411,7
+410,7
@@
bad:
goto end;
}
goto end;
}
- group = EC_GROUP_new_by_
nid
(nid);
+ group = EC_GROUP_new_by_
curve_name
(nid);
if (group == NULL)
{
BIO_printf(bio_err, "unable to create curve (%s)\n",
if (group == NULL)
{
BIO_printf(bio_err, "unable to create curve (%s)\n",
@@
-647,11
+646,11
@@
bad:
assert(need_rand);
assert(need_rand);
- eckey->group = group;
+ if (EC_KEY_set_group(eckey, group) == 0)
+ goto end;
if (!EC_KEY_generate_key(eckey))
{
if (!EC_KEY_generate_key(eckey))
{
- eckey->group = NULL;
EC_KEY_free(eckey);
goto end;
}
EC_KEY_free(eckey);
goto end;
}
@@
-664,11
+663,9
@@
bad:
{
BIO_printf(bio_err, "bad output format specified "
"for outfile\n");
{
BIO_printf(bio_err, "bad output format specified "
"for outfile\n");
- eckey->group = NULL;
EC_KEY_free(eckey);
goto end;
}
EC_KEY_free(eckey);
goto end;
}
- eckey->group = NULL;
EC_KEY_free(eckey);
}
EC_KEY_free(eckey);
}
@@
-701,7
+698,7
@@
end:
OPENSSL_EXIT(ret);
}
OPENSSL_EXIT(ret);
}
-int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
+
static
int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
int len, unsigned char *buffer)
{
BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);
int len, unsigned char *buffer)
{
BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);
@@
-725,4
+722,10
@@
int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
BIO_printf(out, "\n\t};\n\n");
return 1;
}
BIO_printf(out, "\n\t};\n\n");
return 1;
}
+#else /* !OPENSSL_NO_EC */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
#endif
#endif