<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' []>
<rfc ipr="pre5378Trust200902" category="std" docName="draft-ietf-tcpinc-tcpcrypt-04">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc private=""?>
<?rfc topblock="yes"?>
<?rfc comments="no"?>
<front>
<title abbrev="tcpcrypt">Cryptographic protection of TCP Streams (tcpcrypt)</title>

<author initials="A." surname="Bittau" fullname="Andrea Bittau">
<organization>Google</organization>
<address>
<postal>
<street>345 Spear Street</street>
<city>San Francisco, CA</city>
<code>94105</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>bittau@google.com</email>
<uri></uri>
</address>
</author>
<author initials="D." surname="Boneh" fullname="Dan Boneh">
<organization>Stanford University</organization>
<address>
<postal>
<street>353 Serra Mall, Room 475</street>
<city>Stanford, CA</city>
<code>94305</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>dabo@cs.stanford.edu</email>
<uri></uri>
</address>
</author>
<author initials="D." surname="Giffin" fullname="Daniel B. Giffin">
<organization>Stanford University</organization>
<address>
<postal>
<street>353 Serra Mall, Room 288</street>
<city>Stanford, CA</city>
<code>94305</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>dbg@scs.stanford.edu</email>
<uri></uri>
</address>
</author>
<author initials="M." surname="Hamburg" fullname="Mike Hamburg">
<organization>Stanford University</organization>
<address>
<postal>
<street>353 Serra Mall, Room 475</street>
<city>Stanford, CA</city>
<code>94305</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>mike@shiftleft.org</email>
<uri></uri>
</address>
</author>
<author initials="M." surname="Handley" fullname="Mark Handley">
<organization>University College London</organization>
<address>
<postal>
<street>Gower St.</street>
<city>London</city>
<code>WC1E 6BT</code>
<country>UK</country>
<region></region>
</postal>
<phone></phone>
<email>M.Handley@cs.ucl.ac.uk</email>
<uri></uri>
</address>
</author>
<author initials="D." surname="Mazieres" fullname="David Mazieres">
<organization>Stanford University</organization>
<address>
<postal>
<street>353 Serra Mall, Room 290</street>
<city>Stanford, CA</city>
<code>94305</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>dm@uun.org</email>
<uri></uri>
</address>
</author>
<author initials="Q." surname="Slack" fullname="Quinn Slack">
<organization>Stanford University</organization>
<address>
<postal>
<street>353 Serra Mall, Room 288</street>
<city>Stanford, CA</city>
<code>94305</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>sqs@cs.stanford.edu</email>
<uri></uri>
</address>
</author>
<author initials="E." surname="Smith" fullname="Eric W. Smith">
<organization>Kestrel Institute</organization>
<address>
<postal>
<street>3260 Hillview Avenue</street>
<city>Palo Alto, CA</city>
<code>94304</code>
<country>US</country>
<region></region>
</postal>
<phone></phone>
<email>eric.smith@kestrel.edu</email>
<uri></uri>
</address>
</author>
<date year="2017" month="January" day="19"/>

<area>Internet</area>
<workgroup></workgroup>
<keyword>tcp</keyword>
<keyword>encryption</keyword>


<abstract>
<t>This document specifies tcpcrypt, a TCP encryption protocol designed
for use in conjunction with the TCP Encryption Negotiation Option
(TCP-ENO) <xref target="I-D.ietf-tcpinc-tcpeno"/>.  Tcpcrypt coexists with
middleboxes by tolerating resegmentation, NATs, and other
manipulations of the TCP header.  The protocol is self-contained and
specifically tailored to TCP implementations, which often reside in
kernels or other environments in which large external software
dependencies can be undesirable.  Because the size of TCP options is
limited, the protocol requires one additional one-way message latency
to perform key exchange before application data may be transmitted.
However, this cost can be avoided between two hosts that have recently
established a previous tcpcrypt connection.
</t>
</abstract>


</front>

<middle>

<section anchor="requirements-language" title="Requirements language">
<t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,
&quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this
document are to be interpreted as described in <xref target="RFC2119"/>.
</t>
</section>

<section anchor="introduction" title="Introduction">
<t>This document describes tcpcrypt, an extension to TCP for
cryptographic protection of session data.  Tcpcrypt was designed to
meet the following goals:
</t>
<t>
<list style="symbols">
<t>Meet the requirements of the TCP Encryption Negotiation Option
(TCP-ENO) <xref target="I-D.ietf-tcpinc-tcpeno"/> for protecting connection
data.</t>
<t>Be amenable to small, self-contained implementations inside TCP
stacks.</t>
<t>Minimize additional latency at connection startup.</t>
<t>As much as possible, prevent connection failure in the presence of
NATs and other middleboxes that might normalize traffic or otherwise
manipulate TCP segments.</t>
<t>Operate independently of IP addresses, making it possible to
authenticate resumed sessions efficiently even when either end
changes IP address.</t>
</list>
</t>
</section>

<section anchor="encryption-protocol" title="Encryption protocol">
<t>This section describes the tcpcrypt protocol at an abstract level.
The concrete format of all messages is specified in <xref target="encodings"/>.
</t>

<section anchor="cryptographic-algorithms" title="Cryptographic algorithms">
<t>Setting up a tcpcrypt connection employs three types of cryptographic
algorithms:
</t>
<t>
<list style="symbols">
<t>A <spanx style="emph">key agreement scheme</spanx> is used with a short-lived public key
to agree upon a shared secret.</t>
<t>An <spanx style="emph">extract function</spanx> is used to generate a pseudo-random key from
some initial keying material, typically the output of the key
agreement scheme.  The notation Extract(S, IKM) denotes the output
of the extract function with salt S and initial keying material
IKM.</t>
<t>A <spanx style="emph">collision-resistant pseudo-random function (CPRF)</spanx> is used to
generate multiple cryptographic keys from a pseudo-random key,
typically the output of the extract function.  We use the notation
CPRF(K, CONST, L) to designate the output of L bytes of the
pseudo-random function identified by key K on CONST.</t>
</list>
</t>
<t>The Extract and CPRF functions used by default are the Extract and
Expand functions of HKDF <xref target="RFC5869"/>.  These are defined as follows in
terms of the PRF <spanx style="verb">HMAC-Hash(key, value)</spanx> for a negotiated <spanx style="verb">Hash</spanx>
function:
</t>

<figure anchor="fig:hkdf" align="center" title="The symbol | denotes concatenation, and the counter
concatenated to the right of CONST is a single octet.
"><artwork align="center">
HKDF-Extract(salt, IKM) -&gt; PRK
   PRK = HMAC-Hash(salt, IKM)

HKDF-Expand(PRK, CONST, L) -&gt; OKM
   T(0) = empty string (zero length)
   T(1) = HMAC-Hash(PRK, T(0) | CONST | 0x01)
   T(2) = HMAC-Hash(PRK, T(1) | CONST | 0x02)
   T(3) = HMAC-Hash(PRK, T(2) | CONST | 0x03)
   ...

   OKM  = first L octets of T(1) | T(2) | T(3) | ...
</artwork></figure>
<t>Lastly, once tcpcrypt has been successfully set up and encryption keys
have been derived, an algorithm for Authenticated Encryption with
Associated Data (AEAD) is used to protect the confidentiality and
integrity of all transmitted application data.  AEAD algorithms use a
single key to encrypt their input data and also to generate a
cryptographic tag to accompany the resulting ciphertext; when
decryption is performed, the tag allows authentication of the
encrypted data and of optional, associated plaintext data.
</t>
</section>

<section anchor="protocol-negotiation" title="Protocol negotiation">
<t>Tcpcrypt depends on TCP-ENO <xref target="I-D.ietf-tcpinc-tcpeno"/> to negotiate
whether encryption will be enabled for a connection, and also which
key agreement scheme to use.  TCP-ENO negotiates the use of a
particular TCP encryption protocol or <spanx style="emph">TEP</spanx> by including protocol
identifiers in ENO suboptions.  This document associates four TEP
identifiers with the tcpcrypt protocol, as listed in <xref target="tab:tep-ids"/>.
Each identifier indicates the use of a particular key-agreement
scheme.  Future standards may associate additional identifiers with
tcpcrypt.
</t>
<t>An active opener that wishes to negotiate the use of tcpcrypt includes
an ENO option in its SYN segment.  That option includes suboptions
with tcpcrypt TEP identifiers indicating the key-agreement schemes it
is willing to enable.  The active opener MAY additionally include
suboptions indicating support for encryption protocols other than
tcpcrypt, as well as global suboptions as specified by TCP-ENO.
</t>
<t>If a passive opener receives an ENO option including tcpcrypt TEPs it
supports, it MAY then attach an ENO option to its SYN-ACK segment,
including <spanx style="emph">solely</spanx> the TEP it wishes to enable.
</t>
<t>To establish distinct roles for the two hosts in each connection,
tcpcrypt depends on the role-negotiation mechanism of TCP-ENO.  As one
result of the negotiation process, TCP-ENO assigns hosts unique roles
abstractly called &quot;A&quot; at one end of the connection and &quot;B&quot; at the
other.  Generally, an active opener plays the &quot;A&quot; role and a passive
opener plays the &quot;B&quot; role; but in the case of simultaneous open, an
additional mechanism breaks the symmetry and assigns different roles
to the two hosts.  This document adopts the terms &quot;host A&quot; and &quot;host
B&quot; to identify each end of a connection uniquely, following TCP-ENO's
designation.
</t>
<t>ENO suboptions include a flag <spanx style="verb">v</spanx> which indicates the presence of
associated, variable-length data.  In order to propose fresh key
agreement with a particular tcpcrypt TEP, a host sends a one-byte
suboption containing the TEP identifier and <spanx style="verb">v = 0</spanx>.  In order to
propose session resumption (described further below) with a particular
TEP, a host sends a variable-length suboption containing the TEP
identifier, the flag <spanx style="verb">v = 1</spanx>, and an identifier for a session
previously negotiated with the same host and the same TEP.
</t>
<t>Once two hosts have exchanged SYN segments, TCP-ENO defines the
<spanx style="emph">negotiated TEP</spanx> to be the last valid TEP identifier in the SYN
segment of host B (that is, the passive opener in the absence of
simultaneous open) that also occurs in that of host A.  If there is no
such TEP, hosts MUST disable TCP-ENO and tcpcrypt.
</t>
<t>If the negotiated TEP was sent by host B with <spanx style="verb">v = 0</spanx>, it means that
fresh key agreement will be performed as described below in
<xref target="key-exchange"/>.  If it had <spanx style="verb">v = 1</spanx>, the key-exchange messages will be
omitted in favor of determining keys via session-caching as described
in <xref target="session-caching"/>, and protected application data may immediately
be sent as detailed in <xref target="encryption"/>.
</t>
<t>Note that the negotiated TEP is determined without reference to the
<spanx style="verb">v</spanx> bits in ENO suboptions, so if host A offers resumption with a
particular TEP and host B replies with a non-resumption suboption with
the same TEP, that may become the negotiated TEP and fresh key
agreement will be performed.  That is, sending a resumption suboption
also implies willingness to perform fresh key agreement with the
indicated TEP.
</t>
<t>As required by TCP-ENO, once a host has both sent and received an ACK
segment containing a valid ENO option, encryption MUST be enabled and
plaintext application data MUST NOT ever be exchanged on the
connection.  If the negotiated TEP is among those listed in
<xref target="tab:tep-ids"/>, a host MUST follow the protocol described in this
document.
</t>
</section>

<section anchor="key-exchange" title="Key exchange">
<t>Following successful negotiation of a tcpcrypt TEP, all further
signaling is performed in the Data portion of TCP segments.  Except
when resumption was negotiated (described below in
<xref target="session-caching"/>), the two hosts perform key exchange through two
messages, <spanx style="verb">Init1</spanx> and <spanx style="verb">Init2</spanx>, at the start of the data streams of
host A and host B, respectively.  These messages may span multiple TCP
segments and need not end at a segment boundary.  However, the segment
containing the last byte of an <spanx style="verb">Init1</spanx> or <spanx style="verb">Init2</spanx> message SHOULD have
TCP's PSH bit set.
</t>
<t>The key exchange protocol, in abstract, proceeds as follows:
</t>

<figure align="center"><artwork align="center">
A -&gt; B:  Init1 = { INIT1_MAGIC, sym-cipher-list, N_A, PK_A }
B -&gt; A:  Init2 = { INIT2_MAGIC, sym-cipher, N_B, PK_B }
</artwork></figure>
<t>The concrete format of these messages is specified in
<xref target="key-exchange-messages"/>.
</t>
<t>The parameters are defined as follows:
</t>
<t>
<list style="symbols">
<t><spanx style="verb">INIT1_MAGIC</spanx>, <spanx style="verb">INIT2_MAGIC</spanx>: constants defined in
<xref target="tab:crypt-constants"/>.</t>
<t><spanx style="verb">sym-cipher-list</spanx>: a list of symmetric ciphers (AEAD algorithms)
acceptable to host A.  These are specified in <xref target="tab:ae-algs"/>.</t>
<t><spanx style="verb">sym-cipher</spanx>: the symmetric cipher selected by host B from the
<spanx style="verb">sym-cipher-list</spanx> sent by host A.</t>
<t><spanx style="verb">N_A</spanx>, <spanx style="verb">N_B</spanx>: nonces chosen at random by hosts A and B,
respectively.</t>
<t><spanx style="verb">PK_A</spanx>, <spanx style="verb">PK_B</spanx>: ephemeral public keys for hosts A and B,
respectively.  These, as well as their corresponding private keys,
are short-lived values that SHOULD be refreshed periodically.  The
private keys SHOULD NOT ever be written to persistent storage.</t>
</list>
</t>
<t>The ephemeral secret (<spanx style="verb">ES</spanx>) is the result of the key-agreement
algorithm (see <xref target="key-agreement-schemes"/>) indicated by the negotiated
TEP.   The inputs to the algorithm are the local host's ephemeral
private key and the remote host's ephemeral public key.  For example,
host A would compute <spanx style="verb">ES</spanx> using its own private key (not transmitted)
and host B's public key, <spanx style="verb">PK_B</spanx>.
</t>
<t>The two sides then compute a pseudo-random key (<spanx style="verb">PRK</spanx>), from which all
session keys are derived, as follows:
</t>

<figure align="center"><artwork align="center">
PRK = Extract(N_A, eno-transcript | Init1 | Init2 | ES)
</artwork></figure>
<t>Above, <spanx style="verb">|</spanx> denotes concatenation; <spanx style="verb">eno-transcript</spanx> is the
protocol-negotiation transcript defined in TCP-ENO; and <spanx style="verb">Init1</spanx> and
<spanx style="verb">Init2</spanx> are the transmitted encodings of the messages described in
<xref target="key-exchange-messages"/>.
</t>
<t>A series of &quot;session secrets&quot; are then computed from <spanx style="verb">PRK</spanx> as follows:
</t>

<figure align="center"><artwork align="center">
 ss[0] = PRK
 ss[i] = CPRF(ss[i-1], CONST_NEXTK, K_LEN)
</artwork></figure>
<t>The value <spanx style="verb">ss[0]</spanx> is used to generate all key material for the current
connection.  The values <spanx style="verb">ss[i]</spanx> for <spanx style="verb">i &gt; 0</spanx> can be used to avoid
public key cryptography when establishing subsequent connections
between the same two hosts, as described in <xref target="session-caching"/>.  The
<spanx style="verb">CONST_*</spanx> values are constants defined in <xref target="tab:crypt-constants"/>.  The
length <spanx style="verb">K_LEN</spanx> depends on the tcpcrypt TEP in use, and is specified in
<xref target="key-agreement-schemes"/>.
</t>
<t>Given a session secret <spanx style="verb">ss</spanx>, the two sides compute a series of master
keys as follows:
</t>

<figure align="center"><artwork align="center">
mk[0] = CPRF(ss, CONST_REKEY, K_LEN)
mk[i] = CPRF(mk[i-1], CONST_REKEY, K_LEN)
</artwork></figure>
<t>The particular master key in use is advanced as described in
<xref target="rekeying"/>.
</t>
<t>Finally, each master key <spanx style="verb">mk</spanx> is used to generate keys for
authenticated encryption for the &quot;A&quot; and &quot;B&quot; roles.  Key <spanx style="verb">k_ab</spanx> is
used by host A to encrypt and host B to decrypt, while <spanx style="verb">k_ba</spanx> is used
by host B to encrypt and host A to decrypt.
</t>

<figure align="center"><artwork align="center">
k_ab = CPRF(mk, CONST_KEY_A, ae_keylen)
k_ba = CPRF(mk, CONST_KEY_B, ae_keylen)
</artwork></figure>
<t>The value <spanx style="verb">ae_keylen</spanx> depends on the authenticated-encryption
algorithm selected, and is given under &quot;Key Length&quot; in <xref target="tab:ae-algs"/>.
</t>
<t>After host B sends <spanx style="verb">Init2</spanx> or host A receives it, that host may
immediately begin transmitting protected application data as described
in <xref target="encryption"/>.
</t>
<t>If host A receives <spanx style="verb">Init2</spanx> with a <spanx style="verb">sym-cipher</spanx> value that was not
present in the <spanx style="verb">sym-cipher-list</spanx> it previously transmitted in <spanx style="verb">Init1</spanx>,
it MUST abort the connection and raise an error condition distinct
from the end-of-file condition.
</t>
</section>

<section anchor="session-id" title="Session ID">
<t>TCP-ENO requires each TEP to define a <spanx style="emph">session ID</spanx> value that uniquely
identifies each encrypted connection.
</t>
<t>As required, a tcpcrypt session ID begins with the negotiated TEP
identifier along with the <spanx style="verb">v</spanx> bit as transmitted by host B.  The
remainder of the ID is derived from the session secret, as follows:
</t>

<figure align="center"><artwork align="center">
session_id[i] = TEP-byte | CPRF(ss[i], CONST_SESSID, K_LEN)
</artwork></figure>
<t>Again, the length <spanx style="verb">K_LEN</spanx> depends on the TEP, and is specified in
<xref target="key-agreement-schemes"/>.
</t>
</section>

<section anchor="session-caching" title="Session caching">
<t>When two hosts have already negotiated session secret <spanx style="verb">ss[i-1]</spanx>, they
can establish a new connection without public-key operations using
<spanx style="verb">ss[i]</spanx>.  A host signals willingness to resume with a particular
session secret by sending a SYN segment with a resumption suboption:
that is, an ENO suboption containing the negotiated TEP identifier
from the original session and part of an identifier for the session.
</t>
<t>The resumption identifier is calculated from a session secret <spanx style="verb">ss[i]</spanx>
as follows:
</t>

<figure align="center"><artwork align="center">
resume[i] = CPRF(ss[i], CONST_RESUME, 18)
</artwork></figure>
<t>To name a session for resumption, a host sends either the first or
second half of the resumption identifier, according to the role it
played in the original session with secret <spanx style="verb">ss[0]</spanx>.
</t>
<t>A host that originally played role A and wishes to resume from a
cached session sends a suboption with the first half of the resumption
identifier:
</t>

<figure anchor="fig:active-resume-subopt" align="center" title="Resumption suboption sent when original role was A.
The TEP-byte contains a tcpcrypt TEP identifier and v = 1.
"><artwork align="center">
byte     0        1                  9      (10 bytes total)
     +--------+--------+---...---+--------+
     |  TEP-  |      resume[i]{0..8}      |
     |  byte  |                           |
     +--------+--------+---...---+--------+
</artwork></figure>
<t>Similarly, a host that originally played role B sends a suboption with
the second half of the resumption identifier:
</t>

<figure anchor="fig:passive-resume-subopt" align="center" title="Resumption suboption sent when original role was B.
The TEP-byte contains a tcpcrypt TEP identifier and v = 1.
"><artwork align="center">
byte     0        1                  9      (10 bytes total)
     +--------+--------+---...---+--------+
     |  TEP-  |      resume[i]{9..17}     |
     |  byte  |                           |
     +--------+--------+---...---+--------+
</artwork></figure>
<t>If a passive opener recognizes the identifier-half in a resumption
suboption it has received and knows <spanx style="verb">ss[i]</spanx>, it SHOULD (with
exceptions specified below) agree to resume from the cached session by
sending its own resumption suboption, which will contain the other
half of the identifier.
</t>
<t>If it does not agree to resumption with a particular TEP, the passive
opener may either request fresh key exchange by responding with a
non-resumption suboption using the same TEP, or else respond to any
other received suboption.
</t>
<t>If an active opener receives a resumption suboption for a particular
TEP and the received identifier-half does not match the <spanx style="verb">resume[i]</spanx>
value whose other half it previously sent in a resumption suboption
for the same TEP, it MUST ignore that suboption.  In the typical case
that this was the only ENO suboption received, this means the host
MUST disable TCP-ENO and tcpcrypt: that is, it MUST NOT send any more
ENO options and MUST NOT encrypt the connection.
</t>
<t>When a host concludes that TCP-ENO negotiation has succeeded for some
TEP that was received in a resumption suboption, it MUST then enable
encryption with that TEP, using the cached session secret, as
described in <xref target="encryption"/>.
</t>
<t>The session ID (<xref target="session-id"/>) is constructed in the same way for
resumed sessions as it is for fresh ones.  In this case the first byte
will always have <spanx style="verb">v = 1</spanx>.  The remainder of the ID is derived from the
cached session secret.
</t>
<t>In the case of simultaneous open where TCP-ENO is able to establish
asymmetric roles, two hosts that simultaneously send SYN segments with
compatible resumption suboptions may resume the associated session.
</t>
<t>In a particular SYN segment, a host SHOULD NOT send more than one
resumption suboption, and MUST NOT send more than one resumption
suboption with the same TEP identifier.  But in addition to any
resumption suboptions, an active opener MAY include non-resumption
suboptions describing other key-agreement schemes it supports (in
addition to that indicated by the TEP in the resumption suboption).
</t>
<t>After using <spanx style="verb">ss[i]</spanx> to compute <spanx style="verb">mk[0]</spanx>, implementations SHOULD compute
and cache <spanx style="verb">ss[i+1]</spanx> for possible use by a later session, then erase
<spanx style="verb">ss[i]</spanx> from memory.  Hosts SHOULD retain <spanx style="verb">ss[i+1]</spanx> until it is used
or the memory needs to be reclaimed.  Hosts SHOULD NOT write a cached
<spanx style="verb">ss[i+1]</spanx> value to non-volatile storage.
</t>
<t>When proposing resumption, the active opener MUST use the lowest value
of <spanx style="verb">i</spanx> that has not already been used (successfully or not) to
negotiate resumption with the same host and for the same pre-session
key <spanx style="verb">ss[0]</spanx>.
</t>
<t>A host MUST NOT resume with a session secret if it has ever
successfully negotiated resumption in the past, in either role, with
the same secret.  In the event that two hosts simultaneously send SYN
segments to each other that propose resumption with the same session
secret but the two segments are not part of a simultaneous open, both
connections will have to revert to fresh key-exchange.  To avoid this
limitation, implementations MAY choose to implement session caching
such that a given pre-session key <spanx style="verb">ss[0]</spanx> is only used for either
passive or active opens at the same host, not both.
</t>
<t>When two hosts have previously negotiated a tcpcrypt session, either
host may initiate session resumption regardless of which host was the
active opener or played the &quot;A&quot; role in the previous session.
</t>
<t>However, a given host must either encrypt with <spanx style="verb">k_ab</spanx> for all sessions
derived from the same pre-session key <spanx style="verb">ss[0]</spanx>, or with <spanx style="verb">k_ba</spanx>.  Thus,
which keys a host uses to send segments is not affected by the role it
plays in the current connection: it depends only on whether the host
played the &quot;A&quot; or &quot;B&quot; role in the initial session.
</t>
<t>Implementations that perform session caching MUST provide a means for
applications to control session caching, including flushing cached
session secrets associated with an ESTABLISHED connection or disabling
the use of caching for a particular connection.
</t>
</section>

<section anchor="encryption" title="Data encryption and authentication">
<t>Following key exchange (or its omission via session caching), all
further communication in a tcpcrypt-enabled connection is carried out
within delimited <spanx style="emph">application frames</spanx> that are encrypted and
authenticated using the agreed keys.
</t>
<t>This protection is provided via algorithms for Authenticated
Encryption with Associated Data (AEAD).  The particular algorithms
that may be used are listed in <xref target="tab:ae-algs"/>.  One algorithm is
selected during the negotiation described in <xref target="key-exchange"/>.
</t>
<t>The format of an application frame is specified in
<xref target="application-frames"/>.  A sending host breaks its stream of
application data into a series of chunks.  Each chunk is placed in the
<spanx style="verb">data</spanx> portion of a &quot;plaintext&quot; value, which is then encrypted to
yield a frame's <spanx style="verb">ciphertext</spanx> field.  Chunks must be small enough
that the ciphertext (whose length depends on the AEAD cipher used, and
is generally slightly longer than the plaintext) has length less than
2^16 bytes.
</t>
<t>An &quot;associated data&quot; value (see <xref target="associated-data"/>) is constructed for
the frame.  It contains the frame's <spanx style="verb">control</spanx> field and the length of
the ciphertext.
</t>
<t>A &quot;frame nonce&quot; value (see <xref target="frame-nonce"/>) is also constructed for the
frame but not explicitly transmitted.  It contains an <spanx style="verb">offset</spanx> field
whose integer value is the zero-indexed byte offset of the beginning
of the current application frame in the underlying TCP datastream.
(That is, the offset in the framing stream, not the plaintext
application stream.)  Because it is strictly necessary for the
security of the AEAD algorithm, an implementation MUST NOT ever
transmit distinct frames with the same nonce value under the same
encryption key.  In particular, a retransmitted TCP segment MUST
contain the same payload bytes for the same TCP sequence numbers, and
a host MUST NOT transmit more than 2^64 bytes in the underlying TCP
datastream (which would cause the <spanx style="verb">offset</spanx> field to wrap) before
re-keying.
</t>
<t>With reference to the &quot;AEAD Interface&quot; described in Section 2 of
<xref target="RFC5116"/>, tcpcrypt invokes the AEAD algorithm with the secret key
<spanx style="verb">K</spanx> set to k_ab or k_ba, according to the host's role as described
in <xref target="key-exchange"/>.  The plaintext value serves as <spanx style="verb">P</spanx>, the associated
data as <spanx style="verb">A</spanx>, and the frame nonce as <spanx style="verb">N</spanx>.  The output of the encryption
operation, <spanx style="verb">C</spanx>, is transmitted in the frame's <spanx style="verb">ciphertext</spanx> field.
</t>
<t>When a frame is received, tcpcrypt reconstructs the associated data
and frame nonce values (the former contains only data sent in the
clear, and the latter is implicit in the TCP stream), and provides
these and the ciphertext value to the the AEAD decryption operation.
The output of this operation is either a plaintext value <spanx style="verb">P</spanx> or the
special symbol FAIL.  In the latter case, the implementation MUST
either ignore the frame or abort the connection; but if it aborts, the
implementation MUST raise an error condition distinct from the
end-of-file condition.
</t>
</section>

<section anchor="tcp-header-protection" title="TCP header protection">
<t>The <spanx style="verb">ciphertext</spanx> field of the application frame contains protected
versions of certain TCP header values.
</t>
<t>When <spanx style="verb">URGp</spanx> is set, the <spanx style="verb">urgent</spanx> value indicates an offset from the
current frame's beginning offset; the sum of these offsets gives the
index of the last byte of urgent data in the application datastream.
</t>
<t>When <spanx style="verb">FINp</spanx> is set, it indicates that the sender will send no more
application data after this frame.  When the TCP FIN flag differs from
<spanx style="verb">FINp</spanx>, a receiving host MUST either ignore the segment altogether or
abort the connection and raise an error condition distinct from the
end-of-file condition.
</t>
</section>

<section anchor="rekeying" title="Re-keying">
<t>Re-keying allows hosts to wipe from memory keys that could decrypt
previously transmitted segments.  It also allows the use of AEAD
ciphers that can securely encrypt only a bounded number of messages
under a given key.
</t>
<t>We refer to the two encryption keys (k_ab, k_ba) as a <spanx style="emph">key-set</spanx>.  We
refer to the key-set generated by mk[i] as the key-set with
<spanx style="emph">generation number</spanx> <spanx style="verb">i</spanx> within a session.  Each host maintains a
<spanx style="emph">local generation number</spanx> that determines which key-set it uses to
encrypt outgoing frames, and a <spanx style="emph">remote generation number</spanx> equal to the
highest generation used in frames received from its peer.  Initially,
these two values are set to zero.
</t>
<t>A host MAY increment its local generation number beyond the remote
generation number it has recorded.  We call this action <spanx style="emph">initiating
re-keying</spanx>.
</t>
<t>When a host has incremented its local generation number and uses the
new key-set for the first time to encrypt an outgoing frame, it MUST
set <spanx style="verb">rekey = 1</spanx> for that frame.  It MUST set this field to zero in all
other cases.
</t>
<t>When a host receives a frame with <spanx style="verb">rekey = 1</spanx>, it increments its
record of the remote generation number.  If the remote generation
number is now greater than the local generation number, the receiver
MUST immediately increment its local generation number to match and
send a frame (with empty application data if necessary) with
<spanx style="verb">rekey = 1</spanx>.
</t>
<t>A host SHOULD NOT initiate more than one concurrent re-key operation
if it has no data to send; that is, it should not initiate re-keying
with an empty application frame more than once while its record of the
remote generation number is less than its own.
</t>
<t>When retransmitting, implementations must always transmit the same
bytes for the same TCP sequence numbers.  Thus, a frame in a
retransmitted segment MUST always be encrypted with the same key as
when it was originally transmitted.
</t>
<t>Implementations SHOULD delete older-generation keys from memory once
they have received all frames they will need to decrypt with the old
keys and have encrypted all outgoing frames under the old keys.
</t>
</section>

<section anchor="keep-alive" title="Keep-alive">
<t>Instead of using TCP Keep-Alives to verify that the remote endpoint is
still responsive, tcpcrypt implementations SHOULD employ the re-keying
mechanism for this purpose, as follows.  When necessary, a host SHOULD
probe the liveness of its peer by initiating re-keying and
transmitting a new frame immediately (with empty application data if
necessary).
</t>
<t>As described in <xref target="rekeying"/>, a host receiving a frame encrypted under
a generation number greater than its own MUST increment its own
generation number and immediately transmit a new frame (with
zero-length application data, if necessary).
</t>
<t>Implementations MAY use TCP Keep-Alives for purposes that do not
require endpoint authentication, as discussed in <xref target="verified-liveness"/>.
</t>
</section>
</section>

<section anchor="encodings" title="Encodings">
<t>This section provides byte-level encodings for values transmitted or
computed by the protocol.
</t>

<section anchor="key-exchange-messages" title="Key exchange messages">
<t>The <spanx style="verb">Init1</spanx> message has the following encoding:
</t>

<figure align="center"><artwork align="center">
byte   0       1       2       3
   +-------+-------+-------+-------+
   |          INIT1_MAGIC          |
   |                               |
   +-------+-------+-------+-------+

           4        5      6       7
       +-------+-------+-------+-------+
       |          message_len          |
       |              = M              |
       +-------+-------+-------+-------+

           8
       +--------+-------+-------+---...---+-------+
       |nciphers|sym-   |sym-   |         |sym-   |
       | =K+1   |cipher0|cipher1|         |cipherK|
       +--------+-------+-------+---...---+-------+

          K + 10                    K + 10 + N_A_LEN
           |                         |
           v                         v
       +-------+---...---+-------+-------+---...---+-------+
       |           N_A           |          PK_A           |
       |                         |                         |
       +-------+---...---+-------+-------+---...---+-------+

                           M - 1
       +-------+---...---+-------+
       |          ignored        |
       |                         |
       +-------+---...---+-------+
</artwork></figure>
<t>The constant <spanx style="verb">INIT1_MAGIC</spanx> is defined in <xref target="tab:crypt-constants"/>.  The
four-byte field <spanx style="verb">message_len</spanx> gives the length of the entire <spanx style="verb">Init1</spanx>
message, encoded as a big-endian integer.  The <spanx style="verb">nciphers</spanx> field
contains an integer value that specifies the number of one-byte
symmetric-cipher identifiers that follow.  The <spanx style="verb">sym-cipher</spanx> bytes
identify cryptographic algorithms in <xref target="tab:ae-algs"/>.  The length
<spanx style="verb">N_A_LEN</spanx> and the length of <spanx style="verb">PK_A</spanx> are both determined by the
negotiated key-agreement scheme, as described in
<xref target="key-agreement-schemes"/>.
</t>
<t>When sending <spanx style="verb">Init1</spanx>, implementations of this protocol MUST omit the
field <spanx style="verb">ignored</spanx>; that is, they must construct the message such that
its end, as determined by <spanx style="verb">message_len</spanx>, coincides with the end of the
field <spanx style="verb">PK_A</spanx>.  When receiving <spanx style="verb">Init1</spanx>, however, implementations MUST
permit and ignore any bytes following <spanx style="verb">PK_A</spanx>.
</t>
<t>The <spanx style="verb">Init2</spanx> message has the following encoding:
</t>

<figure align="center"><artwork align="center">
byte   0       1       2       3
   +-------+-------+-------+-------+
   |          INIT2_MAGIC          |
   |                               |
   +-------+-------+-------+-------+


           4        5      6       7       8
       +-------+-------+-------+-------+-------+
       |          message_len          |sym-   |
       |              = M              |cipher |
       +-------+-------+-------+-------+-------+

           9                        9 + N_B_LEN
           |                         |
           v                         v
       +-------+---...---+-------+-------+---...---+-------+
       |           N_B           |          PK_B           |
       |                         |                         |
       +-------+---...---+-------+-------+---...---+-------+

                           M - 1
       +-------+---...---+-------+
       |          ignored        |
       |                         |
       +-------+---...---+-------+
</artwork></figure>
<t>The constant <spanx style="verb">INIT2_MAGIC</spanx> is defined in <xref target="tab:crypt-constants"/>.  The
four-byte field <spanx style="verb">message_len</spanx> gives the length of the entire <spanx style="verb">Init2</spanx>
message, encoded as a big-endian integer.  The <spanx style="verb">sym-cipher</spanx> value is a
selection from the symmetric-cipher identifiers in the
previously-received <spanx style="verb">Init1</spanx> message.  The length <spanx style="verb">N_B_LEN</spanx> and the
length of <spanx style="verb">PK_B</spanx> are both determined by the negotiated key-agreement
scheme, as described in <xref target="key-agreement-schemes"/>.
</t>
<t>When sending <spanx style="verb">Init2</spanx>, implementations of this protocol MUST omit the
field <spanx style="verb">ignored</spanx>; that is, they must construct the message such that
its end, as determined by <spanx style="verb">message_len</spanx>, coincides with the end of the
<spanx style="verb">PK_B</spanx> field.  When receiving <spanx style="verb">Init2</spanx>, however, implementations MUST
permit and ignore any bytes following <spanx style="verb">PK_B</spanx>.
</t>
</section>

<section anchor="application-frames" title="Application frames">
<t>An <spanx style="emph">application frame</spanx> comprises a control byte and a length-prefixed
ciphertext value:
</t>

<figure align="center"><artwork align="center">
byte   0       1       2       3               clen+2
   +-------+-------+-------+-------+---...---+-------+
   |control|      clen     |        ciphertext       |
   +-------+-------+-------+-------+---...---+-------+
</artwork></figure>
<t>The field <spanx style="verb">clen</spanx> is an integer in big-endian format and gives the
length of the <spanx style="verb">ciphertext</spanx> field.
</t>
<t>The byte <spanx style="verb">control</spanx> has this structure:
</t>

<figure align="center"><artwork align="center">
bit     7                 1       0
    +-------+---...---+-------+-------+
    |          cres           | rekey |
    +-------+---...---+-------+-------+
</artwork></figure>
<t>The seven-bit field <spanx style="verb">cres</spanx> is reserved; implementations MUST set these
bits to zero when sending, and MUST ignore them when receiving.
</t>
<t>The use of the <spanx style="verb">rekey</spanx> field is described in <xref target="rekeying"/>.
</t>

<section anchor="plaintext" title="Plaintext">
<t>The <spanx style="verb">ciphertext</spanx> field is the result of applying the negotiated
authenticated-encryption algorithm to a &quot;plaintext&quot; value, which has
one of these two formats:
</t>

<figure align="center"><artwork align="center">
byte   0       1               plen-1
   +-------+-------+---...---+-------+
   | flags |           data          |
   +-------+-------+---...---+-------+


byte   0       1       2       3              plen-1
   +-------+-------+-------+-------+---...---+-------+
   | flags |    urgent     |          data           |
   +-------+-------+-------+-------+---...---+-------+
</artwork></figure>
<t>(Note that <spanx style="verb">clen</spanx> in the previous section will generally be greater
than <spanx style="verb">plen</spanx>, as the ciphertext produced by the
authenticated-encryption scheme must both encrypt the application data
and provide a way to verify its integrity.)
</t>
<t>The <spanx style="verb">flags</spanx> byte has this structure:
</t>

<figure align="center"><artwork align="center">
bit    7    6    5    4    3    2    1    0
    +----+----+----+----+----+----+----+----+
    |            fres             |URGp|FINp|
    +----+----+----+----+----+----+----+----+
</artwork></figure>
<t>The six-bit value <spanx style="verb">fres</spanx> is reserved; implementations MUST set these
six bits to zero when sending, and MUST ignore them when receiving.
</t>
<t>When the <spanx style="verb">URGp</spanx> bit is set, it indicates that the <spanx style="verb">urgent</spanx> field is
present, and thus that the plaintext value has the second structure
variant above; otherwise the first variant is used.
</t>
<t>The meaning of <spanx style="verb">urgent</spanx> and of the flag bits is described in
<xref target="tcp-header-protection"/>.
</t>
</section>

<section anchor="associated-data" title="Associated data">
<t>An application frame's &quot;associated data&quot; (which is supplied to the
AEAD algorithm when decrypting the ciphertext and verifying the
frame's integrity) has this format:
</t>

<figure align="center"><artwork align="center">
byte   0       1       2
   +-------+-------+-------+
   |control|     clen      |
   +-------+-------+-------+
</artwork></figure>
<t>It contains the same values as the frame's <spanx style="verb">control</spanx> and <spanx style="verb">clen</spanx>
fields.
</t>
</section>

<section anchor="frame-nonce" title="Frame nonce">
<t>Lastly, a &quot;frame nonce&quot; (provided as input to the AEAD algorithm) has
this format:
</t>

<figure align="center"><artwork align="center">
byte
   +------+------+------+------+
 0 |     FRAME_NONCE_MAGIC     |
   +------+------+------+------+
 4 |                           |
   +           offset          +
 8 |                           |
   +------+------+------+------+
</artwork></figure>
<t>The 4-byte magic constant is defined in <xref target="tab:crypt-constants"/>.  The
8-byte <spanx style="verb">offset</spanx> field contains an integer in big-endian format.  Its
value is specified in <xref target="encryption"/>.
</t>
</section>
</section>
</section>

<section anchor="key-agreement-schemes" title="Key agreement schemes">
<t>The TEP negotiated via TCP-ENO may indicate the use of one
of the key-agreement schemes named in <xref target="tab:tep-ids"/>.  For example,
<spanx style="verb">TCPCRYPT_ECDHE_P256</spanx> names the tcpcrypt protocol with key-agreement
scheme ECDHE-P256.
</t>
<t>All schemes listed there use HKDF-Expand-SHA256 as the CPRF, and these
lengths for nonces and session keys:
</t>

<figure align="center"><artwork align="center">
N_A_LEN: 32 bytes
N_B_LEN: 32 bytes
K_LEN:   32 bytes
</artwork></figure>
<t>Key-agreement schemes ECDHE-P256 and ECDHE-P521 employ the ECSVDP-DH
secret value derivation primitive defined in <xref target="ieee1363"/>.  The named
curves are defined in <xref target="nist-dss"/>.  When the public-key values <spanx style="verb">PK_A</spanx>
and <spanx style="verb">PK_B</spanx> are transmitted as described in <xref target="key-exchange-messages"/>,
they are encoded with the &quot;Elliptic Curve Point to Octet String
Conversion Primitive&quot; described in Section E.2.3 of <xref target="ieee1363"/>, and
are prefixed by a two-byte length in big-endian format:
</t>

<figure align="center"><artwork align="center">
byte   0       1       2               L - 1
   +-------+-------+-------+---...---+-------+
   |   pubkey_len  |          pubkey         |
   |      = L      |                         |
   +-------+-------+-------+---...---+-------+
</artwork></figure>
<t>Implementations SHOULD encode these <spanx style="verb">pubkey</spanx> values in &quot;compressed
format&quot;, and MUST accept values encoded in &quot;compressed&quot;,
&quot;uncompressed&quot; or &quot;hybrid&quot; formats.
</t>
<t>Key-agreement schemes ECDHE-Curve25519 and ECDHE-Curve448 use the
functions X25519 and X448, respectively, to perform the Diffie-Helman
protocol as described in <xref target="RFC7748"/>.  When using these ciphers,
public-key values <spanx style="verb">PK_A</spanx> and <spanx style="verb">PK_B</spanx> are transmitted directly with no
length prefix: 32 bytes for Curve25519, and 56 bytes for Curve448.
</t>
<t>A tcpcrypt implementation MUST support at least the schemes ECDHE-P256
and ECDHE-P521, although system administrators need not enable them.
</t>
</section>

<section anchor="aead-algorithms" title="AEAD algorithms">
<t>Specifiers and key-lengths for AEAD algorithms are given in
<xref target="tab:ae-algs"/>.  The algorithms <spanx style="verb">AEAD_AES_128_GCM</spanx> and
<spanx style="verb">AEAD_AES_256_GCM</spanx> are specified in <xref target="RFC5116"/>.  The algorithm
<spanx style="verb">AEAD_CHACHA20_POLY1305</spanx> is specified in <xref target="RFC7539"/>.
</t>
</section>

<section anchor="iana-considerations" title="IANA considerations">
<t>Tcpcrypt's TEP identifiers will need to be incorporated in IANA's
TCP-ENO encryption protocol identifier registry, as follows:
</t>
<texttable anchor="tab:tep-ids" title="TEP identifiers for use with tcpcrypt
">
<ttcol align="center">cs</ttcol>
<ttcol align="left">Spec name</ttcol>

<c>0x21</c><c>TCPCRYPT_ECDHE_P256</c>
<c>0x22</c><c>TCPCRYPT_ECDHE_P521</c>
<c>0x23</c><c>TCPCRYPT_ECDHE_Curve25519</c>
<c>0x24</c><c>TCPCRYPT_ECDHE_Curve448</c>
</texttable>
<t>A &quot;tcpcrypt AEAD parameter&quot; registry needs to be maintained by IANA as
in the following table.  The use of encryption is described in
<xref target="encryption"/>.
</t>
<texttable anchor="tab:ae-algs" title="Authenticated-encryption algorithms corresponding to
sym-cipher specifiers in Init1 and Init2 messages.
">
<ttcol align="left">AEAD Algorithm</ttcol>
<ttcol align="left">Key Length</ttcol>
<ttcol align="right">sym-cipher</ttcol>

<c>AEAD_AES_128_GCM</c><c>16 bytes</c><c>0x01</c>
<c>AEAD_AES_256_GCM</c><c>32 bytes</c><c>0x02</c>
<c>AEAD_CHACHA20_POLY1305</c><c>32 bytes</c><c>0x10</c>
</texttable>
</section>

<section anchor="security-considerations" title="Security considerations">
<t>Public-key generation, public-key encryption, and shared-secret
generation all require randomness.  Other tcpcrypt functions may also
require randomness, depending on the algorithms and modes of operation
selected.  A weak pseudo-random generator at either host will
compromise tcpcrypt's security.  Many of tcpcrypt's cryptographic
functions require random input, and thus any host implementing
tcpcrypt MUST have access to a cryptographically-secure source of
randomness or pseudo-randomness.
</t>
<t>Most implementations will rely on system-wide pseudo-random generators
seeded from hardware events and a seed carried over from the previous
boot.  Once a pseudo-random generator has been properly seeded, it can
generate effectively arbitrary amounts of pseudo-random data.
However, until a pseudo-random generator has been seeded with
sufficient entropy, not only will tcpcrypt be insecure, it will reveal
information that further weakens the security of the pseudo-random
generator, potentially harming other applications.  As required by
TCP-ENO, implementations MUST NOT send ENO options unless they have
access to an adequate source of randomness.
</t>
<t>The cipher-suites specified in this document all use HMAC-SHA256 to
implement the collision-resistant pseudo-random function denoted by
<spanx style="verb">CPRF</spanx>.  A collision-resistant function is one on which, for
sufficiently large L, an attacker cannot find two distinct inputs
<spanx style="verb">K_1</spanx>, <spanx style="verb">CONST_1</spanx> and <spanx style="verb">K_2</spanx>, <spanx style="verb">CONST_2</spanx> such that <spanx style="verb">CPRF(K_1, CONST_1, L)
= CPRF(K_2, CONST_2, L)</spanx>.  Collision resistance is important to assure
the uniqueness of session IDs, which are generated using the CPRF.
</t>
<t>All of the security considerations of TCP-ENO apply to tcpcrypt.  In
particular, tcpcrypt does not protect against active eavesdroppers
unless applications authenticate the session ID.  If it can be
established that the session IDs computed at each end of the
connection match, then tcpcrypt guarantees that no man-in-the-middle
attacks occurred unless the attacker has broken the underlying
cryptographic primitives (e.g., ECDH).  A proof of this property for
an earlier version of the protocol has been published <xref target="tcpcrypt"/>.
</t>
<t>To gain middlebox compatibility, tcpcrypt does not protect TCP
headers.  Hence, the protocol is vulnerable to denial-of-service from
off-path attackers.  Possible attacks include desynchronizing the
underlying TCP stream, injecting RST packets, and forging or
suppressing rekey bits.  These attacks will cause a tcpcrypt
connection to hang or fail with an error.  Implementations MUST give
higher-level software a way to distinguish such errors from a clean
end-of-stream (indicated by an authenticated <spanx style="verb">FINp</spanx> bit) so that
applications can avoid semantic truncation attacks.
</t>
<t>There is no &quot;key confirmation&quot; step in tcpcrypt.  This is not required
because tcpcrypt's threat model includes the possibility of a
connection to an adversary.  If key negotiation is compromised and
yields two different keys, all subsequent frames will be ignored due
to failed integrity checks, causing the application's connection to
hang.  This is not a new threat because in plain TCP, an active
attacker could have modified sequence and acknowledgement numbers to
hang the connection anyway.
</t>
<t>Tcpcrypt uses short-lived public keys to provide forward secrecy.  All
currently specified key agreement schemes involve ECDHE-based key
agreement, meaning a new key can be efficiently computed for each
connection.  If implementations reuse these parameters, they SHOULD
limit the lifetime of the private parameters, ideally to no more than
two minutes.
</t>
<t>Attackers cannot force passive openers to move forward in their
session caching chain without guessing the content of the resumption
identifier, which will be difficult without key knowledge.
</t>
</section>

<section anchor="design-notes" title="Design notes">

<section anchor="asymmetric-roles" title="Asymmetric roles">
<t>Tcpcrypt transforms a shared pseudo-random key (PRK) into
cryptographic session keys for each direction.  Doing so requires an
asymmetry in the protocol, as the key derivation function must be
perturbed differently to generate different keys in each direction.
Tcpcrypt includes other asymmetries in the roles of the two hosts,
such as the process of negotiating algorithms (e.g., proposing vs.
selecting cipher suites).
</t>
</section>

<section anchor="verified-liveness" title="Verified liveness">
<t>Many hosts implement TCP Keep-Alives <xref target="RFC1122"/> as an option for
applications to ensure that the other end of a TCP connection still
exists even when there is no data to be sent.  A TCP Keep-Alive
segment carries a sequence number one prior to the beginning of the
send window, and may carry one byte of &quot;garbage&quot; data.  Such a segment
causes the remote side to send an acknowledgment.
</t>
<t>Unfortunately, tcpcrypt cannot cryptographically verify Keep-Alive
acknowledgments.  Hence, an attacker could prolong the existence of a
session at one host after the other end of the connection no longer
exists.  (Such an attack might prevent a process with sensitive data
from exiting, giving an attacker more time to compromise a host and
extract the sensitive data.)
</t>
<t>Thus, tcpcrypt specifies a way to stimulate the remote host to send
verifiably fresh and authentic data, described in <xref target="keep-alive"/>.
</t>
<t>The TCP keep-alive mechanism has also been used for its effects on
intermediate nodes in the network, such as preventing flow state from
expiring at NAT boxes or firewalls.  As these purposes do not require
the authentication of endpoints, implementations may safely accomplish
them using either the existing TCP keep-alive mechanism or tcpcrypt's
verified keep-alive mechanism.
</t>
</section>
</section>

<section anchor="acknowledgments" title="Acknowledgments">
<t>We are grateful for contributions, help, discussions, and feedback
from the TCPINC working group, including Marcelo Bagnulo, David Black,
Bob Briscoe, Jana Iyengar, Tero Kivinen, Mirja Kuhlewind, Yoav Nir,
Christoph Paasch, Eric Rescorla, and Kyle Rose.
</t>
<t>This work was funded by gifts from Intel (to Brad Karp) and from
Google; by NSF award CNS-0716806 (A Clean-Slate Infrastructure for
Information Flow Control); by DARPA CRASH under
contract #N66001-10-2-4088; and by the Stanford Secure Internet of
Things Project.
</t>
</section>

</middle>
<back>
<references title="Normative References">
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-tcpinc-tcpeno.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5116.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5869.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7539.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7748.xml"?>
<reference anchor='ieee1363'>
<front>
<title>IEEE Standard Specifications for Public-Key Cryptography (IEEE Std 1363-2000)</title>
<author fullname="IEEE"><organization /></author>
<date year='2000' />
</front>
</reference>
<reference anchor='nist-dss'>
<front>
<title>Digital Signature Standard, FIPS 186-2</title>
<author fullname="NIST"><organization /></author>
<date year='2000' />
</front>
</reference>
</references>
<references title="Informative References">
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.1122.xml"?>
<reference anchor='tcpcrypt'>

<front>
<title>The case for ubiquitous transport-level encryption</title>
<author initials='A.' surname='Bittau' fullname='A. Bittau'>
<organization /></author>
<author initials='M.' surname='Hamburg' fullname='M. Hamburg'>
<organization /></author>
<author initials='M.' surname='Handley' fullname='M. Handley'>
<organization /></author>
<author initials='D.' surname='Mazieres' fullname='D. Mazieres'>
<organization /></author>
<author initials='D.' surname='Boneh' fullname='D. Boneh'>
<organization /></author>
<date year='2010' />
</front>

  <seriesInfo name="USENIX Security" value="" />
</reference>
</references>

<section anchor="protocol-constant-values" title="Protocol constant values">
<texttable anchor="tab:crypt-constants" title="Protocol constants
">
<ttcol align="left">Value</ttcol>
<ttcol align="left">Name</ttcol>

<c>0x01</c><c>CONST_NEXTK</c>
<c>0x02</c><c>CONST_SESSID</c>
<c>0x03</c><c>CONST_REKEY</c>
<c>0x04</c><c>CONST_KEY_A</c>
<c>0x05</c><c>CONST_KEY_B</c>
<c>0x06</c><c>CONST_RESUME</c>
<c>0x15101a0e</c><c>INIT1_MAGIC</c>
<c>0x097105e0</c><c>INIT2_MAGIC</c>
<c>0x44415441</c><c>FRAME_NONCE_MAGIC</c>
</texttable>
</section>

</back>
</rfc>
