idnits 2.17.1 draft-ietf-ipsecme-safecurves-04.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 (August 30, 2016) is 2786 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: March 3, 2017 SJD 6 August 30, 2016 8 Curve25519 and Curve448 for IKEv2 Key Agreement 9 draft-ietf-ipsecme-safecurves-04 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 March 3, 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 (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. That 75 document specified the so-called NIST curves. The state of the art 76 has advanced since then. More modern curves allow faster 77 implementations while making it much easier to write constant-time 78 implementations free from time-based side-channel attacks. This 79 document defines two such curves for use in IKE. See [Curve25519] 80 for details about the speed and security of the Curve25519 function. 82 1.1. Conventions Used in This Document 84 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 85 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 86 document are to be interpreted as described in [RFC2119]. 88 2. Curve25519 & Curve448 90 All cryptographic computations are done using the X25519 and X448 91 functions defined in [RFC7748]. All related parameters (for example, 92 the base point) and the encoding (in particular, pruning the least/ 93 most significant bits and use of little-endian encoding) are 94 inherited from [RFC7748]. 96 An ephemeral Diffie-Hellman key exchange using Curve25519 or Curve448 97 goes as follows: Each party picks a secret key d uniformly at random 98 and computes the corresponding public key. "X" is used below to 99 denote either X25519 or X448, and "G" is used to denote the 100 corresponding base point: 102 pub_mine = X(d, G) 104 Parties exchange their public keys (see Section 3.1) and compute a 105 shared secret: 107 SHARED_SECRET = X(d, pub_peer). 109 This shared secret is used directly as the value denoted g^ir in 110 section 2.14 of RFC 7296. It is 32 octets when Curve25519 is used, 111 and 56 octets when Curve448 is used. 113 3. Use and Negotiation in IKEv2 115 The use of Curve25519 and Curve448 in IKEv2 is negotiated using a 116 Transform Type 4 (Diffie-Hellman group) in the SA payload of either 117 an IKE_SA_INIT or a CREATE_CHILD_SA exchange. The value TBA1 is used 118 for the group defined by Curve25519 and the value TBA2 is used for 119 the group defined by Curve448. 121 3.1. Key Exchange Payload 123 The diagram for the Key Exchange Payload from section 3.4 of RFC 7296 124 is copied below for convenience: 126 1 2 3 127 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 128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 129 | Next Payload |C| RESERVED | Payload Length | 130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 131 | Diffie-Hellman Group Num | RESERVED | 132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 133 | | 134 ~ Key Exchange Data ~ 135 | | 136 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 138 o Payload Length - For Curve25519 the public key is 32 octets, so 139 the Payload Length field will be 40, and for Curve448 the public 140 key is 56 octets, so the Payload Length field will be 64. 141 o The Diffie-Hellman Group Num is TBA1 for Curve25519, or TBA2 for 142 Curve448. 144 o The Key Exchange Data is the 32 or 56 octets as described in 145 section 6 of [RFC7748] 147 3.2. Recipient Tests 149 This document matches the discussion in [RFC7748] related to 150 receiving and accepting incompatible point formats. In particular, 151 receiving entities MUST mask the most-significant bit in the final 152 byte for X25519 (but not X448), and implementations MUST accept non- 153 canonical values. See section 5 of [RFC7748] for further discussion. 155 4. Security Considerations 157 Curve25519 and Curve448 are designed to facilitate the production of 158 high-performance constant-time implementations. Implementors are 159 encouraged to use a constant-time implementation of the functions. 160 This point is of crucial importance if the implementation chooses to 161 reuse its supposedly ephemeral key pair for many key exchanges, which 162 some implementations do in order to improve performance. 164 Curve25519 is intended for the ~128-bit security level, comparable to 165 the 256-bit random ECP group (group 19) defined in RFC 5903, also 166 known as NIST P-256 or secp256r1. Curve448 is intended for the 167 ~224-bit security level. 169 While the NIST curves are advertised as being chosen verifiably at 170 random, there is no explanation for the seeds used to generate them. 171 In contrast, the process used to pick these curves is fully 172 documented and rigid enough so that independent verification has been 173 done. This is widely seen as a security advantage, since it prevents 174 the generating party from maliciously manipulating the parameters. 176 Another family of curves available in IKE, generated in a fully 177 verifiable way, is the Brainpool curves [RFC6954]. For example, 178 brainpoolP256 (group 28) is expected to provide a level of security 179 comparable to Curve25519 and NIST P-256. However, due to the use of 180 pseudo-random prime, it is significantly slower than NIST P-256, 181 which is itself slower than Curve25519. 183 5. IANA Considerations 185 IANA is requested to assign two values from the IKEv2 "Transform Type 186 4 - Diffie-Hellman Group Transform IDs" registry, with names 187 "Curve25519" and "Curve448" and this document as reference. The 188 Recipient Tests field should also point to this document: 190 +--------+------------+---------------------+-----------+ 191 | Number | Name | Recipient Tests | Reference | 192 +--------+------------+---------------------+-----------+ 193 | TBA1 | Curve25519 | RFCxxxx Section 3.2 | RFCxxxx | 194 | TBA2 | Curve448 | RFCxxxx Section 3.2 | RFCxxxx | 195 +--------+------------+---------------------+-----------+ 197 Table 1: New Transform Type 4 Values 199 6. Acknowledgements 201 Curve25519 was designed by D. J. Bernstein and the parameters for 202 Curve448 ("Goldilocks") is by Mike Hamburg. The specification of 203 algorithms, wire format and other considerations are in RFC 7748 by 204 Adam Langley, Mike Hamburg, and Sean Turner. 206 The example in Appendix A was calculated using the master version of 207 OpenSSL, retrieved on August 4th, 2016. 209 7. References 211 7.1. Normative References 213 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 214 Requirement Levels", BCP 14, RFC 2119, March 1997. 216 [RFC7296] Kivinen, T., Kaufman, C., Hoffman, P., Nir, Y., and P. 217 Eronen, "Internet Key Exchange Protocol Version 2 218 (IKEv2)", RFC 7296, October 2014. 220 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 221 for Security", RFC 7748, January 2016. 223 7.2. Informative References 225 [Curve25519] 226 Bernstein, J., "Curve25519: New Diffie-Hellman Speed 227 Records", LNCS 3958, February 2006, 228 . 230 [RFC5903] Fu, D. and J. Solinas, "Elliptic Curve Groups modulo a 231 Prime (ECP Groups) for IKE and IKEv2", RFC 5903, June 232 2010. 234 [RFC6954] Merkle, J. and M. Lochter, "Using the Elliptic Curve 235 Cryptography (ECC) Brainpool Curves for the Internet Key 236 Exchange Protocol Version 2 (IKEv2)", RFC 6954, July 2013. 238 Appendix A. Numerical Example for Curve25519 240 Suppose we have both the initiator and the responder generating 241 private keys by generating 32 random octets. As usual in IKEv2 and 242 its extension, we will denote Initiator values with the suffix _i and 243 responder values with the suffix _r: 245 random_i = 75 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c 246 dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 94 248 random_r = 0a 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e 249 55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 88 251 These numbers need to be fixed by unsetting some bits as described in 252 section 5 of RFC 7748. This affects only the first and last octets 253 of each value: 255 fixed_i = 70 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c 256 dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 54 258 fixed_r = 08 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e 259 55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 48 261 The actual private keys are considered to be encoded in little-endian 262 format: 264 d_i = 549D5F4A460900E6D9F63F53586AD1DD8CEAF925739B78B676B4558630B41F70 266 d_r = 4856A039B8F178E9A1550722DCEF01559ECDBA30E0D0ADDD600D295352645408 268 The public keys are generated from this using the formula in 269 Section 2: 271 pub_i = X25519(d_i, G) = 272 48 d5 dd d4 06 12 57 ba 16 6f a3 f9 bb db 74 f1 273 a4 e8 1c 08 93 84 fa 77 f7 90 70 9f 0d fb c7 66 275 pub_r = X25519(d_r, G) = 276 0b e7 c1 f5 aa d8 7d 7e 44 86 62 67 32 98 a4 43 277 47 8b 85 97 45 17 9e af 56 4c 79 c0 ef 6e ee 25 279 And this is the value of the Key Exchange Data field in the key 280 exchange payload described in Section 3.1. The shared value is 281 calculated as in Section 2: 283 SHARED_SECRET = X25519(d_i, pub_r) = X25519(d_r, pub_i) = 284 c7 49 50 60 7a 12 32 7f-32 04 d9 4b 68 25 bf b0 285 68 b7 f8 31 9a 9e 37 08-ed 3d 43 ce 81 30 c9 50 287 Authors' Addresses 289 Yoav Nir 290 Check Point Software Technologies Ltd. 291 5 Hasolelim st. 292 Tel Aviv 6789735 293 Israel 295 Email: ynir.ietf@gmail.com 297 Simon Josefsson 298 SJD AB 300 Email: simon@josefsson.org