]> granicus.if.org Git - openssl/commitdiff
Fix s_client so it works without a certificate again.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 13 Dec 2004 18:02:23 +0000 (18:02 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 13 Dec 2004 18:02:23 +0000 (18:02 +0000)
apps/s_cb.c
apps/s_client.c

index 21aab25d7e05667f7ad8ee2fa55a30a2be9bf82a..92d9ae8893159143375a7e32e239a8358deef6a2 100644 (file)
@@ -231,6 +231,8 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
 
 int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
        {
+       if (cert ==  NULL)
+               return 1;
        if (SSL_CTX_use_certificate(ctx,cert) <= 0)
                {
                BIO_printf(bio_err,"error setting certificate\n");
index 0204b517b1fc871eea312139dfc1a5a37141036a..c1fcd9d97f05ed8e675cee3c32bf050ce798ef20 100644 (file)
@@ -482,21 +482,32 @@ bad:
        if (key_file == NULL)
                key_file = cert_file;
 
-       key = load_key(bio_err, key_file, key_format, 0, pass, e,
-                      "client certificate private key file");
-       if (!key)
+
+       if (key_file)
+
                {
-               ERR_print_errors(bio_err);
-               goto end;
+
+               key = load_key(bio_err, key_file, key_format, 0, pass, e,
+                              "client certificate private key file");
+               if (!key)
+                       {
+                       ERR_print_errors(bio_err);
+                       goto end;
+                       }
+
                }
 
-       cert = load_cert(bio_err,cert_file,cert_format,
-                       NULL, e, "client certificate file");
+       if (cert_file)
 
-       if (!cert)
                {
-               ERR_print_errors(bio_err);
-               goto end;
+               cert = load_cert(bio_err,cert_file,cert_format,
+                               NULL, e, "client certificate file");
+
+               if (!cert)
+                       {
+                       ERR_print_errors(bio_err);
+                       goto end;
+                       }
                }
 
        if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL