#define USE_SOCKETS
#include "e_os.h"
-#define _XOPEN_SOURCE 1 /* Or isascii won't be declared properly on
+#define _XOPEN_SOURCE 500 /* Or isascii won't be declared properly on
VMS (at least with DECompHP C). */
#include <ctype.h>
#ifndef OPENSSL_NO_ECDH
if (!no_ecdhe)
{
- ecdh = EC_KEY_new();
- if (ecdh != NULL)
- {
- if (named_curve)
- {
- int nid = OBJ_sn2nid(named_curve);
-
- if (nid == 0)
- {
- BIO_printf(bio_err, "unknown curve name (%s)\n", named_curve);
- EC_KEY_free(ecdh);
- goto end;
- }
+ int nid;
- ecdh->group = EC_GROUP_new_by_curve_name(nid);
- if (ecdh->group == NULL)
- {
- BIO_printf(bio_err, "unable to create curve (%s)\n", named_curve);
- EC_KEY_free(ecdh);
- goto end;
- }
+ if (named_curve != NULL)
+ {
+ nid = OBJ_sn2nid(named_curve);
+ if (nid == 0)
+ {
+ BIO_printf(bio_err, "unknown curve name (%s)\n", named_curve);
+ goto end;
}
-
- if (ecdh->group == NULL)
- ecdh->group=EC_GROUP_new_by_curve_name(NID_sect163r2);
+ }
+ else
+ nid = NID_sect163r2;
- SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
- SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
- EC_KEY_free(ecdh);
+ ecdh = EC_KEY_new_by_curve_name(nid);
+ if (ecdh == NULL)
+ {
+ BIO_printf(bio_err, "unable to create curve\n");
+ goto end;
}
+
+ SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
+ SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
+ EC_KEY_free(ecdh);
}
#else
(void)no_ecdhe;