draft-ietf-ipsecme-chacha20-poly1305-02.txt   draft-ietf-ipsecme-chacha20-poly1305-03.txt 
Network Working Group Y. Nir Network Working Group Y. Nir
Internet-Draft Check Point Internet-Draft Check Point
Intended status: Standards Track April 5, 2015 Intended status: Standards Track April 25, 2015
Expires: October 7, 2015 Expires: October 27, 2015
ChaCha20, Poly1305 and their use in IKE & IPsec ChaCha20, Poly1305 and their use in IKE & IPsec
draft-ietf-ipsecme-chacha20-poly1305-02 draft-ietf-ipsecme-chacha20-poly1305-03
Abstract Abstract
This document describes the use of the ChaCha20 stream cipher along This document describes the use of the ChaCha20 stream cipher along
with the Poly1305 authenticator, combined into an AEAD algorithm for with the Poly1305 authenticator, combined into an AEAD algorithm for
IPsec. the Internet Key Exchange protocol (IKEv2) and for IPsec.
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 October 7, 2015. This Internet-Draft will expire on October 27, 2015.
Copyright Notice Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the Copyright (c) 2015 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
skipping to change at page 2, line 12 skipping to change at page 2, line 12
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. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Conventions Used in This Document . . . . . . . . . . . . 2 1.1. Conventions Used in This Document . . . . . . . . . . . . 2
2. ChaCha20 & Poly1305 for ESP . . . . . . . . . . . . . . . . . 3 2. ChaCha20 & Poly1305 for ESP . . . . . . . . . . . . . . . . . 3
2.1. AAD Construction . . . . . . . . . . . . . . . . . . . . 4 2.1. AAD Construction . . . . . . . . . . . . . . . . . . . . 4
3. Use in IKEv2 . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Use in IKEv2 . . . . . . . . . . . . . . . . . . . . . . . . 4
4. Negotiating in IKE . . . . . . . . . . . . . . . . . . . . . 4 4. Negotiation in IKEv2 . . . . . . . . . . . . . . . . . . . . 4
5. Security Considerations . . . . . . . . . . . . . . . . . . . 4 5. Security Considerations . . . . . . . . . . . . . . . . . . . 5
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 5
8.1. Normative References . . . . . . . . . . . . . . . . . . 5 8.1. Normative References . . . . . . . . . . . . . . . . . . 5
8.2. Informative References . . . . . . . . . . . . . . . . . 6 8.2. Informative References . . . . . . . . . . . . . . . . . 6
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 6 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 6
1. Introduction 1. Introduction
The Advanced Encryption Standard (AES - [FIPS-197]) has become the The Advanced Encryption Standard (AES - [FIPS-197]) has become the
gold standard in encryption. Its efficient design, wide gold standard in encryption. Its efficient design, wide
implementation, and hardware support allow for high performance in implementation, and hardware support allow for high performance in
many areas, including IPsec VPNs. On most modern platforms, AES is many areas, including IPsec VPNs. On most modern platforms, AES is
anywhere from 4x to 10x as fast as the previous most-used cipher, anywhere from 4x to 10x as fast as the previous most-used cipher,
3-key Data Encryption Standard (3DES - [FIPS-46]), which makes it not 3-key Data Encryption Standard (3DES - [SP800-67]). 3DES also has a
only the best choice, but the only choice. 64-bit block, which means that the amount of data that can be
encrypted before rekeying is required is not great. These reasons
make AES not only the best choice, but the only choice.
The problem is that if future advances in cryptanalysis reveal a The problem is that if future advances in cryptanalysis reveal a
weakness in AES, VPN users will be in an unenviable position. With weakness in AES, VPN users will be in an unenviable position. With
the only other widely supported cipher being the much slower 3DES, it the only other widely supported cipher being the much slower 3DES, it
is not feasible to re-configure IPsec installations to use 3DES. is not feasible to re-configure IPsec installations to use 3DES.
[standby-cipher] describes this issue and the need for a standby [standby-cipher] describes this issue and the need for a standby
cipher in greater detail. cipher in greater detail.
This document proposes the ChaCha20 stream cipher as such a standby This document proposes the ChaCha20 stream cipher as such a standby
cipher in an Authenticated Encryption with Associated Data (AEAD) cipher in an Authenticated Encryption with Associated Data (AEAD)
skipping to change at page 3, line 12 skipping to change at page 3, line 12
"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. ChaCha20 & Poly1305 for ESP 2. ChaCha20 & Poly1305 for ESP
AEAD_CHACHA20_POLY1305 is a combined mode algorithm, or AEAD. The AEAD_CHACHA20_POLY1305 is a combined mode algorithm, or AEAD. The
construction follows the AEAD construction in section 2.8 of construction follows the AEAD construction in section 2.8 of
[chacha_poly]: [chacha_poly]:
o The Initialization Vector (IV) is 64-bit, and is used as part of o The Initialization Vector (IV) is 64-bit, and is used as part of
the nonce. The IV MUST be unique for each SA but does not need to the nonce. The IV MUST be unique for each invocation for a
be unpredictable. The use of a counter or an LFSR is RECOMMENDED. particular SA but does not need to be unpredictable. The use of a
o A 32-bit sender ID is prepended to the 64-bit IV to form the counter or a linear feedback shift register (LFSR) is RECOMMENDED.
96-bit nonce. For regular IPsec, this is set to all zeros. IPsec o A 32-bit Salt is prepended to the 64-bit IV to form the 96-bit
extensions that allow multiple senders, such as GDOI ([RFC6407]) nonce. The salt is fixed per SA and it is not transmitted as part
or [RFC6054] may set this to different values. of the ESP packet..
o The encryption key is 256-bit. o The encryption key is 256-bit.
o The Internet Key Exchange protocol generates a bitstring called o The Internet Key Exchange protocol generates a bitstring called
KEYMAT that is generated from a PRF. That KEYMAT is divided into KEYMAT using a pseudo-random function (PRF). That KEYMAT is
keys for encryption, message authentication and whatever else is divided into keys for encryption, message authentication and
needed. For the ChaCha20 algorithm, 256 bits are used for the whatever else is needed. For the ChaCha20-poly1305 algorithm, 256
key. TBD: do we want an extra 32 bits as salt for the nonce like bits are used for the key, and a subsequent 32 bits are used for
in GCM, or keep the salt (=SenderID) at zero? the Salt.
o The ChaCha20 encryption algorithm requires the following
parameters: a 256-bit key, a 96-bit nonce, and a 32-bit initial
block counter. For ESP we set these as follows:
* The key is set to the key mentioned above. The ChaCha20 encryption algorithm requires the following parameters:
* The 96-bit nonce is formed from a concatenation of the 32-bit a 256-bit key, a 96-bit nonce, and a 32-bit initial block counter.
sender ID and the 64-bit IV, as described above. For ESP we set these as follows:
* The Initial Block Counter is set to one (1). The reason that
one is used for the initial counter rather than zero is that
zero is reserved for generating the one-time Poly1305 key (see
below)
o As ChaCha20 is not a block cipher, no padding should be necessary.
However, in keeping with the specification in RFC 4303, the ESP
does have padding, so as to align the buffer to an integral
multiple of 4 octets.
o The same key and nonce, along with a block counter of zero are
passed to the ChaCha20 block function, and the top 256 bits of the
result are used as the Poly1305 key. The nonce passed to the
block function here is the same nonce that is used in ChaCha20,
including the 32-bit Sender ID bits, and the key passed is the
same as the encryption key.
o Finally, the Poly1305 function is run on the data to be
authenticated, which is, as specified in section 2.8 of
[chacha_poly] a concatenation of the following in the below order:
* The Authenticated Additional Data (AAD) - see Section 2.1. o The key is set as mentioned above.
o The 96-bit nonce is formed from a concatenation of the 32-bit Salt
and the 64-bit IV, as described above.
o The Initial Block Counter is set to one (1). The reason that one
is used for the initial counter rather than zero is that zero is
reserved for generating the one-time Poly1305 key (see below)
* Padding that rounds the length up to 16 bytes. This is 4 or 8 As the ChaCha20 block function is not applied directly to the
bytes depending on whether extended sequence numbers (ESN) is plaintext, no padding should be necessary. However, in keeping with
set for the SA. The padding is all zeros. the specification in RFC 4303, the ESP does have padding, so as to
* The ciphertext align the buffer to an integral multiple of 4 octets.
* Padding that rounds the total length up to an integral multiple
of 16 bytes. This padding is also all zeros. The same key and nonce, along with a block counter of zero are passed
* The length of the additional data in octets (as a 64-bit to the ChaCha20 block function, and the top 256 bits of the result
little-endian integer). are used as the Poly1305 key. The nonce passed to the block function
* The length of the ciphertext in octets (as a 64-bit little- here is the same nonce that is used in ChaCha20, including the 32-bit
endian integer). Salt, and the key passed is the same as the encryption key.
o The 128-bit output of Poly1305 is used as the tag. All 16 bytes
are included in the packet. Finally, the Poly1305 function is run on the data to be
authenticated, which is, as specified in section 2.8 of [chacha_poly]
a concatenation of the following in the below order:
o The Authenticated Additional Data (AAD) - see Section 2.1.
o Padding that rounds the length up to 16 bytes. This is 4 or 8
bytes depending on whether extended sequence numbers (ESN) is set
for the SA. The padding is all zeros.
o The ciphertext
o Padding that rounds the total length up to an integral multiple of
16 bytes. This padding is also all zeros.
o The length of the additional authenticated data (AAD) in octets
(as a 64-bit little-endian integer).
o The length of the ciphertext in octets (as a 64-bit little-endian
integer).
The 128-bit output of Poly1305 is used as the tag. All 16 bytes are
included in the packet.
The encryption algorithm transform ID for negotiating this algorithm The encryption algorithm transform ID for negotiating this algorithm
in IKE is TBA by IANA. in IKE is TBA by IANA.
2.1. AAD Construction 2.1. AAD Construction
The construction of the Additional Authenticated Data (AAD) is The construction of the Additional Authenticated Data (AAD) is
similar to the one in [RFC4106]. For security associations (SAs) similar to the one in [RFC4106]. For security associations (SAs)
with 32-bit sequence numbers the AAD is 8 bytes: 4-byte SPI followed with 32-bit sequence numbers the AAD is 8 bytes: 4-byte SPI followed
by 4-byte sequence number ordered exactly as it is in the packet. by 4-byte sequence number ordered exactly as it is in the packet.
For SAs with ESN the AAD is 12 bytes: 4-byte SPI followed by an For SAs with ESN the AAD is 12 bytes: 4-byte SPI followed by an
8-byte sequence number as a 64-bit network order integer. 8-byte sequence number as a 64-bit network order integer.
3. Use in IKEv2 3. Use in IKEv2
AEAD algorithms can be used in IKE, as described in [RFC5282]. More AEAD algorithms can be used in IKE, as described in [RFC5282]. More
specifically, the Encrypted Payload is as described in section 3 of specifically:
that document, the IV is 64 bits, as described in Section 2, and the
AAD is as described in section 5.1 of RFC 5282, so it's 32 bytes (28
for the IKEv2 header + 4 bytes for the encrypted payload header)
assuming no unencrypted payloads.
4. Negotiating in IKE o The Encrypted Payload is as described in section 3 of that
document.
o The IV is 64 bits, as described in Section 2.
o The AAD is as described in section 5.1 of RFC 5282, so it's 32
bytes (28 for the IKEv2 header + 4 bytes for the encrypted payload
header) assuming no unencrypted payloads.
4. Negotiation in IKEv2
When negotiating the ChaCha20-Poly1305 algorithm for use in IKE or When negotiating the ChaCha20-Poly1305 algorithm for use in IKE or
IPsec, the value xxx (TBA by IANA) should be used in the transform IPsec, the value xxx (TBA by IANA) should be used in the transform
substructure of the SA payload as the ENCR (type 1) transform ID. As substructure of the SA payload as the ENCR (type 1) transform ID. As
with other AEAD algorithms, INTEG (type 3) transform substructures with other AEAD algorithms, INTEG (type 3) transform substructures
SHOULD NOT be specified unless at least one of the ENCR transforms is MUST NOT be specified or just one INTEG transform MAY be included
non-AEAD. with value NONE (0).
5. Security Considerations 5. Security Considerations
The ChaCha20 cipher is designed to provide 256-bit security. The ChaCha20 cipher is designed to provide 256-bit security.
The Poly1305 authenticator is designed to ensure that forged messages The Poly1305 authenticator is designed to ensure that forged messages
are rejected with a probability of 1-(n/(2^102)) for a 16n-byte are rejected with a probability of 1-(n/(2^102)) for a 16n-byte
message, even after sending 2^64 legitimate messages, so it is SUF- message, even after sending 2^64 legitimate messages, so it is SUF-
CMA in the terminology of [AE]. CMA in the terminology of [AE].
The most important security consideration in implementing this draft The most important security consideration in implementing this draft
is the uniqueness of the nonce used in ChaCha20. The nonce should be is the uniqueness of the nonce used in ChaCha20. The nonce should be
selected uniquely for a particular key, but unpredictability of the selected uniquely for a particular key, but unpredictability of the
nonce is not required. Counters and LFSRs are both acceptable ways nonce is not required. Counters and LFSRs are both acceptable ways
of generating unique nonces, as is encrypting a counter using a of generating unique nonces.
64-bit cipher such as DES. Note that it is not acceptable to use a
truncation of a counter encrypted with a 128-bit or 256-bit cipher,
because such a truncation may repeat after a short time.
Another issue with implementing these algorithms is avoiding side Another issue with implementing these algorithms is avoiding side
channels. This is trivial for ChaCha20, but requires some care for channels. This is trivial for ChaCha20, but requires some care for
Poly1305. Considerations for implementations of these algorithms are Poly1305. Considerations for implementations of these algorithms are
in the [chacha_poly] document. in the [chacha_poly] document.
6. IANA Considerations 6. IANA Considerations
IANA is requested to assign one value from the IKEv2 "Transform Type IANA is requested to assign one value from the IKEv2 "Transform Type
1 - Encryption Algorithm Transform IDs" registry, with name 1 - Encryption Algorithm Transform IDs" registry, with name
ENCR_CHACHA20_POLY1305, and this document as reference. ENCR_CHACHA20_POLY1305, and this document as reference for both ESP
and IKEv2.
7. Acknowledgements 7. Acknowledgements
All of the algorithms in this document were designed by D. J. All of the algorithms in this document were designed by D. J.
Bernstein. The AEAD construction was designed by Adam Langley. The Bernstein. The AEAD construction was designed by Adam Langley. The
author would also like to thank Adam for helpful comments, as well as author would also like to thank Adam for helpful comments, as well as
Yaron Sheffer for telling me to write the algorithms draft. Thanks Yaron Sheffer for telling me to write the algorithms draft. Thanks
also to Martin Willi for pointing out the discrepancy with the final also to Martin Willi for pointing out the discrepancy with the final
version of the algorithm document. version of the algorithm document, and to Valery Smyslov and Tero
Kivinen for helpful comments on this draft.
8. References 8. References
8.1. Normative References 8.1. Normative References
[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, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", RFC [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", RFC
4303, December 2005. 4303, December 2005.
[RFC5282] Black, D. and D. McGrew, "Using Authenticated Encryption [RFC5282] Black, D. and D. McGrew, "Using Authenticated Encryption
Algorithms with the Encrypted Payload of the Internet Key Algorithms with the Encrypted Payload of the Internet Key
Exchange version 2 (IKEv2) Protocol", RFC 5282, August Exchange version 2 (IKEv2) Protocol", RFC 5282, August
2008. 2008.
[RFC6054] McGrew, D. and B. Weis, "Using Counter Modes with
Encapsulating Security Payload (ESP) and Authentication
Header (AH) to Protect Group Traffic", RFC 6054, November
2010.
[RFC7296] Kivinen, T., Kaufman, C., Hoffman, P., Nir, Y., and P. [RFC7296] Kivinen, T., Kaufman, C., Hoffman, P., Nir, Y., and P.
Eronen, "Internet Key Exchange Protocol Version 2 Eronen, "Internet Key Exchange Protocol Version 2
(IKEv2)", RFC 7296, October 2014. (IKEv2)", RFC 7296, October 2014.
[chacha_poly] [chacha_poly]
Langley, A. and Y. Nir, "ChaCha20 and Poly1305 for IETF Langley, A. and Y. Nir, "ChaCha20 and Poly1305 for IETF
protocols", draft-nir-cfrg-chacha20-poly1305-01 (work in protocols", draft-nir-cfrg-chacha20-poly1305-01 (work in
progress), January 2014. progress), January 2014.
8.2. Informative References 8.2. Informative References
skipping to change at page 6, line 32 skipping to change at page 6, line 32
Relations among notions and analysis of the generic Relations among notions and analysis of the generic
composition paradigm", 2000, composition paradigm", 2000,
<http://cseweb.ucsd.edu/~mihir/papers/oem.html>. <http://cseweb.ucsd.edu/~mihir/papers/oem.html>.
[FIPS-197] [FIPS-197]
National Institute of Standards and Technology, "Advanced National Institute of Standards and Technology, "Advanced
Encryption Standard (AES)", FIPS PUB 197, November 2001, Encryption Standard (AES)", FIPS PUB 197, November 2001,
<http://csrc.nist.gov/publications/fips/fips197/ <http://csrc.nist.gov/publications/fips/fips197/
fips-197.pdf>. fips-197.pdf>.
[FIPS-46] National Institute of Standards and Technology, "Data
Encryption Standard", FIPS PUB 46-2, December 1993,
<http://www.itl.nist.gov/fipspubs/fip46-2.htm>.
[RFC4106] Viega, J. and D. McGrew, "The Use of Galois/Counter Mode [RFC4106] Viega, J. and D. McGrew, "The Use of Galois/Counter Mode
(GCM) in IPsec Encapsulating Security Payload (ESP)", RFC (GCM) in IPsec Encapsulating Security Payload (ESP)", RFC
4106, June 2005. 4106, June 2005.
[RFC6407] Weis, B., Rowles, S., and T. Hardjono, "The Group Domain [SP800-67]
of Interpretation", RFC 6407, October 2011. National Institute of Standards and Technology,
"Recommendation for the Triple Data Encryption Algorithm
(TDEA) Block Cipher", FIPS SP800-67, January 2012,
<http://csrc.nist.gov/publications/nistpubs/800-67-Rev1/
SP-800-67-Rev1.pdf>.
[standby-cipher] [standby-cipher]
McGrew, D., Grieco, A., and Y. Sheffer, "Selection of McGrew, D., Grieco, A., and Y. Sheffer, "Selection of
Future Cryptographic Standards", draft-mcgrew-standby- Future Cryptographic Standards", draft-mcgrew-standby-
cipher (work in progress), January 2013. cipher (work in progress), January 2013.
Author's Address Author's Address
Yoav Nir Yoav Nir
Check Point Software Technologies Ltd. Check Point Software Technologies Ltd.
5 Hasolelim st. 5 Hasolelim st.
 End of changes. 20 change blocks. 
81 lines changed or deleted 83 lines changed or added

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