draft-ietf-tcpinc-tcpcrypt-06.txt   draft-ietf-tcpinc-tcpcrypt-07.txt 
Network Working Group A. Bittau Network Working Group A. Bittau
Internet-Draft Google Internet-Draft Google
Intended status: Experimental D. Giffin Intended status: Experimental D. Giffin
Expires: September 14, 2017 Stanford University Expires: April 7, 2018 Stanford University
M. Handley M. Handley
University College London University College London
D. Mazieres D. Mazieres
Stanford University Stanford University
Q. Slack Q. Slack
Sourcegraph Sourcegraph
E. Smith E. Smith
Kestrel Institute Kestrel Institute
March 13, 2017 October 4, 2017
Cryptographic protection of TCP Streams (tcpcrypt) Cryptographic protection of TCP Streams (tcpcrypt)
draft-ietf-tcpinc-tcpcrypt-06 draft-ietf-tcpinc-tcpcrypt-07
Abstract Abstract
This document specifies tcpcrypt, a TCP encryption protocol designed This document specifies tcpcrypt, a TCP encryption protocol designed
for use in conjunction with the TCP Encryption Negotiation Option for use in conjunction with the TCP Encryption Negotiation Option
(TCP-ENO) [I-D.ietf-tcpinc-tcpeno]. Tcpcrypt coexists with (TCP-ENO). Tcpcrypt coexists with middleboxes by tolerating
middleboxes by tolerating resegmentation, NATs, and other resegmentation, NATs, and other manipulations of the TCP header. The
manipulations of the TCP header. The protocol is self-contained and protocol is self-contained and specifically tailored to TCP
specifically tailored to TCP implementations, which often reside in implementations, which often reside in kernels or other environments
kernels or other environments in which large external software in which large external software dependencies can be undesirable.
dependencies can be undesirable. Because the size of TCP options is Because the size of TCP options is limited, the protocol requires one
limited, the protocol requires one additional one-way message latency additional one-way message latency to perform key exchange before
to perform key exchange before application data may be transmitted. application data may be transmitted. However, this cost can be
However, this cost can be avoided between two hosts that have avoided between two hosts that have recently established a previous
recently established a previous tcpcrypt connection. tcpcrypt connection.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 14, 2017. This Internet-Draft will expire on April 7, 2018.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
This document may contain material from IETF Documents or IETF
Contributions published or made publicly available before November
10, 2008. The person(s) controlling the copyright in some of this
material may not have granted the IETF Trust the right to allow
modifications of such material outside the IETF Standards Process.
Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other
than English.
Table of Contents Table of Contents
1. Requirements language . . . . . . . . . . . . . . . . . . . . 3 1. Requirements language . . . . . . . . . . . . . . . . . . . . 3
2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Encryption protocol . . . . . . . . . . . . . . . . . . . . . 4 3. Encryption protocol . . . . . . . . . . . . . . . . . . . . . 3
3.1. Cryptographic algorithms . . . . . . . . . . . . . . . . 4 3.1. Cryptographic algorithms . . . . . . . . . . . . . . . . 3
3.2. Protocol negotiation . . . . . . . . . . . . . . . . . . 5 3.2. Protocol negotiation . . . . . . . . . . . . . . . . . . 4
3.3. Key exchange . . . . . . . . . . . . . . . . . . . . . . 6 3.3. Key exchange . . . . . . . . . . . . . . . . . . . . . . 6
3.4. Session ID . . . . . . . . . . . . . . . . . . . . . . . 8 3.4. Session ID . . . . . . . . . . . . . . . . . . . . . . . 8
3.5. Session caching . . . . . . . . . . . . . . . . . . . . . 8 3.5. Session resumption . . . . . . . . . . . . . . . . . . . 8
3.6. Data encryption and authentication . . . . . . . . . . . 11 3.6. Data encryption and authentication . . . . . . . . . . . 11
3.7. TCP header protection . . . . . . . . . . . . . . . . . . 12 3.7. TCP header protection . . . . . . . . . . . . . . . . . . 12
3.8. Re-keying . . . . . . . . . . . . . . . . . . . . . . . . 12 3.8. Re-keying . . . . . . . . . . . . . . . . . . . . . . . . 13
3.9. Keep-alive . . . . . . . . . . . . . . . . . . . . . . . 13 3.9. Keep-alive . . . . . . . . . . . . . . . . . . . . . . . 14
4. Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4. Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1. Key exchange messages . . . . . . . . . . . . . . . . . . 14 4.1. Key exchange messages . . . . . . . . . . . . . . . . . . 14
4.2. Application frames . . . . . . . . . . . . . . . . . . . 16 4.2. Encryption frames . . . . . . . . . . . . . . . . . . . . 16
4.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . . 17 4.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . . 17
4.2.2. Associated data . . . . . . . . . . . . . . . . . . . 18 4.2.2. Associated data . . . . . . . . . . . . . . . . . . . 18
4.2.3. Frame nonce . . . . . . . . . . . . . . . . . . . . . 18 4.2.3. Frame nonce . . . . . . . . . . . . . . . . . . . . . 18
5. Key agreement schemes . . . . . . . . . . . . . . . . . . . . 18 4.3. Constant values . . . . . . . . . . . . . . . . . . . . . 18
6. AEAD algorithms . . . . . . . . . . . . . . . . . . . . . . . 19 5. Key agreement schemes . . . . . . . . . . . . . . . . . . . . 19
7. IANA considerations . . . . . . . . . . . . . . . . . . . . . 19 6. AEAD algorithms . . . . . . . . . . . . . . . . . . . . . . . 20
8. Security considerations . . . . . . . . . . . . . . . . . . . 20 7. IANA considerations . . . . . . . . . . . . . . . . . . . . . 20
9. Design notes . . . . . . . . . . . . . . . . . . . . . . . . 22 8. Security considerations . . . . . . . . . . . . . . . . . . . 21
9.1. Asymmetric roles . . . . . . . . . . . . . . . . . . . . 22 8.1. Asymmetric roles . . . . . . . . . . . . . . . . . . . . 22
9.2. Verified liveness . . . . . . . . . . . . . . . . . . . . 22 8.2. Verified liveness . . . . . . . . . . . . . . . . . . . . 23
10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 22 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 23
11. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 23 10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 23
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 23 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 24
12.1. Normative References . . . . . . . . . . . . . . . . . . 23 11.1. Normative References . . . . . . . . . . . . . . . . . . 24
12.2. Informative References . . . . . . . . . . . . . . . . . 24 11.2. Informative References . . . . . . . . . . . . . . . . . 25
Appendix A. Protocol constant values . . . . . . . . . . . . . . 24 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24
1. Requirements language 1. Requirements language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. document are to be interpreted as described in [RFC2119].
2. Introduction 2. Introduction
This document describes tcpcrypt, an extension to TCP for This document describes tcpcrypt, an extension to TCP for
skipping to change at page 4, line 18 skipping to change at page 3, line 48
The concrete format of all messages is specified in Section 4. The concrete format of all messages is specified in Section 4.
3.1. Cryptographic algorithms 3.1. Cryptographic algorithms
Setting up a tcpcrypt connection employs three types of cryptographic Setting up a tcpcrypt connection employs three types of cryptographic
algorithms: algorithms:
o A _key agreement scheme_ is used with a short-lived public key to o A _key agreement scheme_ is used with a short-lived public key to
agree upon a shared secret. agree upon a shared secret.
o An _extract function_ is used to generate a pseudo-random key from o An _extract function_ is used to generate a pseudo-random key
some initial keying material, typically the output of the key (PRK) from some initial keying material, typically the output of
agreement scheme. The notation Extract(S, IKM) denotes the output the key agreement scheme. The notation Extract(S, IKM) denotes
of the extract function with salt S and initial keying material the output of the extract function with salt S and initial keying
IKM. material IKM.
o A _collision-resistant pseudo-random function (CPRF)_ is used to o A _collision-resistant pseudo-random function (CPRF)_ is used to
generate multiple cryptographic keys from a pseudo-random key, generate multiple cryptographic keys from a pseudo-random key,
typically the output of the extract function. We use the notation typically the output of the extract function. The CPRF is defined
CPRF(K, CONST, L) to designate the output of L bytes of the to produce an arbitrary amount of Output Keying Material (OKM),
pseudo-random function identified by key K on CONST. and we use the notation CPRF(K, CONST, L) to designate the first L
bytes of the OKM produced by the pseudo-random function identified
by key K on CONST.
The Extract and CPRF functions used by default are the Extract and The Extract and CPRF functions used by default are the Extract and
Expand functions of HKDF [RFC5869]. These are defined as follows in Expand functions of HKDF [RFC5869]. These are defined as follows in
terms of the PRF "HMAC-Hash(key, value)" for a negotiated "Hash" terms of the function "HMAC-Hash(key, value)" for a negotiated "Hash"
function: function; the symbol | denotes concatenation, and the counter
concatenated to the right of CONST occupies a single octet.
HKDF-Extract(salt, IKM) -> PRK HKDF-Extract(salt, IKM) -> PRK
PRK = HMAC-Hash(salt, IKM) PRK = HMAC-Hash(salt, IKM)
HKDF-Expand(PRK, CONST, L) -> OKM HKDF-Expand(PRK, CONST, L) -> OKM
T(0) = empty string (zero length) T(0) = empty string (zero length)
T(1) = HMAC-Hash(PRK, T(0) | CONST | 0x01) T(1) = HMAC-Hash(PRK, T(0) | CONST | 0x01)
T(2) = HMAC-Hash(PRK, T(1) | CONST | 0x02) T(2) = HMAC-Hash(PRK, T(1) | CONST | 0x02)
T(3) = HMAC-Hash(PRK, T(2) | CONST | 0x03) T(3) = HMAC-Hash(PRK, T(2) | CONST | 0x03)
... ...
OKM = first L octets of T(1) | T(2) | T(3) | ... OKM = first L octets of T(1) | T(2) | T(3) | ...
Figure 1: The symbol | denotes concatenation, and the counter Figure 1: HKDF functions used for key derivation
concatenated to the right of CONST is a single octet.
Lastly, once tcpcrypt has been successfully set up and encryption Lastly, once tcpcrypt has been successfully set up and encryption
keys have been derived, an algorithm for Authenticated Encryption keys have been derived, an algorithm for Authenticated Encryption
with Associated Data (AEAD) is used to protect the confidentiality with Associated Data (AEAD) is used to protect the confidentiality
and integrity of all transmitted application data. AEAD algorithms and integrity of all transmitted application data. AEAD algorithms
use a single key to encrypt their input data and also to generate a use a single key to encrypt their input data and also to generate a
cryptographic tag to accompany the resulting ciphertext; when cryptographic tag to accompany the resulting ciphertext; when
decryption is performed, the tag allows authentication of the decryption is performed, the tag allows authentication of the
encrypted data and of optional, associated plaintext data. encrypted data and of optional, associated plaintext data.
3.2. Protocol negotiation 3.2. Protocol negotiation
Tcpcrypt depends on TCP-ENO [I-D.ietf-tcpinc-tcpeno] to negotiate Tcpcrypt depends on TCP-ENO [I-D.ietf-tcpinc-tcpeno] to negotiate
whether encryption will be enabled for a connection, and also which whether encryption will be enabled for a connection, and also which
key agreement scheme to use. TCP-ENO negotiates the use of a key agreement scheme to use. TCP-ENO negotiates the use of a
particular TCP encryption protocol or _TEP_ by including protocol particular TCP encryption protocol or _TEP_ by including protocol
identifiers in ENO suboptions. This document associates four TEP identifiers in ENO suboptions. This document associates four TEP
identifiers with the tcpcrypt protocol, as listed in Table 1. Each identifiers with the tcpcrypt protocol, as listed in Table 2. Each
identifier indicates the use of a particular key-agreement scheme. identifier indicates the use of a particular key-agreement scheme.
Future standards may associate additional identifiers with tcpcrypt. Future standards may associate additional identifiers with tcpcrypt.
An active opener that wishes to negotiate the use of tcpcrypt An active opener that wishes to negotiate the use of tcpcrypt
includes an ENO option in its SYN segment. That option includes includes an ENO option in its SYN segment. That option includes
suboptions with tcpcrypt TEP identifiers indicating the key-agreement suboptions with tcpcrypt TEP identifiers indicating the key-agreement
schemes it is willing to enable. The active opener MAY additionally schemes it is willing to enable. The active opener MAY additionally
include suboptions indicating support for encryption protocols other include suboptions indicating support for encryption protocols other
than tcpcrypt, as well as global suboptions as specified by TCP-ENO. than tcpcrypt, as well as global suboptions as specified by TCP-ENO.
skipping to change at page 6, line 14 skipping to change at page 5, line 47
Once two hosts have exchanged SYN segments, TCP-ENO defines the Once two hosts have exchanged SYN segments, TCP-ENO defines the
_negotiated TEP_ to be the last valid TEP identifier in the SYN _negotiated TEP_ to be the last valid TEP identifier in the SYN
segment of host B (that is, the passive opener in the absence of 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 simultaneous open) that also occurs in that of host A. If there is
no such TEP, hosts MUST disable TCP-ENO and tcpcrypt. no such TEP, hosts MUST disable TCP-ENO and tcpcrypt.
If the negotiated TEP was sent by host B with "v = 0", it means that If the negotiated TEP was sent by host B with "v = 0", it means that
fresh key agreement will be performed as described below in fresh key agreement will be performed as described below in
Section 3.3. If it had "v = 1", the key-exchange messages will be Section 3.3. If it had "v = 1", the key-exchange messages will be
omitted in favor of determining keys via session-caching as described omitted in favor of determining keys via session-resumption as
in Section 3.5, and protected application data may immediately be described in Section 3.5, and protected application data may
sent as detailed in Section 3.6. immediately be sent as detailed in Section 3.6.
Note that the negotiated TEP is determined without reference to the Note that the negotiated TEP is determined without reference to the
"v" bits in ENO suboptions, so if host A offers resumption with a "v" bits in ENO suboptions, so if host A offers resumption with a
particular TEP and host B replies with a non-resumption suboption particular TEP and host B replies with a non-resumption suboption
with the same TEP, that may become the negotiated TEP and fresh key with the same TEP, that may become the negotiated TEP and fresh key
agreement will be performed. That is, sending a resumption suboption agreement will be performed. That is, sending a resumption suboption
also implies willingness to perform fresh key agreement with the also implies willingness to perform fresh key agreement with the
indicated TEP. indicated TEP.
As required by TCP-ENO, once a host has both sent and received an ACK 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 segment containing a valid ENO option, encryption MUST be enabled and
plaintext application data MUST NOT ever be exchanged on the plaintext application data MUST NOT ever be exchanged on the
connection. If the negotiated TEP is among those listed in Table 1, connection. If the negotiated TEP is among those listed in Table 2,
a host MUST follow the protocol described in this document. a host MUST follow the protocol described in this document.
3.3. Key exchange 3.3. Key exchange
Following successful negotiation of a tcpcrypt TEP, all further Following successful negotiation of a tcpcrypt TEP, all further
signaling is performed in the Data portion of TCP segments. Except signaling is performed in the Data portion of TCP segments. Except
when resumption was negotiated (described below in Section 3.5), the when resumption was negotiated (described below in Section 3.5), the
two hosts perform key exchange through two messages, "Init1" and two hosts perform key exchange through two messages, "Init1" and
"Init2", at the start of the data streams of host A and host B, "Init2", at the start of the data streams of host A and host B,
respectively. These messages may span multiple TCP segments and need respectively. These messages may span multiple TCP segments and need
not end at a segment boundary. However, the segment containing the not end at a segment boundary. However, the segment containing the
last byte of an "Init1" or "Init2" message SHOULD have TCP's PSH bit last byte of an "Init1" or "Init2" message MUST have TCP's push flag
set. (PSH) set.
The key exchange protocol, in abstract, proceeds as follows: The key exchange protocol, in abstract, proceeds as follows:
A -> B: Init1 = { INIT1_MAGIC, sym-cipher-list, N_A, PK_A } A -> B: Init1 = { INIT1_MAGIC, sym-cipher-list, N_A, PK_A }
B -> A: Init2 = { INIT2_MAGIC, sym-cipher, N_B, PK_B } B -> A: Init2 = { INIT2_MAGIC, sym-cipher, N_B, PK_B }
The concrete format of these messages is specified in Section 4.1. The concrete format of these messages is specified in Section 4.1.
The parameters are defined as follows: The parameters are defined as follows:
o "INIT1_MAGIC", "INIT2_MAGIC": constants defined in Table 3. o "INIT1_MAGIC", "INIT2_MAGIC": constants defined in Table 1.
o "sym-cipher-list": a list of symmetric ciphers (AEAD algorithms) o "sym-cipher-list": a list of symmetric ciphers (AEAD algorithms)
acceptable to host A. These are specified in Table 2. acceptable to host A. These are specified in Table 3.
o "sym-cipher": the symmetric cipher selected by host B from the o "sym-cipher": the symmetric cipher selected by host B from the
"sym-cipher-list" sent by host A. "sym-cipher-list" sent by host A.
o "N_A", "N_B": nonces chosen at random by hosts A and B, o "N_A", "N_B": nonces chosen at random by hosts A and B,
respectively. respectively.
o "PK_A", "PK_B": ephemeral public keys for hosts A and B, o "PK_A", "PK_B": ephemeral public keys for hosts A and B,
respectively. These, as well as their corresponding private keys, respectively. These, as well as their corresponding private keys,
are short-lived values that SHOULD be refreshed periodically. The are short-lived values that SHOULD be refreshed periodically. The
skipping to change at page 7, line 34 skipping to change at page 7, line 20
and the remote host's ephemeral public key. For example, host A and the remote host's ephemeral public key. For example, host A
would compute "ES" using its own private key (not transmitted) and would compute "ES" using its own private key (not transmitted) and
host B's public key, "PK_B". host B's public key, "PK_B".
The two sides then compute a pseudo-random key ("PRK"), from which The two sides then compute a pseudo-random key ("PRK"), from which
all session keys are derived, as follows: all session keys are derived, as follows:
PRK = Extract(N_A, eno-transcript | Init1 | Init2 | ES) PRK = Extract(N_A, eno-transcript | Init1 | Init2 | ES)
Above, "|" denotes concatenation; "eno-transcript" is the protocol- Above, "|" denotes concatenation; "eno-transcript" is the protocol-
negotiation transcript defined in TCP-ENO; and "Init1" and "Init2" negotiation transcript defined in Section 4.8 of
are the transmitted encodings of the messages described in [I-D.ietf-tcpinc-tcpeno]; and "Init1" and "Init2" are the transmitted
Section 4.1. encodings of the messages described in Section 4.1.
A series of "session secrets" are then computed from "PRK" as A series of "session secrets" are then computed from "PRK" as
follows: follows:
ss[0] = PRK ss[0] = PRK
ss[i] = CPRF(ss[i-1], CONST_NEXTK, K_LEN) ss[i] = CPRF(ss[i-1], CONST_NEXTK, K_LEN)
The value "ss[0]" is used to generate all key material for the The value "ss[0]" is used to generate all key material for the
current connection. The values "ss[i]" for "i > 0" can be used to current connection. The values "ss[i]" for "i > 0" can be used to
avoid public key cryptography when establishing subsequent avoid public key cryptography when establishing subsequent
connections between the same two hosts, as described in Section 3.5. connections between the same two hosts, as described in Section 3.5.
The "CONST_*" values are constants defined in Table 3. The length The "CONST_*" values are constants defined in Table 1. The length
"K_LEN" depends on the tcpcrypt TEP in use, and is specified in "K_LEN" depends on the tcpcrypt TEP in use, and is specified in
Section 5. Section 5.
Given a session secret "ss", the two sides compute a series of master Given a session secret "ss", the two sides compute a series of master
keys as follows: keys as follows:
mk[0] = CPRF(ss, CONST_REKEY, K_LEN) mk[0] = CPRF(ss, CONST_REKEY, K_LEN)
mk[i] = CPRF(mk[i-1], CONST_REKEY, K_LEN) mk[i] = CPRF(mk[i-1], CONST_REKEY, K_LEN)
The particular master key in use is advanced as described in The particular master key in use is advanced as described in
skipping to change at page 8, line 23 skipping to change at page 8, line 9
Finally, each master key "mk" is used to generate keys for Finally, each master key "mk" is used to generate keys for
authenticated encryption for the "A" and "B" roles. Key "k_ab" is authenticated encryption for the "A" and "B" roles. Key "k_ab" is
used by host A to encrypt and host B to decrypt, while "k_ba" is used used by host A to encrypt and host B to decrypt, while "k_ba" is used
by host B to encrypt and host A to decrypt. by host B to encrypt and host A to decrypt.
k_ab = CPRF(mk, CONST_KEY_A, ae_keylen) k_ab = CPRF(mk, CONST_KEY_A, ae_keylen)
k_ba = CPRF(mk, CONST_KEY_B, ae_keylen) k_ba = CPRF(mk, CONST_KEY_B, ae_keylen)
The value "ae_keylen" depends on the authenticated-encryption The value "ae_keylen" depends on the authenticated-encryption
algorithm selected, and is given under "Key Length" in Table 2. algorithm selected, and is given under "Key Length" in Table 3.
After host B sends "Init2" or host A receives it, that host may After host B sends "Init2" or host A receives it, that host may
immediately begin transmitting protected application data as immediately begin transmitting protected application data as
described in Section 3.6. described in Section 3.6.
If host A receives "Init2" with a "sym-cipher" value that was not If host A receives "Init2" with a "sym-cipher" value that was not
present in the "sym-cipher-list" it previously transmitted in present in the "sym-cipher-list" it previously transmitted in
"Init1", it MUST abort the connection and raise an error condition "Init1", it MUST abort the connection and raise an error condition
distinct from the end-of-file condition. distinct from the end-of-file condition.
Throughout this document, to "abort the connection" means to issue
the "Abort" command as described in [RFC0793], Section 3.8. That is,
the TCP connection is destroyed, RESET is transmitted, and the local
user is alerted to the abort event.
3.4. Session ID 3.4. Session ID
TCP-ENO requires each TEP to define a _session ID_ value that TCP-ENO requires each TEP to define a _session ID_ value that
uniquely identifies each encrypted connection. uniquely identifies each encrypted connection.
As required, a tcpcrypt session ID begins with the negotiated TEP As required, a tcpcrypt session ID begins with the negotiated TEP
identifier along with the "v" bit as transmitted by host B. The identifier along with the "v" bit as transmitted by host B. The
remainder of the ID is derived from the session secret, as follows: remainder of the ID is derived from the session secret, as follows:
session_id[i] = TEP-byte | CPRF(ss[i], CONST_SESSID, K_LEN) session_id[i] = TEP-byte | CPRF(ss[i], CONST_SESSID, K_LEN)
Again, the length "K_LEN" depends on the TEP, and is specified in Again, the length "K_LEN" depends on the TEP, and is specified in
Section 5. Section 5.
3.5. Session caching 3.5. Session resumption
When two hosts have already negotiated session secret "ss[i-1]", they When two hosts have already negotiated session secret "ss[i-1]", they
can establish a new connection without public-key operations using can establish a new connection without public-key operations using
"ss[i]". A host signals willingness to resume with a particular "ss[i]". A host signals willingness to resume with a particular
session secret by sending a SYN segment with a resumption suboption: session secret by sending a SYN segment with a resumption suboption:
that is, an ENO suboption containing the negotiated TEP identifier that is, an ENO suboption containing the negotiated TEP identifier
from the original session and part of an identifier for the session. from the original session and part of an identifier for the session.
The resumption identifier is calculated from a session secret "ss[i]" The resumption identifier is calculated from a session secret "ss[i]"
as follows: as follows:
skipping to change at page 10, line 46 skipping to change at page 10, line 38
compute and cache "ss[i+1]" for possible use by a later session, then compute and cache "ss[i+1]" for possible use by a later session, then
erase "ss[i]" from memory. Hosts SHOULD retain "ss[i+1]" until it is erase "ss[i]" from memory. Hosts SHOULD retain "ss[i+1]" until it is
used or the memory needs to be reclaimed. Hosts SHOULD NOT write a used or the memory needs to be reclaimed. Hosts SHOULD NOT write a
cached "ss[i+1]" value to non-volatile storage. cached "ss[i+1]" value to non-volatile storage.
When proposing resumption, the active opener MUST use the lowest When proposing resumption, the active opener MUST use the lowest
value of "i" that has not already been used (successfully or not) to value of "i" that has not already been used (successfully or not) to
negotiate resumption with the same host and for the same pre-session negotiate resumption with the same host and for the same pre-session
key "ss[0]". key "ss[0]".
A host MUST NOT resume with a session secret if it has ever A session secret may not be used to secure more than one TCP
successfully negotiated resumption in the past, in either role, with connection. To prevent this, a host MUST NOT resume with a session
the same secret. In the event that two hosts simultaneously send SYN secret if it has ever enabled encryption in the past with the same
segments to each other that propose resumption with the same session secret, in either role. In the event that two hosts simultaneously
secret but the two segments are not part of a simultaneous open, both send SYN segments to each other that propose resumption with the same
connections will have to revert to fresh key-exchange. To avoid this session secret but the two segments are not part of a simultaneous
limitation, implementations MAY choose to implement session caching open, both connections will have to revert to fresh key-exchange. To
such that a given pre-session key "ss[0]" is only used for either avoid this limitation, implementations MAY choose to implement
passive or active opens at the same host, not both. session resumption such that a given pre-session key "ss[0]" is only
used for either passive or active opens at the same host, not both.
When two hosts have previously negotiated a tcpcrypt session, either When two hosts have previously negotiated a tcpcrypt session, either
host may initiate session resumption regardless of which host was the host may initiate session resumption regardless of which host was the
active opener or played the "A" role in the previous session. active opener or played the "A" role in the previous session.
However, a given host must either encrypt with "k_ab" for all However, a given host must either encrypt with "k_ab" for all
sessions derived from the same pre-session key "ss[0]", or with sessions derived from the same pre-session key "ss[0]", or with
"k_ba". Thus, which keys a host uses to send segments is not "k_ba". Thus, which keys a host uses to send segments is not
affected by the role it plays in the current connection: it depends affected by the role it plays in the current connection: it depends
only on whether the host played the "A" or "B" role in the initial only on whether the host played the "A" or "B" role in the initial
session. session.
Implementations that perform session caching MUST provide a means for Implementations that perform session caching MUST provide a means for
applications to control session caching, including flushing cached applications to control session caching, including flushing cached
session secrets associated with an ESTABLISHED connection or session secrets associated with an ESTABLISHED connection or
disabling the use of caching for a particular connection. disabling the use of caching for a particular connection.
3.6. Data encryption and authentication 3.6. Data encryption and authentication
Following key exchange (or its omission via session caching), all Following key exchange (or its omission via session resumption), all
further communication in a tcpcrypt-enabled connection is carried out further communication in a tcpcrypt-enabled connection is carried out
within delimited _application frames_ that are encrypted and within delimited _encryption frames_ that are encrypted and
authenticated using the agreed keys. authenticated using the agreed keys.
This protection is provided via algorithms for Authenticated This protection is provided via algorithms for Authenticated
Encryption with Associated Data (AEAD). The particular algorithms Encryption with Associated Data (AEAD). The particular algorithms
that may be used are listed in Table 2. One algorithm is selected that may be used are listed in Table 3. One algorithm is selected
during the negotiation described in Section 3.3. during the negotiation described in Section 3.3.
The format of an application frame is specified in Section 4.2. A The format of an encryption frame is specified in Section 4.2. A
sending host breaks its stream of application data into a series of sending host breaks its stream of application data into a series of
chunks. Each chunk is placed in the "data" portion of a "plaintext" chunks. Each chunk is placed in the "data" portion of a "plaintext"
value, which is then encrypted to yield a frame's "ciphertext" field. value, which is then encrypted to yield a frame's "ciphertext" field.
Chunks must be small enough that the ciphertext (whose length depends Chunks must be small enough that the ciphertext (whose length depends
on the AEAD cipher used, and is generally slightly longer than the on the AEAD cipher used, and is generally slightly longer than the
plaintext) has length less than 2^16 bytes. plaintext) has length less than 2^16 bytes.
An "associated data" value (see Section 4.2.2) is constructed for the An "associated data" value (see Section 4.2.2) is constructed for the
frame. It contains the frame's "control" field and the length of the frame. It contains the frame's "control" field and the length of the
ciphertext. ciphertext.
A "frame nonce" value (see Section 4.2.3) is also constructed for the A "frame nonce" value (see Section 4.2.3) is also constructed for the
frame but not explicitly transmitted. It contains an "offset" field frame but not explicitly transmitted. It contains an "offset" field
whose integer value is the zero-indexed byte offset of the beginning whose integer value is the zero-indexed byte offset of the beginning
of the current application frame in the underlying TCP datastream. of the current encryption frame in the underlying TCP datastream.
(That is, the offset in the framing stream, not the plaintext (That is, the offset in the framing stream, not the plaintext
application stream.) Because it is strictly necessary for the application stream.) Because it is strictly necessary for the
security of the AEAD algorithm, an implementation MUST NOT ever security of the AEAD algorithm, an implementation MUST NOT ever
transmit distinct frames with the same nonce value under the same transmit distinct frames with the same nonce value under the same
encryption key. In particular, a retransmitted TCP segment MUST encryption key. In particular, a retransmitted TCP segment MUST
contain the same payload bytes for the same TCP sequence numbers, and 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 a host MUST NOT transmit more than 2^64 bytes in the underlying TCP
datastream (which would cause the "offset" field to wrap) before re- datastream (which would cause the "offset" field to wrap) before re-
keying. keying.
skipping to change at page 12, line 26 skipping to change at page 12, line 20
Section 3.3. The plaintext value serves as "P", the associated data Section 3.3. The plaintext value serves as "P", the associated data
as "A", and the frame nonce as "N". The output of the encryption as "A", and the frame nonce as "N". The output of the encryption
operation, "C", is transmitted in the frame's "ciphertext" field. operation, "C", is transmitted in the frame's "ciphertext" field.
When a frame is received, tcpcrypt reconstructs the associated data When a frame is received, tcpcrypt reconstructs the associated data
and frame nonce values (the former contains only data sent in the and frame nonce values (the former contains only data sent in the
clear, and the latter is implicit in the TCP stream), and provides clear, and the latter is implicit in the TCP stream), and provides
these and the ciphertext value to the the AEAD decryption operation. these and the ciphertext value to the the AEAD decryption operation.
The output of this operation is either a plaintext value "P" or the The output of this operation is either a plaintext value "P" or the
special symbol FAIL. In the latter case, the implementation MUST special symbol FAIL. In the latter case, the implementation MUST
either ignore the frame or abort the connection; but if it aborts, either drop the TCP segment(s) containing the frame or abort the
the implementation MUST raise an error condition distinct from the connection; but if it aborts, the implementation MUST raise an error
end-of-file condition. condition distinct from the end-of-file condition.
3.7. TCP header protection 3.7. TCP header protection
The "ciphertext" field of the application frame contains protected The "ciphertext" field of the encryption frame contains protected
versions of certain TCP header values. versions of certain TCP header values.
When "URGp" is set, the "urgent" value indicates an offset from the When the "URGp" bit is set, the "urgent" value indicates an offset
current frame's beginning offset; the sum of these offsets gives the from the current frame's beginning offset; the sum of these offsets
index of the last byte of urgent data in the application datastream. gives the index of the last byte of urgent data in the application
datastream.
When "FINp" is set, it indicates that the sender will send no more A sender MUST set the "FINp" bit on the last frame it sends in the
application data after this frame. When the TCP FIN flag differs connection (unless it aborts the connection), and MUST NOT set "FINp"
from "FINp", a receiving host MUST either ignore the segment on any other frame.
altogether or abort the connection and raise an error condition
distinct from the end-of-file condition. TCP sets the FIN flag when a sender has no more data, which with
tcpcrypt means setting FIN on the segment containing the last byte of
the last frame. However, a receiver MUST report the end-of-file
condition to the connection's local user when and only when it
receives a frame with the "FINp" bit set. If a host receives a
segment with the TCP FIN flag set but the received datastream
including this segment does not contain a frame with "FINp" set, the
host SHOULD abort the connection and raise an error condition
distinct from the end-of-file condition; but if there are
unacknowledged segments whose retransmission could potentially result
in a valid frame, the host MAY instead drop the segment with the TCP
FIN flag set.
3.8. Re-keying 3.8. Re-keying
Re-keying allows hosts to wipe from memory keys that could decrypt Re-keying allows hosts to wipe from memory keys that could decrypt
previously transmitted segments. It also allows the use of AEAD previously transmitted segments. It also allows the use of AEAD
ciphers that can securely encrypt only a bounded number of messages ciphers that can securely encrypt only a bounded number of messages
under a given key. under a given key.
We refer to the two encryption keys (k_ab, k_ba) as a _key-set_. We We refer to the two encryption keys (k_ab, k_ba) as a _key-set_. We
refer to the key-set generated by mk[i] as the key-set with refer to the key-set generated by mk[i] as the key-set with
skipping to change at page 13, line 32 skipping to change at page 13, line 39
When a host receives a frame with "rekey = 1", it increments its When a host receives a frame with "rekey = 1", it increments its
record of the remote generation number. If the remote generation record of the remote generation number. If the remote generation
number is now greater than the local generation number, the receiver number is now greater than the local generation number, the receiver
MUST immediately increment its local generation number to match. MUST immediately increment its local generation number to match.
Moreover, if the receiver has not yet transmitted a segment with the Moreover, if the receiver has not yet transmitted a segment with the
FIN flag set, it MUST immediately send a frame (with empty FIN flag set, it MUST immediately send a frame (with empty
application data if necessary) with "rekey = 1". application data if necessary) with "rekey = 1".
A host SHOULD NOT initiate more than one concurrent re-key operation 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 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 with an empty encryption frame more than once while its record of the
the remote generation number is less than its own. remote generation number is less than its own.
When retransmitting, implementations must always transmit the same When retransmitting, implementations must always transmit the same
bytes for the same TCP sequence numbers. Thus, a frame in a bytes for the same TCP sequence numbers. Thus, a frame in a
retransmitted segment MUST always be encrypted with the same key as retransmitted segment MUST always be encrypted with the same key as
when it was originally transmitted. when it was originally transmitted.
Implementations SHOULD delete older-generation keys from memory once Implementations SHOULD delete older-generation keys from memory once
they have received all frames they will need to decrypt with the old they have received all frames they will need to decrypt with the old
keys and have encrypted all outgoing frames under the old keys. keys and have encrypted all outgoing frames under the old keys.
skipping to change at page 14, line 12 skipping to change at page 14, line 21
and transmitting a new frame immediately (with empty application data and transmitting a new frame immediately (with empty application data
if necessary). if necessary).
As described in Section 3.8, a host receiving a frame encrypted under As described in Section 3.8, a host receiving a frame encrypted under
a generation number greater than its own MUST increment its own a generation number greater than its own MUST increment its own
generation number and (if it has not already transmitted a segment generation number and (if it has not already transmitted a segment
with FIN set) immediately transmit a new frame (with zero-length with FIN set) immediately transmit a new frame (with zero-length
application data if necessary). application data if necessary).
Implementations MAY use TCP Keep-Alives for purposes that do not Implementations MAY use TCP Keep-Alives for purposes that do not
require endpoint authentication, as discussed in Section 9.2. require endpoint authentication, as discussed in Section 8.2.
4. Encodings 4. Encodings
This section provides byte-level encodings for values transmitted or This section provides byte-level encodings for values transmitted or
computed by the protocol. computed by the protocol.
4.1. Key exchange messages 4.1. Key exchange messages
The "Init1" message has the following encoding: The "Init1" message has the following encoding:
skipping to change at page 15, line 37 skipping to change at page 15, line 37
| N_A | PK_A | | N_A | PK_A |
| | | | | |
+-------+---...---+-------+-------+---...---+-------+ +-------+---...---+-------+-------+---...---+-------+
M - 1 M - 1
+-------+---...---+-------+ +-------+---...---+-------+
| ignored | | ignored |
| | | |
+-------+---...---+-------+ +-------+---...---+-------+
The constant "INIT1_MAGIC" is defined in Table 3. The four-byte The constant "INIT1_MAGIC" is defined in Table 1. The four-byte
field "message_len" gives the length of the entire "Init1" message, field "message_len" gives the length of the entire "Init1" message,
encoded as a big-endian integer. The "nciphers" field contains an encoded as a big-endian integer. The "nciphers" field contains an
integer value that specifies the number of one-byte symmetric-cipher integer value that specifies the number of one-byte symmetric-cipher
identifiers that follow. The "sym-cipher" bytes identify identifiers that follow. The "sym-cipher" bytes identify
cryptographic algorithms in Table 2. The length "N_A_LEN" and the cryptographic algorithms in Table 3. The length "N_A_LEN" and the
length of "PK_A" are both determined by the negotiated key-agreement length of "PK_A" are both determined by the negotiated key-agreement
scheme, as described in Section 5. scheme, as described in Section 5.
When sending "Init1", implementations of this protocol MUST omit the When sending "Init1", implementations of this protocol MUST omit the
field "ignored"; that is, they must construct the message such that field "ignored"; that is, they must construct the message such that
its end, as determined by "message_len", coincides with the end of its end, as determined by "message_len", coincides with the end of
the field "PK_A". When receiving "Init1", however, implementations the field "PK_A". When receiving "Init1", however, implementations
MUST permit and ignore any bytes following "PK_A". MUST permit and ignore any bytes following "PK_A".
The "Init2" message has the following encoding: The "Init2" message has the following encoding:
skipping to change at page 16, line 31 skipping to change at page 16, line 31
| N_B | PK_B | | N_B | PK_B |
| | | | | |
+-------+---...---+-------+-------+---...---+-------+ +-------+---...---+-------+-------+---...---+-------+
M - 1 M - 1
+-------+---...---+-------+ +-------+---...---+-------+
| ignored | | ignored |
| | | |
+-------+---...---+-------+ +-------+---...---+-------+
The constant "INIT2_MAGIC" is defined in Table 3. The four-byte The constant "INIT2_MAGIC" is defined in Table 1. The four-byte
field "message_len" gives the length of the entire "Init2" message, field "message_len" gives the length of the entire "Init2" message,
encoded as a big-endian integer. The "sym-cipher" value is a encoded as a big-endian integer. The "sym-cipher" value is a
selection from the symmetric-cipher identifiers in the previously- selection from the symmetric-cipher identifiers in the previously-
received "Init1" message. The length "N_B_LEN" and the length of received "Init1" message. The length "N_B_LEN" and the length of
"PK_B" are both determined by the negotiated key-agreement scheme, as "PK_B" are both determined by the negotiated key-agreement scheme, as
described in Section 5. described in Section 5.
When sending "Init2", implementations of this protocol MUST omit the When sending "Init2", implementations of this protocol MUST omit the
field "ignored"; that is, they must construct the message such that field "ignored"; that is, they must construct the message such that
its end, as determined by "message_len", coincides with the end of its end, as determined by "message_len", coincides with the end of
the "PK_B" field. When receiving "Init2", however, implementations the "PK_B" field. When receiving "Init2", however, implementations
MUST permit and ignore any bytes following "PK_B". MUST permit and ignore any bytes following "PK_B".
4.2. Application frames 4.2. Encryption frames
An _application frame_ comprises a control byte and a length-prefixed An _encryption frame_ comprises a control byte and a length-prefixed
ciphertext value: ciphertext value:
byte 0 1 2 3 clen+2 byte 0 1 2 3 clen+2
+-------+-------+-------+-------+---...---+-------+ +-------+-------+-------+-------+---...---+-------+
|control| clen | ciphertext | |control| clen | ciphertext |
+-------+-------+-------+-------+---...---+-------+ +-------+-------+-------+-------+---...---+-------+
The field "clen" is an integer in big-endian format and gives the The field "clen" is an integer in big-endian format and gives the
length of the "ciphertext" field. length of the "ciphertext" field.
skipping to change at page 18, line 17 skipping to change at page 18, line 17
When the "URGp" bit is set, it indicates that the "urgent" field is When the "URGp" bit is set, it indicates that the "urgent" field is
present, and thus that the plaintext value has the second structure present, and thus that the plaintext value has the second structure
variant above; otherwise the first variant is used. variant above; otherwise the first variant is used.
The meaning of "urgent" and of the flag bits is described in The meaning of "urgent" and of the flag bits is described in
Section 3.7. Section 3.7.
4.2.2. Associated data 4.2.2. Associated data
An application frame's "associated data" (which is supplied to the An encryption frame's "associated data" (which is supplied to the
AEAD algorithm when decrypting the ciphertext and verifying the AEAD algorithm when decrypting the ciphertext and verifying the
frame's integrity) has this format: frame's integrity) has this format:
byte 0 1 2 byte 0 1 2
+-------+-------+-------+ +-------+-------+-------+
|control| clen | |control| clen |
+-------+-------+-------+ +-------+-------+-------+
It contains the same values as the frame's "control" and "clen" It contains the same values as the frame's "control" and "clen"
fields. fields.
skipping to change at page 18, line 43 skipping to change at page 18, line 43
byte byte
+------+------+------+------+ +------+------+------+------+
0 | FRAME_NONCE_MAGIC | 0 | FRAME_NONCE_MAGIC |
+------+------+------+------+ +------+------+------+------+
4 | | 4 | |
+ offset + + offset +
8 | | 8 | |
+------+------+------+------+ +------+------+------+------+
The 4-byte magic constant is defined in Table 3. The 8-byte "offset" The 4-byte magic constant is defined in Table 1. The 8-byte "offset"
field contains an integer in big-endian format. Its value is field contains an integer in big-endian format. Its value is
specified in Section 3.6. specified in Section 3.6.
4.3. Constant values
The table below defines values for the constants used in the
protocol.
+------------+-------------------+
| Value | Name |
+------------+-------------------+
| 0x01 | CONST_NEXTK |
| 0x02 | CONST_SESSID |
| 0x03 | CONST_REKEY |
| 0x04 | CONST_KEY_A |
| 0x05 | CONST_KEY_B |
| 0x06 | CONST_RESUME |
| 0x15101a0e | INIT1_MAGIC |
| 0x097105e0 | INIT2_MAGIC |
| 0x44415441 | FRAME_NONCE_MAGIC |
+------------+-------------------+
Table 1: Constant values used in the protocol
5. Key agreement schemes 5. Key agreement schemes
The TEP negotiated via TCP-ENO may indicate the use of one of the The TEP negotiated via TCP-ENO may indicate the use of one of the
key-agreement schemes named in Table 1. For example, key-agreement schemes named in Table 2. For example,
"TCPCRYPT_ECDHE_P256" names the tcpcrypt protocol with key-agreement "TCPCRYPT_ECDHE_P256" names the tcpcrypt protocol with key-agreement
scheme ECDHE-P256. scheme ECDHE-P256.
All schemes listed there use HKDF-Expand-SHA256 as the CPRF, and All schemes listed there use HKDF-Expand-SHA256 as the CPRF, and
these lengths for nonces and session keys: these lengths for nonces and session keys:
N_A_LEN: 32 bytes N_A_LEN: 32 bytes
N_B_LEN: 32 bytes N_B_LEN: 32 bytes
K_LEN: 32 bytes K_LEN: 32 bytes
skipping to change at page 19, line 42 skipping to change at page 20, line 17
protocol as described in [RFC7748]. When using these ciphers, protocol as described in [RFC7748]. When using these ciphers,
public-key values "PK_A" and "PK_B" are transmitted directly with no public-key values "PK_A" and "PK_B" are transmitted directly with no
length prefix: 32 bytes for Curve25519, and 56 bytes for Curve448. length prefix: 32 bytes for Curve25519, and 56 bytes for Curve448.
A tcpcrypt implementation MUST support at least the schemes A tcpcrypt implementation MUST support at least the schemes
ECDHE-P256 and ECDHE-P521, although system administrators need not ECDHE-P256 and ECDHE-P521, although system administrators need not
enable them. enable them.
6. AEAD algorithms 6. AEAD algorithms
Specifiers and key-lengths for AEAD algorithms are given in Table 2. Specifiers and key-lengths for AEAD algorithms are given in Table 3.
The algorithms "AEAD_AES_128_GCM" and "AEAD_AES_256_GCM" are The algorithms "AEAD_AES_128_GCM" and "AEAD_AES_256_GCM" are
specified in [RFC5116]. The algorithm "AEAD_CHACHA20_POLY1305" is specified in [RFC5116]. The algorithm "AEAD_CHACHA20_POLY1305" is
specified in [RFC7539]. specified in [RFC7539].
7. IANA considerations 7. IANA considerations
Tcpcrypt's TEP identifiers will need to be incorporated in IANA's Tcpcrypt's TEP identifiers will need to be incorporated in IANA's
TCP-ENO encryption protocol identifier registry, as follows: "TCP encryption protocol identifiers" registry under the
"Transmission Control Protocol (TCP) Parameters" registry, as in the
following table. The various key-agreement schemes used by these
tcpcrypt variants are defined in Section 5.
+------+---------------------------+ +-------+---------------------------+-----------+
| glt | Spec name | | Value | Meaning | Reference |
+------+---------------------------+ +-------+---------------------------+-----------+
| 0x21 | TCPCRYPT_ECDHE_P256 | | 0x21 | TCPCRYPT_ECDHE_P256 | [RFC-TBD] |
| 0x22 | TCPCRYPT_ECDHE_P521 | | 0x22 | TCPCRYPT_ECDHE_P521 | [RFC-TBD] |
| 0x23 | TCPCRYPT_ECDHE_Curve25519 | | 0x23 | TCPCRYPT_ECDHE_Curve25519 | [RFC-TBD] |
| 0x24 | TCPCRYPT_ECDHE_Curve448 | | 0x24 | TCPCRYPT_ECDHE_Curve448 | [RFC-TBD] |
+------+---------------------------+ +-------+---------------------------+-----------+
Table 1: TEP identifiers for use with tcpcrypt Table 2: TEP identifiers for use with tcpcrypt
A "tcpcrypt AEAD parameter" registry needs to be maintained by IANA In Section 4.1, this document defines "sym-cipher" specifiers for
as in the following table. The use of encryption is described in which IANA is to maintain a new "tcpcrypt AEAD Algorithm" registry
Section 3.6. under the "Transmission Control Protocol (TCP) Parameters" registry,
with initial values as given in the following table. The AEAD
algorithms named there are defined in Section 6. Future assignments
are to be made under the "RFC Required" policy detailed in [RFC8126],
relying on early allocation [RFC7120] to facilitate testing before an
RFC is finalized.
+------------------------+------------+------------+ +-------+------------------------+------------+-----------+
| AEAD Algorithm | Key Length | sym-cipher | | Value | AEAD Algorithm | Key Length | Reference |
+------------------------+------------+------------+ +-------+------------------------+------------+-----------+
| AEAD_AES_128_GCM | 16 bytes | 0x01 | | 0x01 | AEAD_AES_128_GCM | 16 bytes | [RFC-TBD] |
| AEAD_AES_256_GCM | 32 bytes | 0x02 | | 0x02 | AEAD_AES_256_GCM | 32 bytes | [RFC-TBD] |
| AEAD_CHACHA20_POLY1305 | 32 bytes | 0x10 | | 0x10 | AEAD_CHACHA20_POLY1305 | 32 bytes | [RFC-TBD] |
+------------------------+------------+------------+ +-------+------------------------+------------+-----------+
Table 2: Authenticated-encryption algorithms corresponding to sym- Table 3: Authenticated-encryption algorithms corresponding to sym-
cipher specifiers in Init1 and Init2 messages. cipher specifiers in Init1 and Init2 messages.
8. Security considerations 8. Security considerations
Public-key generation, public-key encryption, and shared-secret Public-key generation, public-key encryption, and shared-secret
generation all require randomness. Other tcpcrypt functions may also generation all require randomness. Other tcpcrypt functions may also
require randomness, depending on the algorithms and modes of require randomness, depending on the algorithms and modes of
operation selected. A weak pseudo-random generator at either host operation selected. A weak pseudo-random generator at either host
will compromise tcpcrypt's security. Many of tcpcrypt's will compromise tcpcrypt's security. Many of tcpcrypt's
cryptographic functions require random input, and thus any host cryptographic functions require random input, and thus any host
skipping to change at page 22, line 6 skipping to change at page 22, line 36
hang the connection anyway. hang the connection anyway.
Tcpcrypt uses short-lived public keys to provide forward secrecy. Tcpcrypt uses short-lived public keys to provide forward secrecy.
All currently specified key agreement schemes involve ECDHE-based key All currently specified key agreement schemes involve ECDHE-based key
agreement, meaning a new key can be efficiently computed for each agreement, meaning a new key can be efficiently computed for each
connection. If implementations reuse these parameters, they SHOULD connection. If implementations reuse these parameters, they SHOULD
limit the lifetime of the private parameters, ideally to no more than limit the lifetime of the private parameters, ideally to no more than
two minutes. two minutes.
Attackers cannot force passive openers to move forward in their Attackers cannot force passive openers to move forward in their
session caching chain without guessing the content of the resumption session resumption chain without guessing the content of the
identifier, which will be difficult without key knowledge. resumption identifier, which will be difficult without key knowledge.
9. Design notes
9.1. Asymmetric roles 8.1. Asymmetric roles
Tcpcrypt transforms a shared pseudo-random key (PRK) into Tcpcrypt transforms a shared pseudo-random key (PRK) into
cryptographic session keys for each direction. Doing so requires an cryptographic session keys for each direction. Doing so requires an
asymmetry in the protocol, as the key derivation function must be asymmetry in the protocol, as the key derivation function must be
perturbed differently to generate different keys in each direction. perturbed differently to generate different keys in each direction.
Tcpcrypt includes other asymmetries in the roles of the two hosts, Tcpcrypt includes other asymmetries in the roles of the two hosts,
such as the process of negotiating algorithms (e.g., proposing vs. such as the process of negotiating algorithms (e.g., proposing vs.
selecting cipher suites). selecting cipher suites).
9.2. Verified liveness 8.2. Verified liveness
Many hosts implement TCP Keep-Alives [RFC1122] as an option for Many hosts implement TCP Keep-Alives [RFC1122] as an option for
applications to ensure that the other end of a TCP connection still 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 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 segment carries a sequence number one prior to the beginning of the
send window, and may carry one byte of "garbage" data. Such a send window, and may carry one byte of "garbage" data. Such a
segment causes the remote side to send an acknowledgment. segment causes the remote side to send an acknowledgment.
Unfortunately, tcpcrypt cannot cryptographically verify Keep-Alive Unfortunately, tcpcrypt cannot cryptographically verify Keep-Alive
acknowledgments. Hence, an attacker could prolong the existence of a acknowledgments. Hence, an attacker could prolong the existence of a
skipping to change at page 22, line 47 skipping to change at page 23, line 31
Thus, tcpcrypt specifies a way to stimulate the remote host to send Thus, tcpcrypt specifies a way to stimulate the remote host to send
verifiably fresh and authentic data, described in Section 3.9. verifiably fresh and authentic data, described in Section 3.9.
The TCP keep-alive mechanism has also been used for its effects on The TCP keep-alive mechanism has also been used for its effects on
intermediate nodes in the network, such as preventing flow state from intermediate nodes in the network, such as preventing flow state from
expiring at NAT boxes or firewalls. As these purposes do not require expiring at NAT boxes or firewalls. As these purposes do not require
the authentication of endpoints, implementations may safely the authentication of endpoints, implementations may safely
accomplish them using either the existing TCP keep-alive mechanism or accomplish them using either the existing TCP keep-alive mechanism or
tcpcrypt's verified keep-alive mechanism. tcpcrypt's verified keep-alive mechanism.
10. Acknowledgments 9. Acknowledgments
We are grateful for contributions, help, discussions, and feedback We are grateful for contributions, help, discussions, and feedback
from the TCPINC working group, including Marcelo Bagnulo, David from the TCPINC working group, including Marcelo Bagnulo, David
Black, Bob Briscoe, Jana Iyengar, Tero Kivinen, Mirja Kuhlewind, Yoav Black, Bob Briscoe, Jana Iyengar, Tero Kivinen, Mirja Kuhlewind, Yoav
Nir, Christoph Paasch, Eric Rescorla, and Kyle Rose. Nir, Christoph Paasch, Eric Rescorla, and Kyle Rose.
This work was funded by gifts from Intel (to Brad Karp) and from This work was funded by gifts from Intel (to Brad Karp) and from
Google; by NSF award CNS-0716806 (A Clean-Slate Infrastructure for Google; by NSF award CNS-0716806 (A Clean-Slate Infrastructure for
Information Flow Control); by DARPA CRASH under contract Information Flow Control); by DARPA CRASH under contract
#N66001-10-2-4088; and by the Stanford Secure Internet of Things #N66001-10-2-4088; and by the Stanford Secure Internet of Things
Project. Project.
11. Contributors 10. Contributors
Dan Boneh and Michael Hamburg were co-authors of the draft that Dan Boneh and Michael Hamburg were co-authors of the draft that
became this document. became this document.
12. References 11. References
12.1. Normative References 11.1. Normative References
[I-D.ietf-tcpinc-tcpeno] [I-D.ietf-tcpinc-tcpeno]
Bittau, A., Giffin, D., Handley, M., Mazieres, D., and E. Bittau, A., Giffin, D., Handley, M., Mazieres, D., and E.
Smith, "TCP-ENO: Encryption Negotiation Option", draft- Smith, "TCP-ENO: Encryption Negotiation Option", draft-
ietf-tcpinc-tcpeno-08 (work in progress), March 2017. ietf-tcpinc-tcpeno-10 (work in progress), October 2017.
[ieee1363] [ieee1363]
"IEEE Standard Specifications for Public-Key Cryptography "IEEE Standard Specifications for Public-Key Cryptography
(IEEE Std 1363-2000)", 2000. (IEEE Std 1363-2000)", 2000.
[nist-dss] [nist-dss]
"Digital Signature Standard, FIPS 186-2", 2000. "Digital Signature Standard, FIPS 186-2", 2000.
[RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, DOI 10.17487/RFC0793, September 1981,
<https://www.rfc-editor.org/info/rfc793>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-
<http://www.rfc-editor.org/info/rfc2119>. editor.org/info/rfc2119>.
[RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated
Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008,
<http://www.rfc-editor.org/info/rfc5116>. <https://www.rfc-editor.org/info/rfc5116>.
[RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand
Key Derivation Function (HKDF)", RFC 5869, Key Derivation Function (HKDF)", RFC 5869,
DOI 10.17487/RFC5869, May 2010, DOI 10.17487/RFC5869, May 2010, <https://www.rfc-
<http://www.rfc-editor.org/info/rfc5869>. editor.org/info/rfc5869>.
[RFC7120] Cotton, M., "Early IANA Allocation of Standards Track Code
Points", BCP 100, RFC 7120, DOI 10.17487/RFC7120, January
2014, <https://www.rfc-editor.org/info/rfc7120>.
[RFC7539] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF [RFC7539] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF
Protocols", RFC 7539, DOI 10.17487/RFC7539, May 2015, Protocols", RFC 7539, DOI 10.17487/RFC7539, May 2015,
<http://www.rfc-editor.org/info/rfc7539>. <https://www.rfc-editor.org/info/rfc7539>.
[RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves
for Security", RFC 7748, DOI 10.17487/RFC7748, January for Security", RFC 7748, DOI 10.17487/RFC7748, January
2016, <http://www.rfc-editor.org/info/rfc7748>. 2016, <https://www.rfc-editor.org/info/rfc7748>.
12.2. Informative References [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/info/rfc8126>.
11.2. Informative References
[RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts -
Communication Layers", STD 3, RFC 1122, Communication Layers", STD 3, RFC 1122,
DOI 10.17487/RFC1122, October 1989, DOI 10.17487/RFC1122, October 1989, <https://www.rfc-
<http://www.rfc-editor.org/info/rfc1122>. editor.org/info/rfc1122>.
[tcpcrypt] [tcpcrypt]
Bittau, A., Hamburg, M., Handley, M., Mazieres, D., and D. Bittau, A., Hamburg, M., Handley, M., Mazieres, D., and D.
Boneh, "The case for ubiquitous transport-level Boneh, "The case for ubiquitous transport-level
encryption", USENIX Security , 2010. encryption", USENIX Security , 2010.
Appendix A. Protocol constant values
+------------+-------------------+
| Value | Name |
+------------+-------------------+
| 0x01 | CONST_NEXTK |
| 0x02 | CONST_SESSID |
| 0x03 | CONST_REKEY |
| 0x04 | CONST_KEY_A |
| 0x05 | CONST_KEY_B |
| 0x06 | CONST_RESUME |
| 0x15101a0e | INIT1_MAGIC |
| 0x097105e0 | INIT2_MAGIC |
| 0x44415441 | FRAME_NONCE_MAGIC |
+------------+-------------------+
Table 3: Protocol constants
Authors' Addresses Authors' Addresses
Andrea Bittau Andrea Bittau
Google Google
345 Spear Street 345 Spear Street
San Francisco, CA 94105 San Francisco, CA 94105
US US
Email: bittau@google.com Email: bittau@google.com
 End of changes. 71 change blocks. 
172 lines changed or deleted 201 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/