third_party/boringssl/src/ssl/ssl_test.cc
// Test that post-handshake tickets consumed by |SSL_shutdown| are ignored.
Test that post-handshake tickets consumed by |SSL_shutdown| are ignored.
Test that post - handshake tickets consumed by |SSL_shutdown| are ignored .
TEST(SSLTest, ShutdownIgnoresTickets) {
  bssl::UniquePtr<SSL_CTX> ctx(SSL_CTX_new(TLS_method()));
  ASSERT_TRUE(ctx);
  ASSERT_TRUE(SSL_CTX_set_min_proto_version(ctx.get(), TLS1_3_VERSION));
  ASSERT_TRUE(SSL_CTX_set_max_proto_version(ctx.get(), TLS1_3_VERSION));
  bssl::UniquePtr<X509> cert = GetTestCertificate();
  bssl::UniquePtr<EVP_PKEY> key = GetTestKey();
  ASSERT_TRUE(cert);
  ASSERT_TRUE(key);
  ASSERT_TRUE(SSL_CTX_use_certificate(ctx.get(), cert.get()));
  ASSERT_TRUE(SSL_CTX_use_PrivateKey(ctx.get(), key.get()));
  SSL_CTX_set_session_cache_mode(ctx.get(), SSL_SESS_CACHE_BOTH);
  bssl::UniquePtr<SSL> client, server;
  ASSERT_TRUE(ConnectClientAndServer(&client, &server, ctx.get(), ctx.get()));
  SSL_CTX_sess_set_new_cb(ctx.get(), [](SSL *ssl, SSL_SESSION *session) -> int {
    ADD_FAILURE() << "New session callback called during SSL_shutdown";
    return 0;
  });
  EXPECT_EQ(0, SSL_shutdown(server.get()));
  EXPECT_EQ(0, SSL_shutdown(client.get()));
  EXPECT_EQ(1, SSL_shutdown(server.get()));
  EXPECT_EQ(1, SSL_shutdown(client.get()));
}
TEST ( SSLTest , ShutdownIgnoresTickets ) { bssl :: UniquePtr < SSL_CTX > ctx ( SSL_CTX_new ( TLS_method ( ) ) ) ; ASSERT_TRUE ( ctx ) ; ASSERT_TRUE ( SSL_CTX_set_min_proto_version ( ctx . get ( ) , TLS1_3_VERSION ) ) ; ASSERT_TRUE ( SSL_CTX_set_max_proto_version ( ctx . get ( ) , TLS1_3_VERSION ) ) ; bssl :: UniquePtr < X509 > cert = GetTestCertificate ( ) ; bssl :: UniquePtr < EVP_PKEY > key = GetTestKey ( ) ; ASSERT_TRUE ( cert ) ; ASSERT_TRUE ( key ) ; ASSERT_TRUE ( SSL_CTX_use_certificate ( ctx . get ( ) , cert . get ( ) ) ) ; ASSERT_TRUE ( SSL_CTX_use_PrivateKey ( ctx . get ( ) , key . get ( ) ) ) ; SSL_CTX_set_session_cache_mode ( ctx . get ( ) , SSL_SESS_CACHE_BOTH ) ; bssl :: UniquePtr < SSL > client , server ; ASSERT_TRUE ( ConnectClientAndServer ( & client , & server , ctx . get ( ) , ctx . get ( ) ) ) ; SSL_CTX_sess_set_new_cb ( ctx . get ( ) , [ ] ( SSL * ssl , SSL_SESSION * session ) -> int { ADD_FAILURE ( ) << " " ; return 0 ; } ) ; EXPECT_EQ ( 0 , SSL_shutdown ( server . get ( ) ) ) ; EXPECT_EQ ( 0 , SSL_shutdown ( client . get ( ) ) ) ; EXPECT_EQ ( 1 , SSL_shutdown ( server . get ( ) ) ) ; EXPECT_EQ ( 1 , SSL_shutdown ( client . get ( ) ) ) ; }
Test that post-handshake tickets consumed by |SSL_shutdown| are ignored.
Test that post - handshake tickets consumed by |SSL_shutdown| are ignored .
// Send close_notify. // Receive close_notify.