myproposal.h revision 294693
1/* $OpenBSD: myproposal.h,v 1.35 2013/12/06 13:39:49 markus Exp $ */
2/* $FreeBSD: stable/10/crypto/openssh/myproposal.h 294693 2016-01-24 22:28:18Z des $ */
3
4/*
5 * Copyright (c) 2000 Markus Friedl.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <openssl/opensslv.h>
29
30/* conditional algorithm support */
31
32#ifdef OPENSSL_HAS_ECC
33#ifdef OPENSSL_HAS_NISTP521
34# define KEX_ECDH_METHODS \
35	"ecdh-sha2-nistp256," \
36	"ecdh-sha2-nistp384," \
37	"ecdh-sha2-nistp521,"
38# define HOSTKEY_ECDSA_CERT_METHODS \
39	"ecdsa-sha2-nistp256-cert-v01@openssh.com," \
40	"ecdsa-sha2-nistp384-cert-v01@openssh.com," \
41	"ecdsa-sha2-nistp521-cert-v01@openssh.com,"
42# define HOSTKEY_ECDSA_METHODS \
43	"ecdsa-sha2-nistp256," \
44	"ecdsa-sha2-nistp384," \
45	"ecdsa-sha2-nistp521,"
46#else
47# define KEX_ECDH_METHODS \
48	"ecdh-sha2-nistp256," \
49	"ecdh-sha2-nistp384,"
50# define HOSTKEY_ECDSA_CERT_METHODS \
51	"ecdsa-sha2-nistp256-cert-v01@openssh.com," \
52	"ecdsa-sha2-nistp384-cert-v01@openssh.com,"
53# define HOSTKEY_ECDSA_METHODS \
54	"ecdsa-sha2-nistp256," \
55	"ecdsa-sha2-nistp384,"
56#endif
57#else
58# define KEX_ECDH_METHODS
59# define HOSTKEY_ECDSA_CERT_METHODS
60# define HOSTKEY_ECDSA_METHODS
61#endif
62
63#ifdef OPENSSL_HAVE_EVPGCM
64# define AESGCM_CIPHER_MODES \
65	"aes128-gcm@openssh.com,aes256-gcm@openssh.com,"
66#else
67# define AESGCM_CIPHER_MODES
68#endif
69
70#ifdef HAVE_EVP_SHA256
71# define KEX_SHA256_METHODS \
72	"diffie-hellman-group-exchange-sha256,"
73#define KEX_CURVE25519_METHODS \
74	"curve25519-sha256@libssh.org,"
75#define	SHA2_HMAC_MODES \
76	"hmac-sha2-256," \
77	"hmac-sha2-512,"
78#else
79# define KEX_SHA256_METHODS
80# define KEX_CURVE25519_METHODS
81# define SHA2_HMAC_MODES
82#endif
83
84# define KEX_DEFAULT_KEX \
85	KEX_CURVE25519_METHODS \
86	KEX_ECDH_METHODS \
87	KEX_SHA256_METHODS \
88	"diffie-hellman-group-exchange-sha1," \
89	"diffie-hellman-group14-sha1," \
90	"diffie-hellman-group1-sha1"
91
92#define	KEX_DEFAULT_PK_ALG	\
93	HOSTKEY_ECDSA_CERT_METHODS \
94	"ssh-ed25519-cert-v01@openssh.com," \
95	"ssh-rsa-cert-v01@openssh.com," \
96	"ssh-dss-cert-v01@openssh.com," \
97	"ssh-rsa-cert-v00@openssh.com," \
98	"ssh-dss-cert-v00@openssh.com," \
99	HOSTKEY_ECDSA_METHODS \
100	"ssh-ed25519," \
101	"ssh-rsa," \
102	"ssh-dss"
103
104/* the actual algorithms */
105
106#define	KEX_DEFAULT_ENCRYPT \
107	"aes128-ctr,aes192-ctr,aes256-ctr," \
108	"arcfour256,arcfour128," \
109	AESGCM_CIPHER_MODES \
110	"chacha20-poly1305@openssh.com," \
111	"aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \
112	"aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se"
113
114#define	KEX_DEFAULT_MAC \
115	"hmac-md5-etm@openssh.com," \
116	"hmac-sha1-etm@openssh.com," \
117	"umac-64-etm@openssh.com," \
118	"umac-128-etm@openssh.com," \
119	"hmac-sha2-256-etm@openssh.com," \
120	"hmac-sha2-512-etm@openssh.com," \
121	"hmac-ripemd160-etm@openssh.com," \
122	"hmac-sha1-96-etm@openssh.com," \
123	"hmac-md5-96-etm@openssh.com," \
124	"hmac-md5," \
125	"hmac-sha1," \
126	"umac-64@openssh.com," \
127	"umac-128@openssh.com," \
128	SHA2_HMAC_MODES \
129	"hmac-ripemd160," \
130	"hmac-ripemd160@openssh.com," \
131	"hmac-sha1-96," \
132	"hmac-md5-96"
133
134#define	KEX_DEFAULT_COMP	"none,zlib@openssh.com,zlib"
135#define	KEX_DEFAULT_LANG	""
136
137
138static char *myproposal[PROPOSAL_MAX] = {
139	KEX_DEFAULT_KEX,
140	KEX_DEFAULT_PK_ALG,
141	KEX_DEFAULT_ENCRYPT,
142	KEX_DEFAULT_ENCRYPT,
143	KEX_DEFAULT_MAC,
144	KEX_DEFAULT_MAC,
145	KEX_DEFAULT_COMP,
146	KEX_DEFAULT_COMP,
147	KEX_DEFAULT_LANG,
148	KEX_DEFAULT_LANG
149};
150