[141653] trunk/dports/net/openssh

ionic at macports.org ionic at macports.org
Sat Dec 12 02:26:28 PST 2015


Revision: 141653
          https://trac.macports.org/changeset/141653
Author:   ionic at macports.org
Date:     2015-10-25 03:37:32 -0700 (Sun, 25 Oct 2015)
Log Message:
-----------
net/openssh: update to 7.1p1. Rebase patches. Fixes: #48552.

Modified Paths:
--------------
    trunk/dports/net/openssh/Portfile
    trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch
    trunk/dports/net/openssh/files/launchd.patch
    trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch
    trunk/dports/net/openssh/files/pam.patch
    trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff
    trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff

Added Paths:
-----------
    trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff

Removed Paths:
-------------
    trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff

Modified: trunk/dports/net/openssh/Portfile
===================================================================
--- trunk/dports/net/openssh/Portfile	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/Portfile	2015-10-25 10:37:32 UTC (rev 141653)
@@ -4,8 +4,8 @@
 PortSystem          1.0
 
 name                openssh
-version             6.9p1
-revision            2
+version             7.1p1
+revision            0
 categories          net
 platforms           darwin
 maintainers         nomaintainer
@@ -28,8 +28,8 @@
 homepage            http://www.openbsd.org/openssh/
 
 checksums           ${distfiles} \
-                    rmd160  4fb2f0a0280db51024bf72b0f5cd3912d25cb59a \
-                    sha256  6e074df538f357d440be6cf93dc581a21f22d39e236f217fcd8eacbb6c896cfe
+                    rmd160  2c97ea10099fa8658156c0351d60d715655b9b07 \
+                    sha256  fc0a6d2d1d063d5c66dffd952493d0cda256cad204f681de0f84ef85b2ad8428
 
 master_sites        openbsd:OpenSSH/portable \
                     ftp://ftp.cise.ufl.edu/pub/mirrors/openssh/portable/ \
@@ -144,11 +144,13 @@
     set hpn_patchfile       ${name}-${version}-hpnssh14v5.diff
     patchfiles-append       ${hpn_patchfile}
 
-    configure.cppflags-append -DHPN_ENABLED=1
+    use_autoreconf          yes
+
+    configure.args-append   --with-hpn
 }
 
 variant none_cipher conflicts gsskex requires hpn description {Enable optional NONE cipher in HPN patchset} {
-    configure.cppflags-append -DNONE_CIPHER_ENABLED=1
+    configure.args-append   --with-nonecipher
 }
 
 variant gsskex conflicts hpn requires kerberos5 description "Add OpenSSH GSSAPI key exchange patch" {
@@ -207,10 +209,6 @@
 startupitem.name    OpenSSH
 startupitem.start   \
     "if \[ -x ${prefix}/sbin/sshd ]; then
-        if \[ ! -f ${prefix}/etc/ssh/ssh_host_key \]; then
-            ${prefix}/bin/ssh-keygen -t rsa1 -f \\
-            ${prefix}/etc/ssh/ssh_host_key -N \"\" -C `hostname`
-        fi
         if \[ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key \]; then
             ${prefix}/bin/ssh-keygen -t dsa -f \\
             ${prefix}/etc/ssh/ssh_host_dsa_key -N \"\" -C `hostname`

Modified: trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch
===================================================================
--- trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,5 +1,5 @@
---- a/Makefile.in	2015-07-02 18:44:43.000000000 +0200
-+++ b/Makefile.in	2015-07-02 18:48:50.000000000 +0200
+--- a/Makefile.in	2015-08-21 06:49:03.000000000 +0200
++++ b/Makefile.in	2015-10-24 21:56:30.000000000 +0200
 @@ -59,6 +59,7 @@ SED=@SED@
  ENT=@ENT@
  XAUTH_PATH=@XAUTH_PATH@
@@ -61,8 +61,8 @@
  	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
  	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
  	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
---- a/audit-bsm.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/audit-bsm.c	2015-07-02 18:48:50.000000000 +0200
+--- a/audit-bsm.c	2015-08-21 06:49:03.000000000 +0200
++++ b/audit-bsm.c	2015-10-24 21:56:30.000000000 +0200
 @@ -263,7 +263,12 @@ bsm_audit_record(int typ, char *string, 
  	pid_t		pid = getpid();
  	AuditInfoTermID	tid = ssh_bsm_tid;
@@ -77,8 +77,8 @@
  		uid = the_authctxt->pw->pw_uid;
  		gid = the_authctxt->pw->pw_gid;
  	}
---- a/auth-pam.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/auth-pam.c	2015-07-02 18:48:50.000000000 +0200
+--- a/auth-pam.c	2015-08-21 06:49:03.000000000 +0200
++++ b/auth-pam.c	2015-10-24 21:56:30.000000000 +0200
 @@ -793,10 +793,11 @@ sshpam_query(void *ctx, char **name, cha
  				free(msg);
  				return (0);
@@ -93,8 +93,8 @@
  			/* FALLTHROUGH */
  		default:
  			*num = 0;
---- a/auth.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/auth.c	2015-07-02 18:48:50.000000000 +0200
+--- a/auth.c	2015-08-21 06:49:03.000000000 +0200
++++ b/auth.c	2015-10-24 21:56:30.000000000 +0200
 @@ -212,7 +212,7 @@ allowed_user(struct passwd * pw)
  	}
  	if (options.num_deny_groups > 0 || options.num_allow_groups > 0) {
@@ -104,8 +104,8 @@
  			logit("User %.100s from %.100s not allowed because "
  			    "not in any group", pw->pw_name, hostname);
  			return 0;
---- a/authfd.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/authfd.c	2015-07-02 18:48:50.000000000 +0200
+--- a/authfd.c	2015-08-21 06:49:03.000000000 +0200
++++ b/authfd.c	2015-10-24 21:56:30.000000000 +0200
 @@ -165,6 +165,29 @@ ssh_request_reply(int sock, struct sshbu
  }
  
@@ -136,8 +136,8 @@
   * Closes the agent socket if it should be closed (depends on how it was
   * obtained).  The argument must have been returned by
   * ssh_get_authentication_socket().
---- a/authfd.h	2015-07-02 18:44:43.000000000 +0200
-+++ b/authfd.h	2015-07-02 18:48:50.000000000 +0200
+--- a/authfd.h	2015-08-21 06:49:03.000000000 +0200
++++ b/authfd.h	2015-10-24 21:56:30.000000000 +0200
 @@ -43,6 +43,9 @@ int	ssh_agent_sign(int sock, struct sshk
  	    u_char **sigp, size_t *lenp,
  	    const u_char *data, size_t datalen, u_int compat);
@@ -148,7 +148,7 @@
  /* Messages for the authentication agent connection. */
  #define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
  #define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
-@@ -76,6 +78,9 @@ int	ssh_agent_sign(int sock, struct sshk
+@@ -76,6 +79,9 @@ int	ssh_agent_sign(int sock, struct sshk
  #define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
  #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
  
@@ -158,8 +158,8 @@
  #define	SSH_AGENT_CONSTRAIN_LIFETIME		1
  #define	SSH_AGENT_CONSTRAIN_CONFIRM		2
  
---- a/config.h.in	2015-07-02 18:44:44.000000000 +0200
-+++ b/config.h.in	2015-07-02 18:48:50.000000000 +0200
+--- a/config.h.in	2015-08-21 07:09:20.000000000 +0200
++++ b/config.h.in	2015-10-24 21:56:30.000000000 +0200
 @@ -78,6 +78,18 @@
  /* FreeBSD strnvis argument order is swapped compared to OpenBSD */
  #undef BROKEN_STRNVIS
@@ -179,9 +179,9 @@
  /* tcgetattr with ICANON may hang */
  #undef BROKEN_TCGETATTR_ICANON
  
---- a/configure.ac	2015-07-02 18:44:43.000000000 +0200
-+++ b/configure.ac	2015-07-02 18:48:50.000000000 +0200
-@@ -4841,10 +4841,40 @@ AC_CHECK_MEMBER([struct utmp.ut_line], [
+--- a/configure.ac	2015-08-21 06:49:03.000000000 +0200
++++ b/configure.ac	2015-10-24 21:56:30.000000000 +0200
+@@ -4866,10 +4866,40 @@ AC_CHECK_MEMBER([struct utmp.ut_line], [
  #endif
  	])
  
@@ -222,8 +222,8 @@
  if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
  	TEST_SSH_IPV6=no
  else
---- a/groupaccess.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/groupaccess.c	2015-07-02 18:48:51.000000000 +0200
+--- a/groupaccess.c	2015-08-21 06:49:03.000000000 +0200
++++ b/groupaccess.c	2015-10-24 21:56:30.000000000 +0200
 @@ -34,38 +34,67 @@
  #include <string.h>
  #include <limits.h>
@@ -332,8 +332,8 @@
  	return 0;
  }
  
---- a/groupaccess.h	2015-07-02 18:44:43.000000000 +0200
-+++ b/groupaccess.h	2015-07-02 18:48:51.000000000 +0200
+--- a/groupaccess.h	2015-08-21 06:49:03.000000000 +0200
++++ b/groupaccess.h	2015-10-24 21:56:30.000000000 +0200
 @@ -27,7 +27,7 @@
  #ifndef GROUPACCESS_H
  #define GROUPACCESS_H
@@ -343,8 +343,8 @@
  int	 ga_match(char * const *, int);
  int	 ga_match_pattern_list(const char *);
  void	 ga_free(void);
---- a/keychain.c	1970-01-01 01:00:00.000000000 +0100
-+++ b/keychain.c	2015-07-02 18:48:51.000000000 +0200
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/keychain.c	2015-10-24 21:56:30.000000000 +0200
 @@ -0,0 +1,694 @@
 +/*
 + * Copyright (c) 2007 Apple Inc. All rights reserved.
@@ -1040,8 +1040,8 @@
 +#endif
 +
 +}
---- a/keychain.h	1970-01-01 01:00:00.000000000 +0100
-+++ b/keychain.h	2015-07-02 18:48:51.000000000 +0200
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/keychain.h	2015-10-24 21:56:30.000000000 +0200
 @@ -0,0 +1,45 @@
 +/*
 + * Copyright (c) 2007 Apple Inc. All rights reserved.
@@ -1088,8 +1088,8 @@
 +int	 add_identities_using_keychain(
 +	     int (*add_identity)(const char *, const char *));
 +char	*keychain_read_passphrase(const char *filename, int oAskPassGUI);
---- a/readconf.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/readconf.c	2015-07-02 18:48:51.000000000 +0200
+--- a/readconf.c	2015-08-21 06:49:03.000000000 +0200
++++ b/readconf.c	2015-10-24 21:56:30.000000000 +0200
 @@ -155,6 +155,9 @@ typedef enum {
  	oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
  	oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
@@ -1099,10 +1099,10 @@
 +#endif
  	oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
  	oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
- 	oIgnoredUnknownOption, oDeprecated, oUnsupported
-@@ -276,6 +279,9 @@ static struct {
- 	{ "updatehostkeys", oUpdateHostkeys },
+ 	oPubkeyAcceptedKeyTypes,
+@@ -278,6 +281,9 @@ static struct {
  	{ "hostbasedkeytypes", oHostbasedKeyTypes },
+ 	{ "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
  	{ "ignoreunknown", oIgnoreUnknown },
 +#ifdef __APPLE_KEYCHAIN__
 +	{ "askpassgui", oAskPassGUI },
@@ -1110,7 +1110,7 @@
  
  	{ NULL, oBadOption }
  };
-@@ -1386,6 +1392,12 @@ parse_int:
+@@ -1391,6 +1397,12 @@ parse_keytypes:
  		charptr = &options->ignored_unknown;
  		goto parse_string;
  
@@ -1133,7 +1133,7 @@
  	options->num_canonical_domains = 0;
  	options->num_permitted_cnames = 0;
  	options->canonicalize_max_dots = -1;
-@@ -1845,6 +1860,10 @@ fill_default_options(Options * options)
+@@ -1843,6 +1858,10 @@ fill_default_options(Options * options)
  		options->ip_qos_bulk = IPTOS_THROUGHPUT;
  	if (options->request_tty == -1)
  		options->request_tty = REQUEST_TTY_AUTO;
@@ -1144,10 +1144,10 @@
  	if (options->proxy_use_fdpass == -1)
  		options->proxy_use_fdpass = 0;
  	if (options->canonicalize_max_dots == -1)
---- a/readconf.h	2015-07-02 18:44:43.000000000 +0200
-+++ b/readconf.h	2015-07-02 18:48:51.000000000 +0200
-@@ -153,6 +153,10 @@ typedef struct {
- 	char	*hostbased_key_types;
+--- a/readconf.h	2015-08-21 06:49:03.000000000 +0200
++++ b/readconf.h	2015-10-24 21:56:30.000000000 +0200
+@@ -154,6 +154,10 @@ typedef struct {
+ 	char   *pubkey_key_types;
  
  	char	*ignored_unknown; /* Pattern list of unknown tokens to ignore */
 +
@@ -1157,8 +1157,8 @@
  }       Options;
  
  #define SSH_CANONICALISE_NO	0
---- a/scp.1	2015-07-02 18:44:43.000000000 +0200
-+++ b/scp.1	2015-07-02 18:48:51.000000000 +0200
+--- a/scp.1	2015-08-21 06:49:03.000000000 +0200
++++ b/scp.1	2015-10-24 21:56:30.000000000 +0200
 @@ -19,7 +19,7 @@
  .Sh SYNOPSIS
  .Nm scp
@@ -1177,8 +1177,8 @@
  .It Fl c Ar cipher
  Selects the cipher to use for encrypting the data transfer.
  This option is directly passed to
---- a/scp.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/scp.c	2015-07-02 18:48:51.000000000 +0200
+--- a/scp.c	2015-08-21 06:49:03.000000000 +0200
++++ b/scp.c	2015-10-24 21:56:30.000000000 +0200
 @@ -78,6 +78,9 @@
  #ifdef HAVE_SYS_STAT_H
  # include <sys/stat.h>
@@ -1431,8 +1431,8 @@
  	    "           [-l limit] [-o ssh_option] [-P port] [-S program]\n"
  	    "           [[user@]host1:]file1 ... [[user@]host2:]file2\n");
  	exit(1);
---- a/servconf.c	2015-07-02 18:44:44.000000000 +0200
-+++ b/servconf.c	2015-07-02 18:48:51.000000000 +0200
+--- a/servconf.c	2015-10-24 21:56:23.000000000 +0200
++++ b/servconf.c	2015-10-24 21:56:30.000000000 +0200
 @@ -280,7 +280,7 @@ fill_default_server_options(ServerOption
  	if (options->gss_strict_acceptor == -1)
  		options->gss_strict_acceptor = 0;
@@ -1442,7 +1442,7 @@
  	if (options->kbd_interactive_authentication == -1)
  		options->kbd_interactive_authentication = 0;
  	if (options->challenge_response_authentication == -1)
-@@ -739,7 +739,7 @@ match_cfg_line_group(const char *grps, i
+@@ -751,7 +751,7 @@ match_cfg_line_group(const char *grps, i
  	if ((pw = getpwnam(user)) == NULL) {
  		debug("Can't match group at line %d because user %.100s does "
  		    "not exist", line, user);
@@ -1451,8 +1451,8 @@
  		debug("Can't Match group because user %.100s not in any group "
  		    "at line %d", user, line);
  	} else if (ga_match_pattern_list(grps) != 1) {
---- a/session.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/session.c	2015-07-02 18:48:51.000000000 +0200
+--- a/session.c	2015-08-21 06:49:03.000000000 +0200
++++ b/session.c	2015-10-24 21:56:30.000000000 +0200
 @@ -2114,8 +2114,10 @@ session_pty_req(Session *s)
  		n_bytes = packet_remaining();
  	tty_parse_modes(s->ttyfd, &n_bytes);
@@ -1476,8 +1476,8 @@
  
  	/*
  	 * Close the server side of the socket pairs.  We must do this after
---- a/ssh-add.0	2015-07-02 18:44:44.000000000 +0200
-+++ b/ssh-add.0	2015-07-02 18:48:51.000000000 +0200
+--- a/ssh-add.0	2015-08-21 07:08:30.000000000 +0200
++++ b/ssh-add.0	2015-10-24 21:56:30.000000000 +0200
 @@ -4,7 +4,7 @@ NAME
       ssh-add M-bM-^@M-^S adds private key identities to the authentication agent
  
@@ -1501,8 +1501,8 @@
       -s pkcs11
               Add keys provided by the PKCS#11 shared library pkcs11.
  
---- a/ssh-add.1	2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-add.1	2015-07-02 18:48:51.000000000 +0200
+--- a/ssh-add.1	2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-add.1	2015-10-24 21:56:30.000000000 +0200
 @@ -43,7 +43,7 @@
  .Nd adds private key identities to the authentication agent
  .Sh SYNOPSIS
@@ -1526,8 +1526,8 @@
  .It Fl s Ar pkcs11
  Add keys provided by the PKCS#11 shared library
  .Ar pkcs11 .
---- a/ssh-add.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-add.c	2015-07-02 18:48:51.000000000 +0200
+--- a/ssh-add.c	2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-add.c	2015-10-24 21:56:30.000000000 +0200
 @@ -65,6 +65,7 @@
  #include "misc.h"
  #include "ssherr.h"
@@ -1607,7 +1607,7 @@
  			else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
  				fprintf(stderr,
  				    "Error loading key \"%s\": %s\n",
-@@ -445,13 +470,13 @@ lock_agent(int agent_fd, int lock)
+@@ -444,13 +469,13 @@ lock_agent(int agent_fd, int lock)
  }
  
  static int
@@ -1624,7 +1624,7 @@
  			return -1;
  	}
  	return 0;
-@@ -474,6 +499,11 @@ usage(void)
+@@ -473,6 +498,11 @@ usage(void)
  	fprintf(stderr, "  -X          Unlock agent.\n");
  	fprintf(stderr, "  -s pkcs11   Add keys from PKCS#11 provider.\n");
  	fprintf(stderr, "  -e pkcs11   Remove keys provided by PKCS#11 provider.\n");
@@ -1636,7 +1636,7 @@
  }
  
  int
-@@ -485,6 +515,7 @@ main(int argc, char **argv)
+@@ -484,6 +514,7 @@ main(int argc, char **argv)
  	char *pkcs11provider = NULL;
  	int r, i, ch, deleting = 0, ret = 0, key_only = 0;
  	int xflag = 0, lflag = 0, Dflag = 0;
@@ -1644,7 +1644,7 @@
  
  	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
  	sanitise_stdfd();
-@@ -511,7 +542,7 @@ main(int argc, char **argv)
+@@ -510,7 +541,7 @@ main(int argc, char **argv)
  		exit(2);
  	}
  
@@ -1653,7 +1653,7 @@
  		switch (ch) {
  		case 'E':
  			fingerprint_hash = ssh_digest_alg_by_name(optarg);
-@@ -556,6 +587,13 @@ main(int argc, char **argv)
+@@ -555,6 +586,13 @@ main(int argc, char **argv)
  				goto done;
  			}
  			break;
@@ -1667,7 +1667,7 @@
  		default:
  			usage();
  			ret = 1;
-@@ -604,7 +642,7 @@ main(int argc, char **argv)
+@@ -603,7 +641,7 @@ main(int argc, char **argv)
  			    default_files[i]);
  			if (stat(buf, &st) < 0)
  				continue;
@@ -1676,7 +1676,7 @@
  				ret = 1;
  			else
  				count++;
-@@ -613,7 +651,7 @@ main(int argc, char **argv)
+@@ -612,7 +650,7 @@ main(int argc, char **argv)
  			ret = 1;
  	} else {
  		for (i = 0; i < argc; i++) {
@@ -1685,8 +1685,8 @@
  			    argv[i]) == -1)
  				ret = 1;
  		}
---- a/ssh-agent.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-agent.c	2015-07-02 18:54:09.000000000 +0200
+--- a/ssh-agent.c	2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-agent.c	2015-10-24 23:19:13.000000000 +0200
 @@ -71,6 +71,9 @@
  #ifdef HAVE_UTIL_H
  # include <util.h>
@@ -1695,9 +1695,9 @@
 +#include <launch.h>
 +#endif
  
- #include "key.h"	/* XXX for typedef */
- #include "buffer.h"	/* XXX for typedef */
-@@ -81,11 +84,13 @@
+ #include "xmalloc.h"
+ #include "ssh.h"
+@@ -78,11 +81,14 @@
  #include "sshbuf.h"
  #include "sshkey.h"
  #include "authfd.h"
@@ -1708,10 +1708,11 @@
  #include "digest.h"
  #include "ssherr.h"
 +#include "keychain.h"
++#include "key.h"
  
  #ifdef ENABLE_PKCS11
  #include "ssh-pkcs11.h"
-@@ -831,6 +836,61 @@ process_remove_smartcard_key(SocketEntry
+@@ -828,6 +834,61 @@ process_remove_smartcard_key(SocketEntry
  }
  #endif /* ENABLE_PKCS11 */
  
@@ -1764,8 +1765,8 @@
 +
 +	/* e will be NULL when ssh-agent adds keys on its own at startup */
 +	if (e) {
-+		buffer_put_int(&e->output, 1);
-+		buffer_put_char(&e->output,
++		buffer_put_int(e->output, 1);
++		buffer_put_char(e->output,
 +		    result ? SSH_AGENT_FAILURE : SSH_AGENT_SUCCESS);
 +	}
 +}
@@ -1773,7 +1774,7 @@
  /* dispatch incoming messages */
  
  static void
-@@ -925,6 +985,9 @@ process_message(SocketEntry *e)
+@@ -922,6 +983,9 @@ process_message(SocketEntry *e)
  		process_remove_smartcard_key(e);
  		break;
  #endif /* ENABLE_PKCS11 */
@@ -1783,7 +1784,7 @@
  	default:
  		/* Unknown message.  Respond with failure. */
  		error("Unknown message %d", type);
-@@ -1175,7 +1238,11 @@ usage(void)
+@@ -1172,7 +1236,11 @@ usage(void)
  int
  main(int ac, char **av)
  {
@@ -1795,7 +1796,7 @@
  	int sock, fd, ch, result, saved_errno;
  	u_int nalloc;
  	char *shell, *format, *pidstr, *agentsocket = NULL;
-@@ -1210,7 +1277,11 @@ main(int ac, char **av)
+@@ -1207,7 +1275,11 @@ main(int ac, char **av)
  	__progname = ssh_get_progname(av[0]);
  	seed_rng();
  
@@ -1807,7 +1808,7 @@
  		switch (ch) {
  		case 'E':
  			fingerprint_hash = ssh_digest_alg_by_name(optarg);
-@@ -1225,6 +1296,11 @@ main(int ac, char **av)
+@@ -1222,6 +1294,11 @@ main(int ac, char **av)
  		case 'k':
  			k_flag++;
  			break;
@@ -1819,7 +1820,7 @@
  		case 's':
  			if (c_flag)
  				usage();
-@@ -1256,7 +1332,11 @@ main(int ac, char **av)
+@@ -1253,7 +1330,11 @@ main(int ac, char **av)
  	ac -= optind;
  	av += optind;
  
@@ -1831,7 +1832,7 @@
  		usage();
  
  	if (ac == 0 && !c_flag && !s_flag) {
-@@ -1312,6 +1392,53 @@ main(int ac, char **av)
+@@ -1309,6 +1390,53 @@ main(int ac, char **av)
  	 * Create socket early so it will exist before command gets run from
  	 * the parent.
  	 */
@@ -1885,7 +1886,7 @@
  	prev_mask = umask(0177);
  	sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0);
  	if (sock < 0) {
-@@ -1320,6 +1447,14 @@ main(int ac, char **av)
+@@ -1317,6 +1445,14 @@ main(int ac, char **av)
  		cleanup_exit(1);
  	}
  	umask(prev_mask);
@@ -1900,7 +1901,7 @@
  
  	/*
  	 * Fork, and have the parent execute the command, if any, or present
-@@ -1396,6 +1531,7 @@ skip:
+@@ -1393,6 +1529,7 @@ skip:
  	pkcs11_init(0);
  #endif
  	new_socket(AUTH_SOCKET, sock);
@@ -1908,7 +1909,7 @@
  	if (ac > 0)
  		parent_alive_interval = 10;
  	idtab_init();
-@@ -1405,6 +1541,10 @@ skip:
+@@ -1402,6 +1539,10 @@ skip:
  	signal(SIGTERM, cleanup_handler);
  	nalloc = 0;
  
@@ -1919,8 +1920,8 @@
  	while (1) {
  		prepare_select(&readsetp, &writesetp, &max_fd, &nalloc, &tvp);
  		result = select(max_fd + 1, readsetp, writesetp, NULL, tvp);
---- a/ssh-keysign.8	2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-keysign.8	2015-07-02 18:48:51.000000000 +0200
+--- a/ssh-keysign.8	2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-keysign.8	2015-10-24 21:56:30.000000000 +0200
 @@ -72,6 +72,9 @@ accessible to others.
  Since they are readable only by root,
  .Nm
@@ -1931,8 +1932,8 @@
  .Pp
  .It Pa /etc/ssh/ssh_host_dsa_key-cert.pub
  .It Pa /etc/ssh/ssh_host_ecdsa_key-cert.pub
---- a/sshconnect1.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/sshconnect1.c	2015-07-02 18:48:51.000000000 +0200
+--- a/sshconnect1.c	2015-08-21 06:49:03.000000000 +0200
++++ b/sshconnect1.c	2015-10-24 21:56:30.000000000 +0200
 @@ -51,6 +51,7 @@
  #include "auth.h"
  #include "digest.h"
@@ -1952,8 +1953,8 @@
  			passphrase = read_passphrase(buf, 0);
  			if (strcmp(passphrase, "") != 0) {
  				private = key_load_private_type(KEY_RSA1,
---- a/sshconnect2.c	2015-07-02 18:44:43.000000000 +0200
-+++ b/sshconnect2.c	2015-07-02 18:48:51.000000000 +0200
+--- a/sshconnect2.c	2015-08-21 06:49:03.000000000 +0200
++++ b/sshconnect2.c	2015-10-24 21:56:30.000000000 +0200
 @@ -71,6 +71,7 @@
  #include "uidswap.h"
  #include "hostfile.h"
@@ -1962,7 +1963,7 @@
  
  #ifdef GSSAPI
  #include "ssh-gss.h"
-@@ -1143,6 +1144,10 @@ load_identity_file(char *filename, int u
+@@ -1136,6 +1137,10 @@ load_identity_file(char *filename, int u
  		if (i == 0)
  			passphrase = "";
  		else {
@@ -1973,9 +1974,9 @@
  			passphrase = read_passphrase(prompt, 0);
  			if (*passphrase == '\0') {
  				debug2("no passphrase given, try next key");
---- a/sshd.0	2015-07-02 18:44:44.000000000 +0200
-+++ b/sshd.0	2015-07-02 18:48:51.000000000 +0200
-@@ -622,8 +622,7 @@ FILES
+--- a/sshd.0	2015-08-21 07:08:31.000000000 +0200
++++ b/sshd.0	2015-10-24 21:56:30.000000000 +0200
+@@ -621,8 +621,7 @@ FILES
  
  SEE ALSO
       scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),
@@ -1985,9 +1986,9 @@
  
  AUTHORS
       OpenSSH is a derivative of the original and free ssh 1.2.12 release by
---- a/sshd.8	2015-07-02 18:44:43.000000000 +0200
-+++ b/sshd.8	2015-07-02 18:48:51.000000000 +0200
-@@ -956,10 +956,7 @@ The content of this file is not sensitiv
+--- a/sshd.8	2015-08-21 06:49:03.000000000 +0200
++++ b/sshd.8	2015-10-24 21:56:30.000000000 +0200
+@@ -953,10 +953,7 @@ The content of this file is not sensitiv
  .Xr ssh-keygen 1 ,
  .Xr ssh-keyscan 1 ,
  .Xr chroot 2 ,
@@ -1998,9 +1999,9 @@
  .Xr sftp-server 8
  .Sh AUTHORS
  OpenSSH is a derivative of the original and free
---- a/sshd.c	2015-07-02 18:44:44.000000000 +0200
-+++ b/sshd.c	2015-07-02 18:48:51.000000000 +0200
-@@ -2229,6 +2229,12 @@ main(int ac, char **av)
+--- a/sshd.c	2015-10-24 21:56:28.000000000 +0200
++++ b/sshd.c	2015-10-24 21:56:30.000000000 +0200
+@@ -2233,6 +2233,12 @@ main(int ac, char **av)
  	audit_event(SSH_AUTH_SUCCESS);
  #endif
  
@@ -2013,7 +2014,7 @@
  #ifdef GSSAPI
  	if (options.gss_authentication) {
  		temporarily_use_uid(authctxt->pw);
-@@ -2236,12 +2242,6 @@ main(int ac, char **av)
+@@ -2240,12 +2246,6 @@ main(int ac, char **av)
  		restore_uid();
  	}
  #endif
@@ -2026,8 +2027,8 @@
  
  	/*
  	 * In privilege separation, we fork another child and prepare
---- a/sshd_config	2015-07-02 18:44:43.000000000 +0200
-+++ b/sshd_config	2015-07-02 18:48:51.000000000 +0200
+--- a/sshd_config	2015-08-21 06:49:03.000000000 +0200
++++ b/sshd_config	2015-10-24 21:56:30.000000000 +0200
 @@ -35,7 +35,7 @@
  
  # Logging
@@ -2061,9 +2062,9 @@
  
  #AllowAgentForwarding yes
  #AllowTcpForwarding yes
---- a/sshd_config.0	2015-07-02 18:44:44.000000000 +0200
-+++ b/sshd_config.0	2015-07-02 18:48:51.000000000 +0200
-@@ -649,7 +649,7 @@ DESCRIPTION
+--- a/sshd_config.0	2015-08-21 07:08:32.000000000 +0200
++++ b/sshd_config.0	2015-10-24 21:56:30.000000000 +0200
+@@ -689,7 +689,7 @@ DESCRIPTION
  
       PasswordAuthentication
               Specifies whether password authentication is allowed.  The
@@ -2072,7 +2073,7 @@
  
       PermitEmptyPasswords
               When password authentication is allowed, it specifies whether the
-@@ -891,7 +891,7 @@ DESCRIPTION
+@@ -948,7 +948,7 @@ DESCRIPTION
               either PasswordAuthentication or ChallengeResponseAuthentication.
  
               If UsePAM is enabled, you will not be able to run sshd(8) as a
@@ -2081,9 +2082,9 @@
  
       UsePrivilegeSeparation
               Specifies whether sshd(8) separates privileges by creating an
---- a/sshd_config.5	2015-07-02 18:44:43.000000000 +0200
-+++ b/sshd_config.5	2015-07-02 18:48:51.000000000 +0200
-@@ -1111,7 +1111,7 @@ are refused if the number of unauthentic
+--- a/sshd_config.5	2015-08-21 06:49:03.000000000 +0200
++++ b/sshd_config.5	2015-10-24 21:56:30.000000000 +0200
+@@ -1163,7 +1163,7 @@ are refused if the number of unauthentic
  .It Cm PasswordAuthentication
  Specifies whether password authentication is allowed.
  The default is
@@ -2092,7 +2093,7 @@
  .It Cm PermitEmptyPasswords
  When password authentication is allowed, it specifies whether the
  server allows login to accounts with empty password strings.
-@@ -1498,7 +1498,7 @@ is enabled, you will not be able to run
+@@ -1574,7 +1574,7 @@ is enabled, you will not be able to run
  .Xr sshd 8
  as a non-root user.
  The default is

Modified: trunk/dports/net/openssh/files/launchd.patch
===================================================================
--- trunk/dports/net/openssh/files/launchd.patch	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/launchd.patch	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,5 +1,5 @@
---- a/channels.c	2015-07-02 18:36:28.000000000 +0200
-+++ b/channels.c	2015-07-02 18:37:07.000000000 +0200
+--- a/channels.c	2015-08-21 06:49:03.000000000 +0200
++++ b/channels.c	2015-10-24 04:37:00.000000000 +0200
 @@ -4037,15 +4037,35 @@ x11_connect_display(void)
  	 * connection to the real X server.
  	 */
@@ -43,9 +43,9 @@
  	}
  #endif
  	/*
---- a/clientloop.c	2015-07-02 18:36:28.000000000 +0200
-+++ b/clientloop.c	2015-07-02 18:37:07.000000000 +0200
-@@ -314,6 +314,10 @@ client_x11_get_proto(const char *display
+--- a/clientloop.c	2015-08-21 06:49:03.000000000 +0200
++++ b/clientloop.c	2015-10-24 04:37:00.000000000 +0200
+@@ -315,6 +315,10 @@ client_x11_get_proto(const char *display
  	struct stat st;
  	u_int now, x11_timeout_real;
  
@@ -56,7 +56,7 @@
  	xauthdir = xauthfile = NULL;
  	*_proto = proto;
  	*_data = data;
-@@ -329,6 +333,33 @@ client_x11_get_proto(const char *display
+@@ -330,6 +334,33 @@ client_x11_get_proto(const char *display
  			debug("x11_get_proto: DISPLAY not set");
  			return;
  		}
@@ -90,7 +90,7 @@
  		/*
  		 * Handle FamilyLocal case where $DISPLAY does
  		 * not match an authorization entry.  For this we
-@@ -420,6 +451,9 @@ client_x11_get_proto(const char *display
+@@ -421,6 +452,9 @@ client_x11_get_proto(const char *display
  	if (!got_data) {
  		u_int32_t rnd = 0;
  

Modified: trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch
===================================================================
--- trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch	2015-10-25 10:37:32 UTC (rev 141653)
@@ -24,12 +24,12 @@
 
 Updated by: Mihai Moldovan <ionic at macports.org>
 Patch-Name: openssh-6.7p1-gsskex-all-20141021-284f364.patch
-Abstract: Updated for OpenSSH 6.8p1 with MacPorts patches for integration
+Abstract: Updated for OpenSSH 7.1p1 with MacPorts patches for integration
           with Apple's launchd, pam, sandbox and KeyChain.
           WARNING: the commit ID does NOT match this patch. It is merely
                    provided for reference.
-Last-Updated: 2015-07-02
-X-Ref: http://pkgs.fedoraproject.org/cgit/openssh.git/tree/openssh-6.6p1-gsskex.patch?id=1cfd53f089c7c8b2afa839c80c90b56b4c16fb78
+Last-Updated: 2015-10-24
+X-Ref: http://pkgs.fedoraproject.org/cgit/openssh.git/tree/openssh-6.6p1-gsskex.patch?id=2feb7b59e2ffab2b5cde0d6d2b2af33515b30ee2
 ---
  ChangeLog.gssapi | 113 +++++++++++++++++++
  Makefile.in      |   3 +-
@@ -69,11 +69,8 @@
  create mode 100644 kexgssc.c
  create mode 100644 kexgsss.c
 
-diff --git a/ChangeLog.gssapi b/ChangeLog.gssapi
-new file mode 100644
-index 0000000..f117a33
---- /dev/null
-+++ b/ChangeLog.gssapi
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/ChangeLog.gssapi	2015-10-24 08:11:41.000000000 +0200
 @@ -0,0 +1,113 @@
 +20110101
 +  - Finally update for OpenSSH 5.6p1
@@ -188,10 +185,8 @@
 +    add support for GssapiTrustDns option for gssapi-with-mic
 +    (from jbasney AT ncsa.uiuc.edu)
 +    <gssapi-with-mic support is Bugzilla #1008>
-diff --git a/Makefile.in b/Makefile.in
-index 06be3d5..086d8dd 100644
---- a/Makefile.in
-+++ b/Makefile.in
+--- a/Makefile.in	2015-10-24 08:11:05.000000000 +0200
++++ b/Makefile.in	2015-10-24 08:11:41.000000000 +0200
 @@ -92,7 +92,8 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
  	sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o \
  	kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
@@ -211,10 +206,8 @@
  	loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
  	sftp-server.o sftp-common.o \
  	roaming_common.o roaming_serv.o \
-diff --git a/auth-krb5.c b/auth-krb5.c
-index 0089b18..ec47869 100644
---- a/auth-krb5.c
-+++ b/auth-krb5.c
+--- a/auth-krb5.c	2015-10-24 08:11:05.000000000 +0200
++++ b/auth-krb5.c	2015-10-24 08:11:41.000000000 +0200
 @@ -183,8 +183,13 @@ auth_krb5_password(Authctxt *authctxt, c
  
  	len = strlen(authctxt->krb5_ticket_file) + 6;
@@ -262,10 +255,8 @@
  
  	return (krb5_cc_resolve(ctx, ccname, ccache));
  }
-diff --git a/auth2-gss.c b/auth2-gss.c
-index 447f896..284f364 100644
---- a/auth2-gss.c
-+++ b/auth2-gss.c
+--- a/auth2-gss.c	2015-10-24 08:11:05.000000000 +0200
++++ b/auth2-gss.c	2015-10-24 08:43:51.000000000 +0200
 @@ -1,7 +1,7 @@
  /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
  
@@ -275,11 +266,10 @@
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
-@@ -53,6 +53,40 @@ static int input_gssapi_mic(int type, u_
- static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt);
+@@ -54,6 +54,40 @@ static int input_gssapi_exchange_complet
  static int input_gssapi_errtok(int, u_int32_t, void *);
  
-+/* 
+ /*
 + * The 'gssapi_keyex' userauth mechanism.
 + */
 +static int
@@ -302,20 +292,21 @@
 +	gssbuf.length = buffer_len(&b);
 +
 +	/* gss_kex_context is NULL with privsep, so we can't check it here */
-+	if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context, 
++	if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context,
 +	    &gssbuf, &mic))))
 +		authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user,
 +		    authctxt->pw));
-+	
++
 +	buffer_free(&b);
 +	free(mic.value);
 +
 +	return (authenticated);
 +}
 +
- /*
++/*
   * We only support those mechanisms that we know about (ie ones that we know
   * how to check local user kuserok and the like)
+  */
 @@ -238,7 +272,8 @@ input_gssapi_exchange_complete(int type,
  
  	packet_check_eom();
@@ -331,7 +322,7 @@
  
  	if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic))))
 -		authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
-+		authenticated = 
++		authenticated =
 +		    PRIVSEP(ssh_gssapi_userok(authctxt->user, authctxt->pw));
  	else
  		logit("GSSAPI MIC check failed");
@@ -349,10 +340,8 @@
  Authmethod method_gssapi = {
  	"gssapi-with-mic",
  	userauth_gssapi,
-diff --git a/auth2.c b/auth2.c
-index d9b440a..2f0d565 100644
---- a/auth2.c
-+++ b/auth2.c
+--- a/auth2.c	2015-10-24 08:11:05.000000000 +0200
++++ b/auth2.c	2015-10-24 08:11:41.000000000 +0200
 @@ -70,6 +70,7 @@ extern Authmethod method_passwd;
  extern Authmethod method_kbdint;
  extern Authmethod method_hostbased;
@@ -369,11 +358,9 @@
  	&method_gssapi,
  #endif
  	&method_passwd,
-diff --git a/clientloop.c b/clientloop.c
-index 397c965..f9175e3 100644
---- a/clientloop.c
-+++ b/clientloop.c
-@@ -114,6 +114,10 @@
+--- a/clientloop.c	2015-10-24 08:11:05.000000000 +0200
++++ b/clientloop.c	2015-10-24 08:11:41.000000000 +0200
+@@ -115,6 +115,10 @@
  #include "ssherr.h"
  #include "hostfile.h"
  
@@ -384,7 +371,7 @@
  /* import options */
  extern Options options;
  
-@@ -1643,6 +1647,15 @@ client_loop(int have_pty, int escape_cha
+@@ -1644,6 +1648,15 @@ client_loop(int have_pty, int escape_cha
  		/* Do channel operations unless rekeying in progress. */
  		if (!rekeying) {
  			channel_after_select(readset, writeset);
@@ -400,10 +387,8 @@
  			if (need_rekeying || packet_need_rekeying()) {
  				debug("need rekeying");
  				active_state->kex->done = 0;
-diff --git a/config.h.in b/config.h.in
-index 16d6206..a9a8b7a 100644
---- a/config.h.in
-+++ b/config.h.in
+--- a/config.h.in	2015-10-24 08:11:05.000000000 +0200
++++ b/config.h.in	2015-10-24 08:11:41.000000000 +0200
 @@ -1635,6 +1635,9 @@
  /* Use btmp to log bad logins */
  #undef USE_BTMP
@@ -424,78 +409,8 @@
  /* Define if you have Solaris process contracts */
  #undef USE_SOLARIS_PROCESS_CONTRACTS
  
-diff --git a/configure b/configure
-index 6815388..ea5f200 100755
---- a/configure
-+++ b/configure
-@@ -7281,6 +7281,63 @@ cat >>confdefs.h <<\_ACEOF
- #define NO_ATTRIBUTE_ON_RETURN_TYPE 1
- _ACEOF
- 
-+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have the Security Authorization Session API" >&5
-+$as_echo_n "checking if we have the Security Authorization Session API... " >&6; }
-+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+#include <Security/AuthSession.h>
-+int
-+main ()
-+{
-+SessionCreate(0, 0);
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_compile "$LINENO"; then :
-+  ac_cv_use_security_session_api="yes"
-+
-+$as_echo "#define USE_SECURITY_SESSION_API 1" >>confdefs.h
-+
-+		 LIBS="$LIBS -framework Security"
-+		 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-+$as_echo "yes" >&6; }
-+else
-+  ac_cv_use_security_session_api="no"
-+		 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }
-+fi
-+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have an in-memory credentials cache" >&5
-+$as_echo_n "checking if we have an in-memory credentials cache... " >&6; }
-+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+#include <Kerberos/Kerberos.h>
-+int
-+main ()
-+{
-+cc_context_t c;
-+		 (void) cc_initialize (&c, 0, NULL, NULL);
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_compile "$LINENO"; then :
-+
-+$as_echo "#define USE_CCAPI 1" >>confdefs.h
-+
-+		 LIBS="$LIBS -framework Security"
-+		 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-+$as_echo "yes" >&6; }
-+		 if test "x$ac_cv_use_security_session_api" = "xno"; then
-+			as_fn_error $? "*** Need a security framework to use the credentials cache API ***" "$LINENO" 5
-+		fi
-+else
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }
-+
-+fi
-+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- 
- fi
- 
-diff --git a/configure.ac b/configure.ac
-index 67c4486..90e81e1 100644
---- a/configure.ac
-+++ b/configure.ac
+--- a/configure.ac	2015-10-24 08:11:05.000000000 +0200
++++ b/configure.ac	2015-10-24 08:11:41.000000000 +0200
 @@ -625,6 +625,30 @@ main() { if (NSVersionOfRunTimeLibrary("
  	    [Use tunnel device compatibility to OpenBSD])
  	AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
@@ -527,10 +442,8 @@
  	m4_pattern_allow([AU_IPv])
  	AC_CHECK_DECL([AU_IPv4], [], 
  	    AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
-diff --git a/gss-genr.c b/gss-genr.c
-index b39281b..1e569ad 100644
---- a/gss-genr.c
-+++ b/gss-genr.c
+--- a/gss-genr.c	2015-10-24 08:11:05.000000000 +0200
++++ b/gss-genr.c	2015-10-24 08:56:32.000000000 +0200
 @@ -1,7 +1,7 @@
  /* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
  
@@ -568,7 +481,7 @@
 +
 +static ssh_gss_kex_mapping *gss_enc2oid = NULL;
 +
-+int 
++int
 +ssh_gssapi_oid_table_ok(void) {
 +	return (gss_enc2oid != NULL);
 +}
@@ -641,7 +554,7 @@
 +			    sizeof(KEX_GSS_GEX_SHA1_ID) - 1);
 +			buffer_append(&buf, encoded, enclen);
 +			buffer_put_char(&buf, ',');
-+			buffer_append(&buf, KEX_GSS_GRP1_SHA1_ID, 
++			buffer_append(&buf, KEX_GSS_GRP1_SHA1_ID,
 +			    sizeof(KEX_GSS_GRP1_SHA1_ID) - 1);
 +			buffer_append(&buf, encoded, enclen);
 +			buffer_put_char(&buf, ',');
@@ -674,7 +587,7 @@
 +gss_OID
 +ssh_gssapi_id_kex(Gssctxt *ctx, char *name, int kex_type) {
 +	int i = 0;
-+	
++
 +	switch (kex_type) {
 +	case KEX_GSS_GRP1_SHA1:
 +		if (strlen(name) < sizeof(KEX_GSS_GRP1_SHA1_ID))
@@ -877,10 +790,8 @@
 +}
 +
  #endif /* GSSAPI */
-diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c
-index 795992d..fd8b371 100644
---- a/gss-serv-krb5.c
-+++ b/gss-serv-krb5.c
+--- a/gss-serv-krb5.c	2015-10-24 08:11:05.000000000 +0200
++++ b/gss-serv-krb5.c	2015-10-24 09:08:09.000000000 +0200
 @@ -1,7 +1,7 @@
  /* $OpenBSD: gss-serv-krb5.c,v 1.8 2013/07/20 01:55:13 djm Exp $ */
  
@@ -941,7 +852,7 @@
  }
  
 +int
-+ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store, 
++ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store,
 +    ssh_gssapi_client *client)
 +{
 +	krb5_ccache ccache = NULL;
@@ -957,7 +868,7 @@
 +       	}
 +	
 +	/* Find out who the principal in this cache is */
-+	if ((problem = krb5_cc_get_principal(krb_context, ccache, 
++	if ((problem = krb5_cc_get_principal(krb_context, ccache,
 +	    &principal))) {
 +		logit("krb5_cc_get_principal(): %.100s",
 +		    krb5_get_err_text(krb_context, problem));
@@ -1018,10 +929,8 @@
  };
  
  #endif /* KRB5 */
-diff --git a/gss-serv.c b/gss-serv.c
-index 5c59924..50fa438 100644
---- a/gss-serv.c
-+++ b/gss-serv.c
+--- a/gss-serv.c	2015-10-24 08:11:05.000000000 +0200
++++ b/gss-serv.c	2015-10-24 08:11:41.000000000 +0200
 @@ -1,7 +1,7 @@
  /* $OpenBSD: gss-serv.c,v 1.29 2015/05/22 03:50:02 djm Exp $ */
  
@@ -1314,10 +1223,8 @@
  }
  
  #endif
-diff --git a/kex.c b/kex.c
-index a173e70..891852b 100644
---- a/kex.c
-+++ b/kex.c
+--- a/kex.c	2015-10-24 08:11:05.000000000 +0200
++++ b/kex.c	2015-10-24 08:11:41.000000000 +0200
 @@ -55,6 +55,10 @@
  #include "sshbuf.h"
  #include "digest.h"
@@ -1357,10 +1264,8 @@
  	return NULL;
  }
  
-diff --git a/kex.h b/kex.h
-index 4c40ec8..c179a4d 100644
---- a/kex.h
-+++ b/kex.h
+--- a/kex.h	2015-10-24 08:11:05.000000000 +0200
++++ b/kex.h	2015-10-24 08:11:41.000000000 +0200
 @@ -93,6 +93,11 @@ enum kex_exchange {
  	KEX_DH_GEX_SHA256,
  	KEX_ECDH_SHA2,
@@ -1385,8 +1290,8 @@
 +#endif
  	char	*client_version_string;
  	char	*server_version_string;
- 	int	(*verify_host_key)(struct sshkey *, struct ssh *);
-@@ -184,6 +195,11 @@ int	 kexecdh_server(struct ssh *);
+ 	char	*failed_choice;
+@@ -187,6 +198,11 @@ int	 kexecdh_server(struct ssh *);
  int	 kexc25519_client(struct ssh *);
  int	 kexc25519_server(struct ssh *);
  
@@ -1398,11 +1303,8 @@
  int	 kex_dh_hash(const char *, const char *,
      const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
      const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
-diff --git a/kexgssc.c b/kexgssc.c
-new file mode 100644
-index 0000000..92a31c5
---- /dev/null
-+++ b/kexgssc.c
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/kexgssc.c	2015-10-24 09:15:13.000000000 +0200
 @@ -0,0 +1,339 @@
 +/*
 + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
@@ -1460,11 +1362,11 @@
 +	Gssctxt *ctxt;
 +	OM_uint32 maj_status, min_status, ret_flags;
 +	u_int klen, kout, slen = 0, strlen;
-+	DH *dh; 
++	DH *dh;
 +	BIGNUM *dh_server_pub = NULL;
 +	BIGNUM *shared_secret = NULL;
 +	BIGNUM *p = NULL;
-+	BIGNUM *g = NULL;	
++	BIGNUM *g = NULL;
 +	u_char *kbuf;
 +	u_char *serverhostkey = NULL;
 +	u_char *empty = "";
@@ -1476,16 +1378,16 @@
 +	u_char hash[SSH_DIGEST_MAX_LENGTH];
 +	size_t hashlen;
 +
-+	/* Initialise our GSSAPI world */	
++	/* Initialise our GSSAPI world */
 +	ssh_gssapi_build_ctx(&ctxt);
-+	if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type) 
++	if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type)
 +	    == GSS_C_NO_OID)
 +		fatal("Couldn't identify host exchange");
 +
 +	if (ssh_gssapi_import_name(ctxt, kex->gss_host))
 +		fatal("Couldn't import hostname");
 +
-+	if (kex->gss_client && 
++	if (kex->gss_client &&
 +	    ssh_gssapi_client_identity(ctxt, kex->gss_client))
 +		fatal("Couldn't acquire client credentials");
 +
@@ -1525,7 +1427,7 @@
 +	default:
 +		fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type);
 +	}
-+	
++
 +	/* Step 1 - e is dh->pub_key */
 +	dh_gen_key(dh, kex->we_need * 8);
 +
@@ -1535,7 +1437,7 @@
 +		fatal("dh_server_pub == NULL");
 +
 +	token_ptr = GSS_C_NO_BUFFER;
-+			 
++
 +	do {
 +		debug("Calling gss_init_sec_context");
 +		
@@ -1566,9 +1468,9 @@
 +				fatal("Integrity check failed");
 +		}
 +
-+		/* 
++		/*
 +		 * If we have data to send, then the last message that we
-+		 * received cannot have been a 'complete'. 
++		 * received cannot have been a 'complete'.
 +		 */
 +		if (send_tok.length != 0) {
 +			if (first) {
@@ -1586,13 +1488,13 @@
 +			gss_release_buffer(&min_status, &send_tok);
 +
 +			/* If we've sent them data, they should reply */
-+			do {	
++			do {
 +				type = packet_read();
 +				if (type == SSH2_MSG_KEXGSS_HOSTKEY) {
 +					debug("Received KEXGSS_HOSTKEY");
 +					if (serverhostkey)
 +						fatal("Server host key received more than once");
-+					serverhostkey = 
++					serverhostkey =
 +					    packet_get_string(&slen);
 +				}
 +			} while (type == SSH2_MSG_KEXGSS_HOSTKEY);
@@ -1600,20 +1502,20 @@
 +			switch (type) {
 +			case SSH2_MSG_KEXGSS_CONTINUE:
 +				debug("Received GSSAPI_CONTINUE");
-+				if (maj_status == GSS_S_COMPLETE) 
++				if (maj_status == GSS_S_COMPLETE)
 +					fatal("GSSAPI Continue received from server when complete");
 +				recv_tok.value = packet_get_string(&strlen);
-+				recv_tok.length = strlen; 
++				recv_tok.length = strlen;
 +				break;
 +			case SSH2_MSG_KEXGSS_COMPLETE:
 +				debug("Received GSSAPI_COMPLETE");
 +				packet_get_bignum2(dh_server_pub);
 +				msg_tok.value =  packet_get_string(&strlen);
-+				msg_tok.length = strlen; 
++				msg_tok.length = strlen;
 +
 +				/* Is there a token included? */
 +				if (packet_get_char()) {
-+					recv_tok.value=
++					recv_tok.value =
 +					    packet_get_string(&strlen);
 +					recv_tok.length = strlen;
 +					/* If we're already complete - protocol error */
@@ -1634,7 +1536,7 @@
 +				fatal("GSSAPI Error: \n%.400s",msg);
 +			default:
 +				packet_disconnect("Protocol error: didn't expect packet type %d",
-+		    		type);
++				type);
 +			}
 +			token_ptr = &recv_tok;
 +		} else {
@@ -1644,9 +1546,9 @@
 +		}
 +	} while (maj_status & GSS_S_CONTINUE_NEEDED);
 +
-+	/* 
-+	 * We _must_ have received a COMPLETE message in reply from the 
-+	 * server, which will have set dh_server_pub and msg_tok 
++	/*
++	 * We _must_ have received a COMPLETE message in reply from the
++	 * server, which will have set dh_server_pub and msg_tok
 +	 */
 +
 +	if (type != SSH2_MSG_KEXGSS_COMPLETE)
@@ -1677,7 +1579,7 @@
 +	switch (kex->kex_type) {
 +	case KEX_GSS_GRP1_SHA1:
 +	case KEX_GSS_GRP14_SHA1:
-+		kex_dh_hash( kex->client_version_string, 
++		kex_dh_hash( kex->client_version_string,
 +		    kex->server_version_string,
 +		    buffer_ptr(kex->my), buffer_len(kex->my),
 +		    buffer_ptr(kex->peer), buffer_len(kex->peer),
@@ -1696,7 +1598,7 @@
 +		    buffer_ptr(kex->my), buffer_len(kex->my),
 +		    buffer_ptr(kex->peer), buffer_len(kex->peer),
 +		    (serverhostkey ? serverhostkey : empty), slen,
-+ 		    min, nbits, max,
++		    min, nbits, max,
 +		    dh->p, dh->g,
 +		    dh->pub_key,
 +		    dh_server_pub,
@@ -1743,11 +1645,8 @@
 +}
 +
 +#endif /* GSSAPI */
-diff --git a/kexgsss.c b/kexgsss.c
-new file mode 100644
-index 0000000..6a0ece8
---- /dev/null
-+++ b/kexgsss.c
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/kexgsss.c	2015-10-24 09:22:08.000000000 +0200
 @@ -0,0 +1,300 @@
 +/*
 + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
@@ -1807,12 +1706,12 @@
 +	int r = 0;
 +
 +	OM_uint32 maj_status, min_status;
-+	
-+	/* 
++
++	/*
 +	 * Some GSSAPI implementations use the input value of ret_flags (an
-+ 	 * output variable) as a means of triggering mechanism specific 
-+ 	 * features. Initializing it to zero avoids inadvertently 
-+ 	 * activating this non-standard behaviour.
++	 * output variable) as a means of triggering mechanism specific
++	 * features. Initializing it to zero avoids inadvertently
++	 * activating this non-standard behaviour.
 +	 */
 +
 +	OM_uint32 ret_flags = 0;
@@ -1846,7 +1745,7 @@
 +	debug2("%s: Identifying %s", __func__, kex->name);
 +	oid = ssh_gssapi_id_kex(NULL, kex->name, kex->kex_type);
 +	if (oid == GSS_C_NO_OID)
-+	   fatal("Unknown gssapi mechanism");
++		fatal("Unknown gssapi mechanism");
 +
 +	debug2("%s: Acquiring credentials", __func__);
 +
@@ -1894,10 +1793,10 @@
 +		type = packet_read();
 +		switch(type) {
 +		case SSH2_MSG_KEXGSS_INIT:
-+			if (dh_client_pub != NULL) 
++			if (dh_client_pub != NULL)
 +				fatal("Received KEXGSS_INIT after initialising");
 +			recv_tok.value = packet_get_string(&slen);
-+			recv_tok.length = slen; 
++			recv_tok.length = slen;
 +
 +			if ((dh_client_pub = BN_new()) == NULL)
 +				fatal("dh_client_pub == NULL");
@@ -1908,7 +1807,7 @@
 +			break;
 +		case SSH2_MSG_KEXGSS_CONTINUE:
 +			recv_tok.value = packet_get_string(&slen);
-+			recv_tok.length = slen; 
++			recv_tok.length = slen;
 +			break;
 +		default:
 +			packet_disconnect(
@@ -1916,7 +1815,7 @@
 +			    type);
 +		}
 +
-+		maj_status = PRIVSEP(ssh_gssapi_accept_ctx(ctxt, &recv_tok, 
++		maj_status = PRIVSEP(ssh_gssapi_accept_ctx(ctxt, &recv_tok,
 +		    &send_tok, &ret_flags));
 +
 +		free(recv_tok.value);
@@ -1926,7 +1825,7 @@
 +
 +		if (dh_client_pub == NULL)
 +			fatal("No client public key");
-+		
++
 +		if (maj_status & GSS_S_CONTINUE_NEEDED) {
 +			debug("Sending GSSAPI_CONTINUE");
 +			packet_start(SSH2_MSG_KEXGSS_CONTINUE);
@@ -1950,12 +1849,12 @@
 +
 +	if (!(ret_flags & GSS_C_INTEG_FLAG))
 +		fatal("Integrity flag wasn't set");
-+	
++
 +	if (!dh_pub_is_valid(dh, dh_client_pub))
 +		packet_disconnect("bad client public DH value");
 +
 +	klen = DH_size(dh);
-+	kbuf = xmalloc(klen); 
++	kbuf = xmalloc(klen);
 +	kout = DH_compute_key(kbuf, dh_client_pub, dh);
 +	if ((int)kout < 0)
 +		fatal("DH_compute_key: failed");
@@ -2033,7 +1932,7 @@
 +
 +	if (gss_kex_context == NULL)
 +		gss_kex_context = ctxt;
-+	else 
++	else
 +		ssh_gssapi_delete_ctx(&ctxt);
 +
 +	DH_free(dh);
@@ -2043,16 +1942,14 @@
 +	r = kex_send_newkeys(ssh);
 +
 +	/* If this was a rekey, then save out any delegated credentials we
-+	 * just exchanged.  */
++	 * just exchanged. */
 +	if (options.gss_store_rekey)
 +		ssh_gssapi_rekey_creds();
 +	return r;
 +}
 +#endif /* GSSAPI */
-diff --git a/monitor.c b/monitor.c
-index dbe29f1..b0896ef 100644
---- a/monitor.c
-+++ b/monitor.c
+--- a/monitor.c	2015-10-24 08:11:05.000000000 +0200
++++ b/monitor.c	2015-10-24 08:11:41.000000000 +0200
 @@ -157,6 +157,8 @@ int mm_answer_gss_setup_ctx(int, Buffer 
  int mm_answer_gss_accept_ctx(int, Buffer *);
  int mm_answer_gss_userok(int, Buffer *);
@@ -2242,10 +2139,8 @@
 +
  #endif /* GSSAPI */
  
-diff --git a/monitor.h b/monitor.h
-index 5bc41b5..7f32b0c 100644
---- a/monitor.h
-+++ b/monitor.h
+--- a/monitor.h	2015-10-24 08:11:05.000000000 +0200
++++ b/monitor.h	2015-10-24 08:11:41.000000000 +0200
 @@ -65,6 +65,9 @@ enum monitor_reqtype {
  	MONITOR_REQ_PAM_FREE_CTX = 110, MONITOR_ANS_PAM_FREE_CTX = 111,
  	MONITOR_REQ_AUDIT_EVENT = 112, MONITOR_REQ_AUDIT_COMMAND = 113,
@@ -2256,11 +2151,9 @@
  };
  
  struct mm_master;
-diff --git a/monitor_wrap.c b/monitor_wrap.c
-index 45dc169..e476f0d 100644
---- a/monitor_wrap.c
-+++ b/monitor_wrap.c
-@@ -1069,7 +1069,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss
+--- a/monitor_wrap.c	2015-10-24 08:11:05.000000000 +0200
++++ b/monitor_wrap.c	2015-10-24 08:11:41.000000000 +0200
+@@ -1068,7 +1068,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss
  }
  
  int
@@ -2269,7 +2162,7 @@
  {
  	Buffer m;
  	int authenticated = 0;
-@@ -1086,5 +1086,50 @@ mm_ssh_gssapi_userok(char *user)
+@@ -1085,5 +1085,50 @@ mm_ssh_gssapi_userok(char *user)
  	debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not ");
  	return (authenticated);
  }
@@ -2320,10 +2213,8 @@
 +
  #endif /* GSSAPI */
  
-diff --git a/monitor_wrap.h b/monitor_wrap.h
-index 18c2501..a4e9d24 100644
---- a/monitor_wrap.h
-+++ b/monitor_wrap.h
+--- a/monitor_wrap.h	2015-10-24 08:11:05.000000000 +0200
++++ b/monitor_wrap.h	2015-10-24 08:11:41.000000000 +0200
 @@ -58,8 +58,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(K
  OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
  OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *,
@@ -2336,10 +2227,8 @@
  #endif
  
  #ifdef USE_PAM
-diff --git a/readconf.c b/readconf.c
-index 7948ce1..9127e93 100644
---- a/readconf.c
-+++ b/readconf.c
+--- a/readconf.c	2015-10-24 08:11:05.000000000 +0200
++++ b/readconf.c	2015-10-24 08:11:41.000000000 +0200
 @@ -147,6 +147,8 @@ typedef enum {
  	oClearAllForwardings, oNoHostAuthenticationForLocalhost,
  	oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
@@ -2349,7 +2238,7 @@
  	oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
  	oSendEnv, oControlPath, oControlMaster, oControlPersist,
  	oHashKnownHosts,
-@@ -194,10 +196,19 @@ static struct {
+@@ -195,10 +197,19 @@ static struct {
  	{ "afstokenpassing", oUnsupported },
  #if defined(GSSAPI)
  	{ "gssapiauthentication", oGssAuthentication },
@@ -2369,7 +2258,7 @@
  #endif
  	{ "fallbacktorsh", oDeprecated },
  	{ "usersh", oDeprecated },
-@@ -898,10 +909,30 @@ parse_time:
+@@ -900,10 +911,30 @@ parse_time:
  		intptr = &options->gss_authentication;
  		goto parse_flag;
  
@@ -2413,7 +2302,7 @@
  	options->password_authentication = -1;
  	options->kbd_interactive_authentication = -1;
  	options->kbd_interactive_devices = NULL;
-@@ -1743,8 +1779,14 @@ fill_default_options(Options * options)
+@@ -1744,8 +1780,14 @@ fill_default_options(Options * options)
  		options->challenge_response_authentication = 1;
  	if (options->gss_authentication == -1)
  		options->gss_authentication = 0;
@@ -2428,10 +2317,8 @@
  	if (options->password_authentication == -1)
  		options->password_authentication = 1;
  	if (options->kbd_interactive_authentication == -1)
-diff --git a/readconf.h b/readconf.h
-index 0b9cb77..0e29889 100644
---- a/readconf.h
-+++ b/readconf.h
+--- a/readconf.h	2015-10-24 08:11:05.000000000 +0200
++++ b/readconf.h	2015-10-24 08:11:41.000000000 +0200
 @@ -45,7 +45,12 @@ typedef struct {
  	int     challenge_response_authentication;
  					/* Try S/Key or TIS, authentication. */
@@ -2445,11 +2332,9 @@
  	int     password_authentication;	/* Try password
  						 * authentication. */
  	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
-diff --git a/servconf.c b/servconf.c
-index b7f3294..cb3c831 100644
---- a/servconf.c
-+++ b/servconf.c
-@@ -115,8 +115,10 @@ initialize_server_options(ServerOptions 
+--- a/servconf.c	2015-10-24 08:11:05.000000000 +0200
++++ b/servconf.c	2015-10-24 08:11:41.000000000 +0200
+@@ -117,8 +117,10 @@ initialize_server_options(ServerOptions 
  	options->kerberos_ticket_cleanup = -1;
  	options->kerberos_get_afs_token = -1;
  	options->gss_authentication=-1;
@@ -2475,15 +2360,15 @@
  	if (options->password_authentication == -1)
  		options->password_authentication = 0;
  	if (options->kbd_interactive_authentication == -1)
-@@ -401,6 +407,7 @@ typedef enum {
- 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
+@@ -412,6 +418,7 @@ typedef enum {
+ 	sHostKeyAlgorithms,
  	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
  	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
 +	sGssKeyEx, sGssStoreRekey,
  	sAcceptEnv, sPermitTunnel,
  	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
  	sUsePrivilegeSeparation, sAllowAgentForwarding,
-@@ -474,11 +481,17 @@ static struct {
+@@ -486,11 +493,17 @@ static struct {
  	{ "gssapiauthentication", sGssAuthentication, SSHCFG_ALL },
  	{ "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL },
  	{ "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL },
@@ -2501,7 +2386,7 @@
  	{ "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL },
  	{ "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL },
  	{ "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL },
-@@ -1214,6 +1227,10 @@ process_server_config_line(ServerOptions
+@@ -1231,6 +1244,10 @@ process_server_config_line(ServerOptions
  		intptr = &options->gss_authentication;
  		goto parse_flag;
  
@@ -2512,7 +2397,7 @@
  	case sGssCleanupCreds:
  		intptr = &options->gss_cleanup_creds;
  		goto parse_flag;
-@@ -1222,6 +1239,10 @@ process_server_config_line(ServerOptions
+@@ -1239,6 +1256,10 @@ process_server_config_line(ServerOptions
  		intptr = &options->gss_strict_acceptor;
  		goto parse_flag;
  
@@ -2523,7 +2408,7 @@
  	case sPasswordAuthentication:
  		intptr = &options->password_authentication;
  		goto parse_flag;
-@@ -2229,7 +2250,10 @@ dump_config(ServerOptions *o)
+@@ -2246,7 +2267,10 @@ dump_config(ServerOptions *o)
  #endif
  #ifdef GSSAPI
  	dump_cfg_fmtint(sGssAuthentication, o->gss_authentication);
@@ -2534,11 +2419,9 @@
  #endif
  	dump_cfg_fmtint(sPasswordAuthentication, o->password_authentication);
  	dump_cfg_fmtint(sKbdInteractiveAuthentication,
-diff --git a/servconf.h b/servconf.h
-index 766db3a..f8265a8 100644
---- a/servconf.h
-+++ b/servconf.h
-@@ -117,8 +117,10 @@ typedef struct {
+--- a/servconf.h	2015-10-24 08:11:05.000000000 +0200
++++ b/servconf.h	2015-10-24 08:11:41.000000000 +0200
+@@ -118,8 +118,10 @@ typedef struct {
  	int     kerberos_get_afs_token;		/* If true, try to get AFS token if
  						 * authenticated with Kerberos. */
  	int     gss_authentication;	/* If true, permit GSSAPI authentication */
@@ -2549,10 +2432,8 @@
  	int     password_authentication;	/* If true, permit password
  						 * authentication. */
  	int     kbd_interactive_authentication;	/* If true, permit */
-diff --git a/ssh-gss.h b/ssh-gss.h
-index a99d7f0..914701b 100644
---- a/ssh-gss.h
-+++ b/ssh-gss.h
+--- a/ssh-gss.h	2015-10-24 08:11:05.000000000 +0200
++++ b/ssh-gss.h	2015-10-24 09:39:38.000000000 +0200
 @@ -1,6 +1,6 @@
  /* $OpenBSD: ssh-gss.h,v 1.11 2014/02/26 20:28:44 djm Exp $ */
  /*
@@ -2565,11 +2446,11 @@
  
  #define SSH_GSS_OIDTYPE 0x06
  
-+#define SSH2_MSG_KEXGSS_INIT                            30
-+#define SSH2_MSG_KEXGSS_CONTINUE                        31
-+#define SSH2_MSG_KEXGSS_COMPLETE                        32
-+#define SSH2_MSG_KEXGSS_HOSTKEY                         33
-+#define SSH2_MSG_KEXGSS_ERROR                           34
++#define SSH2_MSG_KEXGSS_INIT				30
++#define SSH2_MSG_KEXGSS_CONTINUE			31
++#define SSH2_MSG_KEXGSS_COMPLETE			32
++#define SSH2_MSG_KEXGSS_HOSTKEY				33
++#define SSH2_MSG_KEXGSS_ERROR				34
 +#define SSH2_MSG_KEXGSS_GROUPREQ			40
 +#define SSH2_MSG_KEXGSS_GROUP				41
 +#define KEX_GSS_GRP1_SHA1_ID				"gss-group1-sha1-"
@@ -2627,13 +2508,13 @@
 +int ssh_gssapi_credentials_updated(Gssctxt *);
  
  /* In the server */
-+typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *, 
++typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *,
 +    const char *);
 +char *ssh_gssapi_client_mechanisms(const char *, const char *);
 +char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, const char *,
 +    const char *);
 +gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int);
-+int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *, 
++int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *,
 +    const char *);
  OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
 -int ssh_gssapi_userok(char *name);
@@ -2652,10 +2533,8 @@
  #endif /* GSSAPI */
  
  #endif /* _SSH_GSS_H */
-diff --git a/ssh_config b/ssh_config
-index 03a228f..228e5ab 100644
---- a/ssh_config
-+++ b/ssh_config
+--- a/ssh_config	2015-10-24 08:11:05.000000000 +0200
++++ b/ssh_config	2015-10-24 08:11:41.000000000 +0200
 @@ -26,6 +26,8 @@
  #   HostbasedAuthentication no
  #   GSSAPIAuthentication no
@@ -2665,11 +2544,9 @@
  #   BatchMode no
  #   CheckHostIP yes
  #   AddressFamily any
-diff --git a/ssh_config.5 b/ssh_config.5
-index f9ede7a..e6649ac 100644
---- a/ssh_config.5
-+++ b/ssh_config.5
-@@ -744,11 +744,43 @@ Specifies whether user authentication ba
+--- a/ssh_config.5	2015-10-24 08:11:05.000000000 +0200
++++ b/ssh_config.5	2015-10-24 08:11:41.000000000 +0200
+@@ -749,11 +749,43 @@ Specifies whether user authentication ba
  The default is
  .Dq no .
  Note that this option applies to protocol version 2 only.
@@ -2714,10 +2591,8 @@
  .It Cm HashKnownHosts
  Indicates that
  .Xr ssh 1
-diff --git a/sshconnect2.c b/sshconnect2.c
-index 68f7f4f..7b478f1 100644
---- a/sshconnect2.c
-+++ b/sshconnect2.c
+--- a/sshconnect2.c	2015-10-24 08:11:05.000000000 +0200
++++ b/sshconnect2.c	2015-10-24 08:30:26.000000000 +0200
 @@ -161,9 +161,34 @@ ssh_kex2(char *host, struct sockaddr *ho
  	struct kex *kex;
  	int r;
@@ -2732,9 +2607,9 @@
  
 +#ifdef GSSAPI
 +	if (options.gss_keyex) {
-+		/* Add the GSSAPI mechanisms currently supported on this 
++		/* Add the GSSAPI mechanisms currently supported on this
 +		 * client to the key exchange algorithm proposal */
-+		orig = myproposal[PROPOSAL_KEX_ALGS];
++		orig = options.kex_algorithms;
 +
 +		if (options.gss_trust_dns)
 +			gss_host = (char *)get_canonical_hostname(1);
@@ -2744,25 +2619,25 @@
 +		gss = ssh_gssapi_client_mechanisms(gss_host, options.gss_client_identity);
 +		if (gss) {
 +			debug("Offering GSSAPI proposal: %s", gss);
-+			xasprintf(&myproposal[PROPOSAL_KEX_ALGS],
++			xasprintf(&options.kex_algorithms,
 +			    "%s,%s", gss, orig);
 +		}
 +	}
 +#endif
 +
- 	if (options.ciphers == (char *)-1) {
- 		logit("No valid ciphers for protocol version 2 given, using defaults.");
- 		options.ciphers = NULL;
-@@ -201,6 +226,17 @@ ssh_kex2(char *host, struct sockaddr *ho
  	myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
- 	    myproposal[PROPOSAL_KEX_ALGS]);
+ 	    options.kex_algorithms);
+ 	myproposal[PROPOSAL_ENC_ALGS_CTOS] =
+@@ -194,6 +219,17 @@ ssh_kex2(char *host, struct sockaddr *ho
+ 		    order_hostkeyalgs(host, hostaddr, port));
+ 	}
  
 +#ifdef GSSAPI
 +	/* If we've got GSSAPI algorithms, then we also support the
 +	 * 'null' hostkey, as a last resort */
 +	if (options.gss_keyex && gss) {
 +		orig = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS];
-+		xasprintf(&myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS], 
++		xasprintf(&myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS],
 +		    "%s,null", orig);
 +		free(gss);
 +	}
@@ -2771,7 +2646,7 @@
  	if (options.rekey_limit || options.rekey_interval)
  		packet_set_rekey_limits((u_int32_t)options.rekey_limit,
  		    (time_t)options.rekey_interval);
-@@ -219,10 +255,30 @@ ssh_kex2(char *host, struct sockaddr *ho
+@@ -212,10 +248,30 @@ ssh_kex2(char *host, struct sockaddr *ho
  # endif
  #endif
  	kex->kex[KEX_C25519_SHA256] = kexc25519_client;
@@ -2802,7 +2677,7 @@
  	dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
  
  	if (options.use_roaming && !kex->roaming) {
-@@ -314,6 +370,7 @@ int	input_gssapi_token(int type, u_int32
+@@ -307,6 +363,7 @@ int	input_gssapi_token(int type, u_int32
  int	input_gssapi_hash(int type, u_int32_t, void *);
  int	input_gssapi_error(int, u_int32_t, void *);
  int	input_gssapi_errtok(int, u_int32_t, void *);
@@ -2810,7 +2685,7 @@
  #endif
  
  void	userauth(Authctxt *, char *);
-@@ -329,6 +386,11 @@ static char *authmethods_get(void);
+@@ -322,6 +379,11 @@ static char *authmethods_get(void);
  
  Authmethod authmethods[] = {
  #ifdef GSSAPI
@@ -2822,7 +2697,7 @@
  	{"gssapi-with-mic",
  		userauth_gssapi,
  		NULL,
-@@ -635,19 +697,31 @@ userauth_gssapi(Authctxt *authctxt)
+@@ -628,19 +690,31 @@ userauth_gssapi(Authctxt *authctxt)
  	static u_int mech = 0;
  	OM_uint32 min;
  	int ok = 0;
@@ -2856,7 +2731,7 @@
  			ok = 1; /* Mechanism works */
  		} else {
  			mech++;
-@@ -744,8 +818,8 @@ input_gssapi_response(int type, u_int32_
+@@ -737,8 +811,8 @@ input_gssapi_response(int type, u_int32_
  {
  	Authctxt *authctxt = ctxt;
  	Gssctxt *gssctxt;
@@ -2867,7 +2742,7 @@
  
  	if (authctxt == NULL)
  		fatal("input_gssapi_response: no authentication context");
-@@ -858,6 +932,48 @@ input_gssapi_error(int type, u_int32_t p
+@@ -851,6 +925,48 @@ input_gssapi_error(int type, u_int32_t p
  	free(lang);
  	return 0;
  }
@@ -2916,11 +2791,9 @@
  #endif /* GSSAPI */
  
  int
-diff --git a/sshd.c b/sshd.c
-index 481d001..e6706a8 100644
---- a/sshd.c
-+++ b/sshd.c
-@@ -125,6 +125,10 @@
+--- a/sshd.c	2015-10-24 08:11:05.000000000 +0200
++++ b/sshd.c	2015-10-24 09:36:22.000000000 +0200
+@@ -126,6 +126,10 @@
  #include "version.h"
  #include "ssherr.h"
  
@@ -2931,7 +2804,19 @@
  #ifndef O_NOCTTY
  #define O_NOCTTY	0
  #endif
-@@ -1830,10 +1834,13 @@ main(int ac, char **av)
+@@ -969,8 +973,9 @@ notify_hostkeys(struct ssh *ssh)
+ 	}
+ 	debug3("%s: sent %d hostkeys", __func__, nkeys);
+ 	if (nkeys == 0)
+-		fatal("%s: no hostkeys", __func__);
+-	packet_send();
++		debug3("%s: no hostkeys", __func__);
++	else
++		packet_send();
+ 	sshbuf_free(buf);
+ }
+ 
+@@ -1834,10 +1839,13 @@ main(int ac, char **av)
  		logit("Disabling protocol version 1. Could not load host key");
  		options.protocol &= ~SSH_PROTO_1;
  	}
@@ -2945,7 +2830,7 @@
  	if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) {
  		logit("sshd: no hostkeys available -- exiting.");
  		exit(1);
-@@ -2148,6 +2155,60 @@ main(int ac, char **av)
+@@ -2152,6 +2160,60 @@ main(int ac, char **av)
  	    remote_ip, remote_port, laddr,  get_local_port());
  	free(laddr);
  
@@ -3006,7 +2891,7 @@
  	/*
  	 * We don't want to listen forever unless the other side
  	 * successfully authenticates itself.  So we set up an alarm which is
-@@ -2577,6 +2638,48 @@ do_ssh2_kex(void)
+@@ -2570,6 +2632,48 @@ do_ssh2_kex(void)
  	myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(
  	    list_hostkey_types());
  
@@ -3037,10 +2922,10 @@
 +	else if (orig)
 +		newstr = orig;
 +
-+	/* 
++	/*
 +	 * If we've got GSSAPI mechanisms, then we've got the 'null' host
 +	 * key alg, but we can't tell people about it unless its the only
-+  	 * host key algorithm we support
++	 * host key algorithm we support
 +	 */
 +	if (gss && (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS])) == 0)
 +		myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "null";
@@ -3055,7 +2940,7 @@
  	/* start key exchange */
  	if ((r = kex_setup(active_state, myproposal)) != 0)
  		fatal("kex_setup: %s", ssh_err(r));
-@@ -2591,6 +2694,13 @@ do_ssh2_kex(void)
+@@ -2584,6 +2688,13 @@ do_ssh2_kex(void)
  # endif
  #endif
  	kex->kex[KEX_C25519_SHA256] = kexc25519_server;
@@ -3069,10 +2954,8 @@
  	kex->server = 1;
  	kex->client_version_string=client_version_string;
  	kex->server_version_string=server_version_string;
-diff --git a/sshd_config b/sshd_config
-index e9045bc..d9b8594 100644
---- a/sshd_config
-+++ b/sshd_config
+--- a/sshd_config	2015-10-24 08:11:05.000000000 +0200
++++ b/sshd_config	2015-10-24 08:11:41.000000000 +0200
 @@ -85,6 +85,8 @@ AuthorizedKeysFile	.ssh/authorized_keys
  # GSSAPI options
  #GSSAPIAuthentication no
@@ -3082,11 +2965,9 @@
  
  # Set this to 'yes' to enable PAM authentication, account processing,
  # and session processing. If this is enabled, PAM authentication will
-diff --git a/sshd_config.5 b/sshd_config.5
-index fd44abe..c8b43da 100644
---- a/sshd_config.5
-+++ b/sshd_config.5
-@@ -616,6 +616,12 @@ Specifies whether user authentication ba
+--- a/sshd_config.5	2015-10-24 08:11:05.000000000 +0200
++++ b/sshd_config.5	2015-10-24 08:11:42.000000000 +0200
+@@ -621,6 +621,12 @@ Specifies whether user authentication ba
  The default is
  .Dq no .
  Note that this option applies to protocol version 2 only.
@@ -3099,7 +2980,7 @@
  .It Cm GSSAPICleanupCredentials
  Specifies whether to automatically destroy the user's credentials cache
  on logout.
-@@ -637,6 +643,11 @@ machine's default store.
+@@ -642,6 +648,11 @@ machine's default store.
  This facility is provided to assist with operation on multi homed machines.
  The default is
  .Dq yes .
@@ -3111,19 +2992,17 @@
  .It Cm HostbasedAcceptedKeyTypes
  Specifies the key types that will be accepted for hostbased authentication
  as a comma-separated pattern list.
-diff --git a/sshkey.c b/sshkey.c
-index fdd0c8a..1a96eae 100644
---- a/sshkey.c
-+++ b/sshkey.c
-@@ -116,6 +116,7 @@ static const struct keytype keytypes[] =
- 	{ "ssh-dss-cert-v00 at openssh.com", "DSA-CERT-V00",
- 	    KEY_DSA_CERT_V00, 0, 1 },
+--- a/sshkey.c	2015-10-24 08:11:05.000000000 +0200
++++ b/sshkey.c	2015-10-24 08:11:42.000000000 +0200
+@@ -112,6 +112,7 @@ static const struct keytype keytypes[] =
+ #  endif /* OPENSSL_HAS_NISTP521 */
+ # endif /* OPENSSL_HAS_ECC */
  #endif /* WITH_OPENSSL */
 +	{ "null", "null", KEY_NULL, 0, 0 },
  	{ NULL, NULL, -1, -1, 0 }
  };
  
-@@ -204,7 +205,7 @@ key_alg_list(int certs_only, int plain_o
+@@ -200,7 +201,7 @@ key_alg_list(int certs_only, int plain_o
  	const struct keytype *kt;
  
  	for (kt = keytypes; kt->type != -1; kt++) {
@@ -3132,15 +3011,23 @@
  			continue;
  		if ((certs_only && !kt->cert) || (plain_only && kt->cert))
  			continue;
-diff --git a/sshkey.h b/sshkey.h
-index 450b30c..b573e7f 100644
---- a/sshkey.h
-+++ b/sshkey.h
-@@ -64,6 +64,7 @@ enum sshkey_types {
+--- a/sshkey.h	2015-10-24 08:11:42.000000000 +0200
++++ b/sshkey.h	2015-10-24 08:32:46.000000000 +0200
+@@ -62,6 +62,7 @@ enum sshkey_types {
+ 	KEY_DSA_CERT,
+ 	KEY_ECDSA_CERT,
  	KEY_ED25519_CERT,
- 	KEY_RSA_CERT_V00,
- 	KEY_DSA_CERT_V00,
 +	KEY_NULL,
  	KEY_UNSPEC
  };
  
+--- a/auth.c	2015-10-24 07:49:14.000000000 +0200
++++ b/auth.c	2015-10-24 09:42:00.000000000 +0200
+@@ -354,6 +354,7 @@ auth_root_allowed(const char *method)
+ 	case PERMIT_NO_PASSWD:
+ 		if (strcmp(method, "publickey") == 0 ||
+ 		    strcmp(method, "hostbased") == 0 ||
++		    strcmp(method, "gssapi-keyex") == 0 ||
+ 		    strcmp(method, "gssapi-with-mic") == 0)
+ 			return 1;
+ 		break;

Deleted: trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff
===================================================================
--- trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,1290 +0,0 @@
---- a/HPN-README	1970-01-01 01:00:00.000000000 +0100
-+++ b/HPN-README	2015-07-02 22:09:03.000000000 +0200
-@@ -0,0 +1,129 @@
-+Notes:
-+
-+MULTI-THREADED CIPHER:
-+The AES cipher in CTR mode has been multithreaded (MTR-AES-CTR). This will allow ssh installations
-+on hosts with multiple cores to use more than one processing core during encryption. 
-+Tests have show significant throughput performance increases when using MTR-AES-CTR up 
-+to and including a full gigabit per second on quad core systems. It should be possible to 
-+achieve full line rate on dual core systems but OS and data management overhead makes this
-+more difficult to achieve. The cipher stream from MTR-AES-CTR is entirely compatible with single 
-+thread AES-CTR (ST-AES-CTR) implementations and should be 100% backward compatible. Optimal 
-+performance requires the MTR-AES-CTR mode be enabled on both ends of the connection. 
-+The MTR-AES-CTR replaces ST-AES-CTR and is used in exactly the same way with the same
-+nomenclature. 
-+Use examples: 	ssh -caes128-ctr you at host.com
-+		scp -oCipher=aes256-ctr file you at host.com:~/file
-+
-+NONE CIPHER:
-+To use the NONE option you must have the NoneEnabled switch set on the server and
-+you *must* have *both* NoneEnabled and NoneSwitch set to yes on the client. The NONE
-+feature works with ALL ssh subsystems (as far as we can tell) *AS LONG AS* a tty is not 
-+spawned. If a user uses the -T switch to prevent a tty being created the NONE cipher will
-+be disabled. 
-+
-+The performance increase will only be as good as the network and TCP stack tuning
-+on the reciever side of the connection allows. As a rule of thumb a user will need 
-+at least 10Mb/s connection with a 100ms RTT to see a doubling of performance. The
-+HPN-SSH home page describes this in greater detail. 
-+
-+http://www.psc.edu/networking/projects/hpn-ssh
-+
-+BUFFER SIZES:
-+
-+If HPN is disabled the receive buffer size will be set to the 
-+OpenSSH default of 64K.
-+
-+If an HPN system connects to a nonHPN system the receive buffer will
-+be set to the HPNBufferSize value. The default is 2MB but user adjustable.
-+
-+If an HPN to HPN connection is established a number of different things might
-+happen based on the user options and conditions. 
-+
-+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set 
-+HPN Buffer Size = up to 64MB 
-+This is the default state. The HPN buffer size will grow to a maximum of 64MB 
-+as the TCP receive buffer grows. The maximum HPN Buffer size of 64MB is 
-+geared towards 10GigE transcontinental connections. 
-+
-+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set
-+HPN Buffer Size = TCP receive buffer value. 
-+Users on non-autotuning systesm should disable TCPRcvBufPoll in the 
-+ssh_cofig and sshd_config
-+
-+Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set
-+HPN Buffer Size = minmum of TCP receive buffer and HPNBufferSize. 
-+This would be the system defined TCP receive buffer (RWIN).
-+
-+Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf SET
-+HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. 
-+Generally there is no need to set both.
-+
-+Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set
-+HPN Buffer Size = grows to HPNBufferSize
-+The buffer will grow up to the maximum size specified here. 
-+
-+Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf SET
-+HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. 
-+Generally there is no need to set both of these, especially on autotuning 
-+systems. However, if the users wishes to override the autotuning this would be 
-+one way to do it.
-+
-+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf SET
-+HPN Buffer Size = TCPRcvBuf. 
-+This will override autotuning and set the TCP recieve buffer to the user defined 
-+value.
-+
-+
-+HPN Specific Configuration options
-+
-+TcpRcvBuf=[int]KB client
-+      set the TCP socket receive buffer to n Kilobytes. It can be set up to the 
-+maximum socket size allowed by the system. This is useful in situations where 
-+the tcp receive window is set low but the maximum buffer size is set 
-+higher (as is typical). This works on a per TCP connection basis. You can also 
-+use this to artifically limit the transfer rate of the connection. In these 
-+cases the throughput will be no more than n/RTT. The minimum buffer size is 1KB. 
-+Default is the current system wide tcp receive buffer size.
-+
-+TcpRcvBufPoll=[yes/no] client/server
-+      enable of disable the polling of the tcp receive buffer through the life 
-+of the connection. You would want to make sure that this option is enabled 
-+for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista) 
-+default is yes.
-+
-+NoneEnabled=[yes/no] client/server
-+      enable or disable the use of the None cipher. Care must always be used 
-+when enabling this as it will allow users to send data in the clear. However, 
-+it is important to note that authentication information remains encrypted 
-+even if this option is enabled. Set to no by default.
-+
-+NoneSwitch=[yes/no] client
-+     Switch the encryption cipher being used to the None cipher after
-+authentication takes place. NoneEnabled must be enabled on both the client
-+and server side of the connection. When the connection switches to the NONE
-+cipher a warning is sent to STDERR. The connection attempt will fail with an
-+error if a client requests a NoneSwitch from the server that does not explicitly
-+have NoneEnabled set to yes. Note: The NONE cipher cannot be used in
-+interactive (shell) sessions and it will fail silently. Set to no by default.
-+
-+HPNDisabled=[yes/no] client/server
-+     In some situations, such as transfers on a local area network, the impact 
-+of the HPN code produces a net decrease in performance. In these cases it is 
-+helpful to disable the HPN functionality. By default HPNDisabled is set to no. 
-+
-+HPNBufferSize=[int]KB client/server
-+     This is the default buffer size the HPN functionality uses when interacting
-+with nonHPN SSH installations. Conceptually this is similar to the TcpRcvBuf
-+option as applied to the internal SSH flow control. This value can range from 
-+1KB to 64MB (1-65536). Use of oversized or undersized buffers can cause performance
-+problems depending on the length of the network path. The default size of this buffer
-+is 2MB.
-+
-+
-+Credits: This patch was conceived, designed, and led by Chris Rapier (rapier at psc.edu)
-+         The majority of the actual coding for versions up to HPN12v1 was performed
-+         by Michael Stevens (mstevens at andrew.cmu.edu). The MT-AES-CTR cipher was 
-+	 implemented by Ben Bennet (ben at psc.edu) and improved by Mike Tasota 
-+	 (tasota at gmail.com) an NSF REU grant recipient for 2013. 
-+	 This work was financed, in part, by Cisco System, Inc., the National 
-+         Library of Medicine, and the National Science Foundation. 
---- a/channels.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/channels.c	2015-07-02 22:09:03.000000000 +0200
-@@ -186,6 +186,12 @@ static void port_open_helper(Channel *c,
- static int connect_next(struct channel_connect *);
- static void channel_connect_ctx_free(struct channel_connect *);
- 
-+
-+#ifdef HPN_ENABLED
-+static int hpn_disabled = 0;
-+static int hpn_buffer_size = 2 * 1024 * 1024;
-+#endif
-+
- /* -- channel core */
- 
- Channel *
-@@ -336,6 +342,9 @@ channel_new(char *ctype, int type, int r
- 	c->local_window_max = window;
- 	c->local_consumed = 0;
- 	c->local_maxpacket = maxpack;
-+#ifdef HPN_ENABLED
-+	c->dynamic_window = 0;
-+#endif
- 	c->remote_id = -1;
- 	c->remote_name = xstrdup(remote_name);
- 	c->remote_window = 0;
-@@ -840,11 +849,41 @@ channel_pre_open_13(Channel *c, fd_set *
- 		FD_SET(c->sock, writeset);
- }
- 
-+#ifdef HPN_ENABLED
-+static u_int
-+channel_tcpwinsz(void)
-+{
-+	u_int32_t tcpwinsz = 0;
-+	socklen_t optsz = sizeof(tcpwinsz);
-+	int ret = -1;
-+
-+	/* if we aren't on a socket return 128KB */
-+	if (!packet_connection_is_on_socket())
-+		return (128*1024);
-+	ret = getsockopt(packet_get_connection_in(),
-+	    SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
-+	/* return no more than SSHBUF_SIZE_MAX */
-+	if (ret == 0 && tcpwinsz > SSHBUF_SIZE_MAX)
-+		tcpwinsz = SSHBUF_SIZE_MAX;
-+	debug2("tcpwinsz: %d for connection: %d", tcpwinsz,
-+	    packet_get_connection_in());
-+	return (tcpwinsz);
-+}
-+#endif
-+
- static void
- channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset)
- {
- 	u_int limit = compat20 ? c->remote_window : packet_get_maxsize();
- 
-+#ifdef HPN_ENABLED
-+	/* check buffer limits */
-+	if (!c->tcpwinsz || c->dynamic_window > 0)
-+		c->tcpwinsz = channel_tcpwinsz();
-+
-+	limit = MIN(limit, 2 * c->tcpwinsz);
-+#endif
-+
- 	if (c->istate == CHAN_INPUT_OPEN &&
- 	    limit > 0 &&
- 	    buffer_len(&c->input) < limit &&
-@@ -1862,6 +1901,20 @@ channel_check_window(Channel *c)
- 	    c->local_maxpacket*3) ||
- 	    c->local_window < c->local_window_max/2) &&
- 	    c->local_consumed > 0) {
-+#ifdef HPN_ENABLED
-+		/* adjust max window size if we are in a dynamic environment */
-+		if (c->dynamic_window && (c->tcpwinsz > c->local_window_max)) {
-+			u_int addition = 0;
-+
-+			/*
-+			 * grow the window somewhat aggressively to maintain
-+			 * pressure
-+			 */
-+			addition = 1.5*(c->tcpwinsz - c->local_window_max);
-+			c->local_window_max += addition;
-+			c->local_consumed += addition;
-+		}
-+#endif
- 		packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
- 		packet_put_int(c->remote_id);
- 		packet_put_int(c->local_consumed);
-@@ -2813,6 +2866,17 @@ channel_fwd_bind_addr(const char *listen
- 	return addr;
- }
- 
-+#ifdef HPN_ENABLED
-+void
-+channel_set_hpn(int external_hpn_disabled, int external_hpn_buffer_size)
-+{
-+	hpn_disabled = external_hpn_disabled;
-+	hpn_buffer_size = external_hpn_buffer_size;
-+	debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled,
-+	    hpn_buffer_size);
-+}
-+#endif
-+
- static int
- channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd,
-     int *allocated_listen_port, struct ForwardOptions *fwd_opts)
-@@ -2941,6 +3005,17 @@ channel_setup_fwd_listener_tcpip(int typ
- 		}
- 
- 		/* Allocate a channel number for the socket. */
-+#ifdef HPN_ENABLED
-+		/*
-+		 * explicitly test for hpn disabled option. if true use smaller
-+		 * window size.
-+		 */
-+		if (!hpn_disabled)
-+			c = channel_new("port listener", type, sock, sock, -1,
-+			    hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
-+			    0, "port listener", 1);
-+		else
-+#endif
- 		c = channel_new("port listener", type, sock, sock, -1,
- 		    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
- 		    0, "port listener", 1);
-@@ -3975,6 +4050,14 @@ x11_create_display_inet(int x11_display_
- 	*chanids = xcalloc(num_socks + 1, sizeof(**chanids));
- 	for (n = 0; n < num_socks; n++) {
- 		sock = socks[n];
-+#ifdef HPN_ENABLED
-+		if (!hpn_disabled)
-+			nc = channel_new("x11 listener",
-+			    SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
-+			    hpn_buffer_size, CHAN_X11_PACKET_DEFAULT,
-+			    0, "X11 inet listener", 1);
-+		else
-+#endif
- 		nc = channel_new("x11 listener",
- 		    SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
- 		    CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
---- a/channels.h	2015-07-02 22:08:42.000000000 +0200
-+++ b/channels.h	2015-07-02 22:09:03.000000000 +0200
-@@ -136,6 +136,10 @@ struct Channel {
- 	u_int	local_maxpacket;
- 	int     extended_usage;
- 	int	single_connection;
-+#ifdef HPN_ENABLED
-+	int	dynamic_window;
-+	u_int	tcpwinsz;
-+#endif
- 
- 	char   *ctype;		/* type */
- 
-@@ -312,4 +316,9 @@ void	 chan_rcvd_ieof(Channel *);
- void	 chan_write_failed(Channel *);
- void	 chan_obuf_empty(Channel *);
- 
-+#ifdef HPN_ENABLED
-+/* hpn handler */
-+void     channel_set_hpn(int, int);
-+#endif
-+
- #endif
---- a/cipher.c	2015-07-02 22:08:42.000000000 +0200
-+++ b/cipher.c	2015-07-02 22:09:03.000000000 +0200
-@@ -244,7 +244,13 @@ ciphers_valid(const char *names)
- 	for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
- 	    (p = strsep(&cp, CIPHER_SEP))) {
- 		c = cipher_by_name(p);
--		if (c == NULL || c->number != SSH_CIPHER_SSH2) {
-+		if (c == NULL || (c->number != SSH_CIPHER_SSH2 &&
-+#ifdef NONE_CIPHER_ENABLED
-+				  c->number != SSH_CIPHER_NONE
-+#else
-+				  1
-+#endif
-+				  )) {
- 			free(cipher_list);
- 			return 0;
- 		}
-@@ -545,6 +551,9 @@ cipher_get_keyiv(struct sshcipher_ctx *c
- 
- 	switch (c->number) {
- #ifdef WITH_OPENSSL
-+#ifdef NONE_CIPHER_ENABLED
-+	case SSH_CIPHER_NONE:
-+#endif
- 	case SSH_CIPHER_SSH2:
- 	case SSH_CIPHER_DES:
- 	case SSH_CIPHER_BLOWFISH:
-@@ -593,6 +602,9 @@ cipher_set_keyiv(struct sshcipher_ctx *c
- 
- 	switch (c->number) {
- #ifdef WITH_OPENSSL
-+#ifdef NONE_CIPHER_ENABLED
-+	case SSH_CIPHER_NONE:
-+#endif
- 	case SSH_CIPHER_SSH2:
- 	case SSH_CIPHER_DES:
- 	case SSH_CIPHER_BLOWFISH:
---- a/clientloop.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/clientloop.c	2015-07-02 22:09:03.000000000 +0200
-@@ -1956,6 +1956,15 @@ client_request_x11(const char *request_t
- 	sock = x11_connect_display();
- 	if (sock < 0)
- 		return NULL;
-+#ifdef HPN_ENABLED
-+	/* again is this really necessary for X11? */
-+	if (!options.hpn_disabled)
-+		c = channel_new("x11",
-+		    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
-+		    options.hpn_buffer_size,
-+		    CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
-+	else
-+#endif
- 	c = channel_new("x11",
- 	    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
- 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
-@@ -1981,6 +1990,14 @@ client_request_agent(const char *request
- 			    __func__, ssh_err(r));
- 		return NULL;
- 	}
-+#ifdef HPN_ENABLED
-+	if (!options.hpn_disabled)
-+		c = channel_new("authentication agent connection",
-+		    SSH_CHANNEL_OPEN, sock, sock, -1,
-+		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0,
-+		    "authentication agent connection", 1);
-+	else
-+#endif
- 	c = channel_new("authentication agent connection",
- 	    SSH_CHANNEL_OPEN, sock, sock, -1,
- 	    CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0,
-@@ -2011,6 +2028,12 @@ client_request_tun_fwd(int tun_mode, int
- 		return -1;
- 	}
- 
-+#ifdef HPN_ENABLED
-+	if (!options.hpn_disabled)
-+		c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
-+		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
-+	else
-+#endif
- 	c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
- 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
- 	c->datagram = 1;
---- a/compat.c	2015-07-02 22:08:42.000000000 +0200
-+++ b/compat.c	2015-07-02 22:09:03.000000000 +0200
-@@ -197,6 +197,14 @@ compat_datafellows(const char *version)
- 			debug("match: %s pat %s compat 0x%08x",
- 			    version, check[i].pat, check[i].bugs);
- 			datafellows = check[i].bugs;	/* XXX for now */
-+#ifdef HPN_ENABLED
-+			/* Check to see if the remote side is OpenSSH and not HPN */
-+			if (strstr(version,"OpenSSH") != NULL &&
-+			    strstr(version,"hpn") == NULL) {
-+				datafellows |= SSH_BUG_LARGEWINDOW;
-+				debug("Remote is NON-HPN aware");
-+			}
-+#endif
- 			return check[i].bugs;
- 		}
- 	}
---- a/compat.h	2015-07-02 22:08:42.000000000 +0200
-+++ b/compat.h	2015-07-02 22:09:58.000000000 +0200
-@@ -62,6 +62,9 @@
- #define SSH_BUG_CURVE25519PAD	0x10000000
- #define SSH_BUG_HOSTKEYS	0x20000000
- #define SSH_BUG_DHGEX_LARGE	0x40000000
-+#ifdef HPN_ENABLED
-+#define SSH_BUG_LARGEWINDOW     0x50000000
-+#endif
- 
- void     enable_compat13(void);
- void     enable_compat20(void);
---- a/configure.ac	2015-07-02 22:08:42.000000000 +0200
-+++ b/configure.ac	2015-07-02 22:09:03.000000000 +0200
-@@ -4246,6 +4246,25 @@ AC_ARG_WITH([maildir],
-     ]
- ) # maildir
- 
-+#check whether user wants HPN support
-+HPN_MSG="no"
-+AC_ARG_WITH(hpn,
-+	[  --with-hpn             Enable HPN support],
-+	[ if test "x$withval" != "xno" ; then
-+		AC_DEFINE(HPN_ENABLED,1,[Define if you want HPN support.])
-+		HPN_MSG="yes"
-+	fi ]
-+)
-+#check whether user wants NONECIPHER support
-+NONECIPHER_MSG="no"
-+AC_ARG_WITH(nonecipher,
-+	[  --with-nonecipher             Enable NONECIPHER support],
-+	[ if test "x$withval" != "xno" ; then
-+		AC_DEFINE(NONE_CIPHER_ENABLED,1,[Define if you want NONECIPHER support.])
-+		NONECIPHER_MSG="yes"
-+	fi ]
-+)
-+
- if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
- 	AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
- 	disable_ptmx_check=yes
-@@ -4913,6 +4932,8 @@ echo "           Translate v4 in v6 hack
- echo "                  BSD Auth support: $BSD_AUTH_MSG"
- echo "              Random number source: $RAND_MSG"
- echo "             Privsep sandbox style: $SANDBOX_STYLE"
-+echo "                       HPN support: $HPN_MSG"
-+echo "                NONECIPHER support: $NONECIPHER_MSG"
- 
- echo ""
- 
---- a/kex.c	2015-07-02 22:08:42.000000000 +0200
-+++ b/kex.c	2015-07-02 22:09:03.000000000 +0200
-@@ -589,6 +589,13 @@ kex_choose_conf(struct ssh *ssh)
- 	int nenc, nmac, ncomp;
- 	u_int mode, ctos, need, dh_need, authlen;
- 	int r, first_kex_follows;
-+#ifdef NONE_CIPHER_ENABLED
-+	/* XXX: Could this move into the lower block? */
-+	int auth_flag;
-+
-+	auth_flag = ssh_packet_authentication_state(ssh);
-+	debug ("AUTH STATE IS %d", auth_flag);
-+#endif
- 
- 	if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0 ||
- 	    (r = kex_buf2prop(kex->peer, &first_kex_follows, &peer)) != 0)
-@@ -637,6 +644,17 @@ kex_choose_conf(struct ssh *ssh)
- 		if ((r = choose_comp(&newkeys->comp, cprop[ncomp],
- 		    sprop[ncomp])) != 0)
- 			goto out;
-+#ifdef NONE_CIPHER_ENABLED
-+		debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name);
-+		if (strcmp(newkeys->enc.name, "none") == 0) {
-+			debug("Requesting NONE. Authflag is %d", auth_flag);
-+			if (auth_flag == 1) {
-+				debug("None requested post authentication.");
-+			} else {
-+				fatal("Pre-authentication none cipher requests are not allowed.");
-+			}
-+		}
-+#endif
- 		debug("kex: %s %s %s %s",
- 		    ctos ? "client->server" : "server->client",
- 		    newkeys->enc.name,
---- a/myproposal.h	2015-07-02 22:08:42.000000000 +0200
-+++ b/myproposal.h	2015-07-02 22:09:03.000000000 +0200
-@@ -174,6 +174,10 @@
- #define	KEX_DEFAULT_COMP	"none,zlib at openssh.com,zlib"
- #define	KEX_DEFAULT_LANG	""
- 
-+#ifdef NONE_CIPHER_ENABLED
-+#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT ",none"
-+#endif
-+
- #define KEX_CLIENT \
- 	KEX_CLIENT_KEX, \
- 	KEX_DEFAULT_PK_ALG, \
---- a/packet.c	2015-07-02 22:08:42.000000000 +0200
-+++ b/packet.c	2015-07-02 22:09:03.000000000 +0200
-@@ -2217,6 +2217,24 @@ ssh_packet_send_ignore(struct ssh *ssh, 
- 	}
- }
- 
-+#ifdef NONE_CIPHER_ENABLED
-+/* this supports the forced rekeying required for the NONE cipher */
-+int rekey_requested = 0;
-+void
-+packet_request_rekeying(void)
-+{
-+	rekey_requested = 1;
-+}
-+
-+int
-+ssh_packet_authentication_state(struct ssh *ssh)
-+{
-+	struct session_state *state = ssh->state;
-+
-+	return(state->after_authentication);
-+}
-+#endif
-+
- #define MAX_PACKETS	(1U<<31)
- int
- ssh_packet_need_rekeying(struct ssh *ssh)
-@@ -2225,6 +2243,12 @@ ssh_packet_need_rekeying(struct ssh *ssh
- 
- 	if (ssh->compat & SSH_BUG_NOREKEY)
- 		return 0;
-+#ifdef NONE_CIPHER_ENABLED
-+        if (rekey_requested == 1) {
-+               rekey_requested = 0;
-+               return 1;
-+        }
-+#endif
- 	return
- 	    (state->p_send.packets > MAX_PACKETS) ||
- 	    (state->p_read.packets > MAX_PACKETS) ||
---- a/packet.h	2015-07-02 22:08:42.000000000 +0200
-+++ b/packet.h	2015-07-02 22:09:03.000000000 +0200
-@@ -188,6 +188,11 @@ int	sshpkt_get_bignum2(struct ssh *ssh, 
- int	sshpkt_get_end(struct ssh *ssh);
- const u_char	*sshpkt_ptr(struct ssh *, size_t *lenp);
- 
-+#ifdef NONE_CIPHER_ENABLED
-+void  packet_request_rekeying(void);
-+int   ssh_packet_authentication_state(struct ssh *ssh);
-+#endif
-+
- /* OLD API */
- extern struct ssh *active_state;
- #include "opacket.h"
---- a/readconf.c	2015-07-02 22:08:42.000000000 +0200
-+++ b/readconf.c	2015-07-02 22:09:03.000000000 +0200
-@@ -153,6 +153,12 @@ typedef enum {
- 	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
- 	oVisualHostKey, oUseRoaming,
- 	oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
-+#ifdef HPN_ENABLED
-+	oHPNDisabled, oHPNBufferSize, oTcpRcvBufPoll, oTcpRcvBuf,
-+#endif
-+#ifdef NONE_CIPHER_ENABLED
-+	oNoneSwitch, oNoneEnabled, 
-+#endif
- 	oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
- 	oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
- 	oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
-@@ -275,6 +281,16 @@ static struct {
- 	{ "fingerprinthash", oFingerprintHash },
- 	{ "updatehostkeys", oUpdateHostkeys },
- 	{ "hostbasedkeytypes", oHostbasedKeyTypes },
-+#ifdef NONE_CIPHER_ENABLED
-+	{ "noneenabled", oNoneEnabled },
-+	{ "noneswitch", oNoneSwitch },
-+#endif
-+#ifdef HPN_ENABLED
-+	{ "tcprcvbufpoll", oTcpRcvBufPoll },
-+	{ "tcprcvbuf", oTcpRcvBuf },
-+	{ "hpndisabled", oHPNDisabled },
-+	{ "hpnbuffersize", oHPNBufferSize },
-+#endif
- 	{ "ignoreunknown", oIgnoreUnknown },
- 
- 	{ NULL, oBadOption }
-@@ -904,6 +920,44 @@ parse_time:
- 		intptr = &options->check_host_ip;
- 		goto parse_flag;
- 
-+#ifdef HPN_ENABLED
-+	case oHPNDisabled:
-+		intptr = &options->hpn_disabled;
-+		goto parse_flag;
-+
-+	case oHPNBufferSize:
-+		intptr = &options->hpn_buffer_size;
-+		goto parse_int;
-+
-+	case oTcpRcvBufPoll:
-+		intptr = &options->tcp_rcv_buf_poll;
-+		goto parse_flag;
-+
-+	case oTcpRcvBuf:
-+		intptr = &options->tcp_rcv_buf;
-+		goto parse_int;
-+#endif
-+
-+#ifdef NONE_CIPHER_ENABLED
-+        case oNoneEnabled:
-+               	intptr = &options->none_enabled;
-+               	goto parse_flag;
-+ 
-+       	/* we check to see if the command comes from the */
-+       	/* command line or not. If it does then enable it */
-+       	/* otherwise fail. NONE should never be a default configuration */
-+       	case oNoneSwitch:
-+               	if(strcmp(filename,"command-line") == 0) {
-+                       	intptr = &options->none_switch;
-+                       	goto parse_flag;
-+               	} else {
-+                       	error("NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line", filename);
-+                       	error("Continuing...");
-+                       	debug("NoneSwitch directive found in %.200s.", filename);
-+                       	return 0;
-+               	}
-+#endif
-+
- 	case oVerifyHostKeyDNS:
- 		intptr = &options->verify_host_key_dns;
- 		multistate_ptr = multistate_yesnoask;
-@@ -1665,6 +1719,16 @@ initialize_options(Options * options)
- 	options->ip_qos_interactive = -1;
- 	options->ip_qos_bulk = -1;
- 	options->request_tty = -1;
-+#ifdef NONE_CIPHER_ENABLED
-+	options->none_switch = -1;
-+	options->none_enabled = -1;
-+#endif
-+#ifdef HPN_ENABLED
-+	options->hpn_disabled = -1;
-+	options->hpn_buffer_size = -1;
-+	options->tcp_rcv_buf_poll = -1;
-+	options->tcp_rcv_buf = -1;
-+#endif
- 	options->proxy_use_fdpass = -1;
- 	options->ignored_unknown = NULL;
- 	options->num_canonical_domains = 0;
-@@ -1819,6 +1883,35 @@ fill_default_options(Options * options)
- 		options->server_alive_interval = 0;
- 	if (options->server_alive_count_max == -1)
- 		options->server_alive_count_max = 3;
-+#ifdef NONE_CIPHER_ENABLED
-+	if (options->none_switch == -1)
-+		options->none_switch = 0;
-+	if (options->none_enabled == -1)
-+		options->none_enabled = 0;
-+#endif
-+#ifdef HPN_ENABLED
-+	if (options->hpn_disabled == -1)
-+		options->hpn_disabled = 0;
-+	if (options->hpn_buffer_size > -1) {
-+		/* if a user tries to set the size to 0 set it to 1KB */
-+		if (options->hpn_buffer_size == 0)
-+			options->hpn_buffer_size = 1;
-+		/* limit the buffer to 64MB */
-+		if (options->hpn_buffer_size > 64*1024) {
-+			options->hpn_buffer_size = 64*1024*1024;
-+			debug("User requested buffer larger than 64MB. Request"
-+			    " reverted to 64MB");
-+		} else
-+			options->hpn_buffer_size *= 1024;
-+		debug("hpn_buffer_size set to %d", options->hpn_buffer_size);
-+	}
-+	if (options->tcp_rcv_buf == 0)
-+		options->tcp_rcv_buf = 1;
-+	if (options->tcp_rcv_buf > -1)
-+		options->tcp_rcv_buf *=1024;
-+	if (options->tcp_rcv_buf_poll == -1)
-+		options->tcp_rcv_buf_poll = 1;
-+#endif
- 	if (options->control_master == -1)
- 		options->control_master = 0;
- 	if (options->control_persist == -1) {
---- a/readconf.h	2015-07-02 22:08:42.000000000 +0200
-+++ b/readconf.h	2015-07-02 22:09:03.000000000 +0200
-@@ -105,6 +105,16 @@ typedef struct {
- 	int	clear_forwardings;
- 
- 	int	enable_ssh_keysign;
-+#ifdef NONE_CIPHER_ENABLED
-+	int     none_switch;    /* Use none cipher */
-+	int     none_enabled;   /* Allow none to be used */ 
-+#endif
-+#ifdef HPN_ENABLED
-+	int     tcp_rcv_buf; /* user switch to set tcp recv buffer */
-+	int     tcp_rcv_buf_poll; /* Option to poll recv buf every window transfer */
-+	int     hpn_disabled;    /* Switch to disable HPN buffer management */
-+	int     hpn_buffer_size; /* User definable size for HPN buffer window */
-+#endif
- 	int64_t rekey_limit;
- 	int	rekey_interval;
- 	int	no_host_authentication_for_localhost;
---- a/scp.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/scp.c	2015-07-02 22:09:03.000000000 +0200
-@@ -750,7 +750,7 @@ source(int argc, char **argv)
- 	off_t i, statbytes;
- 	size_t amt, nr;
- 	int fd = -1, haderr, indx;
--	char *last, *name, buf[2048], encname[PATH_MAX];
-+	char *last, *name, buf[16384], encname[PATH_MAX];
- 	int len;
- 
- 	for (indx = 0; indx < argc; ++indx) {
-@@ -919,7 +919,7 @@ sink(int argc, char **argv)
- 	off_t size, statbytes;
- 	unsigned long long ull;
- 	int setimes, targisdir, wrerrno = 0;
--	char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
-+	char ch, *cp, *np, *targ, *why, *vect[1], buf[16384];
- 	struct timeval tv[2];
- 
- #define	atime	tv[0]
---- a/servconf.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/servconf.c	2015-07-02 22:11:41.000000000 +0200
-@@ -163,6 +163,14 @@ initialize_server_options(ServerOptions 
- 	options->authorized_principals_file = NULL;
- 	options->authorized_principals_command = NULL;
- 	options->authorized_principals_command_user = NULL;
-+#ifdef NONE_CIPHER_ENABLED
-+	options->none_enabled = -1;
-+#endif
-+#ifdef HPN_ENABLED
-+	options->tcp_rcv_buf_poll = -1;
-+	options->hpn_disabled = -1;
-+	options->hpn_buffer_size = -1;
-+#endif
- 	options->ip_qos_interactive = -1;
- 	options->ip_qos_bulk = -1;
- 	options->version_addendum = NULL;
-@@ -329,6 +337,57 @@ fill_default_server_options(ServerOption
- 	}
- 	if (options->permit_tun == -1)
- 		options->permit_tun = SSH_TUNMODE_NO;
-+#ifdef NONE_CIPHER_ENABLED
-+	if (options->none_enabled == -1) 
-+		options->none_enabled = 0;
-+#endif
-+#ifdef HPN_ENABLED
-+	if (options->hpn_disabled == -1) 
-+		options->hpn_disabled = 0;
-+
-+	if (options->hpn_buffer_size == -1) {
-+		/*
-+		 * option not explicitly set. Now we have to figure out
-+		 * what value to use.
-+		 */
-+		if (options->hpn_disabled == 1) {
-+			options->hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT;
-+		} else {
-+			int sock, socksize;
-+			socklen_t socksizelen = sizeof(socksize);
-+
-+			/*
-+			 * get the current RCV size and set it to that
-+			 * create a socket but don't connect it
-+			 * we use that the get the rcv socket size
-+			 */
-+			sock = socket(AF_INET, SOCK_STREAM, 0);
-+			getsockopt(sock, SOL_SOCKET, SO_RCVBUF, 
-+			    &socksize, &socksizelen);
-+			close(sock);
-+			options->hpn_buffer_size = socksize;
-+			debug ("HPN Buffer Size: %d", options->hpn_buffer_size);
-+		} 
-+	} else {
-+		/*
-+		 * we have to do this incase the user sets both values in a
-+		 * contradictory manner. hpn_disabled overrrides
-+		 * hpn_buffer_size
-+		 */
-+		if (options->hpn_disabled <= 0) {
-+			if (options->hpn_buffer_size == 0)
-+				options->hpn_buffer_size = 1;
-+			/* limit the maximum buffer to 64MB */
-+			if (options->hpn_buffer_size > 64*1024) {
-+				options->hpn_buffer_size = 64*1024*1024;
-+			} else {
-+				options->hpn_buffer_size *= 1024;
-+			}
-+		} else
-+			options->hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT;
-+	}
-+#endif
-+
- 	if (options->ip_qos_interactive == -1)
- 		options->ip_qos_interactive = IPTOS_LOWDELAY;
- 	if (options->ip_qos_bulk == -1)
-@@ -407,6 +466,12 @@ typedef enum {
- 	sHostCertificate,
- 	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
- 	sAuthorizedPrincipalsCommand, sAuthorizedPrincipalsCommandUser,
-+#ifdef NONE_CIPHER_ENABLED
-+	sNoneEnabled,
-+#endif
-+#ifdef HPN_ENABLED
-+	sTcpRcvBufPoll, sHPNDisabled, sHPNBufferSize,
-+#endif
- 	sKexAlgorithms, sIPQoS, sVersionAddendum,
- 	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
- 	sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
-@@ -537,6 +602,14 @@ static struct {
- 	{ "revokedkeys", sRevokedKeys, SSHCFG_ALL },
- 	{ "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL },
- 	{ "authorizedprincipalsfile", sAuthorizedPrincipalsFile, SSHCFG_ALL },
-+#ifdef NONE_CIPHER_ENABLED
-+	{ "noneenabled", sNoneEnabled, SSHCFG_ALL },
-+#endif
-+#ifdef HPN_ENABLED
-+	{ "hpndisabled", sHPNDisabled, SSHCFG_ALL },
-+	{ "hpnbuffersize", sHPNBufferSize, SSHCFG_ALL },
-+	{ "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL },
-+#endif
- 	{ "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL },
- 	{ "ipqos", sIPQoS, SSHCFG_ALL },
- 	{ "authorizedkeyscommand", sAuthorizedKeysCommand, SSHCFG_ALL },
-@@ -1156,6 +1229,25 @@ process_server_config_line(ServerOptions
- 		intptr = &options->ignore_user_known_hosts;
- 		goto parse_flag;
- 
-+#ifdef NONE_CIPHER_ENABLED
-+	case sNoneEnabled:
-+		intptr = &options->none_enabled;
-+		goto parse_flag;
-+#endif
-+#ifdef HPN_ENABLED
-+	case sTcpRcvBufPoll:
-+		intptr = &options->tcp_rcv_buf_poll;
-+		goto parse_flag;
-+
-+	case sHPNDisabled:
-+		intptr = &options->hpn_disabled;
-+		goto parse_flag;
-+
-+	case sHPNBufferSize:
-+		intptr = &options->hpn_buffer_size;
-+		goto parse_int;
-+#endif
-+
- 	case sRhostsRSAAuthentication:
- 		intptr = &options->rhosts_rsa_authentication;
- 		goto parse_flag;
---- a/servconf.h	2015-07-02 22:08:43.000000000 +0200
-+++ b/servconf.h	2015-07-02 22:09:03.000000000 +0200
-@@ -172,6 +172,15 @@ typedef struct {
- 
- 	int	use_pam;		/* Enable auth via PAM */
- 
-+#ifdef NONE_CIPHER_ENABLED
-+	int	none_enabled;		/* enable NONE cipher switch */	
-+#endif
-+#ifdef HPN_ENABLED
-+	int     tcp_rcv_buf_poll;       /* poll tcp rcv window in autotuning kernels*/
-+	int	hpn_disabled;		/* disable hpn functionality. false by default */
-+	int	hpn_buffer_size;	/* set the hpn buffer size - default 3MB */
-+#endif
-+
- 	int	permit_tun;
- 
- 	int	num_permitted_opens;
---- a/serverloop.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/serverloop.c	2015-07-02 22:09:03.000000000 +0200
-@@ -1051,6 +1051,12 @@ server_request_tun(void)
- 	sock = tun_open(tun, mode);
- 	if (sock < 0)
- 		goto done;
-+#ifdef HPN_ENABLED
-+	if (!options.hpn_disabled)
-+		c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
-+		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
-+	else
-+#endif
- 	c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
- 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
- 	c->datagram = 1;
-@@ -1088,6 +1094,10 @@ server_request_session(void)
- 	c = channel_new("session", SSH_CHANNEL_LARVAL,
- 	    -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
- 	    0, "server-session", 1);
-+#ifdef HPN_ENABLED
-+	if (options.tcp_rcv_buf_poll && !options.hpn_disabled)
-+		c->dynamic_window = 1;
-+#endif
- 	if (session_open(the_authctxt, c->self) != 1) {
- 		debug("session open failed, free channel %d", c->self);
- 		channel_free(c);
---- a/session.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/session.c	2015-07-02 22:09:03.000000000 +0200
-@@ -2329,6 +2329,14 @@ session_set_fds(Session *s, int fdin, in
- 	 */
- 	if (s->chanid == -1)
- 		fatal("no channel for session %d", s->self);
-+#ifdef HPN_ENABLED
-+	if (!options.hpn_disabled)
-+		channel_set_fds(s->chanid,
-+		    fdout, fdin, fderr,
-+		    ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
-+		    1, is_tty, options.hpn_buffer_size);
-+	else
-+#endif
- 	channel_set_fds(s->chanid,
- 	    fdout, fdin, fderr,
- 	    ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
---- a/sftp.1	2015-07-02 22:08:43.000000000 +0200
-+++ b/sftp.1	2015-07-02 22:09:03.000000000 +0200
-@@ -263,7 +263,8 @@ diagnostic messages from
- Specify how many requests may be outstanding at any one time.
- Increasing this may slightly improve file transfer speed
- but will increase memory usage.
--The default is 64 outstanding requests.
-+The default is 256 outstanding requests providing for 8MB
-+of outstanding data with a 32KB buffer.
- .It Fl r
- Recursively copy entire directories when uploading and downloading.
- Note that
---- a/sftp.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/sftp.c	2015-07-02 22:09:03.000000000 +0200
-@@ -71,7 +71,11 @@ typedef void EditLine;
- #include "sftp-client.h"
- 
- #define DEFAULT_COPY_BUFLEN	32768	/* Size of buffer for up/download */
-+#ifdef HPN_ENABLED
-+#define DEFAULT_NUM_REQUESTS	256	/* # concurrent outstanding requests */
-+#else
- #define DEFAULT_NUM_REQUESTS	64	/* # concurrent outstanding requests */
-+#endif
- 
- /* File to read commands from */
- FILE* infile;
---- a/ssh.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/ssh.c	2015-07-02 22:09:03.000000000 +0200
-@@ -883,6 +883,14 @@ main(int ac, char **av)
- 			break;
- 		case 'T':
- 			options.request_tty = REQUEST_TTY_NO;
-+#ifdef NONE_CIPHER_ENABLED
-+			/*
-+			 * ensure that the user doesn't try to backdoor a
-+			 * null cipher switch on an interactive session
-+			 * so explicitly disable it no matter what.
-+			 */
-+			options.none_switch = 0;
-+#endif
- 			break;
- 		case 'o':
- 			line = xstrdup(optarg);
-@@ -1833,9 +1841,85 @@ ssh_session2_open(void)
- 	if (!isatty(err))
- 		set_nonblock(err);
- 
-+#ifdef HPN_ENABLED
-+	/*
-+	 * we need to check to see if what they want to do about buffer
-+	 * sizes here. In a hpn to nonhpn connection we want to limit
-+	 * the window size to something reasonable in case the far side
-+	 * has the large window bug. In hpn to hpn connection we want to
-+	 * use the max window size but allow the user to override it
-+	 * lastly if they disabled hpn then use the ssh std window size
-+
-+	 * so why don't we just do a getsockopt() here and set the
-+	 * ssh window to that? In the case of a autotuning receive
-+	 * window the window would get stuck at the initial buffer
-+	 * size generally less than 96k. Therefore we need to set the
-+	 * maximum ssh window size to the maximum hpn buffer size
-+	 * unless the user has specifically set the tcprcvbufpoll
-+	 * to no. In which case we *can* just set the window to the
-+	 * minimum of the hpn buffer size and tcp receive buffer size
-+	 */
-+
-+	if (tty_flag)
-+		options.hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT;
-+	else
-+		options.hpn_buffer_size = 2*1024*1024;
-+
-+	if (datafellows & SSH_BUG_LARGEWINDOW) {
-+		debug("HPN to Non-HPN Connection");
-+	} else {
-+		int sock, socksize;
-+		socklen_t socksizelen = sizeof(socksize);
-+
-+		if (options.tcp_rcv_buf_poll <= 0) {
-+			sock = socket(AF_INET, SOCK_STREAM, 0);
-+			getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-+			    &socksize, &socksizelen);
-+			close(sock);
-+			debug("socksize %d", socksize);
-+			options.hpn_buffer_size = socksize;
-+			debug ("HPNBufferSize set to TCP RWIN: %d",
-+			    options.hpn_buffer_size);
-+		} else {
-+			if (options.tcp_rcv_buf > 0) {
-+				/*
-+				 * create a socket but don't connect it.
-+				 * we use that the get the rcv socket size
-+				 */
-+				sock = socket(AF_INET, SOCK_STREAM, 0);
-+				/*
-+				 * if they are using the tcp_rcv_buf option
-+				 * attempt to set the buffer size to that
-+				 */
-+				if (options.tcp_rcv_buf)
-+					setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-+					    (void *)&options.tcp_rcv_buf,
-+					    sizeof(options.tcp_rcv_buf));
-+				getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-+				    &socksize, &socksizelen);
-+				close(sock);
-+				debug("socksize %d", socksize);
-+				options.hpn_buffer_size = socksize;
-+				debug ("HPNBufferSize set to user TCPRcvBuf: "
-+				    "%d", options.hpn_buffer_size);
-+			}
-+		}
-+	}
-+
-+	debug("Final hpn_buffer_size = %d", options.hpn_buffer_size);
-+
-+	window = options.hpn_buffer_size;
-+
-+	channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
-+#else
- 	window = CHAN_SES_WINDOW_DEFAULT;
-+#endif
-+
- 	packetmax = CHAN_SES_PACKET_DEFAULT;
- 	if (tty_flag) {
-+#ifdef HPN_ENABLED
-+		window = CHAN_SES_WINDOW_DEFAULT;
-+#endif
- 		window >>= 1;
- 		packetmax >>= 1;
- 	}
-@@ -1844,6 +1928,12 @@ ssh_session2_open(void)
- 	    window, packetmax, CHAN_EXTENDED_WRITE,
- 	    "client-session", /*nonblock*/0);
- 
-+#ifdef HPN_ENABLED
-+	if (options.tcp_rcv_buf_poll > 0 && !options.hpn_disabled) {
-+		c->dynamic_window = 1;
-+		debug ("Enabled Dynamic Window Scaling");
-+	}
-+#endif
- 	debug3("ssh_session2_open: channel_new: %d", c->self);
- 
- 	channel_send_open(c->self);
---- a/sshconnect.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/sshconnect.c	2015-07-02 22:09:03.000000000 +0200
-@@ -266,6 +266,31 @@ ssh_kill_proxy_command(void)
- 		kill(proxy_command_pid, SIGHUP);
- }
- 
-+#ifdef HPN_ENABLED
-+/*
-+ * Set TCP receive buffer if requested.
-+ * Note: tuning needs to happen after the socket is
-+ * created but before the connection happens
-+ * so winscale is negotiated properly -cjr
-+ */
-+static void
-+ssh_set_socket_recvbuf(int sock)
-+{
-+	void *buf = (void *)&options.tcp_rcv_buf;
-+	int sz = sizeof(options.tcp_rcv_buf);
-+	int socksize;
-+	socklen_t socksizelen = sizeof(socksize);
-+
-+	debug("setsockopt Attempting to set SO_RCVBUF to %d", options.tcp_rcv_buf);
-+	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) >= 0) {
-+	  getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &socksize, &socksizelen);
-+	  debug("setsockopt SO_RCVBUF: %.100s %d", strerror(errno), socksize);
-+	} else
-+		error("Couldn't set socket receive buffer to %d: %.100s",
-+		    options.tcp_rcv_buf, strerror(errno));
-+}
-+#endif
-+
- /*
-  * Creates a (possibly privileged) socket for use as the ssh connection.
-  */
-@@ -282,6 +307,11 @@ ssh_create_socket(int privileged, struct
- 	}
- 	fcntl(sock, F_SETFD, FD_CLOEXEC);
- 
-+#ifdef HPN_ENABLED
-+	if (options.tcp_rcv_buf > 0)
-+		ssh_set_socket_recvbuf(sock);
-+#endif
-+
- 	/* Bind the socket to an alternative local IP address */
- 	if (options.bind_address == NULL && !privileged)
- 		return sock;
-@@ -523,11 +553,23 @@ send_client_banner(int connection_out, i
- {
- 	/* Send our own protocol version identification. */
- 	if (compat20) {
--		xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",
--		    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
-+		xasprintf(&client_version_string, "SSH-%d.%d-%.100s%s\r\n",
-+		    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+		    options.hpn_disabled ? "" : SSH_HPN
-+#else
-+		    ""
-+#endif
-+		    );
- 	} else {
--		xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n",
--		    PROTOCOL_MAJOR_1, minor1, SSH_VERSION);
-+		xasprintf(&client_version_string, "SSH-%d.%d-%.100s%s\n",
-+		    PROTOCOL_MAJOR_1, minor1, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+		    options.hpn_disabled ? "" : SSH_HPN
-+#else
-+		    ""
-+#endif
-+		    );
- 	}
- 	if (roaming_atomicio(vwrite, connection_out, client_version_string,
- 	    strlen(client_version_string)) != strlen(client_version_string))
---- a/sshconnect2.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/sshconnect2.c	2015-07-02 22:09:03.000000000 +0200
-@@ -80,6 +80,14 @@
- extern char *client_version_string;
- extern char *server_version_string;
- extern Options options;
-+#ifdef NONE_CIPHER_ENABLED
-+struct kex *xxx_kex;
-+
-+/* tty_flag is set in ssh.c. use this in ssh_userauth2 */
-+/* if it is set then prevent the switch to the null cipher */
-+
-+extern int tty_flag;
-+#endif
- 
- /*
-  * SSH2 key exchange
-@@ -153,13 +161,16 @@ order_hostkeyalgs(char *host, struct soc
- 	return ret;
- }
- 
-+static char *myproposal[PROPOSAL_MAX];
-+static const char *myproposal_default[PROPOSAL_MAX] = { KEX_CLIENT };
- void
- ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
- {
--	char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
- 	struct kex *kex;
- 	int r;
- 
-+	memcpy(&myproposal, &myproposal_default, sizeof(myproposal));
-+
- 	xxx_host = host;
- 	xxx_hostaddr = hostaddr;
- 
-@@ -222,6 +233,10 @@ ssh_kex2(char *host, struct sockaddr *ho
- 	kex->server_version_string=server_version_string;
- 	kex->verify_host_key=&verify_host_key_callback;
- 
-+#ifdef NONE_CIPHER_ENABLED
-+	xxx_kex = kex;
-+#endif
-+
- 	dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
- 
- 	if (options.use_roaming && !kex->roaming) {
-@@ -423,6 +438,29 @@ ssh_userauth2(const char *local_user, co
- 	pubkey_cleanup(&authctxt);
- 	dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
- 
-+#ifdef NONE_CIPHER_ENABLED
-+	/*
-+	 * if the user wants to use the none cipher do it
-+	 * post authentication and only if the right conditions are met
-+	 * both of the NONE commands must be true and there must be no
-+	 * tty allocated.
-+	 */
-+	if ((options.none_switch == 1) && (options.none_enabled == 1)) {
-+		if (!tty_flag) { /* no null on tty sessions */
-+			debug("Requesting none rekeying...");
-+			myproposal[PROPOSAL_ENC_ALGS_STOC] = "none";
-+			myproposal[PROPOSAL_ENC_ALGS_CTOS] = "none";
-+			kex_prop2buf(xxx_kex->my, myproposal);
-+			packet_request_rekeying();
-+			fprintf(stderr, "WARNING: ENABLED NONE CIPHER\n");
-+		} else {
-+			/* requested NONE cipher when in a tty */
-+			debug("Cannot switch to NONE cipher with tty allocated");
-+			fprintf(stderr, "NONE cipher switch disabled when a TTY is allocated\n");
-+		}
-+	}
-+#endif
-+
- 	debug("Authentication succeeded (%s).", authctxt.method->name);
- }
- 
---- a/sshd.c	2015-07-02 22:08:43.000000000 +0200
-+++ b/sshd.c	2015-07-02 22:09:03.000000000 +0200
-@@ -430,8 +430,11 @@ sshd_exchange_identification(int sock_in
- 		minor = PROTOCOL_MINOR_1;
- 	}
- 
--	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
-+	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s%s",
- 	    major, minor, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+	    options.hpn_disabled ? "" : SSH_HPN,
-+#endif
- 	    *options.version_addendum == '\0' ? "" : " ",
- 	    options.version_addendum, newline);
- 
-@@ -1158,6 +1161,10 @@ server_listen(void)
- 	int ret, listen_sock, on = 1;
- 	struct addrinfo *ai;
- 	char ntop[NI_MAXHOST], strport[NI_MAXSERV];
-+#ifdef HPN_ENABLED
-+	int socksize;
-+	socklen_t socksizelen = sizeof(socksize);
-+#endif
- 
- 	for (ai = options.listen_addrs; ai; ai = ai->ai_next) {
- 		if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
-@@ -1198,6 +1205,13 @@ server_listen(void)
- 
- 		debug("Bind to port %s on %s.", strport, ntop);
- 
-+#ifdef HPN_ENABLED
-+		getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF,
-+				   &socksize, &socksizelen);
-+		debug("Server TCP RWIN socket size: %d", socksize);
-+		debug("HPN Buffer Size: %d", options.hpn_buffer_size);
-+#endif
-+
- 		/* Bind the socket to the desired port. */
- 		if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) {
- 			error("Bind to port %s on %s failed: %.200s.",
-@@ -2148,6 +2162,11 @@ main(int ac, char **av)
- 	    remote_ip, remote_port, laddr,  get_local_port());
- 	free(laddr);
- 
-+#ifdef HPN_ENABLED
-+	/* set the HPN options for the child */
-+	channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
-+#endif
-+
- 	/*
- 	 * We don't want to listen forever unless the other side
- 	 * successfully authenticates itself.  So we set up an alarm which is
-@@ -2547,6 +2566,12 @@ do_ssh2_kex(void)
- 	if (options.ciphers != NULL) {
- 		myproposal[PROPOSAL_ENC_ALGS_CTOS] =
- 		myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
-+#ifdef NONE_CIPHER_ENABLED
-+        } else if (options.none_enabled == 1) {
-+                debug ("WARNING: None cipher enabled");
-+                myproposal[PROPOSAL_ENC_ALGS_CTOS] =
-+                myproposal[PROPOSAL_ENC_ALGS_STOC] = KEX_ENCRYPT_INCLUDE_NONE;
-+#endif
- 	}
- 	myproposal[PROPOSAL_ENC_ALGS_CTOS] =
- 	    compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);
---- a/sshd_config	2015-07-02 22:08:43.000000000 +0200
-+++ b/sshd_config	2015-07-02 22:09:03.000000000 +0200
-@@ -125,6 +125,20 @@ UsePrivilegeSeparation sandbox		# Defaul
- # override default of no subsystems
- Subsystem	sftp	/usr/libexec/sftp-server
- 
-+# the following are HPN related configuration options
-+# tcp receive buffer polling. disable in non autotuning kernels
-+#TcpRcvBufPoll yes
-+ 
-+# disable hpn performance boosts
-+#HPNDisabled no
-+
-+# buffer size for hpn to non-hpn connections
-+#HPNBufferSize 2048
-+
-+
-+# allow the use of the none cipher
-+#NoneEnabled no
-+
- # Example of overriding settings on a per-user basis
- #Match User anoncvs
- #	X11Forwarding no
---- a/version.h	2015-07-02 22:08:43.000000000 +0200
-+++ b/version.h	2015-07-02 22:09:03.000000000 +0200
-@@ -4,3 +4,4 @@
- 
- #define SSH_PORTABLE	"p1"
- #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE
-+#define SSH_HPN         "-hpn14v5"

Copied: trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff (from rev 141606, trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff)
===================================================================
--- trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff	                        (rev 0)
+++ trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff	2015-10-25 10:37:32 UTC (rev 141653)
@@ -0,0 +1,1292 @@
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/HPN-README	2015-10-24 07:22:39.000000000 +0200
+@@ -0,0 +1,129 @@
++Notes:
++
++MULTI-THREADED CIPHER:
++The AES cipher in CTR mode has been multithreaded (MTR-AES-CTR). This will allow ssh installations
++on hosts with multiple cores to use more than one processing core during encryption.
++Tests have show significant throughput performance increases when using MTR-AES-CTR up
++to and including a full gigabit per second on quad core systems. It should be possible to
++achieve full line rate on dual core systems but OS and data management overhead makes this
++more difficult to achieve. The cipher stream from MTR-AES-CTR is entirely compatible with single
++thread AES-CTR (ST-AES-CTR) implementations and should be 100% backward compatible. Optimal
++performance requires the MTR-AES-CTR mode be enabled on both ends of the connection.
++The MTR-AES-CTR replaces ST-AES-CTR and is used in exactly the same way with the same
++nomenclature.
++Use examples:  ssh -caes128-ctr you at host.com
++               scp -oCipher=aes256-ctr file you at host.com:~/file
++
++NONE CIPHER:
++To use the NONE option you must have the NoneEnabled switch set on the server and
++you *must* have *both* NoneEnabled and NoneSwitch set to yes on the client. The NONE
++feature works with ALL ssh subsystems (as far as we can tell) *AS LONG AS* a tty is not
++spawned. If a user uses the -T switch to prevent a tty being created the NONE cipher will
++be disabled.
++
++The performance increase will only be as good as the network and TCP stack tuning
++on the receiver side of the connection allows. As a rule of thumb a user will need
++at least 10Mb/s connection with a 100ms RTT to see a doubling of performance. The
++HPN-SSH home page describes this in greater detail.
++
++http://www.psc.edu/networking/projects/hpn-ssh
++
++BUFFER SIZES:
++
++If HPN is disabled the receive buffer size will be set to the
++OpenSSH default of 64K.
++
++If an HPN system connects to a nonHPN system the receive buffer will
++be set to the HPNBufferSize value. The default is 2MB but user adjustable.
++
++If an HPN to HPN connection is established a number of different things might
++happen based on the user options and conditions.
++
++Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set
++HPN Buffer Size = up to 64MB
++This is the default state. The HPN buffer size will grow to a maximum of 64MB
++as the TCP receive buffer grows. The maximum HPN Buffer size of 64MB is
++geared towards 10GigE transcontinental connections.
++
++Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set
++HPN Buffer Size = TCP receive buffer value.
++Users on non-autotuning systesm should disable TCPRcvBufPoll in the
++ssh_cofig and sshd_config
++
++Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set
++HPN Buffer Size = minmum of TCP receive buffer and HPNBufferSize.
++This would be the system defined TCP receive buffer (RWIN).
++
++Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf SET
++HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize.
++Generally there is no need to set both.
++
++Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set
++HPN Buffer Size = grows to HPNBufferSize
++The buffer will grow up to the maximum size specified here.
++
++Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf SET
++HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize.
++Generally there is no need to set both of these, especially on autotuning
++systems. However, if the users wishes to override the autotuning this would be
++one way to do it.
++
++Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf SET
++HPN Buffer Size = TCPRcvBuf.
++This will override autotuning and set the TCP recieve buffer to the user defined
++value.
++
++
++HPN Specific Configuration options
++
++TcpRcvBuf=[int]KB client
++      set the TCP socket receive buffer to n Kilobytes. It can be set up to the
++maximum socket size allowed by the system. This is useful in situations where
++the tcp receive window is set low but the maximum buffer size is set
++higher (as is typical). This works on a per TCP connection basis. You can also
++use this to artifically limit the transfer rate of the connection. In these
++cases the throughput will be no more than n/RTT. The minimum buffer size is 1KB.
++Default is the current system wide tcp receive buffer size.
++
++TcpRcvBufPoll=[yes/no] client/server
++      enable of disable the polling of the tcp receive buffer through the life
++of the connection. You would want to make sure that this option is enabled
++for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista)
++default is yes.
++
++NoneEnabled=[yes/no] client/server
++      enable or disable the use of the None cipher. Care must always be used
++when enabling this as it will allow users to send data in the clear. However,
++it is important to note that authentication information remains encrypted
++even if this option is enabled. Set to no by default.
++
++NoneSwitch=[yes/no] client
++     Switch the encryption cipher being used to the None cipher after
++authentication takes place. NoneEnabled must be enabled on both the client
++and server side of the connection. When the connection switches to the NONE
++cipher a warning is sent to STDERR. The connection attempt will fail with an
++error if a client requests a NoneSwitch from the server that does not explicitly
++have NoneEnabled set to yes. Note: The NONE cipher cannot be used in
++interactive (shell) sessions and it will fail silently. Set to no by default.
++
++HPNDisabled=[yes/no] client/server
++     In some situations, such as transfers on a local area network, the impact
++of the HPN code produces a net decrease in performance. In these cases it is
++helpful to disable the HPN functionality. By default HPNDisabled is set to no.
++
++HPNBufferSize=[int]KB client/server
++     This is the default buffer size the HPN functionality uses when interacting
++with nonHPN SSH installations. Conceptually this is similar to the TcpRcvBuf
++option as applied to the internal SSH flow control. This value can range from
++1KB to 64MB (1-65536). Use of oversized or undersized buffers can cause performance
++problems depending on the length of the network path. The default size of this buffer
++is 2MB.
++
++
++Credits: This patch was conceived, designed, and led by Chris Rapier (rapier at psc.edu)
++         The majority of the actual coding for versions up to HPN12v1 was performed
++         by Michael Stevens (mstevens at andrew.cmu.edu). The MT-AES-CTR cipher was
++        implemented by Ben Bennet (ben at psc.edu) and improved by Mike Tasota
++        (tasota at gmail.com) an NSF REU grant recipient for 2013.
++        This work was financed, in part, by Cisco System, Inc., the National
++         Library of Medicine, and the National Science Foundation.
+--- a/channels.c	2015-10-24 04:53:18.000000000 +0200
++++ b/channels.c	2015-10-24 05:07:01.000000000 +0200
+@@ -186,6 +186,12 @@ static void port_open_helper(Channel *c,
+ static int connect_next(struct channel_connect *);
+ static void channel_connect_ctx_free(struct channel_connect *);
+ 
++
++#ifdef HPN_ENABLED
++static int hpn_disabled = 0;
++static int hpn_buffer_size = 2 * 1024 * 1024;
++#endif
++
+ /* -- channel core */
+ 
+ Channel *
+@@ -336,6 +342,9 @@ channel_new(char *ctype, int type, int r
+ 	c->local_window_max = window;
+ 	c->local_consumed = 0;
+ 	c->local_maxpacket = maxpack;
++#ifdef HPN_ENABLED
++	c->dynamic_window = 0;
++#endif
+ 	c->remote_id = -1;
+ 	c->remote_name = xstrdup(remote_name);
+ 	c->remote_window = 0;
+@@ -840,11 +849,41 @@ channel_pre_open_13(Channel *c, fd_set *
+ 		FD_SET(c->sock, writeset);
+ }
+ 
++#ifdef HPN_ENABLED
++static u_int
++channel_tcpwinsz(void)
++{
++	u_int32_t tcpwinsz = 0;
++	socklen_t optsz = sizeof(tcpwinsz);
++	int ret = -1;
++
++	/* if we aren't on a socket return 128KB */
++	if (!packet_connection_is_on_socket())
++		return (128*1024);
++	ret = getsockopt(packet_get_connection_in(),
++	    SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
++	/* return no more than SSHBUF_SIZE_MAX */
++	if (ret == 0 && tcpwinsz > SSHBUF_SIZE_MAX)
++		tcpwinsz = SSHBUF_SIZE_MAX;
++	debug2("tcpwinsz: %d for connection: %d", tcpwinsz,
++	    packet_get_connection_in());
++	return (tcpwinsz);
++}
++#endif
++
+ static void
+ channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset)
+ {
+ 	u_int limit = compat20 ? c->remote_window : packet_get_maxsize();
+ 
++#ifdef HPN_ENABLED
++	/* check buffer limits */
++	if (!c->tcpwinsz || c->dynamic_window > 0)
++		c->tcpwinsz = channel_tcpwinsz();
++
++	limit = MIN(limit, 2 * c->tcpwinsz);
++#endif
++
+ 	if (c->istate == CHAN_INPUT_OPEN &&
+ 	    limit > 0 &&
+ 	    buffer_len(&c->input) < limit &&
+@@ -1862,6 +1901,20 @@ channel_check_window(Channel *c)
+ 	    c->local_maxpacket*3) ||
+ 	    c->local_window < c->local_window_max/2) &&
+ 	    c->local_consumed > 0) {
++#ifdef HPN_ENABLED
++		/* adjust max window size if we are in a dynamic environment */
++		if (c->dynamic_window && (c->tcpwinsz > c->local_window_max)) {
++			u_int addition = 0;
++
++			/*
++			 * grow the window somewhat aggressively to maintain
++			 * pressure
++			 */
++			addition = 1.5*(c->tcpwinsz - c->local_window_max);
++			c->local_window_max += addition;
++			c->local_consumed += addition;
++		}
++#endif
+ 		packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
+ 		packet_put_int(c->remote_id);
+ 		packet_put_int(c->local_consumed);
+@@ -2813,6 +2866,17 @@ channel_fwd_bind_addr(const char *listen
+ 	return addr;
+ }
+ 
++#ifdef HPN_ENABLED
++void
++channel_set_hpn(int external_hpn_disabled, int external_hpn_buffer_size)
++{
++	hpn_disabled = external_hpn_disabled;
++	hpn_buffer_size = external_hpn_buffer_size;
++	debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled,
++	    hpn_buffer_size);
++}
++#endif
++
+ static int
+ channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd,
+     int *allocated_listen_port, struct ForwardOptions *fwd_opts)
+@@ -2941,6 +3005,17 @@ channel_setup_fwd_listener_tcpip(int typ
+ 		}
+ 
+ 		/* Allocate a channel number for the socket. */
++#ifdef HPN_ENABLED
++		/*
++		 * explicitly test for hpn disabled option. if true use smaller
++		 * window size.
++		 */
++		if (!hpn_disabled)
++			c = channel_new("port listener", type, sock, sock, -1,
++			    hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
++			    0, "port listener", 1);
++		else
++#endif
+ 		c = channel_new("port listener", type, sock, sock, -1,
+ 		    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
+ 		    0, "port listener", 1);
+@@ -3975,6 +4050,14 @@ x11_create_display_inet(int x11_display_
+ 	*chanids = xcalloc(num_socks + 1, sizeof(**chanids));
+ 	for (n = 0; n < num_socks; n++) {
+ 		sock = socks[n];
++#ifdef HPN_ENABLED
++		if (!hpn_disabled)
++			nc = channel_new("x11 listener",
++			    SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
++			    hpn_buffer_size, CHAN_X11_PACKET_DEFAULT,
++			    0, "X11 inet listener", 1);
++		else
++#endif
+ 		nc = channel_new("x11 listener",
+ 		    SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
+ 		    CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
+--- a/channels.h	2015-10-24 04:53:18.000000000 +0200
++++ b/channels.h	2015-10-24 05:07:01.000000000 +0200
+@@ -136,6 +136,10 @@ struct Channel {
+ 	u_int	local_maxpacket;
+ 	int     extended_usage;
+ 	int	single_connection;
++#ifdef HPN_ENABLED
++	int	dynamic_window;
++	u_int	tcpwinsz;
++#endif
+ 
+ 	char   *ctype;		/* type */
+ 
+@@ -312,4 +316,9 @@ void	 chan_rcvd_ieof(Channel *);
+ void	 chan_write_failed(Channel *);
+ void	 chan_obuf_empty(Channel *);
+ 
++#ifdef HPN_ENABLED
++/* hpn handler */
++void     channel_set_hpn(int, int);
++#endif
++
+ #endif
+--- a/cipher.c	2015-10-24 04:53:18.000000000 +0200
++++ b/cipher.c	2015-10-24 05:07:01.000000000 +0200
+@@ -244,7 +244,13 @@ ciphers_valid(const char *names)
+ 	for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
+ 	    (p = strsep(&cp, CIPHER_SEP))) {
+ 		c = cipher_by_name(p);
+-		if (c == NULL || c->number != SSH_CIPHER_SSH2) {
++		if (c == NULL || (c->number != SSH_CIPHER_SSH2 &&
++#ifdef NONE_CIPHER_ENABLED
++				  c->number != SSH_CIPHER_NONE
++#else
++				  1
++#endif
++				  )) {
+ 			free(cipher_list);
+ 			return 0;
+ 		}
+@@ -545,6 +551,9 @@ cipher_get_keyiv(struct sshcipher_ctx *c
+ 
+ 	switch (c->number) {
+ #ifdef WITH_OPENSSL
++#ifdef NONE_CIPHER_ENABLED
++	case SSH_CIPHER_NONE:
++#endif
+ 	case SSH_CIPHER_SSH2:
+ 	case SSH_CIPHER_DES:
+ 	case SSH_CIPHER_BLOWFISH:
+@@ -593,6 +602,9 @@ cipher_set_keyiv(struct sshcipher_ctx *c
+ 
+ 	switch (c->number) {
+ #ifdef WITH_OPENSSL
++#ifdef NONE_CIPHER_ENABLED
++	case SSH_CIPHER_NONE:
++#endif
+ 	case SSH_CIPHER_SSH2:
+ 	case SSH_CIPHER_DES:
+ 	case SSH_CIPHER_BLOWFISH:
+--- a/clientloop.c	2015-10-24 04:53:18.000000000 +0200
++++ b/clientloop.c	2015-10-24 05:07:01.000000000 +0200
+@@ -1957,6 +1957,15 @@ client_request_x11(const char *request_t
+ 	sock = x11_connect_display();
+ 	if (sock < 0)
+ 		return NULL;
++#ifdef HPN_ENABLED
++	/* again is this really necessary for X11? */
++	if (!options.hpn_disabled)
++		c = channel_new("x11",
++		    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
++		    options.hpn_buffer_size,
++		    CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
++	else
++#endif
+ 	c = channel_new("x11",
+ 	    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
+ 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
+@@ -1982,6 +1991,14 @@ client_request_agent(const char *request
+ 			    __func__, ssh_err(r));
+ 		return NULL;
+ 	}
++#ifdef HPN_ENABLED
++	if (!options.hpn_disabled)
++		c = channel_new("authentication agent connection",
++		    SSH_CHANNEL_OPEN, sock, sock, -1,
++		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0,
++		    "authentication agent connection", 1);
++	else
++#endif
+ 	c = channel_new("authentication agent connection",
+ 	    SSH_CHANNEL_OPEN, sock, sock, -1,
+ 	    CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0,
+@@ -2012,6 +2029,12 @@ client_request_tun_fwd(int tun_mode, int
+ 		return -1;
+ 	}
+ 
++#ifdef HPN_ENABLED
++	if (!options.hpn_disabled)
++		c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
++		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
++	else
++#endif
+ 	c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
+ 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
+ 	c->datagram = 1;
+--- a/compat.c	2015-10-24 04:53:18.000000000 +0200
++++ b/compat.c	2015-10-24 05:07:02.000000000 +0200
+@@ -210,6 +210,14 @@ compat_datafellows(const char *version)
+ 			debug("match: %s pat %s compat 0x%08x",
+ 			    version, check[i].pat, check[i].bugs);
+ 			datafellows = check[i].bugs;	/* XXX for now */
++#ifdef HPN_ENABLED
++			/* Check to see if the remote side is OpenSSH and not HPN */
++			if (strstr(version,"OpenSSH") != NULL &&
++			    strstr(version,"hpn") == NULL) {
++				datafellows |= SSH_BUG_LARGEWINDOW;
++				debug("Remote is NON-HPN aware");
++			}
++#endif
+ 			return check[i].bugs;
+ 		}
+ 	}
+--- a/compat.h	2015-10-24 04:53:18.000000000 +0200
++++ b/compat.h	2015-10-24 06:01:31.000000000 +0200
+@@ -62,6 +62,9 @@
+ #define SSH_BUG_CURVE25519PAD	0x10000000
+ #define SSH_BUG_HOSTKEYS	0x20000000
+ #define SSH_BUG_DHGEX_LARGE	0x40000000
++#ifdef HPN_ENABLED
++#define SSH_BUG_LARGEWINDOW     0x80000000
++#endif
+ 
+ void     enable_compat13(void);
+ void     enable_compat20(void);
+--- a/configure.ac	2015-10-24 04:53:18.000000000 +0200
++++ b/configure.ac	2015-10-24 05:07:02.000000000 +0200
+@@ -4271,6 +4271,25 @@ AC_ARG_WITH([maildir],
+     ]
+ ) # maildir
+ 
++#check whether user wants HPN support
++HPN_MSG="no"
++AC_ARG_WITH(hpn,
++	[  --with-hpn             Enable HPN support],
++	[ if test "x$withval" != "xno" ; then
++		AC_DEFINE(HPN_ENABLED,1,[Define if you want HPN support.])
++		HPN_MSG="yes"
++	fi ]
++)
++#check whether user wants NONECIPHER support
++NONECIPHER_MSG="no"
++AC_ARG_WITH(nonecipher,
++	[  --with-nonecipher             Enable NONECIPHER support],
++	[ if test "x$withval" != "xno" ; then
++		AC_DEFINE(NONE_CIPHER_ENABLED,1,[Define if you want NONECIPHER support.])
++		NONECIPHER_MSG="yes"
++	fi ]
++)
++
+ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
+ 	AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
+ 	disable_ptmx_check=yes
+@@ -4938,6 +4957,8 @@ echo "           Translate v4 in v6 hack
+ echo "                  BSD Auth support: $BSD_AUTH_MSG"
+ echo "              Random number source: $RAND_MSG"
+ echo "             Privsep sandbox style: $SANDBOX_STYLE"
++echo "                       HPN support: $HPN_MSG"
++echo "                NONECIPHER support: $NONECIPHER_MSG"
+ 
+ echo ""
+ 
+--- a/kex.c	2015-10-24 04:53:18.000000000 +0200
++++ b/kex.c	2015-10-24 05:19:11.000000000 +0200
+@@ -652,6 +652,13 @@ kex_choose_conf(struct ssh *ssh)
+ 	int nenc, nmac, ncomp;
+ 	u_int mode, ctos, need, dh_need, authlen;
+ 	int r, first_kex_follows;
++#ifdef NONE_CIPHER_ENABLED
++	/* XXX: Could this move into the lower block? */
++	int auth_flag;
++
++	auth_flag = ssh_packet_authentication_state(ssh);
++	debug ("AUTH STATE IS %d", auth_flag);
++#endif
+ 
+ 	if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0 ||
+ 	    (r = kex_buf2prop(kex->peer, &first_kex_follows, &peer)) != 0)
+@@ -709,6 +716,17 @@ kex_choose_conf(struct ssh *ssh)
+ 			peer[ncomp] = NULL;
+ 			goto out;
+ 		}
++#ifdef NONE_CIPHER_ENABLED
++		debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name);
++		if (strcmp(newkeys->enc.name, "none") == 0) {
++			debug("Requesting NONE. Authflag is %d", auth_flag);
++			if (auth_flag == 1) {
++				debug("None requested post authentication.");
++			} else {
++				fatal("Pre-authentication none cipher requests are not allowed.");
++			}
++		}
++#endif
+ 		debug("kex: %s %s %s %s",
+ 		    ctos ? "client->server" : "server->client",
+ 		    newkeys->enc.name,
+--- a/myproposal.h	2015-10-24 04:53:18.000000000 +0200
++++ b/myproposal.h	2015-10-24 05:07:02.000000000 +0200
+@@ -169,6 +169,10 @@
+ #define	KEX_DEFAULT_COMP	"none,zlib at openssh.com,zlib"
+ #define	KEX_DEFAULT_LANG	""
+ 
++#ifdef NONE_CIPHER_ENABLED
++#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT ",none"
++#endif
++
+ #define KEX_CLIENT \
+ 	KEX_CLIENT_KEX, \
+ 	KEX_DEFAULT_PK_ALG, \
+--- a/packet.c	2015-10-24 04:53:18.000000000 +0200
++++ b/packet.c	2015-10-24 05:07:02.000000000 +0200
+@@ -2228,6 +2228,24 @@ ssh_packet_send_ignore(struct ssh *ssh, 
+ 	}
+ }
+ 
++#ifdef NONE_CIPHER_ENABLED
++/* this supports the forced rekeying required for the NONE cipher */
++int rekey_requested = 0;
++void
++packet_request_rekeying(void)
++{
++	rekey_requested = 1;
++}
++
++int
++ssh_packet_authentication_state(struct ssh *ssh)
++{
++	struct session_state *state = ssh->state;
++
++	return(state->after_authentication);
++}
++#endif
++
+ #define MAX_PACKETS	(1U<<31)
+ int
+ ssh_packet_need_rekeying(struct ssh *ssh)
+@@ -2236,6 +2254,12 @@ ssh_packet_need_rekeying(struct ssh *ssh
+ 
+ 	if (ssh->compat & SSH_BUG_NOREKEY)
+ 		return 0;
++#ifdef NONE_CIPHER_ENABLED
++        if (rekey_requested == 1) {
++               rekey_requested = 0;
++               return 1;
++        }
++#endif
+ 	return
+ 	    (state->p_send.packets > MAX_PACKETS) ||
+ 	    (state->p_read.packets > MAX_PACKETS) ||
+--- a/packet.h	2015-10-24 04:53:18.000000000 +0200
++++ b/packet.h	2015-10-24 05:07:02.000000000 +0200
+@@ -188,6 +188,11 @@ int	sshpkt_get_bignum2(struct ssh *ssh, 
+ int	sshpkt_get_end(struct ssh *ssh);
+ const u_char	*sshpkt_ptr(struct ssh *, size_t *lenp);
+ 
++#ifdef NONE_CIPHER_ENABLED
++void  packet_request_rekeying(void);
++int   ssh_packet_authentication_state(struct ssh *ssh);
++#endif
++
+ /* OLD API */
+ extern struct ssh *active_state;
+ #include "opacket.h"
+--- a/readconf.c	2015-10-24 04:53:18.000000000 +0200
++++ b/readconf.c	2015-10-24 06:10:34.000000000 +0200
+@@ -153,6 +153,12 @@ typedef enum {
+ 	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
+ 	oVisualHostKey, oUseRoaming,
+ 	oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
++#ifdef HPN_ENABLED
++	oHPNDisabled, oHPNBufferSize, oTcpRcvBufPoll, oTcpRcvBuf,
++#endif
++#ifdef NONE_CIPHER_ENABLED
++	oNoneSwitch, oNoneEnabled,
++#endif
+ 	oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
+ 	oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
+ 	oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
+@@ -277,6 +283,16 @@ static struct {
+ 	{ "updatehostkeys", oUpdateHostkeys },
+ 	{ "hostbasedkeytypes", oHostbasedKeyTypes },
+ 	{ "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
++#ifdef NONE_CIPHER_ENABLED
++	{ "noneenabled", oNoneEnabled },
++	{ "noneswitch", oNoneSwitch },
++#endif
++#ifdef HPN_ENABLED
++	{ "tcprcvbufpoll", oTcpRcvBufPoll },
++	{ "tcprcvbuf", oTcpRcvBuf },
++	{ "hpndisabled", oHPNDisabled },
++	{ "hpnbuffersize", oHPNBufferSize },
++#endif
+ 	{ "ignoreunknown", oIgnoreUnknown },
+ 
+ 	{ NULL, oBadOption }
+@@ -906,6 +922,44 @@ parse_time:
+ 		intptr = &options->check_host_ip;
+ 		goto parse_flag;
+ 
++#ifdef HPN_ENABLED
++	case oHPNDisabled:
++		intptr = &options->hpn_disabled;
++		goto parse_flag;
++
++	case oHPNBufferSize:
++		intptr = &options->hpn_buffer_size;
++		goto parse_int;
++
++	case oTcpRcvBufPoll:
++		intptr = &options->tcp_rcv_buf_poll;
++		goto parse_flag;
++
++	case oTcpRcvBuf:
++		intptr = &options->tcp_rcv_buf;
++		goto parse_int;
++#endif
++
++#ifdef NONE_CIPHER_ENABLED
++        case oNoneEnabled:
++                intptr = &options->none_enabled;
++                goto parse_flag;
++
++        /* we check to see if the command comes from the */
++        /* command line or not. If it does then enable it */
++        /* otherwise fail. NONE should never be a default configuration */
++        case oNoneSwitch:
++                if(strcmp(filename,"command-line") == 0) {
++                        intptr = &options->none_switch;
++                        goto parse_flag;
++                } else {
++                        error("NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line", filename);
++                        error("Continuing...");
++                        debug("NoneSwitch directive found in %.200s.", filename);
++                        return 0;
++                }
++#endif
++
+ 	case oVerifyHostKeyDNS:
+ 		intptr = &options->verify_host_key_dns;
+ 		multistate_ptr = multistate_yesnoask;
+@@ -1665,6 +1719,16 @@ initialize_options(Options * options)
+ 	options->ip_qos_interactive = -1;
+ 	options->ip_qos_bulk = -1;
+ 	options->request_tty = -1;
++#ifdef NONE_CIPHER_ENABLED
++	options->none_switch = -1;
++	options->none_enabled = -1;
++#endif
++#ifdef HPN_ENABLED
++	options->hpn_disabled = -1;
++	options->hpn_buffer_size = -1;
++	options->tcp_rcv_buf_poll = -1;
++	options->tcp_rcv_buf = -1;
++#endif
+ 	options->proxy_use_fdpass = -1;
+ 	options->ignored_unknown = NULL;
+ 	options->num_canonical_domains = 0;
+@@ -1817,6 +1881,35 @@ fill_default_options(Options * options)
+ 		options->server_alive_interval = 0;
+ 	if (options->server_alive_count_max == -1)
+ 		options->server_alive_count_max = 3;
++#ifdef NONE_CIPHER_ENABLED
++	if (options->none_switch == -1)
++		options->none_switch = 0;
++	if (options->none_enabled == -1)
++		options->none_enabled = 0;
++#endif
++#ifdef HPN_ENABLED
++	if (options->hpn_disabled == -1)
++		options->hpn_disabled = 0;
++	if (options->hpn_buffer_size > -1) {
++		/* if a user tries to set the size to 0 set it to 1KB */
++		if (options->hpn_buffer_size == 0)
++			options->hpn_buffer_size = 1;
++		/* limit the buffer to 64MB */
++		if (options->hpn_buffer_size > 64*1024) {
++			options->hpn_buffer_size = 64*1024*1024;
++			debug("User requested buffer larger than 64MB. Request"
++			    " reverted to 64MB");
++		} else
++			options->hpn_buffer_size *= 1024;
++		debug("hpn_buffer_size set to %d", options->hpn_buffer_size);
++	}
++	if (options->tcp_rcv_buf == 0)
++		options->tcp_rcv_buf = 1;
++	if (options->tcp_rcv_buf > -1)
++		options->tcp_rcv_buf *=1024;
++	if (options->tcp_rcv_buf_poll == -1)
++		options->tcp_rcv_buf_poll = 1;
++#endif
+ 	if (options->control_master == -1)
+ 		options->control_master = 0;
+ 	if (options->control_persist == -1) {
+--- a/readconf.h	2015-10-24 04:53:18.000000000 +0200
++++ b/readconf.h	2015-10-24 06:17:07.000000000 +0200
+@@ -105,6 +105,16 @@ typedef struct {
+ 	int	clear_forwardings;
+ 
+ 	int	enable_ssh_keysign;
++#ifdef NONE_CIPHER_ENABLED
++	int     none_switch;    /* Use none cipher */
++	int     none_enabled;   /* Allow none to be used */
++#endif
++#ifdef HPN_ENABLED
++	int     tcp_rcv_buf; /* user switch to set tcp recv buffer */
++	int     tcp_rcv_buf_poll; /* Option to poll recv buf every window transfer */
++	int     hpn_disabled;    /* Switch to disable HPN buffer management */
++	int     hpn_buffer_size; /* User definable size for HPN buffer window */
++#endif
+ 	int64_t rekey_limit;
+ 	int	rekey_interval;
+ 	int	no_host_authentication_for_localhost;
+--- a/scp.c	2015-10-24 04:53:18.000000000 +0200
++++ b/scp.c	2015-10-24 05:07:02.000000000 +0200
+@@ -750,7 +750,7 @@ source(int argc, char **argv)
+ 	off_t i, statbytes;
+ 	size_t amt, nr;
+ 	int fd = -1, haderr, indx;
+-	char *last, *name, buf[2048], encname[PATH_MAX];
++	char *last, *name, buf[16384], encname[PATH_MAX];
+ 	int len;
+ 
+ 	for (indx = 0; indx < argc; ++indx) {
+@@ -919,7 +919,7 @@ sink(int argc, char **argv)
+ 	off_t size, statbytes;
+ 	unsigned long long ull;
+ 	int setimes, targisdir, wrerrno = 0;
+-	char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
++	char ch, *cp, *np, *targ, *why, *vect[1], buf[16384];
+ 	struct timeval tv[2];
+ 
+ #define	atime	tv[0]
+--- a/servconf.c	2015-10-24 04:53:18.000000000 +0200
++++ b/servconf.c	2015-10-24 06:21:38.000000000 +0200
+@@ -165,6 +165,14 @@ initialize_server_options(ServerOptions 
+ 	options->authorized_principals_file = NULL;
+ 	options->authorized_principals_command = NULL;
+ 	options->authorized_principals_command_user = NULL;
++#ifdef NONE_CIPHER_ENABLED
++	options->none_enabled = -1;
++#endif
++#ifdef HPN_ENABLED
++	options->tcp_rcv_buf_poll = -1;
++	options->hpn_disabled = -1;
++	options->hpn_buffer_size = -1;
++#endif
+ 	options->ip_qos_interactive = -1;
+ 	options->ip_qos_bulk = -1;
+ 	options->version_addendum = NULL;
+@@ -329,6 +337,57 @@ fill_default_server_options(ServerOption
+ 	}
+ 	if (options->permit_tun == -1)
+ 		options->permit_tun = SSH_TUNMODE_NO;
++#ifdef NONE_CIPHER_ENABLED
++	if (options->none_enabled == -1)
++		options->none_enabled = 0;
++#endif
++#ifdef HPN_ENABLED
++	if (options->hpn_disabled == -1)
++		options->hpn_disabled = 0;
++
++	if (options->hpn_buffer_size == -1) {
++		/*
++		 * option not explicitly set. Now we have to figure out
++		 * what value to use.
++		 */
++		if (options->hpn_disabled == 1) {
++			options->hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT;
++		} else {
++			int sock, socksize;
++			socklen_t socksizelen = sizeof(socksize);
++
++			/*
++			 * get the current RCV size and set it to that
++			 * create a socket but don't connect it
++			 * we use that the get the rcv socket size
++			 */
++			sock = socket(AF_INET, SOCK_STREAM, 0);
++			getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++			    &socksize, &socksizelen);
++			close(sock);
++			options->hpn_buffer_size = socksize;
++			debug ("HPN Buffer Size: %d", options->hpn_buffer_size);
++		}
++	} else {
++		/*
++		 * we have to do this incase the user sets both values in a
++		 * contradictory manner. hpn_disabled overrrides
++		 * hpn_buffer_size
++		 */
++		if (options->hpn_disabled <= 0) {
++			if (options->hpn_buffer_size == 0)
++				options->hpn_buffer_size = 1;
++			/* limit the maximum buffer to 64MB */
++			if (options->hpn_buffer_size > 64*1024) {
++				options->hpn_buffer_size = 64*1024*1024;
++			} else {
++				options->hpn_buffer_size *= 1024;
++			}
++		} else
++			options->hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT;
++	}
++#endif
++
+ 	if (options->ip_qos_interactive == -1)
+ 		options->ip_qos_interactive = IPTOS_LOWDELAY;
+ 	if (options->ip_qos_bulk == -1)
+@@ -418,6 +477,12 @@ typedef enum {
+ 	sHostCertificate,
+ 	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
+ 	sAuthorizedPrincipalsCommand, sAuthorizedPrincipalsCommandUser,
++#ifdef NONE_CIPHER_ENABLED
++	sNoneEnabled,
++#endif
++#ifdef HPN_ENABLED
++	sTcpRcvBufPoll, sHPNDisabled, sHPNBufferSize,
++#endif
+ 	sKexAlgorithms, sIPQoS, sVersionAddendum,
+ 	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
+ 	sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
+@@ -549,6 +614,14 @@ static struct {
+ 	{ "revokedkeys", sRevokedKeys, SSHCFG_ALL },
+ 	{ "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL },
+ 	{ "authorizedprincipalsfile", sAuthorizedPrincipalsFile, SSHCFG_ALL },
++#ifdef NONE_CIPHER_ENABLED
++	{ "noneenabled", sNoneEnabled, SSHCFG_ALL },
++#endif
++#ifdef HPN_ENABLED
++	{ "hpndisabled", sHPNDisabled, SSHCFG_ALL },
++	{ "hpnbuffersize", sHPNBufferSize, SSHCFG_ALL },
++	{ "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL },
++#endif
+ 	{ "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL },
+ 	{ "ipqos", sIPQoS, SSHCFG_ALL },
+ 	{ "authorizedkeyscommand", sAuthorizedKeysCommand, SSHCFG_ALL },
+@@ -1169,6 +1242,25 @@ process_server_config_line(ServerOptions
+ 		intptr = &options->ignore_user_known_hosts;
+ 		goto parse_flag;
+ 
++#ifdef NONE_CIPHER_ENABLED
++	case sNoneEnabled:
++		intptr = &options->none_enabled;
++		goto parse_flag;
++#endif
++#ifdef HPN_ENABLED
++	case sTcpRcvBufPoll:
++		intptr = &options->tcp_rcv_buf_poll;
++		goto parse_flag;
++
++	case sHPNDisabled:
++		intptr = &options->hpn_disabled;
++		goto parse_flag;
++
++	case sHPNBufferSize:
++		intptr = &options->hpn_buffer_size;
++		goto parse_int;
++#endif
++
+ 	case sRhostsRSAAuthentication:
+ 		intptr = &options->rhosts_rsa_authentication;
+ 		goto parse_flag;
+--- a/servconf.h	2015-10-24 04:53:18.000000000 +0200
++++ b/servconf.h	2015-10-24 07:22:48.000000000 +0200
+@@ -173,6 +173,15 @@ typedef struct {
+ 
+ 	int	use_pam;		/* Enable auth via PAM */
+ 
++#ifdef NONE_CIPHER_ENABLED
++	int	none_enabled;		/* enable NONE cipher switch */
++#endif
++#ifdef HPN_ENABLED
++	int     tcp_rcv_buf_poll;       /* poll tcp rcv window in autotuning kernels*/
++	int	hpn_disabled;		/* disable hpn functionality. false by default */
++	int	hpn_buffer_size;	/* set the hpn buffer size - default 3MB */
++#endif
++
+ 	int	permit_tun;
+ 
+ 	int	num_permitted_opens;
+--- a/serverloop.c	2015-10-24 04:53:18.000000000 +0200
++++ b/serverloop.c	2015-10-24 05:07:02.000000000 +0200
+@@ -1051,6 +1051,12 @@ server_request_tun(void)
+ 	sock = tun_open(tun, mode);
+ 	if (sock < 0)
+ 		goto done;
++#ifdef HPN_ENABLED
++	if (!options.hpn_disabled)
++		c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
++		    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
++	else
++#endif
+ 	c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
+ 	    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
+ 	c->datagram = 1;
+@@ -1088,6 +1094,10 @@ server_request_session(void)
+ 	c = channel_new("session", SSH_CHANNEL_LARVAL,
+ 	    -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
+ 	    0, "server-session", 1);
++#ifdef HPN_ENABLED
++	if (options.tcp_rcv_buf_poll && !options.hpn_disabled)
++		c->dynamic_window = 1;
++#endif
+ 	if (session_open(the_authctxt, c->self) != 1) {
+ 		debug("session open failed, free channel %d", c->self);
+ 		channel_free(c);
+--- a/session.c	2015-10-24 04:53:18.000000000 +0200
++++ b/session.c	2015-10-24 05:07:02.000000000 +0200
+@@ -2329,6 +2329,14 @@ session_set_fds(Session *s, int fdin, in
+ 	 */
+ 	if (s->chanid == -1)
+ 		fatal("no channel for session %d", s->self);
++#ifdef HPN_ENABLED
++	if (!options.hpn_disabled)
++		channel_set_fds(s->chanid,
++		    fdout, fdin, fderr,
++		    ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
++		    1, is_tty, options.hpn_buffer_size);
++	else
++#endif
+ 	channel_set_fds(s->chanid,
+ 	    fdout, fdin, fderr,
+ 	    ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
+--- a/sftp.1	2015-10-24 04:53:18.000000000 +0200
++++ b/sftp.1	2015-10-24 05:07:02.000000000 +0200
+@@ -263,7 +263,8 @@ diagnostic messages from
+ Specify how many requests may be outstanding at any one time.
+ Increasing this may slightly improve file transfer speed
+ but will increase memory usage.
+-The default is 64 outstanding requests.
++The default is 256 outstanding requests providing for 8MB
++of outstanding data with a 32KB buffer.
+ .It Fl r
+ Recursively copy entire directories when uploading and downloading.
+ Note that
+--- a/sftp.c	2015-10-24 04:53:18.000000000 +0200
++++ b/sftp.c	2015-10-24 05:07:02.000000000 +0200
+@@ -71,7 +71,11 @@ typedef void EditLine;
+ #include "sftp-client.h"
+ 
+ #define DEFAULT_COPY_BUFLEN	32768	/* Size of buffer for up/download */
++#ifdef HPN_ENABLED
++#define DEFAULT_NUM_REQUESTS	256	/* # concurrent outstanding requests */
++#else
+ #define DEFAULT_NUM_REQUESTS	64	/* # concurrent outstanding requests */
++#endif
+ 
+ /* File to read commands from */
+ FILE* infile;
+--- a/ssh.c	2015-10-24 04:53:18.000000000 +0200
++++ b/ssh.c	2015-10-24 05:07:02.000000000 +0200
+@@ -884,6 +884,14 @@ main(int ac, char **av)
+ 			break;
+ 		case 'T':
+ 			options.request_tty = REQUEST_TTY_NO;
++#ifdef NONE_CIPHER_ENABLED
++			/*
++			 * ensure that the user doesn't try to backdoor a
++			 * null cipher switch on an interactive session
++			 * so explicitly disable it no matter what.
++			 */
++			options.none_switch = 0;
++#endif
+ 			break;
+ 		case 'o':
+ 			line = xstrdup(optarg);
+@@ -1834,9 +1842,85 @@ ssh_session2_open(void)
+ 	if (!isatty(err))
+ 		set_nonblock(err);
+ 
++#ifdef HPN_ENABLED
++	/*
++	 * we need to check to see if what they want to do about buffer
++	 * sizes here. In a hpn to nonhpn connection we want to limit
++	 * the window size to something reasonable in case the far side
++	 * has the large window bug. In hpn to hpn connection we want to
++	 * use the max window size but allow the user to override it
++	 * lastly if they disabled hpn then use the ssh std window size
++
++	 * so why don't we just do a getsockopt() here and set the
++	 * ssh window to that? In the case of a autotuning receive
++	 * window the window would get stuck at the initial buffer
++	 * size generally less than 96k. Therefore we need to set the
++	 * maximum ssh window size to the maximum hpn buffer size
++	 * unless the user has specifically set the tcprcvbufpoll
++	 * to no. In which case we *can* just set the window to the
++	 * minimum of the hpn buffer size and tcp receive buffer size
++	 */
++
++	if (tty_flag)
++		options.hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT;
++	else
++		options.hpn_buffer_size = 2*1024*1024;
++
++	if (datafellows & SSH_BUG_LARGEWINDOW) {
++		debug("HPN to Non-HPN Connection");
++	} else {
++		int sock, socksize;
++		socklen_t socksizelen = sizeof(socksize);
++
++		if (options.tcp_rcv_buf_poll <= 0) {
++			sock = socket(AF_INET, SOCK_STREAM, 0);
++			getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++			    &socksize, &socksizelen);
++			close(sock);
++			debug("socksize %d", socksize);
++			options.hpn_buffer_size = socksize;
++			debug ("HPNBufferSize set to TCP RWIN: %d",
++			    options.hpn_buffer_size);
++		} else {
++			if (options.tcp_rcv_buf > 0) {
++				/*
++				 * create a socket but don't connect it.
++				 * we use that the get the rcv socket size
++				 */
++				sock = socket(AF_INET, SOCK_STREAM, 0);
++				/*
++				 * if they are using the tcp_rcv_buf option
++				 * attempt to set the buffer size to that
++				 */
++				if (options.tcp_rcv_buf)
++					setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++					    (void *)&options.tcp_rcv_buf,
++					    sizeof(options.tcp_rcv_buf));
++				getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++				    &socksize, &socksizelen);
++				close(sock);
++				debug("socksize %d", socksize);
++				options.hpn_buffer_size = socksize;
++				debug ("HPNBufferSize set to user TCPRcvBuf: "
++				    "%d", options.hpn_buffer_size);
++			}
++		}
++	}
++
++	debug("Final hpn_buffer_size = %d", options.hpn_buffer_size);
++
++	window = options.hpn_buffer_size;
++
++	channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
++#else
+ 	window = CHAN_SES_WINDOW_DEFAULT;
++#endif
++
+ 	packetmax = CHAN_SES_PACKET_DEFAULT;
+ 	if (tty_flag) {
++#ifdef HPN_ENABLED
++		window = CHAN_SES_WINDOW_DEFAULT;
++#endif
+ 		window >>= 1;
+ 		packetmax >>= 1;
+ 	}
+@@ -1845,6 +1929,12 @@ ssh_session2_open(void)
+ 	    window, packetmax, CHAN_EXTENDED_WRITE,
+ 	    "client-session", /*nonblock*/0);
+ 
++#ifdef HPN_ENABLED
++	if (options.tcp_rcv_buf_poll > 0 && !options.hpn_disabled) {
++		c->dynamic_window = 1;
++		debug ("Enabled Dynamic Window Scaling");
++	}
++#endif
+ 	debug3("ssh_session2_open: channel_new: %d", c->self);
+ 
+ 	channel_send_open(c->self);
+--- a/sshconnect.c	2015-10-24 04:53:18.000000000 +0200
++++ b/sshconnect.c	2015-10-24 05:07:02.000000000 +0200
+@@ -266,6 +266,31 @@ ssh_kill_proxy_command(void)
+ 		kill(proxy_command_pid, SIGHUP);
+ }
+ 
++#ifdef HPN_ENABLED
++/*
++ * Set TCP receive buffer if requested.
++ * Note: tuning needs to happen after the socket is
++ * created but before the connection happens
++ * so winscale is negotiated properly -cjr
++ */
++static void
++ssh_set_socket_recvbuf(int sock)
++{
++	void *buf = (void *)&options.tcp_rcv_buf;
++	int sz = sizeof(options.tcp_rcv_buf);
++	int socksize;
++	socklen_t socksizelen = sizeof(socksize);
++
++	debug("setsockopt Attempting to set SO_RCVBUF to %d", options.tcp_rcv_buf);
++	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) >= 0) {
++	  getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &socksize, &socksizelen);
++	  debug("setsockopt SO_RCVBUF: %.100s %d", strerror(errno), socksize);
++	} else
++		error("Couldn't set socket receive buffer to %d: %.100s",
++		    options.tcp_rcv_buf, strerror(errno));
++}
++#endif
++
+ /*
+  * Creates a (possibly privileged) socket for use as the ssh connection.
+  */
+@@ -282,6 +307,11 @@ ssh_create_socket(int privileged, struct
+ 	}
+ 	fcntl(sock, F_SETFD, FD_CLOEXEC);
+ 
++#ifdef HPN_ENABLED
++	if (options.tcp_rcv_buf > 0)
++		ssh_set_socket_recvbuf(sock);
++#endif
++
+ 	/* Bind the socket to an alternative local IP address */
+ 	if (options.bind_address == NULL && !privileged)
+ 		return sock;
+@@ -523,11 +553,23 @@ send_client_banner(int connection_out, i
+ {
+ 	/* Send our own protocol version identification. */
+ 	if (compat20) {
+-		xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",
+-		    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
++		xasprintf(&client_version_string, "SSH-%d.%d-%.100s%s\r\n",
++		    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
++#ifdef HPN_ENABLED
++		    options.hpn_disabled ? "" : SSH_HPN
++#else
++		    ""
++#endif
++		    );
+ 	} else {
+-		xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n",
+-		    PROTOCOL_MAJOR_1, minor1, SSH_VERSION);
++		xasprintf(&client_version_string, "SSH-%d.%d-%.100s%s\n",
++		    PROTOCOL_MAJOR_1, minor1, SSH_VERSION,
++#ifdef HPN_ENABLED
++		    options.hpn_disabled ? "" : SSH_HPN
++#else
++		    ""
++#endif
++		    );
+ 	}
+ 	if (roaming_atomicio(vwrite, connection_out, client_version_string,
+ 	    strlen(client_version_string)) != strlen(client_version_string))
+--- a/sshconnect2.c	2015-10-24 04:53:18.000000000 +0200
++++ b/sshconnect2.c	2015-10-24 05:07:02.000000000 +0200
+@@ -80,6 +80,14 @@
+ extern char *client_version_string;
+ extern char *server_version_string;
+ extern Options options;
++#ifdef NONE_CIPHER_ENABLED
++struct kex *xxx_kex;
++
++/* tty_flag is set in ssh.c. use this in ssh_userauth2 */
++/* if it is set then prevent the switch to the null cipher */
++
++extern int tty_flag;
++#endif
+ 
+ /*
+  * SSH2 key exchange
+@@ -153,13 +161,16 @@ order_hostkeyalgs(char *host, struct soc
+ 	return ret;
+ }
+ 
++static char *myproposal[PROPOSAL_MAX];
++static const char *myproposal_default[PROPOSAL_MAX] = { KEX_CLIENT };
+ void
+ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
+ {
+-	char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
+ 	struct kex *kex;
+ 	int r;
+ 
++	memcpy(&myproposal, &myproposal_default, sizeof(myproposal));
++
+ 	xxx_host = host;
+ 	xxx_hostaddr = hostaddr;
+ 
+@@ -215,6 +226,10 @@ ssh_kex2(char *host, struct sockaddr *ho
+ 	kex->server_version_string=server_version_string;
+ 	kex->verify_host_key=&verify_host_key_callback;
+ 
++#ifdef NONE_CIPHER_ENABLED
++	xxx_kex = kex;
++#endif
++
+ 	dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
+ 
+ 	if (options.use_roaming && !kex->roaming) {
+@@ -416,6 +431,29 @@ ssh_userauth2(const char *local_user, co
+ 	pubkey_cleanup(&authctxt);
+ 	dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
+ 
++#ifdef NONE_CIPHER_ENABLED
++	/*
++	 * if the user wants to use the none cipher do it
++	 * post authentication and only if the right conditions are met
++	 * both of the NONE commands must be true and there must be no
++	 * tty allocated.
++	 */
++	if ((options.none_switch == 1) && (options.none_enabled == 1)) {
++		if (!tty_flag) { /* no null on tty sessions */
++			debug("Requesting none rekeying...");
++			myproposal[PROPOSAL_ENC_ALGS_STOC] = "none";
++			myproposal[PROPOSAL_ENC_ALGS_CTOS] = "none";
++			kex_prop2buf(xxx_kex->my, myproposal);
++			packet_request_rekeying();
++			fprintf(stderr, "WARNING: ENABLED NONE CIPHER\n");
++		} else {
++			/* requested NONE cipher when in a tty */
++			debug("Cannot switch to NONE cipher with tty allocated");
++			fprintf(stderr, "NONE cipher switch disabled when a TTY is allocated\n");
++		}
++	}
++#endif
++
+ 	debug("Authentication succeeded (%s).", authctxt.method->name);
+ }
+ 
+--- a/sshd.c	2015-10-24 04:53:18.000000000 +0200
++++ b/sshd.c	2015-10-24 05:36:38.000000000 +0200
+@@ -431,8 +431,11 @@ sshd_exchange_identification(int sock_in
+ 		minor = PROTOCOL_MINOR_1;
+ 	}
+ 
+-	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
++	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s%s",
+ 	    major, minor, SSH_VERSION,
++#ifdef HPN_ENABLED
++	    options.hpn_disabled ? "" : SSH_HPN,
++#endif
+ 	    *options.version_addendum == '\0' ? "" : " ",
+ 	    options.version_addendum, newline);
+ 
+@@ -1162,6 +1165,10 @@ server_listen(void)
+ 	int ret, listen_sock, on = 1;
+ 	struct addrinfo *ai;
+ 	char ntop[NI_MAXHOST], strport[NI_MAXSERV];
++#ifdef HPN_ENABLED
++	int socksize;
++	socklen_t socksizelen = sizeof(socksize);
++#endif
+ 
+ 	for (ai = options.listen_addrs; ai; ai = ai->ai_next) {
+ 		if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
+@@ -1202,6 +1209,13 @@ server_listen(void)
+ 
+ 		debug("Bind to port %s on %s.", strport, ntop);
+ 
++#ifdef HPN_ENABLED
++		getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF,
++				   &socksize, &socksizelen);
++		debug("Server TCP RWIN socket size: %d", socksize);
++		debug("HPN Buffer Size: %d", options.hpn_buffer_size);
++#endif
++
+ 		/* Bind the socket to the desired port. */
+ 		if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) {
+ 			error("Bind to port %s on %s failed: %.200s.",
+@@ -2152,6 +2166,11 @@ main(int ac, char **av)
+ 	    remote_ip, remote_port, laddr,  get_local_port());
+ 	free(laddr);
+ 
++#ifdef HPN_ENABLED
++	/* set the HPN options for the child */
++	channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
++#endif
++
+ 	/*
+ 	 * We don't want to listen forever unless the other side
+ 	 * successfully authenticates itself.  So we set up an alarm which is
+@@ -2555,6 +2574,14 @@ do_ssh2_kex(void)
+ 	myproposal[PROPOSAL_MAC_ALGS_CTOS] =
+ 	    myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
+ 
++#ifdef NONE_CIPHER_ENABLED
++        if (options.none_enabled == 1) {
++                debug ("WARNING: None cipher enabled");
++                myproposal[PROPOSAL_ENC_ALGS_CTOS] =
++                myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_proposal(KEX_ENCRYPT_INCLUDE_NONE);
++        }
++#endif
++
+ 	if (options.compression == COMP_NONE) {
+ 		myproposal[PROPOSAL_COMP_ALGS_CTOS] =
+ 		myproposal[PROPOSAL_COMP_ALGS_STOC] = "none";
+--- a/sshd_config	2015-10-24 04:53:18.000000000 +0200
++++ b/sshd_config	2015-10-24 07:19:47.000000000 +0200
+@@ -125,6 +125,20 @@ UsePrivilegeSeparation sandbox		# Defaul
+ # override default of no subsystems
+ Subsystem	sftp	/usr/libexec/sftp-server
+ 
++# the following are HPN related configuration options
++# tcp receive buffer polling. disable in non autotuning kernels
++#TcpRcvBufPoll yes
++
++# disable hpn performance boosts
++#HPNDisabled no
++
++# buffer size for hpn to non-hpn connections
++#HPNBufferSize 2048
++
++
++# allow the use of the none cipher
++#NoneEnabled no
++
+ # Example of overriding settings on a per-user basis
+ #Match User anoncvs
+ #	X11Forwarding no
+--- a/version.h	2015-10-24 04:53:19.000000000 +0200
++++ b/version.h	2015-10-24 05:07:02.000000000 +0200
+@@ -4,3 +4,4 @@
+ 
+ #define SSH_PORTABLE	"p1"
+ #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE
++#define SSH_HPN         "-hpn14v5"

Modified: trunk/dports/net/openssh/files/pam.patch
===================================================================
--- trunk/dports/net/openssh/files/pam.patch	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/pam.patch	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,6 +1,6 @@
---- a/servconf.c	2015-07-02 18:40:27.000000000 +0200
-+++ b/servconf.c	2015-07-02 18:43:00.000000000 +0200
-@@ -183,7 +183,7 @@ fill_default_server_options(ServerOption
+--- a/servconf.c	2015-08-21 06:49:03.000000000 +0200
++++ b/servconf.c	2015-10-24 04:40:13.000000000 +0200
+@@ -185,7 +185,7 @@ fill_default_server_options(ServerOption
  
  	/* Portable-specific options */
  	if (options->use_pam == -1)

Modified: trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff
===================================================================
--- trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,6 +1,6 @@
---- a/sandbox-darwin.c.orig	2014-02-12 01:31:10.000000000 +0100
-+++ b/sandbox-darwin.c	2014-02-12 01:31:54.000000000 +0100
-@@ -62,8 +62,16 @@
+--- a/sandbox-darwin.c	2015-08-21 06:49:03.000000000 +0200
++++ b/sandbox-darwin.c	2015-10-24 04:41:19.000000000 +0200
+@@ -62,8 +62,16 @@ ssh_sandbox_child(struct ssh_sandbox *bo
  	struct rlimit rl_zero;
  
  	debug3("%s: starting Darwin sandbox", __func__);

Modified: trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff
===================================================================
--- trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff	2015-10-25 10:29:54 UTC (rev 141652)
+++ trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff	2015-10-25 10:37:32 UTC (rev 141653)
@@ -1,6 +1,6 @@
---- a/sshd.c	2015-04-06 19:51:36.000000000 +0200
-+++ b/sshd.c	2015-04-06 19:51:53.000000000 +0200
-@@ -714,11 +714,18 @@ privsep_preauth(Authctxt *authctxt)
+--- a/sshd.c	2015-08-21 06:49:03.000000000 +0200
++++ b/sshd.c	2015-10-24 20:10:08.000000000 +0200
+@@ -715,11 +715,18 @@ privsep_preauth(Authctxt *authctxt)
  		set_log_handler(mm_log_handler, pmonitor);
  
  		/* Demote the child */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/93f112bd/attachment-0001.html>


More information about the macports-changes mailing list