Remove unnecessary BIO_do_handshake()s
authorNan Xiao <nan@chinadtrace.org>
Mon, 29 Mar 2021 09:24:01 +0000 (17:24 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 1 Apr 2021 13:21:47 +0000 (15:21 +0200)
Since BIO_do_connect() and BIO_do_handshake() are same, no
need to invoke BIO_do_handshake() once more after BIO_do_connect().

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14725)

demos/bio/client-arg.c
demos/bio/client-conf.c
doc/man3/BIO_f_ssl.pod

index 976fefff5da360dbc8dc5b59153f9735e4b78c61..27c4c98f966483d78743102edd0c0ddcfaa4ecd4 100644 (file)
@@ -94,12 +94,6 @@ int main(int argc, char **argv)
         goto end;
     }
 
-    if (BIO_do_handshake(sbio) <= 0) {
-        fprintf(stderr, "Error establishing SSL connection\n");
-        ERR_print_errors_fp(stderr);
-        goto end;
-    }
-
     /* Could examine ssl here to get connection info */
 
     BIO_puts(sbio, "GET / HTTP/1.0\n\n");
index 84edc796dcf24ac5340dc5a66a8fb27af49ae091..270df377e7dbcd4421426216744fe0123056cc14 100644 (file)
@@ -102,12 +102,6 @@ int main(int argc, char **argv)
         goto end;
     }
 
-    if (BIO_do_handshake(sbio) <= 0) {
-        fprintf(stderr, "Error establishing SSL connection\n");
-        ERR_print_errors_fp(stderr);
-        goto end;
-    }
-
     /* Could examine ssl here to get connection info */
 
     BIO_puts(sbio, "GET / HTTP/1.0\n\n");
index 6a21e0c41cdf57df219aa278e7086a7078bae4eb..8eee317c7adf22064f3c33bdfc9a456c3dc11190 100644 (file)
@@ -188,11 +188,6 @@ unencrypted example in L<BIO_s_connect(3)>.
      ERR_print_errors_fp(stderr);
      exit(1);
  }
- if (BIO_do_handshake(sbio) <= 0) {
-     fprintf(stderr, "Error establishing SSL connection\n");
-     ERR_print_errors_fp(stderr);
-     exit(1);
- }
 
  /* XXX Could examine ssl here to get connection info */