title: Difference in openssl implementation while testing ssl/tls version support
body: <p>I am trying to test tls/ssl version support using <code>openssl</code>. I see there is difference in result in 3 different versions of OpenSSL.</p>
  
  <p><strong>OpenSSL 1.0.1j 15 Oct 2014:</strong> Please note that in this case I am able to make a connection using openssl and even able to test ssl2, tls1 etc. but below output only comes when trying to test ssl3. So, I am not able to understand the behavior.</p>
  
  <pre><code>C:\Users\himanshu.agrawal&gt;openssl s_client -connect facebook.com:443 -ssl3
  WARNING: can't open config file: /apache24/conf/openssl.cnf
  unknown option -ssl3
  usage: s_client args
  
   -host host     - use -connect instead
   -port port     - use -connect instead
   -connect host:port - who to connect to (default is localhost:4433)
   -verify arg   - turn on peer certificate verification
   -verify_return_error - return verification errors
   -cert arg     - certificate file to use, PEM format assumed
   -certform arg - certificate format (PEM or DER) PEM default
   -key arg      - Private key file to use, in cert file if
                   not specified but cert file is.
   -keyform arg  - key format (PEM or DER) PEM default
   -pass arg     - private key file pass phrase source
   -CApath arg   - PEM format directory of CA's
   -CAfile arg   - PEM format file of CA's
   -reconnect    - Drop and re-make the connection with the same Session-ID
   -pause        - sleep(1) after each read(2) and write(2) system call
   -prexit       - print session information even on connection failure
   -showcerts    - show all certificates in the chain
   -debug        - extra output
   -msg          - Show protocol messages
   -nbio_test    - more ssl protocol testing
   -state        - print the 'ssl' states
   -nbio         - Run with non-blocking IO
   -crlf         - convert LF from terminal into CRLF
   -quiet        - no s_client output
   -ign_eof      - ignore input eof (default when -quiet)
   -no_ign_eof   - don't ignore input eof
   -psk_identity arg - PSK identity
   -psk arg      - PSK in hex (without 0x)
   -srpuser user     - SRP authentification for 'user'
   -srppass arg      - password for 'user'
   -srp_lateuser     - SRP username into second ClientHello message
   -srp_moregroups   - Tolerate other than the known g N values.
   -srp_strength int - minimal mength in bits for N (default 1024).
   -ssl2         - just use SSLv2
   -ssl3         - just use SSLv3
   -tls1_2       - just use TLSv1.2
   -tls1_1       - just use TLSv1.1
   -tls1         - just use TLSv1
   -dtls1        - just use DTLSv1
   -fallback_scsv - send TLS_FALLBACK_SCSV
   -mtu          - set the link layer MTU
   -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol
   -bugs         - Switch on all SSL implementation bug workarounds
   -serverpref   - Use server's cipher preferences (only SSLv2)
   -cipher       - preferred cipher to use, use the 'openssl ciphers'
                   command to see what is available
   -starttls prot - use the STARTTLS command before starting TLS
                   for those protocols that support it, where
                   'prot' defines which one to assume.  Currently,
                   only "smtp", "pop3", "imap", "ftp" and "xmpp"
                   are supported.
   -engine id    - Initialise and use the specified engine
   -rand file;file;...
   -sess_out arg - file to write SSL session to
   -sess_in arg  - file to read SSL session from
   -servername host  - Set TLS extension servername in ClientHello
   -tlsextdebug      - hex dump of all TLS extensions received
   -status           - request certificate status from server
   -no_ticket        - disable use of RFC4507bis session tickets
   -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)
   -legacy_renegotiation - enable use of legacy renegotiation (dangerous)
   -use_srtp profiles - Offer SRTP key management with a colon-separated profile list
   -keymatexport label   - Export keying material using label
   -keymatexportlen len  - Export len bytes of keying material (default 20)
  </code></pre>
  
  <p><strong>OpenSSL 1.0.2d 9 Jul 2015</strong></p>
  
  <pre><code>$ openssl s_client -connect facebook.com:443 -ssl3
  CONNECTED(00000003)
  2282780:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1472:SSL alert number 40
  2282780:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 7 bytes and written 0 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  No ALPN negotiated
  SSL-Session:
      Protocol  : SSLv3
      Cipher    : 0000
      Session-ID:
      Session-ID-ctx:
      Master-Key:
      Key-Arg   : None
      PSK identity: None
      PSK identity hint: None
      SRP username: None
      Start Time: 1449768766
      Timeout   : 7200 (sec)
      Verify return code: 0 (ok)
  ---
  </code></pre>
  
  <p><strong>OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008:</strong>
  I know SSL3 is disabled in Facebook but interestingly I am getting a SSL connection established. But when I look closely then I see that server certificate is totally different. Actually this time I am running command on a remote box and that's a private network and I am connecting to it using VPN and then executing openssl command. Could something related to this.</p>
  
  <p>Anybody has any idea or seen such differences, especially first 2.</p>