Add options to set additional type specific certificate chains to
[openssl.git] / apps / s_client.c
index 30588ccf66b0dab8cc5d708e87d35b8eb5c7e33f..16f1ac37dbb0ae3dcd32be3cef1f325ee02d35f3 100644 (file)
@@ -601,6 +601,7 @@ int MAIN(int argc, char **argv)
 #endif
 #ifndef OPENSSL_NO_TLSEXT
        char *servername = NULL; 
+       char *curves=NULL;
         tlsextctx tlsextcbp = 
         {NULL,0};
 # ifndef OPENSSL_NO_NEXTPROTONEG
@@ -622,13 +623,7 @@ int MAIN(int argc, char **argv)
        SRP_ARG srp_arg = {NULL,NULL,0,0,0,1024};
 #endif
 
-#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
        meth=SSLv23_client_method();
-#elif !defined(OPENSSL_NO_SSL3)
-       meth=SSLv3_client_method();
-#elif !defined(OPENSSL_NO_SSL2)
-       meth=SSLv2_client_method();
-#endif
 
        apps_startup();
        c_Pause=0;
@@ -943,6 +938,11 @@ int MAIN(int argc, char **argv)
                        servername= *(++argv);
                        /* meth=TLSv1_client_method(); */
                        }
+               else if (strcmp(*argv,"-curves") == 0)
+                       {
+                       if (--argc < 1) goto bad;
+                       curves= *(++argv);
+                       }
 #endif
 #ifndef OPENSSL_NO_JPAKE
                else if (strcmp(*argv,"-jpake") == 0)
@@ -1170,7 +1170,7 @@ bad:
 #endif
 
        SSL_CTX_set_verify(ctx,verify,verify_callback);
-       if (!set_cert_key_stuff(ctx,cert,key))
+       if (!set_cert_key_stuff(ctx,cert,key, NULL))
                goto end;
 
        if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
@@ -1182,6 +1182,12 @@ bad:
                }
 
 #ifndef OPENSSL_NO_TLSEXT
+       if (curves != NULL)
+               if(!SSL_CTX_set1_curves_list(ctx,curves)) {
+               BIO_printf(bio_err,"error setting curve list\n");
+               ERR_print_errors(bio_err);
+               goto end;
+       }
        if (servername != NULL)
                {
                tlsextcbp.biodebug = bio_err;
@@ -1209,21 +1215,6 @@ bad:
 #endif
 
        con=SSL_new(ctx);
-#if 0
-{
-int curves[3];
-int rv;
-curves[0] = EC_curve_nist2nid("P-256");
-curves[1] = EC_curve_nist2nid("P-521");
-curves[2] = EC_curve_nist2nid("P-384");
-rv = SSL_set1_curvelist(con, curves, sizeof(curves)/sizeof(int));
-if (rv == 0)
-       {
-       fprintf(stderr, "Error setting curve list\n");
-       exit(1);
-       }
-}
-#endif
        if (sess_in)
                {
                SSL_SESSION *sess;