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