idnits 2.17.1 draft-ietf-ipsecme-safecurves-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 11, 2016) is 2752 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 7748 Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group Y. Nir 3 Internet-Draft Check Point 4 Intended status: Standards Track S. Josefsson 5 Expires: April 14, 2017 SJD 6 October 11, 2016 8 Curve25519 and Curve448 for IKEv2 Key Agreement 9 draft-ietf-ipsecme-safecurves-05 11 Abstract 13 This document describes the use of Curve25519 and Curve448 for 14 ephemeral key exchange in the Internet Key Exchange (IKEv2) protocol. 16 Status of This Memo 18 This Internet-Draft is submitted in full conformance with the 19 provisions of BCP 78 and BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF). Note that other groups may also distribute 23 working documents as Internet-Drafts. The list of current Internet- 24 Drafts is at http://datatracker.ietf.org/drafts/current/. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 This Internet-Draft will expire on April 14, 2017. 33 Copyright Notice 35 Copyright (c) 2016 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents 40 (http://trustee.ietf.org/license-info) in effect on the date of 41 publication of this document. Please review these documents 42 carefully, as they describe your rights and restrictions with respect 43 to this document. Code Components extracted from this document must 44 include Simplified BSD License text as described in Section 4.e of 45 the Trust Legal Provisions and are provided without warranty as 46 described in the Simplified BSD License. 48 Table of Contents 50 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 51 1.1. Conventions Used in This Document . . . . . . . . . . . . 2 52 2. Curve25519 & Curve448 . . . . . . . . . . . . . . . . . . . . 2 53 3. Use and Negotiation in IKEv2 . . . . . . . . . . . . . . . . 3 54 3.1. Key Exchange Payload . . . . . . . . . . . . . . . . . . 3 55 3.2. Recipient Tests . . . . . . . . . . . . . . . . . . . . . 4 56 4. Security Considerations . . . . . . . . . . . . . . . . . . . 4 57 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 58 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5 59 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 60 7.1. Normative References . . . . . . . . . . . . . . . . . . 5 61 7.2. Informative References . . . . . . . . . . . . . . . . . 5 62 Appendix A. Numerical Example for Curve25519 . . . . . . . . . . 6 63 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 7 65 1. Introduction 67 The "Elliptic Curves for Security" document [RFC7748] describes two 68 elliptic curves: Curve25519 and Curve448, as well as the X25519 and 69 X448 functions for performing key agreement using Diffie-Hellman 70 operations with these curves. The curves and functions are designed 71 for both performance and security. 73 Elliptic curve Diffie-Hellman [RFC5903] has been specified for the 74 Internet Key Exchange (IKEv2 - [RFC7296]) for almost ten years. RFC 75 5903 and its predecessor specified the so-called NIST curves. The 76 state of the art has advanced since then. More modern curves allow 77 faster implementations while making it much easier to write constant- 78 time implementations resilient to time-based side-channel attacks. 79 This document defines two such curves for use in IKE. See 80 [Curve25519] for details about the speed and security of the 81 Curve25519 function. 83 1.1. Conventions Used in This Document 85 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 86 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 87 document are to be interpreted as described in [RFC2119]. 89 2. Curve25519 & Curve448 91 Implementations of Curve25519 and Curve448 in IKEv2 SHALL follow the 92 steps described in this section. All cryptographic computations are 93 done using the X25519 and X448 functions defined in [RFC7748]. All 94 related parameters (for example, the base point) and the encoding (in 95 particular, pruning the least/most significant bits and use of 96 little-endian encoding) are compliant with [RFC7748]. 98 An ephemeral Diffie-Hellman key exchange using Curve25519 or Curve448 99 is performed as follows: Each party picks a secret key d uniformly at 100 random and computes the corresponding public key. "X" is used below 101 to denote either X25519 or X448, and "G" is used to denote the 102 corresponding base point: 104 pub_mine = X(d, G) 106 Parties exchange their public keys (see Section 3.1) and compute a 107 shared secret: 109 SHARED_SECRET = X(d, pub_peer). 111 This shared secret is used directly as the value denoted g^ir in 112 section 2.14 of RFC 7296. It is 32 octets when Curve25519 is used, 113 and 56 octets when Curve448 is used. 115 3. Use and Negotiation in IKEv2 117 The use of Curve25519 and Curve448 in IKEv2 is negotiated using a 118 Transform Type 4 (Diffie-Hellman group) in the SA payload of either 119 an IKE_SA_INIT or a CREATE_CHILD_SA exchange. The value TBA1 is used 120 for the group defined by Curve25519 and the value TBA2 is used for 121 the group defined by Curve448. 123 3.1. Key Exchange Payload 125 The diagram for the Key Exchange Payload from section 3.4 of RFC 7296 126 is copied below for convenience: 128 1 2 3 129 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 131 | Next Payload |C| RESERVED | Payload Length | 132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 133 | Diffie-Hellman Group Num | RESERVED | 134 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 135 | | 136 ~ Key Exchange Data ~ 137 | | 138 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 140 o Payload Length - For Curve25519 the public key is 32 octets, so 141 the Payload Length field will be 40, and for Curve448 the public 142 key is 56 octets, so the Payload Length field will be 64. 144 o The Diffie-Hellman Group Num is TBA1 for Curve25519, or TBA2 for 145 Curve448. 146 o The Key Exchange Data is the 32 or 56 octets as described in 147 section 6 of [RFC7748] 149 3.2. Recipient Tests 151 Receiving and handling of incompatible point formats MUST follow the 152 considerations described in section 5 of [RFC7748]. In particular, 153 receiving entities MUST mask the most-significant bit in the final 154 byte for X25519 (but not X448), and implementations MUST accept non- 155 canonical values. 157 4. Security Considerations 159 Curve25519 and Curve448 are designed to facilitate the production of 160 high-performance constant-time implementations. Implementors are 161 encouraged to use a constant-time implementation of the functions. 162 This point is of crucial importance especially if the implementation 163 chooses to reuse its ephemeral key pair in many key exchanges for 164 performance reasons. 166 Curve25519 is intended for the ~128-bit security level, comparable to 167 the 256-bit random ECP group (group 19) defined in RFC 5903, also 168 known as NIST P-256 or secp256r1. Curve448 is intended for the 169 ~224-bit security level. 171 While the NIST curves are advertised as being chosen verifiably at 172 random, there is no explanation for the seeds used to generate them. 173 In contrast, the process used to pick Curve25519 and Curve448 is 174 fully documented and rigid enough so that independent verification 175 can and has been done. This is widely seen as a security advantage, 176 since it prevents the generating party from maliciously manipulating 177 the parameters. 179 Another family of curves available in IKE that were generated in a 180 fully verifiable way, is the Brainpool curves [RFC6954]. For 181 example, brainpoolP256 (group 28) is expected to provide a level of 182 security comparable to Curve25519 and NIST P-256. However, due to 183 the use of pseudo-random prime, it is significantly slower than NIST 184 P-256, which is itself slower than Curve25519. 186 5. IANA Considerations 188 IANA is requested to assign two values from the IKEv2 "Transform Type 189 4 - Diffie-Hellman Group Transform IDs" registry, with names 190 "Curve25519" and "Curve448" and this document as reference. The 191 Recipient Tests field should also point to this document: 193 +--------+------------+---------------------+-----------+ 194 | Number | Name | Recipient Tests | Reference | 195 +--------+------------+---------------------+-----------+ 196 | TBA1 | Curve25519 | RFCxxxx Section 3.2 | RFCxxxx | 197 | TBA2 | Curve448 | RFCxxxx Section 3.2 | RFCxxxx | 198 +--------+------------+---------------------+-----------+ 200 Table 1: New Transform Type 4 Values 202 6. Acknowledgements 204 Curve25519 was designed by D. J. Bernstein and the parameters for 205 Curve448 ("Goldilocks") were defined by Mike Hamburg. The 206 specification of algorithms, wire format and other considerations are 207 documented in RFC 7748 by Adam Langley, Mike Hamburg, and Sean 208 Turner. 210 The example in Appendix A was calculated using the master version of 211 OpenSSL, retrieved on August 4th, 2016. 213 7. References 215 7.1. Normative References 217 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 218 Requirement Levels", BCP 14, RFC 2119, March 1997. 220 [RFC7296] Kivinen, T., Kaufman, C., Hoffman, P., Nir, Y., and P. 221 Eronen, "Internet Key Exchange Protocol Version 2 222 (IKEv2)", RFC 7296, October 2014. 224 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 225 for Security", RFC 7748, January 2016. 227 7.2. Informative References 229 [Curve25519] 230 Bernstein, J., "Curve25519: New Diffie-Hellman Speed 231 Records", LNCS 3958, February 2006, 232 . 234 [RFC5903] Fu, D. and J. Solinas, "Elliptic Curve Groups modulo a 235 Prime (ECP Groups) for IKE and IKEv2", RFC 5903, June 236 2010. 238 [RFC6954] Merkle, J. and M. Lochter, "Using the Elliptic Curve 239 Cryptography (ECC) Brainpool Curves for the Internet Key 240 Exchange Protocol Version 2 (IKEv2)", RFC 6954, July 2013. 242 Appendix A. Numerical Example for Curve25519 244 Suppose we have both the initiator and the responder generating 245 private keys by generating 32 random octets. As usual in IKEv2 and 246 its extension, we will denote Initiator values with the suffix _i and 247 responder values with the suffix _r: 249 random_i = 75 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c 250 dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 94 252 random_r = 0a 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e 253 55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 88 255 These numbers need to be fixed by unsetting some bits as described in 256 section 5 of RFC 7748. This affects only the first and last octets 257 of each value: 259 fixed_i = 70 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c 260 dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 54 262 fixed_r = 08 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e 263 55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 48 265 The actual private keys are considered to be encoded in little-endian 266 format: 268 d_i = 549D5F4A460900E6D9F63F53586AD1DD8CEAF925739B78B676B4558630B41F70 270 d_r = 4856A039B8F178E9A1550722DCEF01559ECDBA30E0D0ADDD600D295352645408 272 The public keys are generated from this using the formula in 273 Section 2: 275 pub_i = X25519(d_i, G) = 276 48 d5 dd d4 06 12 57 ba 16 6f a3 f9 bb db 74 f1 277 a4 e8 1c 08 93 84 fa 77 f7 90 70 9f 0d fb c7 66 279 pub_r = X25519(d_r, G) = 280 0b e7 c1 f5 aa d8 7d 7e 44 86 62 67 32 98 a4 43 281 47 8b 85 97 45 17 9e af 56 4c 79 c0 ef 6e ee 25 283 And this is the value of the Key Exchange Data field in the key 284 exchange payload described in Section 3.1. The shared value is 285 calculated as in Section 2: 287 SHARED_SECRET = X25519(d_i, pub_r) = X25519(d_r, pub_i) = 288 c7 49 50 60 7a 12 32 7f-32 04 d9 4b 68 25 bf b0 289 68 b7 f8 31 9a 9e 37 08-ed 3d 43 ce 81 30 c9 50 291 Authors' Addresses 293 Yoav Nir 294 Check Point Software Technologies Ltd. 295 5 Hasolelim st. 296 Tel Aviv 6789735 297 Israel 299 Email: ynir.ietf@gmail.com 301 Simon Josefsson 302 SJD AB 304 Email: simon@josefsson.org