summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cipher.c64
-rw-r--r--cipher.h4
-rw-r--r--packet.c35
-rw-r--r--ssh_config6
-rw-r--r--ssh_config.59
-rw-r--r--sshd.86
-rw-r--r--sshd_config.518
7 files changed, 32 insertions, 110 deletions
diff --git a/cipher.c b/cipher.c
index 9e26b96b8..c3cd5dcf4 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.c,v 1.106 2017/05/04 01:33:21 djm Exp $ */ 1/* $OpenBSD: cipher.c,v 1.107 2017/05/07 23:12:57 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -67,7 +67,6 @@ struct sshcipher {
67 u_int key_len; 67 u_int key_len;
68 u_int iv_len; /* defaults to block_size */ 68 u_int iv_len; /* defaults to block_size */
69 u_int auth_len; 69 u_int auth_len;
70 u_int discard_len;
71 u_int flags; 70 u_int flags;
72#define CFLAG_CBC (1<<0) 71#define CFLAG_CBC (1<<0)
73#define CFLAG_CHACHAPOLY (1<<1) 72#define CFLAG_CHACHAPOLY (1<<1)
@@ -83,42 +82,31 @@ struct sshcipher {
83 82
84static const struct sshcipher ciphers[] = { 83static const struct sshcipher ciphers[] = {
85#ifdef WITH_OPENSSL 84#ifdef WITH_OPENSSL
86 { "3des-cbc", 8, 24, 0, 0, 0, 1, EVP_des_ede3_cbc }, 85 { "3des-cbc", 8, 24, 0, 0, CFLAG_CBC, EVP_des_ede3_cbc },
87# ifndef OPENSSL_NO_BF 86 { "aes128-cbc", 16, 16, 0, 0, CFLAG_CBC, EVP_aes_128_cbc },
88 { "blowfish-cbc", 8, 16, 0, 0, 0, 1, EVP_bf_cbc }, 87 { "aes192-cbc", 16, 24, 0, 0, CFLAG_CBC, EVP_aes_192_cbc },
89# endif /* OPENSSL_NO_BF */ 88 { "aes256-cbc", 16, 32, 0, 0, CFLAG_CBC, EVP_aes_256_cbc },
90# ifndef OPENSSL_NO_CAST
91 { "cast128-cbc", 8, 16, 0, 0, 0, 1, EVP_cast5_cbc },
92# endif /* OPENSSL_NO_CAST */
93# ifndef OPENSSL_NO_RC4
94 { "arcfour", 8, 16, 0, 0, 0, 0, EVP_rc4 },
95 { "arcfour128", 8, 16, 0, 0, 1536, 0, EVP_rc4 },
96 { "arcfour256", 8, 32, 0, 0, 1536, 0, EVP_rc4 },
97# endif /* OPENSSL_NO_RC4 */
98 { "aes128-cbc", 16, 16, 0, 0, 0, 1, EVP_aes_128_cbc },
99 { "aes192-cbc", 16, 24, 0, 0, 0, 1, EVP_aes_192_cbc },
100 { "aes256-cbc", 16, 32, 0, 0, 0, 1, EVP_aes_256_cbc },
101 { "rijndael-cbc@lysator.liu.se", 89 { "rijndael-cbc@lysator.liu.se",
102 16, 32, 0, 0, 0, 1, EVP_aes_256_cbc }, 90 16, 32, 0, 0, CFLAG_CBC, EVP_aes_256_cbc },
103 { "aes128-ctr", 16, 16, 0, 0, 0, 0, EVP_aes_128_ctr }, 91 { "aes128-ctr", 16, 16, 0, 0, 0, EVP_aes_128_ctr },
104 { "aes192-ctr", 16, 24, 0, 0, 0, 0, EVP_aes_192_ctr }, 92 { "aes192-ctr", 16, 24, 0, 0, 0, EVP_aes_192_ctr },
105 { "aes256-ctr", 16, 32, 0, 0, 0, 0, EVP_aes_256_ctr }, 93 { "aes256-ctr", 16, 32, 0, 0, 0, EVP_aes_256_ctr },
106# ifdef OPENSSL_HAVE_EVPGCM 94# ifdef OPENSSL_HAVE_EVPGCM
107 { "aes128-gcm@openssh.com", 95 { "aes128-gcm@openssh.com",
108 16, 16, 12, 16, 0, 0, EVP_aes_128_gcm }, 96 16, 16, 12, 16, 0, EVP_aes_128_gcm },
109 { "aes256-gcm@openssh.com", 97 { "aes256-gcm@openssh.com",
110 16, 32, 12, 16, 0, 0, EVP_aes_256_gcm }, 98 16, 32, 12, 16, 0, EVP_aes_256_gcm },
111# endif /* OPENSSL_HAVE_EVPGCM */ 99# endif /* OPENSSL_HAVE_EVPGCM */
112#else 100#else
113 { "aes128-ctr", 16, 16, 0, 0, 0, CFLAG_AESCTR, NULL }, 101 { "aes128-ctr", 16, 16, 0, 0, CFLAG_AESCTR, NULL },
114 { "aes192-ctr", 16, 24, 0, 0, 0, CFLAG_AESCTR, NULL }, 102 { "aes192-ctr", 16, 24, 0, 0, CFLAG_AESCTR, NULL },
115 { "aes256-ctr", 16, 32, 0, 0, 0, CFLAG_AESCTR, NULL }, 103 { "aes256-ctr", 16, 32, 0, 0, CFLAG_AESCTR, NULL },
116#endif 104#endif
117 { "chacha20-poly1305@openssh.com", 105 { "chacha20-poly1305@openssh.com",
118 8, 64, 0, 16, 0, CFLAG_CHACHAPOLY, NULL }, 106 8, 64, 0, 16, CFLAG_CHACHAPOLY, NULL },
119 { "none", 8, 0, 0, 0, 0, CFLAG_NONE, NULL }, 107 { "none", 8, 0, 0, 0, CFLAG_NONE, NULL },
120 108
121 { NULL, 0, 0, 0, 0, 0, 0, NULL } 109 { NULL, 0, 0, 0, 0, 0, NULL }
122}; 110};
123 111
124/*--*/ 112/*--*/
@@ -252,7 +240,6 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher,
252#ifdef WITH_OPENSSL 240#ifdef WITH_OPENSSL
253 const EVP_CIPHER *type; 241 const EVP_CIPHER *type;
254 int klen; 242 int klen;
255 u_char *junk, *discard;
256#endif 243#endif
257 244
258 *ccp = NULL; 245 *ccp = NULL;
@@ -314,23 +301,6 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher,
314 ret = SSH_ERR_LIBCRYPTO_ERROR; 301 ret = SSH_ERR_LIBCRYPTO_ERROR;
315 goto out; 302 goto out;
316 } 303 }
317
318 if (cipher->discard_len > 0) {
319 if ((junk = malloc(cipher->discard_len)) == NULL ||
320 (discard = malloc(cipher->discard_len)) == NULL) {
321 free(junk);
322 ret = SSH_ERR_ALLOC_FAIL;
323 goto out;
324 }
325 ret = EVP_Cipher(cc->evp, discard, junk, cipher->discard_len);
326 explicit_bzero(discard, cipher->discard_len);
327 free(junk);
328 free(discard);
329 if (ret != 1) {
330 ret = SSH_ERR_LIBCRYPTO_ERROR;
331 goto out;
332 }
333 }
334 ret = 0; 304 ret = 0;
335#endif /* WITH_OPENSSL */ 305#endif /* WITH_OPENSSL */
336 out: 306 out:
diff --git a/cipher.h b/cipher.h
index f9ac151f7..dc7ecf113 100644
--- a/cipher.h
+++ b/cipher.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.h,v 1.51 2017/05/04 01:33:21 djm Exp $ */ 1/* $OpenBSD: cipher.h,v 1.52 2017/05/07 23:12:57 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -71,7 +71,5 @@ u_int cipher_ctx_is_plaintext(struct sshcipher_ctx *);
71int cipher_get_keyiv(struct sshcipher_ctx *, u_char *, u_int); 71int cipher_get_keyiv(struct sshcipher_ctx *, u_char *, u_int);
72int cipher_set_keyiv(struct sshcipher_ctx *, const u_char *); 72int cipher_set_keyiv(struct sshcipher_ctx *, const u_char *);
73int cipher_get_keyiv_len(const struct sshcipher_ctx *); 73int cipher_get_keyiv_len(const struct sshcipher_ctx *);
74int cipher_get_keycontext(const struct sshcipher_ctx *, u_char *);
75void cipher_set_keycontext(struct sshcipher_ctx *, const u_char *);
76 74
77#endif /* CIPHER_H */ 75#endif /* CIPHER_H */
diff --git a/packet.c b/packet.c
index 533bd1e61..ec0eb0cd3 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.253 2017/05/03 21:08:09 naddy Exp $ */ 1/* $OpenBSD: packet.c,v 1.254 2017/05/07 23:12:57 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -884,7 +884,7 @@ ssh_set_newkeys(struct ssh *ssh, int mode)
884 } 884 }
885 /* 885 /*
886 * The 2^(blocksize*2) limit is too expensive for 3DES, 886 * The 2^(blocksize*2) limit is too expensive for 3DES,
887 * blowfish, etc, so enforce a 1GB limit for small blocksizes. 887 * so enforce a 1GB limit for small blocksizes.
888 */ 888 */
889 if (enc->block_size >= 16) 889 if (enc->block_size >= 16)
890 *max_blocks = (u_int64_t)1 << (enc->block_size*2); 890 *max_blocks = (u_int64_t)1 << (enc->block_size*2);
@@ -2223,8 +2223,6 @@ int
2223ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m) 2223ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m)
2224{ 2224{
2225 struct session_state *state = ssh->state; 2225 struct session_state *state = ssh->state;
2226 u_char *p;
2227 size_t slen, rlen;
2228 int r; 2226 int r;
2229 2227
2230 if ((r = kex_to_blob(m, ssh->kex)) != 0 || 2228 if ((r = kex_to_blob(m, ssh->kex)) != 0 ||
@@ -2242,22 +2240,6 @@ ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m)
2242 (r = sshbuf_put_u64(m, state->p_read.bytes)) != 0) 2240 (r = sshbuf_put_u64(m, state->p_read.bytes)) != 0)
2243 return r; 2241 return r;
2244 2242
2245 slen = cipher_get_keycontext(state->send_context, NULL);
2246 rlen = cipher_get_keycontext(state->receive_context, NULL);
2247 if ((r = sshbuf_put_u32(m, slen)) != 0 ||
2248 (r = sshbuf_reserve(m, slen, &p)) != 0)
2249 return r;
2250 if (cipher_get_keycontext(state->send_context, p) != (int)slen)
2251 return SSH_ERR_INTERNAL_ERROR;
2252 if ((r = sshbuf_put_u32(m, rlen)) != 0 ||
2253 (r = sshbuf_reserve(m, rlen, &p)) != 0)
2254 return r;
2255 if (cipher_get_keycontext(state->receive_context, p) != (int)rlen)
2256 return SSH_ERR_INTERNAL_ERROR;
2257 if ((r = sshbuf_put_stringb(m, state->input)) != 0 ||
2258 (r = sshbuf_put_stringb(m, state->output)) != 0)
2259 return r;
2260
2261 return 0; 2243 return 0;
2262} 2244}
2263 2245
@@ -2379,8 +2361,8 @@ int
2379ssh_packet_set_state(struct ssh *ssh, struct sshbuf *m) 2361ssh_packet_set_state(struct ssh *ssh, struct sshbuf *m)
2380{ 2362{
2381 struct session_state *state = ssh->state; 2363 struct session_state *state = ssh->state;
2382 const u_char *keyin, *keyout, *input, *output; 2364 const u_char *input, *output;
2383 size_t rlen, slen, ilen, olen; 2365 size_t ilen, olen;
2384 int r; 2366 int r;
2385 2367
2386 if ((r = kex_from_blob(m, &ssh->kex)) != 0 || 2368 if ((r = kex_from_blob(m, &ssh->kex)) != 0 ||
@@ -2407,15 +2389,6 @@ ssh_packet_set_state(struct ssh *ssh, struct sshbuf *m)
2407 (r = ssh_set_newkeys(ssh, MODE_OUT)) != 0) 2389 (r = ssh_set_newkeys(ssh, MODE_OUT)) != 0)
2408 return r; 2390 return r;
2409 2391
2410 if ((r = sshbuf_get_string_direct(m, &keyout, &slen)) != 0 ||
2411 (r = sshbuf_get_string_direct(m, &keyin, &rlen)) != 0)
2412 return r;
2413 if (cipher_get_keycontext(state->send_context, NULL) != (int)slen ||
2414 cipher_get_keycontext(state->receive_context, NULL) != (int)rlen)
2415 return SSH_ERR_INVALID_FORMAT;
2416 cipher_set_keycontext(state->send_context, keyout);
2417 cipher_set_keycontext(state->receive_context, keyin);
2418
2419 if ((r = ssh_packet_set_postauth(ssh)) != 0) 2392 if ((r = ssh_packet_set_postauth(ssh)) != 0)
2420 return r; 2393 return r;
2421 2394
diff --git a/ssh_config b/ssh_config
index 515513c3b..c12f5ef52 100644
--- a/ssh_config
+++ b/ssh_config
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh_config,v 1.32 2017/05/03 10:01:44 jmc Exp $ 1# $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $
2 2
3# This is the ssh client system-wide configuration file. See 3# This is the ssh client system-wide configuration file. See
4# ssh_config(5) for more information. This file provides defaults for 4# ssh_config(5) for more information. This file provides defaults for
@@ -35,8 +35,8 @@
35# IdentityFile ~/.ssh/id_ed25519 35# IdentityFile ~/.ssh/id_ed25519
36# Port 22 36# Port 22
37# Protocol 2 37# Protocol 2
38# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc 38# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
39# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160 39# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
40# EscapeChar ~ 40# EscapeChar ~
41# Tunnel no 41# Tunnel no
42# TunnelDevice any:any 42# TunnelDevice any:any
diff --git a/ssh_config.5 b/ssh_config.5
index 68fd028e5..db37b92cd 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: ssh_config.5,v 1.247 2017/05/03 21:49:18 naddy Exp $ 36.\" $OpenBSD: ssh_config.5,v 1.248 2017/05/07 23:12:57 djm Exp $
37.Dd $Mdocdate: May 3 2017 $ 37.Dd $Mdocdate: May 7 2017 $
38.Dt SSH_CONFIG 5 38.Dt SSH_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -414,11 +414,6 @@ aes192-ctr
414aes256-ctr 414aes256-ctr
415aes128-gcm@openssh.com 415aes128-gcm@openssh.com
416aes256-gcm@openssh.com 416aes256-gcm@openssh.com
417arcfour
418arcfour128
419arcfour256
420blowfish-cbc
421cast128-cbc
422chacha20-poly1305@openssh.com 417chacha20-poly1305@openssh.com
423.Ed 418.Ed
424.Pp 419.Pp
diff --git a/sshd.8 b/sshd.8
index 7725a692c..05368f947 100644
--- a/sshd.8
+++ b/sshd.8
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: sshd.8,v 1.288 2017/01/30 23:27:39 dtucker Exp $ 36.\" $OpenBSD: sshd.8,v 1.289 2017/05/07 23:12:57 djm Exp $
37.Dd $Mdocdate: January 30 2017 $ 37.Dd $Mdocdate: May 7 2017 $
38.Dt SSHD 8 38.Dt SSHD 8
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -260,7 +260,7 @@ The client selects the encryption algorithm
260to use from those offered by the server. 260to use from those offered by the server.
261Additionally, session integrity is provided 261Additionally, session integrity is provided
262through a cryptographic message authentication code 262through a cryptographic message authentication code
263(hmac-md5, hmac-sha1, umac-64, umac-128, hmac-ripemd160, 263(hmac-md5, hmac-sha1, umac-64, umac-128,
264hmac-sha2-256 or hmac-sha2-512). 264hmac-sha2-256 or hmac-sha2-512).
265.Pp 265.Pp
266Finally, the server and the client enter an authentication dialog. 266Finally, the server and the client enter an authentication dialog.
diff --git a/sshd_config.5 b/sshd_config.5
index ac6ccc793..7ccf6fd4e 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: sshd_config.5,v 1.243 2017/03/14 07:19:07 djm Exp $ 36.\" $OpenBSD: sshd_config.5,v 1.244 2017/05/07 23:12:57 djm Exp $
37.Dd $Mdocdate: March 14 2017 $ 37.Dd $Mdocdate: May 7 2017 $
38.Dt SSHD_CONFIG 5 38.Dt SSHD_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -464,16 +464,6 @@ aes128-gcm@openssh.com
464.It 464.It
465aes256-gcm@openssh.com 465aes256-gcm@openssh.com
466.It 466.It
467arcfour
468.It
469arcfour128
470.It
471arcfour256
472.It
473blowfish-cbc
474.It
475cast128-cbc
476.It
477chacha20-poly1305@openssh.com 467chacha20-poly1305@openssh.com
478.El 468.El
479.Pp 469.Pp
@@ -962,8 +952,6 @@ hmac-md5
962.It 952.It
963hmac-md5-96 953hmac-md5-96
964.It 954.It
965hmac-ripemd160
966.It
967hmac-sha1 955hmac-sha1
968.It 956.It
969hmac-sha1-96 957hmac-sha1-96
@@ -980,8 +968,6 @@ hmac-md5-etm@openssh.com
980.It 968.It
981hmac-md5-96-etm@openssh.com 969hmac-md5-96-etm@openssh.com
982.It 970.It
983hmac-ripemd160-etm@openssh.com
984.It
985hmac-sha1-etm@openssh.com 971hmac-sha1-etm@openssh.com
986.It 972.It
987hmac-sha1-96-etm@openssh.com 973hmac-sha1-96-etm@openssh.com