draft-ietf-tcpinc-tcpcrypt-09.txt   draft-ietf-tcpinc-tcpcrypt-10.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: May 6, 2018 Stanford University Expires: May 21, 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
November 2, 2017 November 17, 2017
Cryptographic protection of TCP Streams (tcpcrypt) Cryptographic protection of TCP Streams (tcpcrypt)
draft-ietf-tcpinc-tcpcrypt-09 draft-ietf-tcpinc-tcpcrypt-10
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). Tcpcrypt coexists with middleboxes by tolerating (TCP-ENO). Tcpcrypt coexists with middleboxes by tolerating
resegmentation, NATs, and other manipulations of the TCP header. The resegmentation, NATs, and other manipulations of the TCP header. The
protocol is self-contained and specifically tailored to TCP protocol is self-contained and specifically tailored to TCP
implementations, which often reside in kernels or other environments implementations, which often reside in kernels or other environments
in which large external software dependencies can be undesirable. in which large external software dependencies can be undesirable.
skipping to change at page 1, line 43 skipping to change at page 1, line 43
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 https://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 May 6, 2018. This Internet-Draft will expire on May 21, 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
(https://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.
Table of Contents Table of Contents
1. Requirements Language . . . . . . . . . . . . . . . . . . . . 3 1. Requirements Language . . . . . . . . . . . . . . . . . . . . 3
2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Encryption Protocol . . . . . . . . . . . . . . . . . . . . . 3 3. Encryption Protocol . . . . . . . . . . . . . . . . . . . . . 3
3.1. Cryptographic Algorithms . . . . . . . . . . . . . . . . 3 3.1. Cryptographic Algorithms . . . . . . . . . . . . . . . . 3
3.2. Protocol Negotiation . . . . . . . . . . . . . . . . . . 5 3.2. Protocol Negotiation . . . . . . . . . . . . . . . . . . 5
3.3. Key Exchange . . . . . . . . . . . . . . . . . . . . . . 6 3.3. Key Exchange . . . . . . . . . . . . . . . . . . . . . . 6
3.4. Session ID . . . . . . . . . . . . . . . . . . . . . . . 8 3.4. Session ID . . . . . . . . . . . . . . . . . . . . . . . 9
3.5. Session Resumption . . . . . . . . . . . . . . . . . . . 9 3.5. Session Resumption . . . . . . . . . . . . . . . . . . . 9
3.6. Data Encryption and Authentication . . . . . . . . . . . 12 3.6. Data Encryption and Authentication . . . . . . . . . . . 12
3.7. TCP Header Protection . . . . . . . . . . . . . . . . . . 13 3.7. TCP Header Protection . . . . . . . . . . . . . . . . . . 14
3.8. Re-Keying . . . . . . . . . . . . . . . . . . . . . . . . 13 3.8. Re-Keying . . . . . . . . . . . . . . . . . . . . . . . . 14
3.9. Keep-Alive . . . . . . . . . . . . . . . . . . . . . . . 14 3.9. Keep-Alive . . . . . . . . . . . . . . . . . . . . . . . 15
4. Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4. Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1. Key-Exchange Messages . . . . . . . . . . . . . . . . . . 15 4.1. Key-Exchange Messages . . . . . . . . . . . . . . . . . . 16
4.2. Encryption Frames . . . . . . . . . . . . . . . . . . . . 17 4.2. Encryption Frames . . . . . . . . . . . . . . . . . . . . 18
4.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . . 17 4.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . . 18
4.2.2. Associated Data . . . . . . . . . . . . . . . . . . . 18 4.2.2. Associated Data . . . . . . . . . . . . . . . . . . . 19
4.2.3. Frame Nonce . . . . . . . . . . . . . . . . . . . . . 19 4.2.3. Frame ID . . . . . . . . . . . . . . . . . . . . . . 19
4.3. Constant Values . . . . . . . . . . . . . . . . . . . . . 19 4.3. Constant Values . . . . . . . . . . . . . . . . . . . . . 20
5. Key-Agreement Schemes . . . . . . . . . . . . . . . . . . . . 19 5. Key-Agreement Schemes . . . . . . . . . . . . . . . . . . . . 20
6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . . . 21 6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . . . 21
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22
8. Security Considerations . . . . . . . . . . . . . . . . . . . 22 8. Security Considerations . . . . . . . . . . . . . . . . . . . 23
8.1. Asymmetric Roles . . . . . . . . . . . . . . . . . . . . 24 8.1. Asymmetric Roles . . . . . . . . . . . . . . . . . . . . 24
8.2. Verified Liveness . . . . . . . . . . . . . . . . . . . . 24 8.2. Verified Liveness . . . . . . . . . . . . . . . . . . . . 25
8.3. Mandatory Key-Agreement Schemes . . . . . . . . . . . . . 25 8.3. Mandatory Key-Agreement Schemes . . . . . . . . . . . . . 25
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 25 9. Experiments . . . . . . . . . . . . . . . . . . . . . . . . . 26
10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 26 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 26 11. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 27
11.1. Normative References . . . . . . . . . . . . . . . . . . 26 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 27
11.2. Informative References . . . . . . . . . . . . . . . . . 27 12.1. Normative References . . . . . . . . . . . . . . . . . . 27
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28 12.2. Informative References . . . . . . . . . . . . . . . . . 28
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 29
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", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
2. Introduction 2. Introduction
skipping to change at page 3, line 43 skipping to change at page 3, line 44
o Operate independently of IP addresses, making it possible to o Operate independently of IP addresses, making it possible to
authenticate resumed sessions efficiently even when either end authenticate resumed sessions efficiently even when either end
changes IP address. changes IP address.
A companion document [I-D.ietf-tcpinc-api] describes recommended A companion document [I-D.ietf-tcpinc-api] describes recommended
interfaces for configuring certain parameters of this protocol. interfaces for configuring certain parameters of this protocol.
3. Encryption Protocol 3. Encryption Protocol
This section describes the tcpcrypt protocol at an abstract level. This section describes the operation of the tcpcrypt protocol. The
The concrete format of all messages is specified in Section 4. wire 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 o An _extract function_ is used to generate a pseudo-random key
skipping to change at page 5, line 12 skipping to change at page 5, line 12
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 4. Each identifiers with the tcpcrypt protocol, as listed in Table 4 in
identifier indicates the use of a particular key-agreement scheme, Section 7. Each identifier indicates the use of a particular key-
with an associated CPRF and length parameters. Future standards may agreement scheme, with an associated CPRF and length parameters.
associate additional TEP identifiers with tcpcrypt, following the Future standards may associate additional TEP identifiers with
assignment policy specified by TCP-ENO. tcpcrypt, following the assignment policy specified by TCP-ENO.
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.
If a passive opener receives an ENO option including tcpcrypt TEPs it 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, supports, it MAY then attach an ENO option to its SYN-ACK segment,
skipping to change at page 6, line 49 skipping to change at page 6, line 49
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 1. o "INIT1_MAGIC", "INIT2_MAGIC": constants defined in Section 4.3.
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 5. acceptable to host A. These are specified in Table 5 in
Section 7.
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 MUST be refreshed as frequently as
private keys SHOULD NOT ever be written to persistent storage. practically possible. The private keys SHOULD NOT ever be written
to persistent storage. The security risks associated with the
storage of these keys are discussed in Section 8.
If a host receives an ephemeral public key from its peer and a
required key-validation step fails (see Section 5), it MUST abort the
connection and raise an error condition distinct from the end-of-file
condition.
The ephemeral secret ("ES") is the result of the key-agreement The ephemeral secret ("ES") is the result of the key-agreement
algorithm (see Section 5) indicated by the negotiated TEP. The algorithm (see Section 5) indicated by the negotiated TEP. The
inputs to the algorithm are the local host's ephemeral private key inputs to the algorithm are the local host's ephemeral private key
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:
skipping to change at page 7, line 46 skipping to change at page 8, line 5
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 1. The length The "CONST_*" values are constants defined in Section 4.3. The
"K_LEN" depends on the tcpcrypt TEP in use, and is specified in length "K_LEN" depends on the tcpcrypt TEP in use, and is specified
Section 5. in Section 5.
Given a session secret "ss[i]", the two sides compute a series of Given a session secret "ss[i]", the two sides compute a series of
master keys as follows: master keys as follows:
mk[0] = CPRF(ss[i], CONST_REKEY, K_LEN) mk[0] = CPRF(ss[i], CONST_REKEY, K_LEN)
mk[j] = CPRF(mk[j-1], CONST_REKEY, K_LEN) mk[j] = CPRF(mk[j-1], CONST_REKEY, K_LEN)
The process of advancing through the series of master keys is The process of advancing through the series of master keys is
described in Section 3.8. described in Section 3.8.
Finally, each master key "mk[j]" is used to generate keys for Finally, each master key "mk[j]" is used to generate traffic keys for
authenticated encryption: protecting application data using authenticated encryption:
k_ab[j] = CPRF(mk[j], CONST_KEY_A, ae_keylen) k_ab[j] = CPRF(mk[j], CONST_KEY_A, ae_keylen + 12)
k_ba[j] = CPRF(mk[j], CONST_KEY_B, ae_keylen) k_ba[j] = CPRF(mk[j], CONST_KEY_B, ae_keylen + 12)
In the first session derived from fresh key-agreement, keys "k_ab[j]" In the first session derived from fresh key-agreement, traffic keys
are used by host A to encrypt and host B to decrypt, while keys "k_ab[j]" are used by host A to encrypt and host B to decrypt, while
"k_ba[j]" are used by host B to encrypt and host A to decrypt. In a keys "k_ba[j]" are used by host B to encrypt and host A to decrypt.
resumed session, as described more thoroughly below in Section 3.5, In a resumed session, as described more thoroughly below in
each host uses the keys in the same way as it did in the original Section 3.5, each host uses the keys in the same way as it did in the
session, regardless of its role in the current session: for example, original session, regardless of its role in the current session: for
if a host played role "A" in the first session, it will use keys example, if a host played role "A" in the first session, it will use
"k_ab[j]" to encrypt in each derived session. keys "k_ab[j]" to encrypt in each derived session.
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 5. algorithm selected, and is given under "Key Length" in Table 5 in
Section 7. The algorithm uses the first "ae_keylen" bytes of each
traffic key as an authenticated-encryption key, and the following 12
bytes as a "nonce randomizer".
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.
skipping to change at page 9, line 12 skipping to change at page 9, line 22
"v" bit. The remainder of the ID is derived from the session secret, "v" bit. The remainder of the ID is derived from the session secret,
as follows: 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 Resumption 3.5. Session Resumption
If two hosts have previously negotiated a session with a particular If two hosts have previously negotiated a session with secret
session secret, they can establish a new connection without public- "ss[i-1]", they can establish a new connection without public-key
key operations using the next session secret in the sequence derived operations using "ss[i]", the next session secret in the sequence
from the original PRK. derived from the original PRK.
A host signals willingness to resume with a particular session secret A host signals willingness to resume with a particular session secret
by sending a SYN segment with a resumption suboption: that is, an ENO by sending a SYN segment with a resumption suboption: that is, an ENO
suboption whose value is the negotiated TEP identifier of the session suboption whose value is the negotiated TEP identifier of the
concatenated with half of the "resumption identifier" for the previous session concatenated with half of the "resumption
session. identifier" for the new 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:
resume[i] = CPRF(ss[i], CONST_RESUME, 18) resume[i] = CPRF(ss[i], CONST_RESUME, 18)
To name a session for resumption, a host sends either the first or To name a session for resumption, a host sends either the first or
second half of the resumption identifier, according to the role it second half of the resumption identifier, according to the role it
played in the original session with secret "ss[0]". played in the original session with secret "ss[0]".
skipping to change at page 10, line 15 skipping to change at page 10, line 27
byte 0 1 9 (10 bytes total) byte 0 1 9 (10 bytes total)
+--------+--------+---...---+--------+ +--------+--------+---...---+--------+
| TEP- | resume[i]{9..17} | | TEP- | resume[i]{9..17} |
| byte | | | byte | |
+--------+--------+---...---+--------+ +--------+--------+---...---+--------+
Figure 3: Resumption suboption sent when original role was B. The Figure 3: Resumption suboption sent when original role was B. The
TEP-byte contains a tcpcrypt TEP identifier and v = 1. TEP-byte contains a tcpcrypt TEP identifier and v = 1.
If a passive opener receives a resumption suboption containing an If a passive opener receives a resumption suboption containing an
identifier-half it recognizes as being derived from a session secret identifier-half that names a session secret that it has cached and
that it has cached, it SHOULD (with exceptions specified below) agree the subobtion's TEP matches the TEP used in the previous session, it
to resume from the cached session by sending its own resumption SHOULD (with exceptions specified below) agree to resume from the
suboption, which will contain the other half of the identifier. cached session by sending its own resumption suboption, which will
contain the other half of the identifier. Otherwise, it MUST NOT
agree to resumption.
If the passive opener does not agree to resumption with a particular If the passive opener does not agree to resumption with a particular
TEP, it may either request fresh key exchange by responding with a TEP, it may either request fresh key exchange by responding with a
non-resumption suboption using the same TEP, or else respond to any non-resumption suboption using the same TEP, or else respond to any
other received suboption. other received suboption.
If an active opener receives a resumption suboption for a particular If an active opener sends a resumption suboption with a particular
TEP and the received identifier-half does not match the "resume[i]" TEP and the appropriate half of a resumption identifier and then, in
value whose other half it previously sent in a resumption suboption the same TCP handshake, receives a resumption suboption with the same
for the same TEP, it MUST ignore that suboption. In the typical case TEP and an identifier-half that does _not_ match that resumption
that this was the only ENO suboption received, this means the host identifier, it MUST ignore that suboption. In the typical case that
MUST disable TCP-ENO and tcpcrypt: that is, it MUST NOT send any more this was the only ENO suboption received, this means the host MUST
ENO options and MUST NOT encrypt the connection. disable TCP-ENO and tcpcrypt: that is, it MUST NOT send any more ENO
options and MUST NOT encrypt the connection.
When a host concludes that TCP-ENO negotiation has succeeded for some When a host concludes that TCP-ENO negotiation has succeeded for some
TEP that was received in a resumption suboption, it MUST then enable TEP that was received in a resumption suboption, it MUST then enable
encryption with that TEP, using the cached session secret, as encryption with that TEP, using the cached session secret, as
described in Section 3.6. described in Section 3.6.
The session ID (Section 3.4) is constructed in the same way for The session ID (Section 3.4) is constructed in the same way for
resumed sessions as it is for fresh ones. In this case the first resumed sessions as it is for fresh ones. In this case the first
byte will always have "v = 1". The remainder of the ID is derived byte will always have "v = 1". The remainder of the ID is derived
from the cached session secret. from the cached session secret.
In the case of simultaneous open where TCP-ENO is able to establish In the case of simultaneous open where TCP-ENO is able to establish
asymmetric roles, two hosts that simultaneously send SYN segments asymmetric roles, two hosts that simultaneously send SYN segments
with compatible resumption suboptions may resume the associated with compatible resumption suboptions may resume the associated
session. session.
In a particular SYN segment, a host SHOULD NOT send more than one In a particular SYN segment, a host SHOULD NOT send more than one
resumption suboption, and MUST NOT send more than one resumption resumption suboption (because this consumes TCP option space and is
suboption with the same TEP identifier. But in addition to any unlikely to be a useful practice), and MUST NOT send more than one
resumption suboptions, an active opener MAY include non-resumption resumption suboption with the same TEP identifier. But in addition
suboptions describing other TEPs it supports (in addition to the TEP to any resumption suboptions, an active opener MAY include non-
in the resumption suboption). resumption suboptions describing other TEPs it supports (in addition
to the TEP in the resumption suboption).
After using "ss[i]" to compute "mk[0]", implementations SHOULD After using "ss[i]" to compute "mk[0]", implementations SHOULD
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
skipping to change at page 12, line 14 skipping to change at page 12, line 27
3.6. Data Encryption and Authentication 3.6. Data Encryption and Authentication
Following key exchange (or its omission via session resumption), 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 _encryption 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 5, and additional algorithms may that may be used are listed in Table 5 in Section 7, and additional
be specified according to the policy in Section 7. One algorithm is algorithms may be specified according to the policy in that section.
selected during the negotiation described in Section 3.3. One algorithm is selected during the negotiation described in
Section 3.3.
The format of an encryption 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 ID" 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 encryption 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 algorithms specified in this document, an security of the AEAD algorithms specified in this document, an
implementation MUST NOT ever transmit distinct frames with the same implementation MUST NOT ever transmit distinct frames with the same
nonce value under the same encryption key. In particular, a frame ID value under the same encryption key. In particular, a
retransmitted TCP segment MUST contain the same payload bytes for the retransmitted TCP segment MUST contain the same payload bytes for the
same TCP sequence numbers, and a host MUST NOT transmit more than same TCP sequence numbers, and a host MUST NOT transmit more than
2^64 bytes in the underlying TCP datastream (which would cause the 2^64 bytes in the underlying TCP datastream (which would cause the
"offset" field to wrap) before re-keying. "offset" field to wrap) before re-keying.
With reference to the "AEAD Interface" described in Section 2 of With reference to the "AEAD Interface" described in Section 2 of
[RFC5116], tcpcrypt invokes the AEAD algorithm with the secret key [RFC5116], tcpcrypt invokes the AEAD algorithm with values taken from
"K" set to "k_ab[j]" or "k_ba[j]" for some "j", according to the the traffic key "k_ab[j]" or "k_ba[j]" for some "j", according to the
host's role as described in Section 3.3. The plaintext value serves host's role as described in Section 3.3.
as "P", the associated data as "A", and the frame nonce as "N". The
output of the encryption operation, "C", is transmitted in the First, the traffic key is divided into two parts:
byte 0 ae_keylen ae_keylen + 11
| | |
v v v
+----+----+--...--+----+----+----+--...--+----+
| K | NR |
+----+----+--...--+----+----+----+--...--+----+
\_____________________________________________/
traffic key
The first "ae_keylen" bytes of the traffic key provide the AEAD key
"K", while the remaining 12 bytes provide a "nonce randomizer" value
"NR". The frame ID is then combined via bitwise exclusive-or with
the nonce randomizer to yield "N", the AEAD nonce for the frame:
N = frame_ID xor NR
The plaintext value serves as "P", and the associated data as "A".
The output of the encryption operation, "C", is transmitted in the
frame's "ciphertext" field. 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 ID values (the former contains only data sent in the clear,
clear, and the latter is implicit in the TCP stream), and provides and the latter is implicit in the TCP stream), computes the nonce N
these and the ciphertext value to the the AEAD decryption operation. as above, and provides these and the ciphertext value to the the AEAD
The output of this operation is either a plaintext value "P" or the decryption operation. The output of this operation is either a
special symbol FAIL. In the latter case, the implementation MUST plaintext value "P" or the special symbol FAIL. In the latter case,
either drop the TCP segment(s) containing the frame or abort the the implementation SHOULD abort the connection and raise an error
connection; but if it aborts, the implementation MUST raise an error condition distinct from the end-of-file condition. But if none of
condition distinct from the end-of-file condition. the TCP segment(s) containing the frame have been acknowledged and
retransmission could potentially result in a valid frame, an
implementation MAY instead drop these segments.
3.7. TCP Header Protection 3.7. TCP Header Protection
The "ciphertext" field of the encryption 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 the "URGp" bit is set, the "urgent" value indicates an offset When the "URGp" bit is set, the "urgent" value indicates an offset
from the current frame's beginning offset; the sum of these offsets 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 gives the index of the last byte of urgent data in the application
datastream. datastream.
skipping to change at page 14, line 25 skipping to change at page 15, line 15
all other cases. all other cases.
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 MUST NOT initiate more than one concurrent re-key operation if
if it has no data to send; that is, it should not initiate re-keying it has no data to send; that is, it MUST NOT initiate re-keying with
with an empty encryption frame more than once while its record of the an empty encryption frame more than once while its record of the
remote generation number is less than its own. remote generation number is less than its own.
Note that when parts of the datastream are retransmitted, TCP Note that when parts of the datastream are retransmitted, TCP
requires that implementations always send the same data bytes for the requires that implementations always send the same data bytes for the
same TCP sequence numbers. Thus, frame data in retransmitted same TCP sequence numbers. Thus, frame data in retransmitted
segments must be encrypted with the same key as when it was first segments must be encrypted with the same key as when it was first
transmitted, regardless of the current local generation number. transmitted, regardless of the current local generation number.
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
skipping to change at page 16, line 5 skipping to change at page 16, line 46
| N_A | PK_A | | N_A | PK_A |
| | | | | |
+-------+---...---+-------+-------+---...---+-------+ +-------+---...---+-------+-------+---...---+-------+
M - 1 M - 1
+-------+---...---+-------+ +-------+---...---+-------+
| ignored | | ignored |
| | | |
+-------+---...---+-------+ +-------+---...---+-------+
The constant "INIT1_MAGIC" is defined in Table 1. The four-byte The constant "INIT1_MAGIC" is defined in Section 4.3. 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 two-byte symmetric-cipher integer value that specifies the number of two-byte symmetric-cipher
identifiers that follow. The "sym_cipher[i]" identifiers indicate identifiers that follow. The "sym_cipher[i]" identifiers indicate
cryptographic algorithms in Table 5. The length "N_A_LEN" and the cryptographic algorithms in Table 5 in Section 7. The length
length of "PK_A" are both determined by the negotiated TEP, as "N_A_LEN" and the length of "PK_A" are both determined by the
described in Section 5. negotiated TEP, as described in Section 5.
Implementations of this protocol MUST construct "Init1" such that the Implementations of this protocol MUST construct "Init1" such that the
field "ignored" has zero length; that is, they must construct the field "ignored" has zero length; that is, they must construct the
message such that its end, as determined by "message_len", coincides message such that its end, as determined by "message_len", coincides
with the end of the field "PK_A". When receiving "Init1", however, with the end of the field "PK_A". When receiving "Init1", however,
implementations MUST permit and ignore any bytes following "PK_A". implementations MUST permit and ignore any bytes following "PK_A".
The "Init2" message has the following encoding: The "Init2" message has the following encoding:
byte 0 1 2 3 byte 0 1 2 3
skipping to change at page 16, line 48 skipping to change at page 17, line 41
| N_B | PK_B | | N_B | PK_B |
| | | | | |
+-------+---...---+-------+-------+---...---+-------+ +-------+---...---+-------+-------+---...---+-------+
M - 1 M - 1
+-------+---...---+-------+ +-------+---...---+-------+
| ignored | | ignored |
| | | |
+-------+---...---+-------+ +-------+---...---+-------+
The constant "INIT2_MAGIC" is defined in Table 1. The four-byte The constant "INIT2_MAGIC" is defined in Section 4.3. 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 TEP, as described in "PK_B" are both determined by the negotiated TEP, as described in
Section 5. Section 5.
Implementations of this protocol MUST construct "Init2" such that the Implementations of this protocol MUST construct "Init2" such that the
field "ignored" has zero length; that is, they must construct the field "ignored" has zero length; that is, they must construct the
message such that its end, as determined by "message_len", coincides message such that its end, as determined by "message_len", coincides
skipping to change at page 19, line 5 skipping to change at page 19, line 38
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.
4.2.3. Frame Nonce 4.2.3. Frame ID
Lastly, a "frame nonce" (provided as input to the AEAD algorithm) has Lastly, a "frame ID" (used to construct the nonce for the AEAD
this format: algorithm) has this format:
byte byte
+------+------+------+------+ +------+------+------+------+
0 | FRAME_NONCE_MAGIC | 0 | FRAME_ID_MAGIC |
+------+------+------+------+ +------+------+------+------+
4 | | 4 | |
+ offset + + offset +
8 | | 8 | |
+------+------+------+------+ +------+------+------+------+
The 4-byte magic constant is defined in Table 1. The 8-byte "offset" The 4-byte magic constant is defined in Section 4.3. The 8-byte
field contains an integer in big-endian format. Its value is "offset" field contains an integer in big-endian format. Its value
specified in Section 3.6. is specified in Section 3.6.
4.3. Constant Values 4.3. Constant Values
The table below defines values for the constants used in the The table below defines values for the constants used in the
protocol. protocol.
+------------+-------------------+ +------------+----------------+
| Value | Name | | Value | Name |
+------------+-------------------+ +------------+----------------+
| 0x01 | CONST_NEXTK | | 0x01 | CONST_NEXTK |
| 0x02 | CONST_SESSID | | 0x02 | CONST_SESSID |
| 0x03 | CONST_REKEY | | 0x03 | CONST_REKEY |
| 0x04 | CONST_KEY_A | | 0x04 | CONST_KEY_A |
| 0x05 | CONST_KEY_B | | 0x05 | CONST_KEY_B |
| 0x06 | CONST_RESUME | | 0x06 | CONST_RESUME |
| 0x15101a0e | INIT1_MAGIC | | 0x15101a0e | INIT1_MAGIC |
| 0x097105e0 | INIT2_MAGIC | | 0x097105e0 | INIT2_MAGIC |
| 0x44415441 | FRAME_NONCE_MAGIC | | 0x44415441 | FRAME_ID_MAGIC |
+------------+-------------------+ +------------+----------------+
Table 1: Constant values used in the protocol Table 1: Constant values used in the protocol
5. Key-Agreement Schemes 5. Key-Agreement Schemes
The TEP negotiated via TCP-ENO indicates the use of one of the key- The TEP negotiated via TCP-ENO indicates the use of one of the key-
agreement schemes named in Table 4. For example, agreement schemes named in Table 4 in Section 7. For example,
"TCPCRYPT_ECDHE_P256" names the tcpcrypt protocol using ECDHE-P256 "TCPCRYPT_ECDHE_P256" names the tcpcrypt protocol using ECDHE-P256
together with the CPRF and length parameters specified below. together with the CPRF and length parameters specified below.
All the TEPs specified in this document require the use of HKDF- All the TEPs specified in this document require the use of HKDF-
Expand-SHA256 as the CPRF, and these lengths for nonces and session Expand-SHA256 as the CPRF, and these lengths for nonces and session
keys: 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 20, line 33 skipping to change at page 21, line 16
encoded with the "Elliptic Curve Point to Octet String Conversion encoded with the "Elliptic Curve Point to Octet String Conversion
Primitive" described in Section E.2.3 of [ieee1363], and are prefixed Primitive" described in Section E.2.3 of [ieee1363], and are prefixed
by a two-byte length in big-endian format: by a two-byte length in big-endian format:
byte 0 1 2 L - 1 byte 0 1 2 L - 1
+-------+-------+-------+---...---+-------+ +-------+-------+-------+---...---+-------+
| pubkey_len | pubkey | | pubkey_len | pubkey |
| = L | | | = L | |
+-------+-------+-------+---...---+-------+ +-------+-------+-------+---...---+-------+
Implementations SHOULD encode these "pubkey" values in "compressed Implementations MUST encode these "pubkey" values in "compressed
format", and MUST accept values encoded in "compressed", format". Implementations MUST validate these "pubkey" values
"uncompressed" or "hybrid" formats. according to the algorithm in [ieee1363] Section A.16.10.
Key-agreement schemes ECDHE-Curve25519 and ECDHE-Curve448 use the Key-agreement schemes ECDHE-Curve25519 and ECDHE-Curve448 use the
functions X25519 and X448, respectively, to perform the Diffie-Helman functions X25519 and X448, respectively, to perform the Diffie-Helman
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.
Implementations are required to implement certain TEPs, according to Implementations are required to implement certain TEPs, according to
Table 2. Note that system administrators may configure which TEPs a Table 2 below. Note that system administrators may configure which
host will negotiate, independent of these requirements. TEPs a host will negotiate, independent of these requirements.
+-------------+---------------------------+ +-------------+---------------------------+
| Requirement | TEP | | Requirement | TEP |
+-------------+---------------------------+ +-------------+---------------------------+
| MUST | TCPCRYPT_ECDHE_Curve25519 | | MUST | TCPCRYPT_ECDHE_Curve25519 |
| SHOULD | TCPCRYPT_ECDHE_Curve448 | | SHOULD | TCPCRYPT_ECDHE_Curve448 |
| MAY | TCPCRYPT_ECDHE_P256 | | MAY | TCPCRYPT_ECDHE_P256 |
| MAY | TCPCRYPT_ECDHE_P521 | | MAY | TCPCRYPT_ECDHE_P521 |
+-------------+---------------------------+ +-------------+---------------------------+
Table 2: Requirements for implementation of TEPs Table 2: Requirements for implementation of TEPs
6. AEAD Algorithms 6. AEAD Algorithms
Specifiers and key-lengths for AEAD algorithms are given in Table 5. Specifiers and key-lengths for AEAD algorithms are given in Table 5
The algorithms "AEAD_AES_128_GCM" and "AEAD_AES_256_GCM" are in Section 7. The algorithms "AEAD_AES_128_GCM" and
specified in [RFC5116]. The algorithm "AEAD_CHACHA20_POLY1305" is "AEAD_AES_256_GCM" are specified in [RFC5116]. The algorithm
specified in [RFC7539]. "AEAD_CHACHA20_POLY1305" is specified in [RFC7539].
Implementations are required to support certain algorithms according Implementations are required to support certain algorithms according
to Table 3. Note that system administrators may configure which to Table 3 below. Note that system administrators may configure
algorithms a host will negotiate, independent of these requirements. which algorithms a host will negotiate, independent of these
requirements.
+-------------+------------------------+ +-------------+------------------------+
| Requirement | AEAD Algorithm | | Requirement | AEAD Algorithm |
+-------------+------------------------+ +-------------+------------------------+
| MUST | AEAD_AES_128_GCM | | MUST | AEAD_AES_128_GCM |
| SHOULD | AEAD_AES_256_GCM | | SHOULD | AEAD_AES_256_GCM |
| SHOULD | AEAD_CHACHA20_POLY1305 | | SHOULD | AEAD_CHACHA20_POLY1305 |
+-------------+------------------------+ +-------------+------------------------+
Table 3: Requirements for implementation of AEAD algorithms Table 3: Requirements for implementation of AEAD algorithms
7. IANA Considerations 7. IANA Considerations
Tcpcrypt's TEP identifiers will need to be incorporated in IANA's For use with TCP-ENO's negotiation mechanism, tcpcrypt's TEP
"TCP encryption protocol identifiers" registry under the identifiers will need to be incorporated in IANA's "TCP encryption
"Transmission Control Protocol (TCP) Parameters" registry, as in the protocol identifiers" registry under the "Transmission Control
following table. The various key-agreement schemes used by these Protocol (TCP) Parameters" registry, as in Table 4 below. The
tcpcrypt variants are defined in Section 5. various key-agreement schemes used by these tcpcrypt variants are
defined in Section 5.
+-------+---------------------------+-----------+ +-------+---------------------------+-----------+
| Value | Meaning | Reference | | Value | Meaning | Reference |
+-------+---------------------------+-----------+ +-------+---------------------------+-----------+
| 0x21 | TCPCRYPT_ECDHE_P256 | [RFC-TBD] | | 0x21 | TCPCRYPT_ECDHE_P256 | [RFC-TBD] |
| 0x22 | TCPCRYPT_ECDHE_P521 | [RFC-TBD] | | 0x22 | TCPCRYPT_ECDHE_P521 | [RFC-TBD] |
| 0x23 | TCPCRYPT_ECDHE_Curve25519 | [RFC-TBD] | | 0x23 | TCPCRYPT_ECDHE_Curve25519 | [RFC-TBD] |
| 0x24 | TCPCRYPT_ECDHE_Curve448 | [RFC-TBD] | | 0x24 | TCPCRYPT_ECDHE_Curve448 | [RFC-TBD] |
+-------+---------------------------+-----------+ +-------+---------------------------+-----------+
Table 4: TEP identifiers for use with tcpcrypt Table 4: TEP identifiers for use with tcpcrypt
In Section 4.1, this document defines "sym_cipher" specifiers for In Section 4.1, this document defines "sym_cipher" specifiers in the
which IANA is to maintain a new "tcpcrypt AEAD Algorithm" registry range 0x0001 to 0xFFFF inclusive, for which IANA is to maintain a new
under the "Transmission Control Protocol (TCP) Parameters" registry, "tcpcrypt AEAD Algorithm" registry under the "Transmission Control
with initial values as given in the following table. The AEAD Protocol (TCP) Parameters" registry. The initial values for this
algorithms named there are defined in Section 6. Future assignments registry are given in Table 5 below. The AEAD algorithms named there
are to be made under the "RFC Required" policy detailed in [RFC8126], are defined in Section 6. Future assignments are to be made upon
relying on early allocation [RFC7120] to facilitate testing before an satisfying either of two policies defined in [RFC8126]: "IETF Review"
RFC is finalized. or (for non-IETF stream specifications) "Expert Review with RFC
Required." IANA will furthermore provide early allocation [RFC7120]
to facilitate testing before RFCs are finalized.
+--------+------------------------+------------+-----------+ +--------+------------------------+------------+-----------+
| Value | AEAD Algorithm | Key Length | Reference | | Value | AEAD Algorithm | Key Length | Reference |
+--------+------------------------+------------+-----------+ +--------+------------------------+------------+-----------+
| 0x0001 | AEAD_AES_128_GCM | 16 bytes | [RFC-TBD] | | 0x0001 | AEAD_AES_128_GCM | 16 bytes | [RFC-TBD] |
| 0x0002 | AEAD_AES_256_GCM | 32 bytes | [RFC-TBD] | | 0x0002 | AEAD_AES_256_GCM | 32 bytes | [RFC-TBD] |
| 0x0010 | AEAD_CHACHA20_POLY1305 | 32 bytes | [RFC-TBD] | | 0x0010 | AEAD_CHACHA20_POLY1305 | 32 bytes | [RFC-TBD] |
+--------+------------------------+------------+-----------+ +--------+------------------------+------------+-----------+
Table 5: Authenticated-encryption algorithms corresponding to Table 5: Authenticated-encryption algorithms corresponding to
sym_cipher specifiers in Init1 and Init2 messages. sym_cipher specifiers in Init1 and Init2 messages.
8. Security Considerations 8. Security Considerations
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.
Most implementations will rely on a device's pseudo-random generator,
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.
The cipher-suites specified in this document all use HMAC-SHA256 to
implement the collision-resistant pseudo-random function denoted by
"CPRF". A collision-resistant function is one for which, for
sufficiently large L, an attacker cannot find two distinct inputs
"K_1", "CONST_1" and "K_2", "CONST_2" such that "CPRF(K_1, CONST_1,
L) = CPRF(K_2, CONST_2, L)". Collision resistance is important to
assure the uniqueness of session IDs, which are generated using the
CPRF.
All of the security considerations of TCP-ENO apply to tcpcrypt. In All of the security considerations of TCP-ENO apply to tcpcrypt. In
particular, tcpcrypt does not protect against active eavesdroppers particular, tcpcrypt does not protect against active eavesdroppers
unless applications authenticate the session ID. If it can be unless applications authenticate the session ID. If it can be
established that the session IDs computed at each end of the established that the session IDs computed at each end of the
connection match, then tcpcrypt guarantees that no man-in-the-middle connection match, then tcpcrypt guarantees that no man-in-the-middle
attacks occurred unless the attacker has broken the underlying attacks occurred unless the attacker has broken the underlying
cryptographic primitives (e.g., ECDH). A proof of this property for cryptographic primitives (e.g., ECDH). A proof of this property for
an earlier version of the protocol has been published [tcpcrypt]. an earlier version of the protocol has been published [tcpcrypt].
To gain middlebox compatibility, tcpcrypt does not protect TCP To gain middlebox compatibility, tcpcrypt does not protect TCP
headers. Hence, the protocol is vulnerable to denial-of-service from headers. Hence, the protocol is vulnerable to denial-of-service from
off-path attackers just as plain TCP is. Possible attacks include off-path attackers just as plain TCP is. Possible attacks include
desynchronizing the underlying TCP stream, injecting RST or FIN desynchronizing the underlying TCP stream, injecting RST or FIN
segments, and forging rekey bits. These attacks will cause a segments, and forging re-key bits. These attacks will cause a
tcpcrypt connection to hang or fail with an error, but not in any tcpcrypt connection to hang or fail with an error, but not in any
circumstance where plain TCP could continue uncorrupted. circumstance where plain TCP could continue uncorrupted.
Implementations MUST give higher-level software a way to distinguish Implementations MUST give higher-level software a way to distinguish
such errors from a clean end-of-stream (indicated by an authenticated such errors from a clean end-of-stream (indicated by an authenticated
"FINp" bit) so that applications can avoid semantic truncation "FINp" bit) so that applications can avoid semantic truncation
attacks. attacks.
There is no "key confirmation" step in tcpcrypt. This is not There is no "key confirmation" step in tcpcrypt. This is not
required because tcpcrypt's threat model includes the possibility of required because tcpcrypt's threat model includes the possibility of
a connection to an adversary. If key negotiation is compromised and a connection to an adversary. If key negotiation is compromised and
skipping to change at page 24, line 5 skipping to change at page 24, line 4
to failed integrity checks, causing the application's connection to to failed integrity checks, causing the application's connection to
hang. This is not a new threat because in plain TCP, an active hang. This is not a new threat because in plain TCP, an active
attacker could have modified sequence and acknowledgement numbers to attacker could have modified sequence and acknowledgement numbers to
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.
That is, once an implementation removes these keys from memory, a That is, once an implementation removes these keys from memory, a
compromise of the system will not provide any means to derive the compromise of the system will not provide any means to derive the
session keys for past connections. All currently-specified key session keys for past connections. All currently-specified key
agreement schemes involve ECDHE-based key agreement, meaning a new agreement schemes involve ECDHE-based key agreement, meaning a new
keypair can be efficiently computed for each connection. If key-pair can be efficiently computed for each connection. If
implementations reuse these parameters, they SHOULD limit the implementations reuse these parameters, they MUST limit the lifetime
lifetime of the private parameters as far as practical in order to of the private parameters as far as practical in order to minimize
minimize the number of past connections that are vulnerable. the number of past connections that are vulnerable. Of course,
placing private keys in persistent storage introduces severe risks
that they may not be destroyed reliably and in a timely fashion, and
SHOULD be avoided at all costs.
Attackers cannot force passive openers to move forward in their Attackers cannot force passive openers to move forward in their
session resumption chain without guessing the content of the session resumption chain without guessing the content of the
resumption identifier, which will be difficult without key knowledge. resumption identifier, which will be difficult without key knowledge.
The cipher-suites specified in this document all use HMAC-SHA256 to
implement the collision-resistant pseudo-random function denoted by
"CPRF". A collision-resistant function is one for which, for
sufficiently large L, an attacker cannot find two distinct inputs
(K_1, CONST_1) and (K_2, CONST_2) such that CPRF(K_1, CONST_1, L) =
CPRF(K_2, CONST_2, L). Collision resistance is important to assure
the uniqueness of session IDs, which are generated using the CPRF.
Lastly, 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.
Recommendations on how to achieve this may be found in [RFC4086].
Most implementations will rely on a device's pseudo-random generator,
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.
8.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).
skipping to change at page 25, line 48 skipping to change at page 26, line 28
code size requirements on a wide variety of platforms." On this code size requirements on a wide variety of platforms." On this
principle, tcpcrypt excludes the NIST curves from the set of principle, tcpcrypt excludes the NIST curves from the set of
mandatory-to-implement key-agreement algorithms. mandatory-to-implement key-agreement algorithms.
Lastly, this document encourages (via SHOULD) support for key- Lastly, this document encourages (via SHOULD) support for key-
agreement with Curve448 as this scheme appears likely to admit safe agreement with Curve448 as this scheme appears likely to admit safe
and efficient implementations; but it does not absolutely require and efficient implementations; but it does not absolutely require
such support, as well-proven implementations may not yet be such support, as well-proven implementations may not yet be
available. available.
9. Acknowledgments 9. Experiments
Some experience will be required to determine whether the tcpcrypt
protocol can be deployed safely and successfully across the diverse
environments of the global internet.
Safety means that TCP implementations that support tcpcrypt are able
to communicate reliably in all the same settings as they would
without tcpcrypt. As described in [I-D.ietf-tcpinc-tcpeno]
Section 9, this property can be subverted if middleboxes strip ENO
options from non-SYN segments after allowing them in SYN segments; or
if the particular communication patterns of tcpcrypt offend the
policies of middleboxes doing deep-packet-inspection.
Success, in addition to safety, means that hosts which implement
tcpcrypt actually enable encryption when they connect to each other.
This property depends on the network's treatment of the TCP-ENO
handshake, and can be subverted if middleboxes merely strip unknown
TCP options or if they terminate TCP connections and relay data back
and forth unencrypted.
Ease of implementation will be a further challenge to deployment.
Because tcpcrypt requires encryption operations on frames that may
span TCP segments, kernel implementations are forced to buffer
segments in different ways than are necessary for plain TCP. More
implementation experience will show how much additional code
complexity is required in various operating systems, and what kind of
performance effects can be expected.
10. Acknowledgments
We are grateful for contributions, help, discussions, and feedback We are grateful for contributions, help, discussions, and feedback
from the TCPINC working group and from other IETF reviewers, from the TCPINC working group and from other IETF reviewers,
including Marcelo Bagnulo, David Black, Bob Briscoe, Jana Iyengar, including Marcelo Bagnulo, David Black, Bob Briscoe, Jana Iyengar,
Stephen Kent, Tero Kivinen, Mirja Kuhlewind, Yoav Nir, Christoph Stephen Kent, Tero Kivinen, Mirja Kuhlewind, Yoav Nir, Christoph
Paasch, Eric Rescorla, Kyle Rose, and Dale Worley. Paasch, Eric Rescorla, Kyle Rose, and Dale Worley.
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.
10. Contributors 11. 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.
11. References 12. References
11.1. Normative References 12.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-11 (work in progress), October 2017. ietf-tcpinc-tcpeno-13 (work in progress), November 2017.
[ieee1363] [ieee1363]
IEEE, "IEEE Standard Specifications for Public-Key IEEE, "IEEE Standard Specifications for Public-Key
Cryptography (IEEE Std 1363-2000)", 2000. Cryptography (IEEE Std 1363-2000)", 2000.
[nist-dss] [nist-dss]
NIST, "FIPS PUB 186-4: Digital Signature Standard (DSS)", NIST, "FIPS PUB 186-4: Digital Signature Standard (DSS)",
2013. 2013.
[RFC0793] Postel, J., "Transmission Control Protocol", STD 7, [RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, DOI 10.17487/RFC0793, September 1981, RFC 793, DOI 10.17487/RFC0793, September 1981,
<https://www.rfc-editor.org/info/rfc793>. <https://www.rfc-editor.org/info/rfc793>.
[RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
Hashing for Message Authentication", RFC 2104, Hashing for Message Authentication", RFC 2104,
DOI 10.17487/RFC2104, February 1997, DOI 10.17487/RFC2104, February 1997, <https://www.rfc-
<https://www.rfc-editor.org/info/rfc2104>. editor.org/info/rfc2104>.
[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-
<https://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,
<https://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-
<https://www.rfc-editor.org/info/rfc5869>. editor.org/info/rfc5869>.
[RFC7120] Cotton, M., "Early IANA Allocation of Standards Track Code [RFC7120] Cotton, M., "Early IANA Allocation of Standards Track Code
Points", BCP 100, RFC 7120, DOI 10.17487/RFC7120, January Points", BCP 100, RFC 7120, DOI 10.17487/RFC7120, January
2014, <https://www.rfc-editor.org/info/rfc7120>. 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,
<https://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
skipping to change at page 27, line 31 skipping to change at page 28, line 40
[RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26, Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017, RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/info/rfc8126>. <https://www.rfc-editor.org/info/rfc8126>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
11.2. Informative References 12.2. Informative References
[I-D.ietf-tcpinc-api] [I-D.ietf-tcpinc-api]
Bittau, A., Boneh, D., Giffin, D., Handley, M., Mazieres, Bittau, A., Boneh, D., Giffin, D., Handley, M., Mazieres,
D., and E. Smith, "Interface Extensions for TCP-ENO and D., and E. Smith, "Interface Extensions for TCP-ENO and
tcpcrypt", draft-ietf-tcpinc-api-05 (work in progress), tcpcrypt", draft-ietf-tcpinc-api-05 (work in progress),
September 2017. September 2017.
[nist-ecc] [nist-ecc]
Bernstein, D. and T. Lange, "Failures in NIST's ECC Bernstein, D. and T. Lange, "Failures in NIST's ECC
standards", 2016, standards", 2016, <https://cr.yp.to/newelliptic/nistecc-
<https://cr.yp.to/newelliptic/nistecc-20160106.pdf>. 20160106.pdf>.
[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-
<https://www.rfc-editor.org/info/rfc1122>. editor.org/info/rfc1122>.
[RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker,
"Randomness Requirements for Security", BCP 106, RFC 4086,
DOI 10.17487/RFC4086, June 2005, <https://www.rfc-
editor.org/info/rfc4086>.
[RFC7696] Housley, R., "Guidelines for Cryptographic Algorithm [RFC7696] Housley, R., "Guidelines for Cryptographic Algorithm
Agility and Selecting Mandatory-to-Implement Algorithms", Agility and Selecting Mandatory-to-Implement Algorithms",
BCP 201, RFC 7696, DOI 10.17487/RFC7696, November 2015, BCP 201, RFC 7696, DOI 10.17487/RFC7696, November 2015,
<https://www.rfc-editor.org/info/rfc7696>. <https://www.rfc-editor.org/info/rfc7696>.
[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.
 End of changes. 62 change blocks. 
198 lines changed or deleted 273 lines changed or added

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