draft-ietf-curdle-ssh-curves-04.txt   draft-ietf-curdle-ssh-curves-05.txt 
Internet Engineering Task Force A. Adamantiadis Internet Engineering Task Force A. Adamantiadis
Internet-Draft libssh Internet-Draft libssh
Intended status: Standards Track S. Josefsson Intended status: Standards Track S. Josefsson
Expires: October 12, 2017 SJD AB Expires: November 11, 2017 SJD AB
M. Baushke M. Baushke
Juniper Networks, Inc. Juniper Networks, Inc.
April 10, 2017 May 10, 2017
Secure Shell (SSH) Key Exchange Method using Curve25519 and Curve448 Secure Shell (SSH) Key Exchange Method using Curve25519 and Curve448
draft-ietf-curdle-ssh-curves-04 draft-ietf-curdle-ssh-curves-05
Abstract Abstract
This document describes the conventions for using Curve25519 and This document describes the conventions for using Curve25519 and
Curve448 key exchange methods in the Secure Shell (SSH) protocol. Curve448 key exchange methods in the Secure Shell (SSH) protocol.
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.
skipping to change at page 1, line 34 skipping to change at page 1, line 34
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 12, 2017. This Internet-Draft will expire on November 11, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 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
2. Key Exchange Methods . . . . . . . . . . . . . . . . . . . . 2 2. Key Exchange Methods . . . . . . . . . . . . . . . . . . . . 2
2.1. Shared Secret Encoding . . . . . . . . . . . . . . . . . 3 2.1. Shared Secret Encoding . . . . . . . . . . . . . . . . . 3
3. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 4 3. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 4
4. Security Considerations . . . . . . . . . . . . . . . . . . . 4 4. Security Considerations . . . . . . . . . . . . . . . . . . . 4
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5
6. References . . . . . . . . . . . . . . . . . . . . . . . . . 4 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.1. Normative References . . . . . . . . . . . . . . . . . . 4 6.1. Normative References . . . . . . . . . . . . . . . . . . 5
6.2. Informative References . . . . . . . . . . . . . . . . . 5 6.2. Informative References . . . . . . . . . . . . . . . . . 5
Appendix A. Copying conditions . . . . . . . . . . . . . . . . . 5 Appendix A. Copying conditions . . . . . . . . . . . . . . . . . 6
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 6 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 6
1. Introduction 1. Introduction
Secure Shell (SSH) [RFC4251] is a secure remote login protocol. The Secure Shell (SSH) [RFC4251] is a secure remote login protocol. The
key exchange protocol described in [RFC4253] supports an extensible key exchange protocol described in [RFC4253] supports an extensible
set of methods. [RFC5656] describes how elliptic curves are set of methods. [RFC5656] describes how elliptic curves are
integrated in SSH, and this document reuses those protocol messages. integrated in SSH, and this document reuses those protocol messages.
This document describes how to implement key exchange based on This document describes how to implement key exchange based on
skipping to change at page 3, line 44 skipping to change at page 3, line 44
other side's public key and the local private key scalar. The 32 or other side's public key and the local private key scalar. The 32 or
56 bytes of X are converted into K by interpreting the bytes as an 56 bytes of X are converted into K by interpreting the bytes as an
unsigned fixed-length integer encoded in network byte order. This unsigned fixed-length integer encoded in network byte order. This
conversion follows the normal "mpint" process as described in section conversion follows the normal "mpint" process as described in section
5 of [RFC4251]. 5 of [RFC4251].
To clarify a corner-case in this conversion, when X is encoded as an To clarify a corner-case in this conversion, when X is encoded as an
mpint K, in order to calculate the exchange hash, it may vary as mpint K, in order to calculate the exchange hash, it may vary as
follows: follows:
o Trim all leading zero-bytes of X. If X is all zero-bytes, then
the key exchange MUST fail.
o If the high bit of X is set, the mpint format requires a zero byte o If the high bit of X is set, the mpint format requires a zero byte
to be prepended. In this case, the length of the encoded K will to be prepended.
be larger.
o If X has leading zero bytes, the mpint format requires such bytes o The length of the encoded K may not be the same as the original
to be skipped. In this case, the length of the encoded K will be length of X due to trimming or prepending zero-bytes as needed for
smaller. "mpint" format.
Or, as pseudo code:
k := x;
while (k.length() > 0 && k[0] == 0) k = k[1:];
assert(k.length() > 0);
if 0 != (k[0] & 0x80) k = '\0' .. k;
Figure 1
When performing the X25519 or X448 operations, the integer values
there will be encoded into byte strings by doing a fix-length
unsigned litle-endian conversion, per [RFC7748]. It is only later
when these byte strings are then passed to the ECDH code in SSH that
the bytes are re-interpreted as a fixed-length unsigned big-endian
integer value K, and then later that K value is encoded as a
variable-length signed "mpint" before being fed to the hash algorithm
used for key generation.
3. Acknowledgements 3. Acknowledgements
The "curve25519-sha256" key exchange method is identical to the The "curve25519-sha256" key exchange method is identical to the
"curve25519-sha256@libssh.org" key exchange method created by Aris "curve25519-sha256@libssh.org" key exchange method created by Aris
Adamantiadis and implemented in libssh and OpenSSH. Adamantiadis and implemented in libssh and OpenSSH.
Thanks to the following people for review and comments: Denis Bider, Thanks to the following people for review and comments: Denis Bider,
Damien Miller, Niels Moeller, Matt Johnston. Damien Miller, Niels Moeller, Matt Johnston, Eric Rescorla, Ron
Frederick, Stefan Buehler.
4. Security Considerations 4. Security Considerations
The security considerations of [RFC4251], [RFC5656], and [RFC7748] The security considerations of [RFC4251], [RFC5656], and [RFC7748]
are inherited. are inherited.
Curve25519 provide strong security and is efficient on a wide range Curve25519 provide strong security and is efficient on a wide range
of architectures, and has properties that allows better of architectures, and has properties that allows better
implementation properties compared to traditional elliptic curves. implementation properties compared to traditional elliptic curves.
Curve448 with SHA-512 is similar, but have not received the same Curve448 with SHA-512 is similar, but has not received the same
cryptographic review as Curve25519, and is slower, but it is provided cryptographic review as Curve25519, and is slower, but it is provided
as an hedge to combat unforseen analytical advances against as an hedge to combat unforseen analytical advances against
Curve25519 and SHA-256. Curve25519 and SHA-256.
The way the derived binary secret string is encoded into a mpint The way the derived binary secret string is encoded into a mpint
before it is hashed (i.e., adding or removing zero-bytes for before it is hashed (i.e., adding or removing zero-bytes for
encoding) raises the potential for a side-channel attack which could encoding) raises the potential for a side-channel attack which could
determine the length of what is hashed. This would leak the most determine the length of what is hashed. This would leak the most
significant bit of the derived secret, and/or allow detection of when significant bit of the derived secret, and/or allow detection of when
the most significant bytes are zero. For backwards compatibility the most significant bytes are zero. For backwards compatibility
skipping to change at page 5, line 23 skipping to change at page 5, line 38
[RFC4253] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH) [RFC4253] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253, Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253,
January 2006, <http://www.rfc-editor.org/info/rfc4253>. January 2006, <http://www.rfc-editor.org/info/rfc4253>.
[RFC5656] Stebila, D. and J. Green, "Elliptic Curve Algorithm [RFC5656] Stebila, D. and J. Green, "Elliptic Curve Algorithm
Integration in the Secure Shell Transport Layer", Integration in the Secure Shell Transport Layer",
RFC 5656, DOI 10.17487/RFC5656, December 2009, RFC 5656, DOI 10.17487/RFC5656, December 2009,
<http://www.rfc-editor.org/info/rfc5656>. <http://www.rfc-editor.org/info/rfc5656>.
6.2. Informative References
[IANA-KEX]
Internet Assigned Numbers Authority (IANA), "Secure Shell
(SSH) Protocol Parameters: Key Exchange Method Names",
March 2017, <http://www.iana.org/assignments/ssh-
parameters/ssh-parameters.xhtml#ssh-parameters-16>.
[RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
(SHA and SHA-based HMAC and HKDF)", RFC 6234, (SHA and SHA-based HMAC and HKDF)", RFC 6234,
DOI 10.17487/RFC6234, May 2011, DOI 10.17487/RFC6234, May 2011,
<http://www.rfc-editor.org/info/rfc6234>. <http://www.rfc-editor.org/info/rfc6234>.
[RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves
for Security", RFC 7748, DOI 10.17487/RFC7748, January for Security", RFC 7748, DOI 10.17487/RFC7748, January
2016, <http://www.rfc-editor.org/info/rfc7748>. 2016, <http://www.rfc-editor.org/info/rfc7748>.
6.2. Informative References
[IANA-KEX]
Internet Assigned Numbers Authority (IANA), "Secure Shell
(SSH) Protocol Parameters: Key Exchange Method Names",
March 2017, <http://www.iana.org/assignments/ssh-
parameters/ssh-parameters.xhtml#ssh-parameters-16>.
Appendix A. Copying conditions Appendix A. Copying conditions
Regarding this entire document or any portion of it, the authors make Regarding this entire document or any portion of it, the authors make
no guarantees and are not responsible for any damage resulting from no guarantees and are not responsible for any damage resulting from
its use. The authors grant irrevocable permission to anyone to use, its use. The authors grant irrevocable permission to anyone to use,
modify, and distribute it in any way that does not diminish the modify, and distribute it in any way that does not diminish the
rights of anyone else to use, modify, and distribute it, provided rights of anyone else to use, modify, and distribute it, provided
that redistributed derivative works do not contain misleading author that redistributed derivative works do not contain misleading author
or version information. Derivative works need not be licensed under or version information. Derivative works need not be licensed under
similar terms. similar terms.
 End of changes. 13 change blocks. 
23 lines changed or deleted 44 lines changed or added

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