fix "dereferencing type-punned pointer will break strict-aliasing rules"
[openssl.git] / apps / s_server.c
index 059c4a06c7e9e3a7a5618d84cbd468da309944b4..59b6305e97a5cf8d3584f147f2540ecf0b92b79c 100644 (file)
@@ -525,7 +525,7 @@ int MAIN(int argc, char *argv[])
        int vflags = 0;
        short port=PORT;
        char *CApath=NULL,*CAfile=NULL;
-       char *context = NULL;
+       unsigned char *context = NULL;
        char *dhfile = NULL;
        char *named_curve = NULL;
        int badop=0,bugs=0;
@@ -604,7 +604,7 @@ int MAIN(int argc, char *argv[])
                else if (strcmp(*argv,"-context") == 0)
                        {
                        if (--argc < 1) goto bad;
-                       context= *(++argv);
+                       context= (unsigned char *)*(++argv);
                        }
                else if (strcmp(*argv,"-cert") == 0)
                        {
@@ -981,13 +981,6 @@ bad:
                {
                EC_KEY *ecdh=NULL;
 
-               ecdh = EC_KEY_new();
-               if (ecdh == NULL)
-                       {
-                       BIO_printf(bio_err,"Could not create ECDH struct.\n");
-                       goto end;
-                       }
-
                if (named_curve)
                        {
                        int nid = OBJ_sn2nid(named_curve);
@@ -998,9 +991,8 @@ bad:
                                        named_curve);
                                goto end;
                                }
-
-                       ecdh->group = EC_GROUP_new_by_nid(nid);
-                       if (ecdh->group == NULL)
+                       ecdh = EC_KEY_new_by_curve_name(nid);
+                       if (ecdh == NULL)
                                {
                                BIO_printf(bio_err, "unable to create curve (%s)\n", 
                                        named_curve);
@@ -1008,15 +1000,15 @@ bad:
                                }
                        }
 
-               if (ecdh->group != NULL)
+               if (ecdh != NULL)
                        {
                        BIO_printf(bio_s_out,"Setting temp ECDH parameters\n");
                        }
                else
                        {
                        BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
-                       ecdh->group=EC_GROUP_new_by_nid(NID_sect163r2);
-                       if (ecdh->group == NULL) 
+                       ecdh = EC_KEY_new_by_curve_name(NID_sect163r2);
+                       if (ecdh == NULL) 
                                {
                                BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
                                goto end;