You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/21 08:27:35 UTC

[trafficserver] 02/02: Rename QUICCryptoTls to QUICTLS

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 235252651b7935c928bc13432c87813942e870ba
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Feb 21 17:27:12 2018 +0900

    Rename QUICCryptoTls to QUICTLS
---
 iocore/net/quic/Makefile.am                        |   7 +-
 iocore/net/quic/QUICHandshake.cc                   |  14 +-
 iocore/net/quic/QUICHandshakeProtocol.cc           | 260 +--------------------
 iocore/net/quic/QUICPacket.cc                      |  11 +-
 iocore/net/quic/QUICPacket.h                       |   2 +-
 .../quic/{QUICHandshakeProtocol.cc => QUICTLS.cc}  |  85 ++-----
 iocore/net/quic/QUICTLS.h                          |   6 +-
 ...eProtocol_boringssl.cc => QUICTLS_boringssl.cc} |  22 +-
 ...shakeProtocol_openssl.cc => QUICTLS_openssl.cc} |  14 +-
 iocore/net/quic/test/Makefile.am                   |  37 +--
 iocore/net/quic/test/test_QUICHandshake.cc         |   2 +-
 iocore/net/quic/test/test_QUICHandshakeProtocol.cc |   8 +-
 12 files changed, 84 insertions(+), 384 deletions(-)

diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index 7ff8913..c8b0c56 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -35,10 +35,10 @@ AM_CPPFLAGS += \
 noinst_LIBRARIES = libquic.a
 
 if OPENSSL_IS_BORINGSSL
-QUICHandshakeProtocol_impl = QUICHandshakeProtocol_boringssl.cc
+QUICTLS_impl = QUICTLS_boringssl.cc
 QUICKeyGenerator_impl = QUICKeyGenerator_boringssl.cc
 else
-QUICHandshakeProtocol_impl = QUICHandshakeProtocol_openssl.cc
+QUICTLS_impl = QUICTLS_openssl.cc
 QUICKeyGenerator_impl = QUICKeyGenerator_openssl.cc
 endif
 
@@ -57,7 +57,8 @@ libquic_a_SOURCES = \
   QUICStream.cc \
   QUICHandshake.cc \
   QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  QUICTLS.cc \
+  $(QUICTLS_impl) \
   QUICKeyGenerator.cc \
   $(QUICKeyGenerator_impl) \
   QUICKeyGenerator.cc \
diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index 51bdbf2..e3a5ce3 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -93,7 +93,7 @@ QUICHandshake::QUICHandshake(QUICConnection *qc, SSL_CTX *ssl_ctx) : QUICHandsha
 QUICHandshake::QUICHandshake(QUICConnection *qc, SSL_CTX *ssl_ctx, QUICStatelessResetToken token)
   : QUICApplication(qc),
     _ssl(SSL_new(ssl_ctx)),
-    _hs_protocol(new QUICCryptoTls(this->_ssl, qc->direction())),
+    _hs_protocol(new QUICTLS(this->_ssl, qc->direction())),
     _version_negotiator(new QUICVersionNegotiator()),
     _netvc_context(qc->direction()),
     _reset_token(token)
@@ -172,9 +172,9 @@ const char *
 QUICHandshake::negotiated_cipher_suite()
 {
   // FIXME Generalize and remove dynamic_cast
-  QUICCryptoTls *crypto_tls = dynamic_cast<QUICCryptoTls *>(this->_hs_protocol);
-  if (crypto_tls) {
-    return SSL_get_cipher_name(crypto_tls->ssl_handle());
+  QUICTLS *hs_tls = dynamic_cast<QUICTLS *>(this->_hs_protocol);
+  if (hs_tls) {
+    return SSL_get_cipher_name(hs_tls->ssl_handle());
   }
 
   return nullptr;
@@ -184,9 +184,9 @@ void
 QUICHandshake::negotiated_application_name(const uint8_t **name, unsigned int *len)
 {
   // FIXME Generalize and remove dynamic_cast
-  QUICCryptoTls *crypto_tls = dynamic_cast<QUICCryptoTls *>(this->_hs_protocol);
-  if (crypto_tls) {
-    SSL_get0_alpn_selected(crypto_tls->ssl_handle(), name, len);
+  QUICTLS *hs_tls = dynamic_cast<QUICTLS *>(this->_hs_protocol);
+  if (hs_tls) {
+    SSL_get0_alpn_selected(hs_tls->ssl_handle(), name, len);
   }
 }
 
diff --git a/iocore/net/quic/QUICHandshakeProtocol.cc b/iocore/net/quic/QUICHandshakeProtocol.cc
index 6b80632..2957978 100644
--- a/iocore/net/quic/QUICHandshakeProtocol.cc
+++ b/iocore/net/quic/QUICHandshakeProtocol.cc
@@ -21,31 +21,13 @@
  *  limitations under the License.
  */
 #include "QUICGlobals.h"
-#include "QUICTLS.h"
-
-#include <openssl/err.h>
-#include <openssl/ssl.h>
-#include <openssl/bio.h>
+#include "QUICHandshakeProtocol.h"
 
 #include "ts/Diags.h"
 #include "ts/string_view.h"
 #include "QUICTypes.h"
 #include "QUICHKDF.h"
 
-constexpr static char tag[] = "quic_crypto";
-
-static void
-to_hex(uint8_t *out, uint8_t *in, int in_len)
-{
-  for (int i = 0; i < in_len; ++i) {
-    int u4         = in[i] / 16;
-    int l4         = in[i] % 16;
-    out[i * 2]     = (u4 < 10) ? ('0' + u4) : ('A' + u4 - 10);
-    out[i * 2 + 1] = (l4 < 10) ? ('0' + l4) : ('A' + l4 - 10);
-  }
-  out[in_len * 2] = 0;
-}
-
 //
 // QUICPacketProtection
 //
@@ -92,243 +74,3 @@ QUICPacketProtection::key_phase() const
 {
   return this->_key_phase;
 }
-
-//
-// QUICHandshakeProtocol
-//
-QUICCryptoTls::QUICCryptoTls(SSL *ssl, NetVConnectionContext_t nvc_ctx) : QUICHandshakeProtocol(), _ssl(ssl), _netvc_context(nvc_ctx)
-{
-  if (this->_netvc_context == NET_VCONNECTION_IN) {
-    SSL_set_accept_state(this->_ssl);
-  } else if (this->_netvc_context == NET_VCONNECTION_OUT) {
-    SSL_set_connect_state(this->_ssl);
-  } else {
-    ink_assert(false);
-  }
-
-  this->_client_pp = new QUICPacketProtection();
-  this->_server_pp = new QUICPacketProtection();
-}
-
-QUICCryptoTls::~QUICCryptoTls()
-{
-  delete this->_client_pp;
-  delete this->_server_pp;
-}
-
-int
-QUICCryptoTls::handshake(uint8_t *out, size_t &out_len, size_t max_out_len, const uint8_t *in, size_t in_len)
-{
-  ink_assert(this->_ssl != nullptr);
-
-  // TODO: directly read/write from VIO
-  BIO *rbio = BIO_new(BIO_s_mem());
-  BIO *wbio = BIO_new(BIO_s_mem());
-  if (in != nullptr || in_len != 0) {
-    BIO_write(rbio, in, in_len);
-  }
-  SSL_set_bio(this->_ssl, rbio, wbio);
-
-  int err = SSL_ERROR_NONE;
-  if (!SSL_is_init_finished(this->_ssl)) {
-    ERR_clear_error();
-    int ret = SSL_do_handshake(this->_ssl);
-    if (ret <= 0) {
-      err = SSL_get_error(this->_ssl, ret);
-
-      switch (err) {
-      case SSL_ERROR_WANT_READ:
-      case SSL_ERROR_WANT_WRITE:
-        break;
-      default:
-        char err_buf[256] = {0};
-        ERR_error_string_n(err, err_buf, sizeof(err_buf));
-        Debug(tag, "Handshake error: %s (%d)", err_buf, err);
-        return err;
-      }
-    }
-
-    out_len = BIO_ctrl_pending(wbio);
-    if (out_len > 0) {
-      BIO_read(wbio, out, max_out_len);
-    }
-  }
-
-  return err;
-}
-
-bool
-QUICCryptoTls::is_handshake_finished() const
-{
-  return SSL_is_init_finished(this->_ssl);
-}
-
-bool
-QUICCryptoTls::is_key_derived() const
-{
-  return (this->_client_pp->key_phase() != QUICKeyPhase::CLEARTEXT && this->_server_pp->key_phase() != QUICKeyPhase::CLEARTEXT);
-}
-
-int
-QUICCryptoTls::initialize_key_materials(QUICConnectionId cid)
-{
-  // Generate keys
-  uint8_t print_buf[512];
-  std::unique_ptr<KeyMaterial> km;
-  km = this->_keygen_for_client.generate(cid);
-  if (is_debug_tag_set("vv_quic_crypto")) {
-    to_hex(print_buf, km->key, km->key_len);
-    Debug("vv_quic_crypto", "client key 0x%s", print_buf);
-    to_hex(print_buf, km->iv, km->iv_len);
-    Debug("vv_quic_crypto", "client iv 0x%s", print_buf);
-  }
-  this->_client_pp->set_key(std::move(km), QUICKeyPhase::CLEARTEXT);
-
-  km = this->_keygen_for_server.generate(cid);
-  if (is_debug_tag_set("vv_quic_crypto")) {
-    to_hex(print_buf, km->key, km->key_len);
-    Debug("vv_quic_crypto", "server key 0x%s", print_buf);
-    to_hex(print_buf, km->iv, km->iv_len);
-    Debug("vv_quic_crypto", "server iv 0x%s", print_buf);
-  }
-  this->_server_pp->set_key(std::move(km), QUICKeyPhase::CLEARTEXT);
-
-  // Update algorithm
-  this->_aead = _get_evp_aead();
-
-  return 1;
-}
-
-int
-QUICCryptoTls::update_key_materials()
-{
-  ink_assert(SSL_is_init_finished(this->_ssl));
-  // Switch key phase
-  QUICKeyPhase next_key_phase;
-  switch (this->_client_pp->key_phase()) {
-  case QUICKeyPhase::PHASE_0:
-    next_key_phase = QUICKeyPhase::PHASE_1;
-    break;
-  case QUICKeyPhase::PHASE_1:
-    next_key_phase = QUICKeyPhase::PHASE_0;
-    break;
-  case QUICKeyPhase::CLEARTEXT:
-    next_key_phase = QUICKeyPhase::PHASE_0;
-    break;
-  default:
-    Error("QUICKeyPhase value is undefined");
-    ink_assert(false);
-    next_key_phase = QUICKeyPhase::PHASE_0;
-  }
-
-  // Generate keys
-  uint8_t print_buf[512];
-  std::unique_ptr<KeyMaterial> km;
-  km = this->_keygen_for_client.generate(this->_ssl);
-  if (is_debug_tag_set("vv_quic_crypto")) {
-    to_hex(print_buf, km->key, km->key_len);
-    Debug("vv_quic_crypto", "client key 0x%s", print_buf);
-    to_hex(print_buf, km->iv, km->iv_len);
-    Debug("vv_quic_crypto", "client iv 0x%s", print_buf);
-  }
-  this->_client_pp->set_key(std::move(km), next_key_phase);
-  km = this->_keygen_for_server.generate(this->_ssl);
-  if (is_debug_tag_set("vv_quic_crypto")) {
-    to_hex(print_buf, km->key, km->key_len);
-    Debug("vv_quic_crypto", "server key 0x%s", print_buf);
-    to_hex(print_buf, km->iv, km->iv_len);
-    Debug("vv_quic_crypto", "server iv 0x%s", print_buf);
-  }
-  this->_server_pp->set_key(std::move(km), next_key_phase);
-
-  // Update algorithm
-  this->_aead = _get_evp_aead();
-
-  return 1;
-}
-
-SSL *
-QUICCryptoTls::ssl_handle()
-{
-  return this->_ssl;
-}
-
-bool
-QUICCryptoTls::encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
-                       uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
-{
-  QUICPacketProtection *pp = nullptr;
-
-  switch (this->_netvc_context) {
-  case NET_VCONNECTION_IN: {
-    pp = this->_server_pp;
-    break;
-  }
-  case NET_VCONNECTION_OUT: {
-    pp = this->_client_pp;
-    break;
-  }
-  default:
-    ink_assert(false);
-    return false;
-  }
-
-  size_t tag_len = this->_get_aead_tag_len();
-  return _encrypt(cipher, cipher_len, max_cipher_len, plain, plain_len, pkt_num, ad, ad_len, pp->get_key(phase), tag_len);
-}
-
-bool
-QUICCryptoTls::decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
-                       uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
-{
-  QUICPacketProtection *pp = nullptr;
-
-  switch (this->_netvc_context) {
-  case NET_VCONNECTION_IN: {
-    pp = this->_client_pp;
-    break;
-  }
-  case NET_VCONNECTION_OUT: {
-    pp = this->_server_pp;
-    break;
-  }
-  default:
-    ink_assert(false);
-    return false;
-  }
-
-  size_t tag_len = this->_get_aead_tag_len();
-  bool ret       = _decrypt(plain, plain_len, max_plain_len, cipher, cipher_len, pkt_num, ad, ad_len, pp->get_key(phase), tag_len);
-  if (!ret) {
-    Debug(tag, "Failed to decrypt a packet: pkt_num=%" PRIu64, pkt_num);
-  }
-  return ret;
-}
-
-/**
- * Example iv_len = 12
- *
- *   0                   1
- *   0 1 2 3 4 5 6 7 8 9 0 1 2  (byte)
- *  +-+-+-+-+-+-+-+-+-+-+-+-+-+
- *  |           iv            |    // IV
- *  +-+-+-+-+-+-+-+-+-+-+-+-+-+
- *  |0|0|0|0|    pkt num      |    // network byte order & left-padded with zeros
- *  +-+-+-+-+-+-+-+-+-+-+-+-+-+
- *  |          nonce          |    // nonce = iv xor pkt_num
- *  +-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- */
-void
-QUICCryptoTls::_gen_nonce(uint8_t *nonce, size_t &nonce_len, uint64_t pkt_num, const uint8_t *iv, size_t iv_len) const
-{
-  nonce_len = iv_len;
-  memcpy(nonce, iv, iv_len);
-
-  pkt_num    = htobe64(pkt_num);
-  uint8_t *p = reinterpret_cast<uint8_t *>(&pkt_num);
-
-  for (size_t i = 0; i < 8; ++i) {
-    nonce[iv_len - 8 + i] ^= p[i];
-  }
-}
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 9f2c9ac..bb505f6 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -674,7 +674,7 @@ QUICPacketFactory::create(ats_unique_buf buf, size_t len, QUICPacketNumber base_
   case QUICPacketType::PROTECTED:
     if (this->_hs_protocol->is_key_derived()) {
       if (this->_hs_protocol->decrypt(plain_txt.get(), plain_txt_len, max_plain_txt_len, header->payload(), header->payload_size(),
-                                 header->packet_number(), header->buf(), header->size(), header->key_phase())) {
+                                      header->packet_number(), header->buf(), header->size(), header->key_phase())) {
         result = QUICPacketCreationResult::SUCCESS;
       } else {
         result = QUICPacketCreationResult::FAILED;
@@ -686,8 +686,9 @@ QUICPacketFactory::create(ats_unique_buf buf, size_t len, QUICPacketNumber base_
   case QUICPacketType::INITIAL:
     if (!this->_hs_protocol->is_key_derived()) {
       if (QUICTypeUtil::is_supported_version(header->version())) {
-        if (this->_hs_protocol->decrypt(plain_txt.get(), plain_txt_len, max_plain_txt_len, header->payload(), header->payload_size(),
-                                   header->packet_number(), header->buf(), header->size(), QUICKeyPhase::CLEARTEXT)) {
+        if (this->_hs_protocol->decrypt(plain_txt.get(), plain_txt_len, max_plain_txt_len, header->payload(),
+                                        header->payload_size(), header->packet_number(), header->buf(), header->size(),
+                                        QUICKeyPhase::CLEARTEXT)) {
           result = QUICPacketCreationResult::SUCCESS;
         } else {
           result = QUICPacketCreationResult::FAILED;
@@ -702,7 +703,7 @@ QUICPacketFactory::create(ats_unique_buf buf, size_t len, QUICPacketNumber base_
   case QUICPacketType::HANDSHAKE:
     if (!this->_hs_protocol->is_key_derived()) {
       if (this->_hs_protocol->decrypt(plain_txt.get(), plain_txt_len, max_plain_txt_len, header->payload(), header->payload_size(),
-                                 header->packet_number(), header->buf(), header->size(), QUICKeyPhase::CLEARTEXT)) {
+                                      header->packet_number(), header->buf(), header->size(), QUICKeyPhase::CLEARTEXT)) {
         result = QUICPacketCreationResult::SUCCESS;
       } else {
         result = QUICPacketCreationResult::FAILED;
@@ -821,7 +822,7 @@ QUICPacketFactory::_create_encrypted_packet(QUICPacketHeader *header, bool retra
 
   QUICPacket *packet = nullptr;
   if (this->_hs_protocol->encrypt(cipher_txt.get(), cipher_txt_len, max_cipher_txt_len, header->payload(), header->payload_size(),
-                             header->packet_number(), header->buf(), header->size(), header->key_phase())) {
+                                  header->packet_number(), header->buf(), header->size(), header->key_phase())) {
     packet = quicPacketAllocator.alloc();
     new (packet) QUICPacket(header, std::move(cipher_txt), cipher_txt_len, retransmittable);
   }
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 3bb3307..2e52c6e 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -309,7 +309,7 @@ public:
   void set_hs_protocol(QUICHandshakeProtocol *hs_protocol);
 
 private:
-  QUICVersion _version = QUIC_SUPPORTED_VERSIONS[0];
+  QUICVersion _version                = QUIC_SUPPORTED_VERSIONS[0];
   QUICHandshakeProtocol *_hs_protocol = nullptr;
   QUICPacketNumberGenerator _packet_number_generator;
 
diff --git a/iocore/net/quic/QUICHandshakeProtocol.cc b/iocore/net/quic/QUICTLS.cc
similarity index 75%
copy from iocore/net/quic/QUICHandshakeProtocol.cc
copy to iocore/net/quic/QUICTLS.cc
index 6b80632..f6da788 100644
--- a/iocore/net/quic/QUICHandshakeProtocol.cc
+++ b/iocore/net/quic/QUICTLS.cc
@@ -20,19 +20,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-#include "QUICGlobals.h"
+
 #include "QUICTLS.h"
 
 #include <openssl/err.h>
 #include <openssl/ssl.h>
 #include <openssl/bio.h>
 
-#include "ts/Diags.h"
-#include "ts/string_view.h"
-#include "QUICTypes.h"
-#include "QUICHKDF.h"
-
-constexpr static char tag[] = "quic_crypto";
+constexpr static char tag[] = "quic_tls";
 
 static void
 to_hex(uint8_t *out, uint8_t *in, int in_len)
@@ -46,57 +41,7 @@ to_hex(uint8_t *out, uint8_t *in, int in_len)
   out[in_len * 2] = 0;
 }
 
-//
-// QUICPacketProtection
-//
-
-QUICPacketProtection::~QUICPacketProtection()
-{
-}
-
-void
-QUICPacketProtection::set_key(std::unique_ptr<KeyMaterial> km, QUICKeyPhase phase)
-{
-  this->_key_phase = phase;
-  switch (phase) {
-  case QUICKeyPhase::PHASE_0:
-    this->_phase_0_key = std::move(km);
-    break;
-  case QUICKeyPhase::PHASE_1:
-    this->_phase_1_key = std::move(km);
-    break;
-  case QUICKeyPhase::CLEARTEXT:
-    this->_cleartext_key = std::move(km);
-    break;
-  }
-}
-
-const KeyMaterial &
-QUICPacketProtection::get_key(QUICKeyPhase phase) const
-{
-  switch (phase) {
-  case QUICKeyPhase::PHASE_0:
-    return *this->_phase_0_key;
-  case QUICKeyPhase::PHASE_1:
-    return *this->_phase_1_key;
-  case QUICKeyPhase::CLEARTEXT:
-    return *this->_cleartext_key;
-  }
-
-  ink_release_assert(!"Bad phase");
-  return *this->_cleartext_key;
-}
-
-QUICKeyPhase
-QUICPacketProtection::key_phase() const
-{
-  return this->_key_phase;
-}
-
-//
-// QUICHandshakeProtocol
-//
-QUICCryptoTls::QUICCryptoTls(SSL *ssl, NetVConnectionContext_t nvc_ctx) : QUICHandshakeProtocol(), _ssl(ssl), _netvc_context(nvc_ctx)
+QUICTLS::QUICTLS(SSL *ssl, NetVConnectionContext_t nvc_ctx) : QUICHandshakeProtocol(), _ssl(ssl), _netvc_context(nvc_ctx)
 {
   if (this->_netvc_context == NET_VCONNECTION_IN) {
     SSL_set_accept_state(this->_ssl);
@@ -110,14 +55,14 @@ QUICCryptoTls::QUICCryptoTls(SSL *ssl, NetVConnectionContext_t nvc_ctx) : QUICHa
   this->_server_pp = new QUICPacketProtection();
 }
 
-QUICCryptoTls::~QUICCryptoTls()
+QUICTLS::~QUICTLS()
 {
   delete this->_client_pp;
   delete this->_server_pp;
 }
 
 int
-QUICCryptoTls::handshake(uint8_t *out, size_t &out_len, size_t max_out_len, const uint8_t *in, size_t in_len)
+QUICTLS::handshake(uint8_t *out, size_t &out_len, size_t max_out_len, const uint8_t *in, size_t in_len)
 {
   ink_assert(this->_ssl != nullptr);
 
@@ -158,19 +103,19 @@ QUICCryptoTls::handshake(uint8_t *out, size_t &out_len, size_t max_out_len, cons
 }
 
 bool
-QUICCryptoTls::is_handshake_finished() const
+QUICTLS::is_handshake_finished() const
 {
   return SSL_is_init_finished(this->_ssl);
 }
 
 bool
-QUICCryptoTls::is_key_derived() const
+QUICTLS::is_key_derived() const
 {
   return (this->_client_pp->key_phase() != QUICKeyPhase::CLEARTEXT && this->_server_pp->key_phase() != QUICKeyPhase::CLEARTEXT);
 }
 
 int
-QUICCryptoTls::initialize_key_materials(QUICConnectionId cid)
+QUICTLS::initialize_key_materials(QUICConnectionId cid)
 {
   // Generate keys
   uint8_t print_buf[512];
@@ -200,7 +145,7 @@ QUICCryptoTls::initialize_key_materials(QUICConnectionId cid)
 }
 
 int
-QUICCryptoTls::update_key_materials()
+QUICTLS::update_key_materials()
 {
   ink_assert(SSL_is_init_finished(this->_ssl));
   // Switch key phase
@@ -248,14 +193,14 @@ QUICCryptoTls::update_key_materials()
 }
 
 SSL *
-QUICCryptoTls::ssl_handle()
+QUICTLS::ssl_handle()
 {
   return this->_ssl;
 }
 
 bool
-QUICCryptoTls::encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
-                       uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
+QUICTLS::encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
+                 uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
 {
   QUICPacketProtection *pp = nullptr;
 
@@ -278,8 +223,8 @@ QUICCryptoTls::encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_le
 }
 
 bool
-QUICCryptoTls::decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
-                       uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
+QUICTLS::decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
+                 uint64_t pkt_num, const uint8_t *ad, size_t ad_len, QUICKeyPhase phase) const
 {
   QUICPacketProtection *pp = nullptr;
 
@@ -320,7 +265,7 @@ QUICCryptoTls::decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len,
  *
  */
 void
-QUICCryptoTls::_gen_nonce(uint8_t *nonce, size_t &nonce_len, uint64_t pkt_num, const uint8_t *iv, size_t iv_len) const
+QUICTLS::_gen_nonce(uint8_t *nonce, size_t &nonce_len, uint64_t pkt_num, const uint8_t *iv, size_t iv_len) const
 {
   nonce_len = iv_len;
   memcpy(nonce, iv, iv_len);
diff --git a/iocore/net/quic/QUICTLS.h b/iocore/net/quic/QUICTLS.h
index ea52733..20c2a66 100644
--- a/iocore/net/quic/QUICTLS.h
+++ b/iocore/net/quic/QUICTLS.h
@@ -36,11 +36,11 @@
 #include "I_NetVConnection.h"
 #include "QUICHandshakeProtocol.h"
 
-class QUICCryptoTls : public QUICHandshakeProtocol
+class QUICTLS : public QUICHandshakeProtocol
 {
 public:
-  QUICCryptoTls(SSL *ssl, NetVConnectionContext_t nvc_ctx);
-  ~QUICCryptoTls();
+  QUICTLS(SSL *ssl, NetVConnectionContext_t nvc_ctx);
+  ~QUICTLS();
 
   int handshake(uint8_t *out, size_t &out_len, size_t max_out_len, const uint8_t *in, size_t in_len) override;
   bool is_handshake_finished() const override;
diff --git a/iocore/net/quic/QUICHandshakeProtocol_boringssl.cc b/iocore/net/quic/QUICTLS_boringssl.cc
similarity index 74%
rename from iocore/net/quic/QUICHandshakeProtocol_boringssl.cc
rename to iocore/net/quic/QUICTLS_boringssl.cc
index 1010a8c..de441b3 100644
--- a/iocore/net/quic/QUICHandshakeProtocol_boringssl.cc
+++ b/iocore/net/quic/QUICTLS_boringssl.cc
@@ -29,10 +29,10 @@
 #include <openssl/hkdf.h>
 #include <openssl/aead.h>
 
-static constexpr char tag[] = "quic_crypto";
+static constexpr char tag[] = "quic_tls";
 
 const EVP_AEAD *
-QUICCryptoTls::_get_evp_aead(const SSL_CIPHER *cipher) const
+QUICTLS::_get_evp_aead(const SSL_CIPHER *cipher) const
 {
   ink_assert(SSL_CIPHER_is_AEAD(cipher));
 
@@ -50,14 +50,14 @@ QUICCryptoTls::_get_evp_aead(const SSL_CIPHER *cipher) const
 }
 
 size_t
-QUICCryptoTls::_get_aead_tag_len(const SSL_CIPHER * /* cipher */) const
+QUICTLS::_get_aead_tag_len(const SSL_CIPHER * /* cipher */) const
 {
   return EVP_AEAD_DEFAULT_TAG_LENGTH;
 }
 
 int
-QUICCryptoTls::_hkdf_expand_label(uint8_t *dst, size_t dst_len, const uint8_t *secret, size_t secret_len, const char *label,
-                                  size_t label_len, const EVP_MD *digest) const
+QUICTLS::_hkdf_expand_label(uint8_t *dst, size_t dst_len, const uint8_t *secret, size_t secret_len, const char *label,
+                            size_t label_len, const EVP_MD *digest) const
 {
   uint8_t info[256] = {0};
   size_t info_len   = 0;
@@ -66,9 +66,9 @@ QUICCryptoTls::_hkdf_expand_label(uint8_t *dst, size_t dst_len, const uint8_t *s
 }
 
 bool
-QUICCryptoTls::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
-                        uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const uint8_t *key, size_t key_len, const uint8_t *iv,
-                        size_t iv_len, size_t tag_len) const
+QUICTLS::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
+                  uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const uint8_t *key, size_t key_len, const uint8_t *iv,
+                  size_t iv_len, size_t tag_len) const
 {
   uint8_t nonce[EVP_MAX_IV_LENGTH] = {0};
   size_t nonce_len                 = 0;
@@ -91,9 +91,9 @@ QUICCryptoTls::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_l
 }
 
 bool
-QUICCryptoTls::_decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
-                        uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const uint8_t *key, size_t key_len, const uint8_t *iv,
-                        size_t iv_len, size_t tag_len) const
+QUICTLS::_decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
+                  uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const uint8_t *key, size_t key_len, const uint8_t *iv,
+                  size_t iv_len, size_t tag_len) const
 {
   uint8_t nonce[EVP_MAX_IV_LENGTH] = {0};
   size_t nonce_len                 = 0;
diff --git a/iocore/net/quic/QUICHandshakeProtocol_openssl.cc b/iocore/net/quic/QUICTLS_openssl.cc
similarity index 88%
rename from iocore/net/quic/QUICHandshakeProtocol_openssl.cc
rename to iocore/net/quic/QUICTLS_openssl.cc
index 2325a49..7dafc65 100644
--- a/iocore/net/quic/QUICHandshakeProtocol_openssl.cc
+++ b/iocore/net/quic/QUICTLS_openssl.cc
@@ -28,10 +28,10 @@
 #include <openssl/kdf.h>
 #include <openssl/evp.h>
 
-static constexpr char tag[] = "quic_crypto";
+static constexpr char tag[] = "quic_tls";
 
 const EVP_CIPHER *
-QUICCryptoTls::_get_evp_aead() const
+QUICTLS::_get_evp_aead() const
 {
   if (this->is_handshake_finished()) {
     switch (SSL_CIPHER_get_id(SSL_get_current_cipher(this->_ssl))) {
@@ -54,7 +54,7 @@ QUICCryptoTls::_get_evp_aead() const
 }
 
 size_t
-QUICCryptoTls::_get_aead_tag_len() const
+QUICTLS::_get_aead_tag_len() const
 {
   if (this->is_handshake_finished()) {
     switch (SSL_CIPHER_get_id(SSL_get_current_cipher(this->_ssl))) {
@@ -77,8 +77,8 @@ QUICCryptoTls::_get_aead_tag_len() const
 }
 
 bool
-QUICCryptoTls::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
-                        uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const KeyMaterial &km, size_t tag_len) const
+QUICTLS::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_len, const uint8_t *plain, size_t plain_len,
+                  uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const KeyMaterial &km, size_t tag_len) const
 {
   uint8_t nonce[EVP_MAX_IV_LENGTH] = {0};
   size_t nonce_len                 = 0;
@@ -126,8 +126,8 @@ QUICCryptoTls::_encrypt(uint8_t *cipher, size_t &cipher_len, size_t max_cipher_l
 }
 
 bool
-QUICCryptoTls::_decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
-                        uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const KeyMaterial &km, size_t tag_len) const
+QUICTLS::_decrypt(uint8_t *plain, size_t &plain_len, size_t max_plain_len, const uint8_t *cipher, size_t cipher_len,
+                  uint64_t pkt_num, const uint8_t *ad, size_t ad_len, const KeyMaterial &km, size_t tag_len) const
 {
   uint8_t nonce[EVP_MAX_IV_LENGTH] = {0};
   size_t nonce_len                 = 0;
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index c0ea1e2..d0b482e 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -53,10 +53,10 @@ AM_CPPFLAGS += \
 
 if OPENSSL_IS_BORINGSSL
 QUICKeyGenerator_impl = ../QUICKeyGenerator_boringssl.cc
-QUICHandshakeProtocol_impl = ../QUICHandshakeProtocol_boringssl.cc
+QUICTLS_impl = ../QUICTLS_boringssl.cc
 else
 QUICKeyGenerator_impl = ../QUICKeyGenerator_openssl.cc
-QUICHandshakeProtocol_impl = ../QUICHandshakeProtocol_openssl.cc
+QUICTLS_impl = ../QUICTLS_openssl.cc
 endif
 
 #
@@ -73,7 +73,8 @@ test_QUICPacket_SOURCES = \
   test_QUICPacket.cc \
   ../QUICPacket.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICTypes.cc
 
 test_QUICPacket_LDADD = \
@@ -101,7 +102,8 @@ test_QUICPacketFactory_SOURCES = \
   test_QUICPacketFactory.cc \
   ../QUICPacket.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICTypes.cc
 
 test_QUICPacketFactory_LDADD = \
@@ -135,7 +137,8 @@ test_QUICFrame_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICTypes.cc \
   ../QUICStream.cc \
   ../QUICStreamState.cc \
@@ -183,7 +186,8 @@ test_QUICFrameDispatcher_SOURCES = \
   ../QUICEchoApp.cc \
   ../QUICDebugNames.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICKeyGenerator.cc \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
@@ -305,7 +309,8 @@ test_QUICTransportParameters_SOURCES = \
   ../QUICHandshake.cc \
   ../QUICVersionNegotiator.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICKeyGenerator.cc \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
@@ -378,7 +383,8 @@ test_QUICHandshakeProtocol_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICHandshakeProtocol.h \
   ../QUICTypes.cc \
   ../QUICGlobals.cc \
@@ -411,7 +417,8 @@ test_QUICLossDetector_SOURCES = \
   ../QUICTypes.cc \
   ../QUICPacket.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICFrame.cc
 
 #
@@ -444,7 +451,8 @@ test_QUICTypeUtil_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICTypes.cc
 
 #
@@ -480,7 +488,8 @@ test_QUICAckFrameCreator_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../../SSLNextProtocolSet.cc
 
 #
@@ -512,7 +521,8 @@ test_QUICVersionNegotiator_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICApplication.cc \
   ../QUICApplicationMap.cc \
   ../QUICHandshake.cc \
@@ -561,7 +571,8 @@ test_QUICFlowController_SOURCES = \
   $(QUICKeyGenerator_impl) \
   ../QUICHKDF.cc \
   ../QUICHandshakeProtocol.cc \
-  $(QUICHandshakeProtocol_impl) \
+  ../QUICTLS.cc \
+  $(QUICTLS_impl) \
   ../QUICFrame.cc
 
 #
diff --git a/iocore/net/quic/test/test_QUICHandshake.cc b/iocore/net/quic/test/test_QUICHandshake.cc
index 9a5da76..15a342d 100644
--- a/iocore/net/quic/test/test_QUICHandshake.cc
+++ b/iocore/net/quic/test/test_QUICHandshake.cc
@@ -63,7 +63,7 @@ TEST_CASE("1-RTT handshake ", "[quic]")
 
   // setup stream 0
   MockQUICFrameTransmitter tx;
-  QUICStream *stream = new MockQUICStream();
+  QUICStream *stream          = new MockQUICStream();
   MockQUICStreamIO *stream_io = new MockQUICStreamIO(nullptr, stream);
 
   client->set_stream(stream, stream_io);
diff --git a/iocore/net/quic/test/test_QUICHandshakeProtocol.cc b/iocore/net/quic/test/test_QUICHandshakeProtocol.cc
index 0877c21..789dd0f 100644
--- a/iocore/net/quic/test/test_QUICHandshakeProtocol.cc
+++ b/iocore/net/quic/test/test_QUICHandshakeProtocol.cc
@@ -62,7 +62,7 @@ TEST_CASE("QUICHndshakeProtocol Cleartext", "[quic]")
   SSL_CTX *client_ssl_ctx = SSL_CTX_new(TLS_method());
   SSL_CTX_set_min_proto_version(client_ssl_ctx, TLS1_3_VERSION);
   SSL_CTX_set_max_proto_version(client_ssl_ctx, TLS1_3_VERSION);
-  QUICHandshakeProtocol *client = new QUICCryptoTls(SSL_new(client_ssl_ctx), NET_VCONNECTION_OUT);
+  QUICHandshakeProtocol *client = new QUICTLS(SSL_new(client_ssl_ctx), NET_VCONNECTION_OUT);
 
   // Server
   SSL_CTX *server_ssl_ctx = SSL_CTX_new(TLS_method());
@@ -72,7 +72,7 @@ TEST_CASE("QUICHndshakeProtocol Cleartext", "[quic]")
   SSL_CTX_use_certificate(server_ssl_ctx, PEM_read_bio_X509(crt_bio, nullptr, nullptr, nullptr));
   BIO *key_bio(BIO_new_mem_buf(server_key, sizeof(server_key)));
   SSL_CTX_use_PrivateKey(server_ssl_ctx, PEM_read_bio_PrivateKey(key_bio, nullptr, nullptr, nullptr));
-  QUICHandshakeProtocol *server = new QUICCryptoTls(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
+  QUICHandshakeProtocol *server = new QUICTLS(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
 
   CHECK(client->initialize_key_materials(0x8394c8f03e515700));
   CHECK(server->initialize_key_materials(0x8394c8f03e515700));
@@ -120,7 +120,7 @@ TEST_CASE("QUICHandshakeProtocol 1-RTT", "[quic]")
   SSL_CTX *client_ssl_ctx = SSL_CTX_new(TLS_method());
   SSL_CTX_set_min_proto_version(client_ssl_ctx, TLS1_3_VERSION);
   SSL_CTX_set_max_proto_version(client_ssl_ctx, TLS1_3_VERSION);
-  QUICHandshakeProtocol *client = new QUICCryptoTls(SSL_new(client_ssl_ctx), NET_VCONNECTION_OUT);
+  QUICHandshakeProtocol *client = new QUICTLS(SSL_new(client_ssl_ctx), NET_VCONNECTION_OUT);
 
   // Server
   SSL_CTX *server_ssl_ctx = SSL_CTX_new(TLS_method());
@@ -130,7 +130,7 @@ TEST_CASE("QUICHandshakeProtocol 1-RTT", "[quic]")
   SSL_CTX_use_certificate(server_ssl_ctx, PEM_read_bio_X509(crt_bio, nullptr, nullptr, nullptr));
   BIO *key_bio(BIO_new_mem_buf(server_key, sizeof(server_key)));
   SSL_CTX_use_PrivateKey(server_ssl_ctx, PEM_read_bio_PrivateKey(key_bio, nullptr, nullptr, nullptr));
-  QUICHandshakeProtocol *server = new QUICCryptoTls(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
+  QUICHandshakeProtocol *server = new QUICTLS(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
 
   CHECK(client->initialize_key_materials(0x8394c8f03e515708));
   CHECK(server->initialize_key_materials(0x8394c8f03e515708));

-- 
To stop receiving notification emails like this one, please contact
maskit@apache.org.