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:22:10 +0000 (15:22 +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)

(cherry picked from commit 975e37cd016f86985d16f1ee646e88213494854a)

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

index e8d5e46ab5365ddefc026820dcd5536252d49b13..6b35a45ff458fcb79bea52abbe70552ff85ddbbd 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 e819030eecf74780380f4b49c1bc211207ece4e3..930cd372f87d3e3dc92427410fb8f1eb4bfcf0df 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 59cccbd4e597919bdabe09a15e9f3e5a69a8d4db..6e37aa27f2328bf444ce55b6c13600871dbaddc2 100644 (file)
@@ -185,11 +185,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 */