The branch master has been updated via 0a6793c942b525124990847b50ee18c7dc3359d4 (commit) via 3cf96e88b78df21bc2ac09a793d1c66ce7912760 (commit) via 0785274ca53bbc20774186df6081dc75258db9bb (commit) via 397f4f78760480f982adaeed98ccb10bda4d3fbb (commit) via 3b58c54f26b826abd55a513494ef892e7ad069ad (commit) from 67adf0a7c273a82901ce8705ae8d71ee2f1c959c (commit)
- Log ----------------------------------------------------------------- commit 0a6793c942b525124990847b50ee18c7dc3359d4 Author: Matt Caswell <m...@openssl.org> Date: Thu Dec 29 10:42:15 2016 +0000 Fix CT test_sslmessages hangs The CT tests in test_sslmessages require EC to be available, therefore we must skip these if no-ec Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2153) commit 3cf96e88b78df21bc2ac09a793d1c66ce7912760 Author: Matt Caswell <m...@openssl.org> Date: Wed Dec 28 15:32:39 2016 +0000 Fix compilation with no-ec Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2153) commit 0785274ca53bbc20774186df6081dc75258db9bb Author: Matt Caswell <m...@openssl.org> Date: Wed Dec 28 17:30:51 2016 +0000 Fix extension for various no- options Previously we were omitting the extension information from ext_defs if the association no- option was defined. This doesn't work because the indexes into the table are no longer valid. Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2153) commit 397f4f78760480f982adaeed98ccb10bda4d3fbb Author: Matt Caswell <m...@openssl.org> Date: Wed Dec 28 15:01:57 2016 +0000 Add a test to check the EC point formats extension appears when we expect The previous commit fixed a bug where the EC point formats extensions did not appear in the ServerHello. This should have been caught by 70-test_sslmessages but that test never tries an EC ciphersuite. This updates the test to do that. Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2153) commit 3b58c54f26b826abd55a513494ef892e7ad069ad Author: Matt Caswell <m...@openssl.org> Date: Wed Dec 28 12:10:28 2016 +0000 Fix the EC point formats extension This should be sent in the ServerHello if a EC based ciphersuite is negotiated. The relevant flag to do this was missed off in the recent extensions refactor. Fixes GitHub Issue #2133 Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2153) ----------------------------------------------------------------------- Summary of changes: Configure | 3 ++- ssl/statem/extensions.c | 16 +++++++++++++++- ssl/statem/extensions_clnt.c | 4 ++++ ssl/statem/extensions_srvr.c | 6 ++++++ test/recipes/70-test_sslmessages.t | 38 +++++++++++++++++++++++++++++++------- test/testlib/checkhandshake.pm | 5 ++++- util/TLSProxy/Message.pm | 4 ++++ util/TLSProxy/Proxy.pm | 11 +++++++++++ util/TLSProxy/ServerHello.pm | 1 + util/TLSProxy/ServerKeyExchange.pm | 6 +++--- 10 files changed, 81 insertions(+), 13 deletions(-) diff --git a/Configure b/Configure index 896d4d4..b2e2e47 100755 --- a/Configure +++ b/Configure @@ -507,7 +507,8 @@ my @disable_cascades = ( "stdio" => [ "apps", "capieng" ], "apps" => [ "tests" ], - "comp" => [ "zlib" ], + "comp" => [ "zlib" ], + "ec" => [ "tls1_3" ], sub { !$disabled{"unit-test"} } => [ "heartbeats" ], sub { !$disabled{"msan"} } => [ "asm" ], diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c index 760b150..2bb09c9 100644 --- a/ssl/statem/extensions.c +++ b/ssl/statem/extensions.c @@ -92,6 +92,7 @@ typedef struct extensions_definition_st { * * TODO(TLS1.3): Make sure we have a test to check the consistency of these */ +#define INVALID_EXTENSION { 0x10000, 0, NULL, NULL, NULL, NULL, NULL, NULL } static const EXTENSION_DEFINITION ext_defs[] = { { TLSEXT_TYPE_renegotiate, @@ -116,11 +117,13 @@ static const EXTENSION_DEFINITION ext_defs[] = { EXT_CLIENT_HELLO | EXT_TLS1_2_AND_BELOW_ONLY, init_srp, tls_parse_ctos_srp, NULL, NULL, tls_construct_ctos_srp, NULL }, +#else + INVALID_EXTENSION, #endif #ifndef OPENSSL_NO_EC { TLSEXT_TYPE_ec_point_formats, - EXT_CLIENT_HELLO | EXT_TLS1_2_AND_BELOW_ONLY, + EXT_CLIENT_HELLO | EXT_TLS1_2_SERVER_HELLO | EXT_TLS1_2_AND_BELOW_ONLY, NULL, tls_parse_ctos_ec_pt_formats, tls_parse_stoc_ec_pt_formats, tls_construct_stoc_ec_pt_formats, tls_construct_ctos_ec_pt_formats, final_ec_pt_formats @@ -132,6 +135,9 @@ static const EXTENSION_DEFINITION ext_defs[] = { NULL /* TODO(TLS1.3): Need to add this */, tls_construct_ctos_supported_groups, NULL }, +#else + INVALID_EXTENSION, + INVALID_EXTENSION, #endif { TLSEXT_TYPE_session_ticket, @@ -155,6 +161,8 @@ static const EXTENSION_DEFINITION ext_defs[] = { tls_parse_stoc_status_request, tls_construct_stoc_status_request, tls_construct_ctos_status_request, final_status_request }, +#else + INVALID_EXTENSION, #endif #ifndef OPENSSL_NO_NEXTPROTONEG { @@ -163,6 +171,8 @@ static const EXTENSION_DEFINITION ext_defs[] = { init_npn, tls_parse_ctos_npn, tls_parse_stoc_npn, tls_construct_stoc_next_proto_neg, tls_construct_ctos_npn, NULL }, +#else + INVALID_EXTENSION, #endif { /* @@ -183,6 +193,8 @@ static const EXTENSION_DEFINITION ext_defs[] = { init_srtp, tls_parse_ctos_use_srtp, tls_parse_stoc_use_srtp, tls_construct_stoc_use_srtp, tls_construct_ctos_use_srtp, NULL }, +#else + INVALID_EXTENSION, #endif { TLSEXT_TYPE_encrypt_then_mac, @@ -203,6 +215,8 @@ static const EXTENSION_DEFINITION ext_defs[] = { */ NULL, tls_parse_stoc_sct, NULL, tls_construct_ctos_sct, NULL }, +#else + INVALID_EXTENSION, #endif { TLSEXT_TYPE_extended_master_secret, diff --git a/ssl/statem/extensions_clnt.c b/ssl/statem/extensions_clnt.c index 6d2ed23..f291e5f 100644 --- a/ssl/statem/extensions_clnt.c +++ b/ssl/statem/extensions_clnt.c @@ -480,6 +480,7 @@ int tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_key_share(SSL *s, WPACKET *pkt, int *al) { +#ifndef OPENSSL_NO_TLS1_3 size_t i, sharessent = 0, num_curves = 0; const unsigned char *pcurves = NULL; @@ -559,6 +560,7 @@ int tls_construct_ctos_key_share(SSL *s, WPACKET *pkt, int *al) SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE, ERR_R_INTERNAL_ERROR); return 0; } +#endif return 1; } @@ -983,6 +985,7 @@ int tls_parse_stoc_ems(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, int *al) { +#ifndef OPENSSL_NO_TLS1_3 unsigned int group_id; PACKET encoded_pt; EVP_PKEY *ckey = s->s3->tmp.pkey, *skey = NULL; @@ -1038,6 +1041,7 @@ int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, int *al) return 0; } EVP_PKEY_free(skey); +#endif return 1; } diff --git a/ssl/statem/extensions_srvr.c b/ssl/statem/extensions_srvr.c index 9876212..74db91d 100644 --- a/ssl/statem/extensions_srvr.c +++ b/ssl/statem/extensions_srvr.c @@ -457,6 +457,7 @@ int tls_parse_ctos_etm(SSL *s, PACKET *pkt, int *al) * used. Returns 1 if the group is in the list (and allowed if |checkallow| is * 1) or 0 otherwise. */ +#ifndef OPENSSL_NO_TLS1_3 static int check_in_list(SSL *s, unsigned int group_id, const unsigned char *groups, size_t num_groups, int checkallow) @@ -479,6 +480,7 @@ static int check_in_list(SSL *s, unsigned int group_id, /* If i == num_groups then not in the list */ return i < num_groups; } +#endif /* * Process a key_share extension received in the ClientHello. |pkt| contains @@ -487,6 +489,7 @@ static int check_in_list(SSL *s, unsigned int group_id, */ int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, int *al) { +#ifndef OPENSSL_NO_TLS1_3 unsigned int group_id; PACKET key_share_list, encoded_pt; const unsigned char *clntcurves, *srvrcurves; @@ -607,6 +610,7 @@ int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, int *al) found = 1; } +#endif return 1; } @@ -857,6 +861,7 @@ int tls_construct_stoc_ems(SSL *s, WPACKET *pkt, int *al) int tls_construct_stoc_key_share(SSL *s, WPACKET *pkt, int *al) { +#ifndef OPENSSL_NO_TLS1_3 unsigned char *encodedPoint; size_t encoded_pt_len = 0; EVP_PKEY *ckey = s->s3->peer_tmp, *skey = NULL; @@ -905,6 +910,7 @@ int tls_construct_stoc_key_share(SSL *s, WPACKET *pkt, int *al) SSLerr(SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE, ERR_R_INTERNAL_ERROR); return 0; } +#endif return 1; } diff --git a/test/recipes/70-test_sslmessages.t b/test/recipes/70-test_sslmessages.t index fb4ec61..48a2708 100755 --- a/test/recipes/70-test_sslmessages.t +++ b/test/recipes/70-test_sslmessages.t @@ -46,6 +46,9 @@ my $proxy = TLSProxy::Proxy->new( [TLSProxy::Message::MT_CERTIFICATE, checkhandshake::ALL_HANDSHAKES & ~checkhandshake::RESUME_HANDSHAKE], + (disabled("ec") ? () : + [TLSProxy::Message::MT_SERVER_KEY_EXCHANGE, + checkhandshake::EC_HANDSHAKE]), [TLSProxy::Message::MT_CERTIFICATE_STATUS, checkhandshake::OCSP_HANDSHAKE], #ServerKeyExchange handshakes not currently supported by TLSProxy @@ -94,10 +97,14 @@ my $proxy = TLSProxy::Proxy->new( checkhandshake::SERVER_NAME_CLI_EXTENSION], [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_STATUS_REQUEST, checkhandshake::STATUS_REQUEST_CLI_EXTENSION], - [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SUPPORTED_GROUPS, - checkhandshake::DEFAULT_EXTENSIONS], - [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EC_POINT_FORMATS, - checkhandshake::DEFAULT_EXTENSIONS], + (disabled("ec") ? () : + [TLSProxy::Message::MT_CLIENT_HELLO, + TLSProxy::Message::EXT_SUPPORTED_GROUPS, + checkhandshake::DEFAULT_EXTENSIONS]), + (disabled("ec") ? () : + [TLSProxy::Message::MT_CLIENT_HELLO, + TLSProxy::Message::EXT_EC_POINT_FORMATS, + checkhandshake::DEFAULT_EXTENSIONS]), [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SIG_ALGS, checkhandshake::DEFAULT_EXTENSIONS], [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ALPN, @@ -135,6 +142,8 @@ my $proxy = TLSProxy::Proxy->new( checkhandshake::SCT_SRV_EXTENSION], [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_NPN, checkhandshake::NPN_SRV_EXTENSION], + [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_EC_POINT_FORMATS, + checkhandshake::EC_POINT_FORMAT_SRV_EXTENSION], [0,0,0] ); @@ -143,7 +152,7 @@ my $proxy = TLSProxy::Proxy->new( $proxy->serverconnects(2); $proxy->clientflags("-no_tls1_3 -sess_out ".$session); $proxy->start() or plan skip_all => "Unable to start up Proxy for tests"; -plan tests => 20; +plan tests => 21; checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, checkhandshake::DEFAULT_EXTENSIONS, "Default handshake test"); @@ -266,7 +275,8 @@ checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, "ALPN handshake test"); SKIP: { - skip "No CT support in this OpenSSL build", 1 if disabled("ct"); + skip "No CT and/or EC support in this OpenSSL build", 1 + if disabled("ct") || disabled("ec"); #Test 14: SCT handshake (client request only) $proxy->clear(); @@ -295,7 +305,8 @@ checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, "SCT handshake test (server)"); SKIP: { - skip "No CT support in this OpenSSL build", 1 if disabled("ct"); + skip "No CT and/or EC support in this OpenSSL build", 1 + if disabled("ct") || disabled("ec"); #Test 16: SCT handshake (client and server) #There is no built-in server side support for this so we are actually also @@ -358,3 +369,16 @@ checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, checkhandshake::DEFAULT_EXTENSIONS | checkhandshake::SRP_CLI_EXTENSION, "SRP extension test"); + +#Test 21: EC handshake +SKIP: { + skip "No EC support in this OpenSSL build", 1 if disabled("ec"); + $proxy->clear(); + $proxy->clientflags("-no_tls1_3"); + $proxy->ciphers("ECDHE-RSA-AES128-SHA"); + $proxy->start(); + checkhandshake($proxy, checkhandshake::EC_HANDSHAKE, + checkhandshake::DEFAULT_EXTENSIONS + | checkhandshake::EC_POINT_FORMAT_SRV_EXTENSION, + "EC handshake test"); +} diff --git a/test/testlib/checkhandshake.pm b/test/testlib/checkhandshake.pm index eb34fff..9529b94 100644 --- a/test/testlib/checkhandshake.pm +++ b/test/testlib/checkhandshake.pm @@ -23,8 +23,9 @@ use constant { CLIENT_AUTH_HANDSHAKE => 8, RENEG_HANDSHAKE => 16, NPN_HANDSHAKE => 32, + EC_HANDSHAKE => 64, - ALL_HANDSHAKES => 63 + ALL_HANDSHAKES => 127 }; use constant { @@ -43,6 +44,8 @@ use constant { NPN_CLI_EXTENSION => 0x00000800, NPN_SRV_EXTENSION => 0x00001000, SRP_CLI_EXTENSION => 0x00002000, + #Client side for ec point formats is a default extension + EC_POINT_FORMAT_SRV_EXTENSION => 0x00004000, }; our @handmessages = (); diff --git a/util/TLSProxy/Message.pm b/util/TLSProxy/Message.pm index e5c42c8..7837787 100644 --- a/util/TLSProxy/Message.pm +++ b/util/TLSProxy/Message.pm @@ -83,6 +83,10 @@ use constant { EXT_DUPLICATE_EXTENSION => 0xfde8 }; +use constant { + CIPHER_ADH_AES_128_SHA => 0x03000034 +}; + my $payload = ""; my $messlen = -1; my $mt; diff --git a/util/TLSProxy/Proxy.pm b/util/TLSProxy/Proxy.pm index 6561589..84ca3a7 100644 --- a/util/TLSProxy/Proxy.pm +++ b/util/TLSProxy/Proxy.pm @@ -25,6 +25,7 @@ my $have_IPv6 = 0; my $IP_factory; my $is_tls13 = 0; +my $ciphersuite = undef; sub new { @@ -108,6 +109,7 @@ sub clearClient $self->{message_list} = []; $self->{clientflags} = ""; $is_tls13 = 0; + $ciphersuite = undef; TLSProxy::Message->clear(); TLSProxy::Record->clear(); @@ -535,4 +537,13 @@ sub reneg return $self->{reneg}; } +sub ciphersuite +{ + my $class = shift; + if (@_) { + $ciphersuite = shift; + } + return $ciphersuite; +} + 1; diff --git a/util/TLSProxy/ServerHello.pm b/util/TLSProxy/ServerHello.pm index 5a038c9..1abdd05 100644 --- a/util/TLSProxy/ServerHello.pm +++ b/util/TLSProxy/ServerHello.pm @@ -103,6 +103,7 @@ sub parse $self->session_id_len($session_id_len); $self->session($session); $self->ciphersuite($ciphersuite); + TLSProxy::Proxy->ciphersuite($ciphersuite); $self->comp_meth($comp_meth); $self->extension_data(\%extensions); diff --git a/util/TLSProxy/ServerKeyExchange.pm b/util/TLSProxy/ServerKeyExchange.pm index 6e5b4cd..7640b3f 100644 --- a/util/TLSProxy/ServerKeyExchange.pm +++ b/util/TLSProxy/ServerKeyExchange.pm @@ -42,9 +42,9 @@ sub parse { my $self = shift; - #Minimal SKE parsing. Only supports DHE at the moment (if its not DHE - #the parsing data will be trash...which is ok as long as we don't try to - #use it) + #Minimal SKE parsing. Only supports one known DHE ciphersuite at the moment + return if (TLSProxy::Proxy->ciphersuite() + != TLSProxy::Message::CIPHER_ADH_AES_128_SHA); my $p_len = unpack('n', $self->data); my $ptr = 2; _____ openssl-commits mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits