Commit 9472baae authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Backport TLS v1.2 support from HEAD.

This includes TLS v1.2 server and client support but at present
client certificate support is not implemented.
parent ae17b9ec
Loading
Loading
Loading
Loading
+20 −0
Changes for CHANGES: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,26 @@

 Changes between 1.0.0d and 1.0.1  [xx XXX xxxx]

  *) Initial TLS v1.2 client support. Add a default signature algorithms
     extension including all the algorithms we support. Parse new signature
     format in client key exchange. Relax some ECC signing restrictions for
     TLS v1.2 as indicated in RFC5246.
     [Steve Henson]

  *) Add server support for TLS v1.2 signature algorithms extension. Switch
     to new signature format when needed using client digest preference.
     All server ciphersuites should now work correctly in TLS v1.2. No client
     support yet and no support for client certificates.
     [Steve Henson]

  *) Initial TLS v1.2 support. Add new SHA256 digest to ssl code, switch
     to SHA256 for PRF when using TLS v1.2 and later. Add new SHA256 based
     ciphersuites. At present only RSA key exchange ciphersuites work with
     TLS v1.2. Add new option for TLS v1.2 replacing the old and obsolete
     SSL_OP_PKCS1_CHECK flags with SSL_OP_NO_TLSv1_2. New TLSv1.2 methods
     and version checking.
     [Steve Henson]
 
  *) New option OPENSSL_NO_SSL_INTERN. If an application can be compiled
     with this defined it will not be affected by any changes to ssl internal
     structures. Add several utility functions to allow openssl application
+4 −0
Changes for apps/s_cb.c: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -673,6 +673,10 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
		extname = "renegotiate";
		break;

		case TLSEXT_TYPE_signature_algorithms:
		extname = "signature algorithms";
		break;

#ifdef TLSEXT_TYPE_opaque_prf_input
		case TLSEXT_TYPE_opaque_prf_input:
		extname = "opaque PRF input";
+22 −1
Changes for apps/s_client.c: 22 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -328,11 +328,12 @@ static void sc_usage(void)
#endif
	BIO_printf(bio_err," -ssl2         - just use SSLv2\n");
	BIO_printf(bio_err," -ssl3         - just use SSLv3\n");
	BIO_printf(bio_err," -tls1_2       - just use TLSv1.2\n");
	BIO_printf(bio_err," -tls1_1       - just use TLSv1.1\n");
	BIO_printf(bio_err," -tls1         - just use TLSv1\n");
	BIO_printf(bio_err," -dtls1        - just use DTLSv1\n");    
	BIO_printf(bio_err," -mtu          - set the link layer MTU\n");
	BIO_printf(bio_err," -no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
	BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
	BIO_printf(bio_err," -bugs         - Switch on all SSL implementation bug workarounds\n");
	BIO_printf(bio_err," -serverpref   - Use server's cipher preferences (only SSLv2)\n");
	BIO_printf(bio_err," -cipher       - preferred cipher to use, use the 'openssl ciphers'\n");
@@ -750,6 +751,8 @@ int MAIN(int argc, char **argv)
			meth=SSLv3_client_method();
#endif
#ifndef OPENSSL_NO_TLS1
		else if	(strcmp(*argv,"-tls1_2") == 0)
			meth=TLSv1_2_client_method();
		else if	(strcmp(*argv,"-tls1_1") == 0)
			meth=TLSv1_1_client_method();
		else if	(strcmp(*argv,"-tls1") == 0)
@@ -800,6 +803,8 @@ int MAIN(int argc, char **argv)
			if (--argc < 1) goto bad;
			CAfile= *(++argv);
			}
		else if (strcmp(*argv,"-no_tls1_2") == 0)
			off|=SSL_OP_NO_TLSv1_2;
		else if (strcmp(*argv,"-no_tls1_1") == 0)
			off|=SSL_OP_NO_TLSv1_1;
		else if (strcmp(*argv,"-no_tls1") == 0)
@@ -1036,6 +1041,9 @@ bad:
		SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
		}
#endif
	/* HACK while TLS v1.2 is disabled by default */
	if (!(off & SSL_OP_NO_TLSv1_2))
		SSL_CTX_clear_options(ctx, SSL_OP_NO_TLSv1_2);
	if (bugs)
		SSL_CTX_set_options(ctx,SSL_OP_ALL|off);
	else
@@ -1927,6 +1935,19 @@ static void print_stuff(BIO *bio, SSL *s, int full)
	BIO_printf(bio,"Expansion: %s\n",
		expansion ? SSL_COMP_get_name(expansion) : "NONE");
#endif
 
#ifdef SSL_DEBUG
	{
	/* Print out local port of connection: useful for debugging */
	int sock;
	struct sockaddr_in ladd;
	socklen_t ladd_size = sizeof(ladd);
	sock = SSL_get_fd(s);
	getsockname(sock, (struct sockaddr *)&ladd, &ladd_size);
	BIO_printf(bio_c_out, "LOCAL PORT is %u\n", ntohs(ladd.sin_port));
	}
#endif

	SSL_SESSION_print(bio,SSL_get_session(s));
	BIO_printf(bio,"---\n");
	if (peer != NULL)
+9 −0
Changes for apps/s_server.c: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -499,6 +499,7 @@ static void sv_usage(void)
#endif
	BIO_printf(bio_err," -ssl2         - Just talk SSLv2\n");
	BIO_printf(bio_err," -ssl3         - Just talk SSLv3\n");
	BIO_printf(bio_err," -tls1_2       - Just talk TLSv1.2\n");
	BIO_printf(bio_err," -tls1_1       - Just talk TLSv1.1\n");
	BIO_printf(bio_err," -tls1         - Just talk TLSv1\n");
	BIO_printf(bio_err," -dtls1        - Just talk DTLSv1\n");
@@ -509,6 +510,7 @@ static void sv_usage(void)
	BIO_printf(bio_err," -no_ssl3      - Just disable SSLv3\n");
	BIO_printf(bio_err," -no_tls1      - Just disable TLSv1\n");
	BIO_printf(bio_err," -no_tls1_1    - Just disable TLSv1.1\n");
	BIO_printf(bio_err," -no_tls1_2    - Just disable TLSv1.2\n");
#ifndef OPENSSL_NO_DH
	BIO_printf(bio_err," -no_dhe       - Disable ephemeral DH\n");
#endif
@@ -1190,6 +1192,8 @@ int MAIN(int argc, char *argv[])
			{ off|=SSL_OP_NO_TLSv1; }
		else if	(strcmp(*argv,"-no_tls1_1") == 0)
			{ off|=SSL_OP_NO_TLSv1_1; }
		else if	(strcmp(*argv,"-no_tls1_2") == 0)
			{ off|=SSL_OP_NO_TLSv1_2; }
		else if	(strcmp(*argv,"-no_comp") == 0)
			{ off|=SSL_OP_NO_COMPRESSION; }
#ifndef OPENSSL_NO_TLSEXT
@@ -1209,6 +1213,8 @@ int MAIN(int argc, char *argv[])
			{ meth=TLSv1_server_method(); }
		else if	(strcmp(*argv,"-tls1_1") == 0)
			{ meth=TLSv1_1_server_method(); }
		else if	(strcmp(*argv,"-tls1_2") == 0)
			{ meth=TLSv1_2_server_method(); }
#endif
#ifndef OPENSSL_NO_DTLS1
		else if	(strcmp(*argv,"-dtls1") == 0)
@@ -1457,6 +1463,9 @@ bad:
	SSL_CTX_set_quiet_shutdown(ctx,1);
	if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
	if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
	/* HACK while TLS v1.2 is disabled by default */
	if (!(off & SSL_OP_NO_TLSv1_2))
		SSL_CTX_clear_options(ctx, SSL_OP_NO_TLSv1_2);
	SSL_CTX_set_options(ctx,off);
	/* DTLS: partial reads end up discarding unread UDP bytes :-( 
	 * Setting read ahead solves this problem.
+1 −1
Changes for ssl/d1_srvr.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1139,7 +1139,7 @@ int dtls1_send_server_key_exchange(SSL *s)
		if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)
			&& !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK))
			{
			if ((pkey=ssl_get_sign_pkey(s,s->s3->tmp.new_cipher))
			if ((pkey=ssl_get_sign_pkey(s,s->s3->tmp.new_cipher, NULL))
				== NULL)
				{
				al=SSL_AD_DECODE_ERROR;
Loading