From 68f37b7a3f451aa1ca8c93669c024d01f6270ae8 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 18 Nov 2016 15:14:42 +0900 Subject: [PATCH] Run TestOneSidedShutdown at all versions. Change-Id: I3a5d949eec9241ea43da40ce23e0e7f2a25e30e5 Reviewed-on: https://boringssl-review.googlesource.com/12381 CQ-Verified: CQ bot account: commit-bot@chromium.org Reviewed-by: Steven Valdez Reviewed-by: David Benjamin Commit-Queue: David Benjamin --- ssl/ssl_test.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ssl/ssl_test.cc b/ssl/ssl_test.cc index f0d4a185..ae9d5ca4 100644 --- a/ssl/ssl_test.cc +++ b/ssl/ssl_test.cc @@ -1378,16 +1378,22 @@ static bool TestSequenceNumber(bool is_dtls, const SSL_METHOD *method, return true; } -static bool TestOneSidedShutdown() { - bssl::UniquePtr client_ctx(SSL_CTX_new(TLS_method())); - bssl::UniquePtr server_ctx(SSL_CTX_new(TLS_method())); - if (!client_ctx || !server_ctx) { - return false; +static bool TestOneSidedShutdown(bool is_dtls, const SSL_METHOD *method, + uint16_t version) { + // SSL_shutdown is a no-op in DTLS. + if (is_dtls) { + return true; } + bssl::UniquePtr client_ctx(SSL_CTX_new(method)); + bssl::UniquePtr server_ctx(SSL_CTX_new(method)); bssl::UniquePtr cert = GetTestCertificate(); bssl::UniquePtr key = GetTestKey(); - if (!cert || !key || + if (!client_ctx || !server_ctx || !cert || !key || + !SSL_CTX_set_min_proto_version(server_ctx.get(), version) || + !SSL_CTX_set_max_proto_version(server_ctx.get(), version) || + !SSL_CTX_set_min_proto_version(client_ctx.get(), version) || + !SSL_CTX_set_max_proto_version(client_ctx.get(), version) || !SSL_CTX_use_certificate(server_ctx.get(), cert.get()) || !SSL_CTX_use_PrivateKey(server_ctx.get(), key.get())) { return false; @@ -1433,6 +1439,7 @@ static bool TestOneSidedShutdown() { return true; } + static bool TestSessionDuplication() { bssl::UniquePtr client_ctx(SSL_CTX_new(TLS_method())); bssl::UniquePtr server_ctx(SSL_CTX_new(TLS_method())); @@ -2648,7 +2655,7 @@ int main() { !TestClientCAList() || !TestInternalSessionCache() || !ForEachVersion(TestSequenceNumber) || - !TestOneSidedShutdown() || + !ForEachVersion(TestOneSidedShutdown) || !TestSessionDuplication() || !TestSetFD() || !TestSetBIO() ||