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

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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 92741d4  Add draft-05(-pre) support
92741d4 is described below

commit 92741d4334cc3a8b4d87ae310f51c192597b4838
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Aug 15 09:52:55 2017 +0900

    Add draft-05(-pre) support
    
    - Change label prefix of Key Expansion
    - Change largest length of the Largest Acknowledged field of Ack frame
    - Change QUIC_SUPPORTED_VERSIONS
---
 iocore/net/quic/QUICCrypto.cc                  | 10 +++++-----
 iocore/net/quic/QUICFrame.cc                   | 10 +++-------
 iocore/net/quic/QUICTypes.cc                   |  6 ------
 iocore/net/quic/QUICTypes.h                    |  8 +++++++-
 iocore/net/quic/test/test_QUICPacketFactory.cc |  2 +-
 5 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/iocore/net/quic/QUICCrypto.cc b/iocore/net/quic/QUICCrypto.cc
index 2707dfa..f3df0a6 100644
--- a/iocore/net/quic/QUICCrypto.cc
+++ b/iocore/net/quic/QUICCrypto.cc
@@ -36,11 +36,11 @@ constexpr static char tag[] = "quic_crypto";
 constexpr static ts::StringView exporter_label_client_1_rtt("EXPORTER-QUIC 
client 1-RTT Secret", ts::StringView::literal);
 constexpr static ts::StringView exporter_label_server_1_rtt("EXPORTER-QUIC 
server 1-RTT Secret", ts::StringView::literal);
 
-// [quic-tls draft-04] "TLS 1.3, " + Label
-// constexpr static ts::StringView expand_label_client_1_rtt("TLS 1.3, QUIC 
client 1-RTT secret", ts::StringView::literal);
-// constexpr static ts::StringView expand_label_server_1_rtt("TLS 1.3, QUIC 
server 1-RTT secret", ts::StringView::literal);
-constexpr static ts::StringView expand_label_key("TLS 1.3, key", 
ts::StringView::literal);
-constexpr static ts::StringView expand_label_iv("TLS 1.3, iv", 
ts::StringView::literal);
+// [quic-tls draft-05] "tls13 " + Label
+// constexpr static ts::StringView expand_label_client_1_rtt("tls13 QUIC 
client 1-RTT secret", ts::StringView::literal);
+// constexpr static ts::StringView expand_label_server_1_rtt("tls13 QUIC 
server 1-RTT secret", ts::StringView::literal);
+constexpr static ts::StringView expand_label_key("tls13 key", 
ts::StringView::literal);
+constexpr static ts::StringView expand_label_iv("tls13 iv", 
ts::StringView::literal);
 
 //
 // QUICPacketProtection
diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index d7495c7..cf36199 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -327,7 +327,7 @@ QUICAckFrame::store(uint8_t *buf, size_t *len) const
     QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 4, p, &n);
   } else {
     buf[0] += 0x03 << 2;
-    QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 6, p, &n);
+    QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 8, p, &n);
   }
   p += n;
 
@@ -439,14 +439,10 @@ QUICAckFrame::_get_largest_acknowledged_length() const
    * 0 -> 1 byte
    * 1 -> 2 byte
    * 2 -> 4 byte
-   * 3 -> 6 byte
+   * 3 -> 8 byte
   */
   int n = (this->_buf[0] & 0x0c) >> 2;
-  if (n == 0) {
-    return 1;
-  } else {
-    return n * 2;
-  }
+  return 0x01 << n;
 }
 
 size_t
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index 0be3d00..cf45000 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -23,12 +23,6 @@
 
 #include "QUICTypes.h"
 
-// TODO: Update version number
-// Note: You need to update QUICTypes.h if you change the number of versions
-const QUICVersion QUIC_SUPPORTED_VERSIONS[] = {
-  0xff000004, // Prefix for drafts (0xff000000) + draft number
-};
-
 const QUICStreamId STREAM_ID_FOR_HANDSHAKE = 0;
 
 bool
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index d1f613b..abff721 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -45,7 +45,13 @@ typedef uint32_t QUICVersion;
 typedef uint32_t QUICStreamId;
 typedef uint64_t QUICOffset;
 
-extern const QUICVersion QUIC_SUPPORTED_VERSIONS[1];
+// TODO: Update version number
+// Note: You also need to update tests for VersionNegotiationPacket, if you 
change the number of versions
+// Prefix for drafts (0xff000000) + draft number
+constexpr QUICVersion QUIC_SUPPORTED_VERSIONS[] = {
+  0xff000005,
+};
+
 extern const QUICStreamId STREAM_ID_FOR_HANDSHAKE;
 
 enum class QUICPacketType : int {
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc 
b/iocore/net/quic/test/test_QUICPacketFactory.cc
index 48f6c5d..31bdbd2 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFactory.cc
@@ -48,7 +48,7 @@ 
TEST_CASE("QUICPacketFactory_Create_VersionNegotiationPacket", "[quic]")
   CHECK(packet->type() == QUICPacketType::VERSION_NEGOTIATION);
   CHECK(packet->connection_id() == client_initial_packet.connection_id());
   CHECK(packet->packet_number() == client_initial_packet.packet_number());
-  CHECK(memcmp(packet->payload(), "\xff\x00\x00\x04", 4) == 0);
+  CHECK(memcmp(packet->payload(), "\xff\x00\x00\x05", 4) == 0);
 }
 
 TEST_CASE("QUICPacketFactory_Create_ServerCleartextPacket", "[quic]")

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Reply via email to