Internet Research Task Force (IRTF) Y. Nir
Request for Comments: 7539 Check Point
Category: Informational A. Langley
ISSN: 2070-1721 Google, Inc.
May 2015
ChaCha20 and Poly1305 for IETF Protocols
Abstract
This document defines the ChaCha20 stream cipher as well as the use
of the Poly1305 authenticator, both as stand-alone algorithms and as
a "combined mode", or Authenticated Encryption with Associated Data
(AEAD) algorithm.
This document does not introduce any new crypto, but is meant to
serve as a stable reference and an implementation guide. It is a
product of the Crypto Forum Research Group (CFRG).
Status of This Memo
This document is not an Internet Standards Track specification; it is
published for informational purposes.
This document is a product of the Internet Research Task Force
(IRTF). The IRTF publishes the results of Internet-related research
and development activities. These results might not be suitable for
deployment. This RFC represents the consensus of the Crypto Forum
Research Group of the Internet Research Task Force (IRTF). Documents
approved for publication by the IRSG are not a candidate for any
level of Internet Standard; see Section 2 of RFC 5741.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc7539.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document.
Nir & Langley Informational [Page 1]RFC 7539 ChaCha20 & Poly1305 May 2015Table of Contents
1. Introduction ....................................................3
1.1. Conventions Used in This Document ..........................4
2. The Algorithms ..................................................4
2.1. The ChaCha Quarter Round ...................................4
2.1.1. Test Vector for the ChaCha Quarter Round ............5
2.2. A Quarter Round on the ChaCha State ........................5
2.2.1. Test Vector for the Quarter Round on the
ChaCha State ........................................6
2.3. The ChaCha20 Block Function ................................6
2.3.1. The ChaCha20 Block Function in Pseudocode ...........8
2.3.2. Test Vector for the ChaCha20 Block Function .........9
2.4. The ChaCha20 Encryption Algorithm .........................10
2.4.1. The ChaCha20 Encryption Algorithm in Pseudocode ....11
2.4.2. Example and Test Vector for the ChaCha20 Cipher ....11
2.5. The Poly1305 Algorithm ....................................13
2.5.1. The Poly1305 Algorithms in Pseudocode ..............15
2.5.2. Poly1305 Example and Test Vector ...................15
2.6. Generating the Poly1305 Key Using ChaCha20 ................17
2.6.1. Poly1305 Key Generation in Pseudocode ..............18
2.6.2. Poly1305 Key Generation Test Vector ................18
2.7. A Pseudorandom Function for Crypto Suites based on
ChaCha/Poly1305 ...........................................18
2.8. AEAD Construction .........................................19
2.8.1. Pseudocode for the AEAD Construction ...............21
2.8.2. Example and Test Vector for
AEAD_CHACHA20_POLY1305 .............................22
3. Implementation Advice ..........................................24
4. Security Considerations ........................................24
5. IANA Considerations ............................................26
6. References .....................................................26
6.1. Normative References ......................................26
6.2. Informative References ....................................26
Appendix A. Additional Test Vectors ...............................29
A.1. The ChaCha20 Block Functions ...............................29
A.2. ChaCha20 Encryption ........................................32
A.3. Poly1305 Message Authentication Code .......................34