<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[141653] trunk/dports/net/openssh</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/141653">141653</a></dd>
<dt>Author</dt> <dd>ionic@macports.org</dd>
<dt>Date</dt> <dd>2015-10-25 03:37:32 -0700 (Sun, 25 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>net/openssh: update to 7.1p1. Rebase patches. Fixes: #48552.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsnetopensshPortfile">trunk/dports/net/openssh/Portfile</a></li>
<li><a href="#trunkdportsnetopensshfiles0002Applekeychainintegrationotherchangespatch">trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch</a></li>
<li><a href="#trunkdportsnetopensshfileslaunchdpatch">trunk/dports/net/openssh/files/launchd.patch</a></li>
<li><a href="#trunkdportsnetopensshfilesopenssh67p1gsskexall20141021284f364patch">trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch</a></li>
<li><a href="#trunkdportsnetopensshfilespampatch">trunk/dports/net/openssh/files/pam.patch</a></li>
<li><a href="#trunkdportsnetopensshfilespatchsandboxdarwincapplesandboxnamedexternaldiff">trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff</a></li>
<li><a href="#trunkdportsnetopensshfilespatchsshdcapplesandboxnamedexternaldiff">trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportsnetopensshfilesopenssh71p1hpnssh14v5diff">trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkdportsnetopensshfilesopenssh69p1hpnssh14v5diff">trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsnetopensshPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/Portfile (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> PortSystem          1.0
</span><span class="cx"> 
</span><span class="cx"> name                openssh
</span><del>-version             6.9p1
-revision            2
</del><ins>+version             7.1p1
+revision            0
</ins><span class="cx"> categories          net
</span><span class="cx"> platforms           darwin
</span><span class="cx"> maintainers         nomaintainer
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx"> homepage            http://www.openbsd.org/openssh/
</span><span class="cx"> 
</span><span class="cx"> checksums           ${distfiles} \
</span><del>-                    rmd160  4fb2f0a0280db51024bf72b0f5cd3912d25cb59a \
-                    sha256  6e074df538f357d440be6cf93dc581a21f22d39e236f217fcd8eacbb6c896cfe
</del><ins>+                    rmd160  2c97ea10099fa8658156c0351d60d715655b9b07 \
+                    sha256  fc0a6d2d1d063d5c66dffd952493d0cda256cad204f681de0f84ef85b2ad8428
</ins><span class="cx"> 
</span><span class="cx"> master_sites        openbsd:OpenSSH/portable \
</span><span class="cx">                     ftp://ftp.cise.ufl.edu/pub/mirrors/openssh/portable/ \
</span><span class="lines">@@ -144,11 +144,13 @@
</span><span class="cx">     set hpn_patchfile       ${name}-${version}-hpnssh14v5.diff
</span><span class="cx">     patchfiles-append       ${hpn_patchfile}
</span><span class="cx"> 
</span><del>-    configure.cppflags-append -DHPN_ENABLED=1
</del><ins>+    use_autoreconf          yes
+
+    configure.args-append   --with-hpn
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> variant none_cipher conflicts gsskex requires hpn description {Enable optional NONE cipher in HPN patchset} {
</span><del>-    configure.cppflags-append -DNONE_CIPHER_ENABLED=1
</del><ins>+    configure.args-append   --with-nonecipher
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> variant gsskex conflicts hpn requires kerberos5 description &quot;Add OpenSSH GSSAPI key exchange patch&quot; {
</span><span class="lines">@@ -207,10 +209,6 @@
</span><span class="cx"> startupitem.name    OpenSSH
</span><span class="cx"> startupitem.start   \
</span><span class="cx">     &quot;if \[ -x ${prefix}/sbin/sshd ]; then
</span><del>-        if \[ ! -f ${prefix}/etc/ssh/ssh_host_key \]; then
-            ${prefix}/bin/ssh-keygen -t rsa1 -f \\
-            ${prefix}/etc/ssh/ssh_host_key -N \&quot;\&quot; -C `hostname`
-        fi
</del><span class="cx">         if \[ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key \]; then
</span><span class="cx">             ${prefix}/bin/ssh-keygen -t dsa -f \\
</span><span class="cx">             ${prefix}/etc/ssh/ssh_host_dsa_key -N \&quot;\&quot; -C `hostname`
</span></span></pre></div>
<a id="trunkdportsnetopensshfiles0002Applekeychainintegrationotherchangespatch"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/0002-Apple-keychain-integration-other-changes.patch (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><del>---- a/Makefile.in        2015-07-02 18:44:43.000000000 +0200
-+++ b/Makefile.in        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/Makefile.in        2015-08-21 06:49:03.000000000 +0200
++++ b/Makefile.in        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -59,6 +59,7 @@ SED=@SED@
</span><span class="cx">  ENT=@ENT@
</span><span class="cx">  XAUTH_PATH=@XAUTH_PATH@
</span><span class="lines">@@ -61,8 +61,8 @@
</span><span class="cx">          $(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
</span><span class="cx">          $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
</span><span class="cx">          $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
</span><del>---- a/audit-bsm.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/audit-bsm.c        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/audit-bsm.c        2015-08-21 06:49:03.000000000 +0200
++++ b/audit-bsm.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -263,7 +263,12 @@ bsm_audit_record(int typ, char *string, 
</span><span class="cx">          pid_t                pid = getpid();
</span><span class="cx">          AuditInfoTermID        tid = ssh_bsm_tid;
</span><span class="lines">@@ -77,8 +77,8 @@
</span><span class="cx">                  uid = the_authctxt-&gt;pw-&gt;pw_uid;
</span><span class="cx">                  gid = the_authctxt-&gt;pw-&gt;pw_gid;
</span><span class="cx">          }
</span><del>---- a/auth-pam.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/auth-pam.c        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/auth-pam.c        2015-08-21 06:49:03.000000000 +0200
++++ b/auth-pam.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -793,10 +793,11 @@ sshpam_query(void *ctx, char **name, cha
</span><span class="cx">                                  free(msg);
</span><span class="cx">                                  return (0);
</span><span class="lines">@@ -93,8 +93,8 @@
</span><span class="cx">                          /* FALLTHROUGH */
</span><span class="cx">                  default:
</span><span class="cx">                          *num = 0;
</span><del>---- a/auth.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/auth.c        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/auth.c        2015-08-21 06:49:03.000000000 +0200
++++ b/auth.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -212,7 +212,7 @@ allowed_user(struct passwd * pw)
</span><span class="cx">          }
</span><span class="cx">          if (options.num_deny_groups &gt; 0 || options.num_allow_groups &gt; 0) {
</span><span class="lines">@@ -104,8 +104,8 @@
</span><span class="cx">                          logit(&quot;User %.100s from %.100s not allowed because &quot;
</span><span class="cx">                              &quot;not in any group&quot;, pw-&gt;pw_name, hostname);
</span><span class="cx">                          return 0;
</span><del>---- a/authfd.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/authfd.c        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/authfd.c        2015-08-21 06:49:03.000000000 +0200
++++ b/authfd.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -165,6 +165,29 @@ ssh_request_reply(int sock, struct sshbu
</span><span class="cx">  }
</span><span class="cx">  
</span><span class="lines">@@ -136,8 +136,8 @@
</span><span class="cx">   * Closes the agent socket if it should be closed (depends on how it was
</span><span class="cx">   * obtained).  The argument must have been returned by
</span><span class="cx">   * ssh_get_authentication_socket().
</span><del>---- a/authfd.h        2015-07-02 18:44:43.000000000 +0200
-+++ b/authfd.h        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/authfd.h        2015-08-21 06:49:03.000000000 +0200
++++ b/authfd.h        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -43,6 +43,9 @@ int        ssh_agent_sign(int sock, struct sshk
</span><span class="cx">              u_char **sigp, size_t *lenp,
</span><span class="cx">              const u_char *data, size_t datalen, u_int compat);
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">  /* Messages for the authentication agent connection. */
</span><span class="cx">  #define SSH_AGENTC_REQUEST_RSA_IDENTITIES        1
</span><span class="cx">  #define SSH_AGENT_RSA_IDENTITIES_ANSWER                2
</span><del>-@@ -76,6 +78,9 @@ int        ssh_agent_sign(int sock, struct sshk
</del><ins>+@@ -76,6 +79,9 @@ int        ssh_agent_sign(int sock, struct sshk
</ins><span class="cx">  #define SSH2_AGENTC_ADD_ID_CONSTRAINED                25
</span><span class="cx">  #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
</span><span class="cx">  
</span><span class="lines">@@ -158,8 +158,8 @@
</span><span class="cx">  #define        SSH_AGENT_CONSTRAIN_LIFETIME                1
</span><span class="cx">  #define        SSH_AGENT_CONSTRAIN_CONFIRM                2
</span><span class="cx">  
</span><del>---- a/config.h.in        2015-07-02 18:44:44.000000000 +0200
-+++ b/config.h.in        2015-07-02 18:48:50.000000000 +0200
</del><ins>+--- a/config.h.in        2015-08-21 07:09:20.000000000 +0200
++++ b/config.h.in        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -78,6 +78,18 @@
</span><span class="cx">  /* FreeBSD strnvis argument order is swapped compared to OpenBSD */
</span><span class="cx">  #undef BROKEN_STRNVIS
</span><span class="lines">@@ -179,9 +179,9 @@
</span><span class="cx">  /* tcgetattr with ICANON may hang */
</span><span class="cx">  #undef BROKEN_TCGETATTR_ICANON
</span><span class="cx">  
</span><del>---- 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], [
</del><ins>+--- 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], [
</ins><span class="cx">  #endif
</span><span class="cx">          ])
</span><span class="cx">  
</span><span class="lines">@@ -222,8 +222,8 @@
</span><span class="cx">  if test &quot;x$ac_cv_func_getaddrinfo&quot; != &quot;xyes&quot; ; then
</span><span class="cx">          TEST_SSH_IPV6=no
</span><span class="cx">  else
</span><del>---- a/groupaccess.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/groupaccess.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/groupaccess.c        2015-08-21 06:49:03.000000000 +0200
++++ b/groupaccess.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -34,38 +34,67 @@
</span><span class="cx">  #include &lt;string.h&gt;
</span><span class="cx">  #include &lt;limits.h&gt;
</span><span class="lines">@@ -332,8 +332,8 @@
</span><span class="cx">          return 0;
</span><span class="cx">  }
</span><span class="cx">  
</span><del>---- a/groupaccess.h        2015-07-02 18:44:43.000000000 +0200
-+++ b/groupaccess.h        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/groupaccess.h        2015-08-21 06:49:03.000000000 +0200
++++ b/groupaccess.h        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -27,7 +27,7 @@
</span><span class="cx">  #ifndef GROUPACCESS_H
</span><span class="cx">  #define GROUPACCESS_H
</span><span class="lines">@@ -343,8 +343,8 @@
</span><span class="cx">  int         ga_match(char * const *, int);
</span><span class="cx">  int         ga_match_pattern_list(const char *);
</span><span class="cx">  void         ga_free(void);
</span><del>---- a/keychain.c        1970-01-01 01:00:00.000000000 +0100
-+++ b/keychain.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- /dev/null        1970-01-01 00:00:00.000000000 +0000
++++ b/keychain.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -0,0 +1,694 @@
</span><span class="cx"> +/*
</span><span class="cx"> + * Copyright (c) 2007 Apple Inc. All rights reserved.
</span><span class="lines">@@ -1040,8 +1040,8 @@
</span><span class="cx"> +#endif
</span><span class="cx"> +
</span><span class="cx"> +}
</span><del>---- a/keychain.h        1970-01-01 01:00:00.000000000 +0100
-+++ b/keychain.h        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- /dev/null        1970-01-01 00:00:00.000000000 +0000
++++ b/keychain.h        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -0,0 +1,45 @@
</span><span class="cx"> +/*
</span><span class="cx"> + * Copyright (c) 2007 Apple Inc. All rights reserved.
</span><span class="lines">@@ -1088,8 +1088,8 @@
</span><span class="cx"> +int         add_identities_using_keychain(
</span><span class="cx"> +             int (*add_identity)(const char *, const char *));
</span><span class="cx"> +char        *keychain_read_passphrase(const char *filename, int oAskPassGUI);
</span><del>---- a/readconf.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/readconf.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/readconf.c        2015-08-21 06:49:03.000000000 +0200
++++ b/readconf.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -155,6 +155,9 @@ typedef enum {
</span><span class="cx">          oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
</span><span class="cx">          oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
</span><span class="lines">@@ -1099,10 +1099,10 @@
</span><span class="cx"> +#endif
</span><span class="cx">          oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
</span><span class="cx">          oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
</span><del>-         oIgnoredUnknownOption, oDeprecated, oUnsupported
-@@ -276,6 +279,9 @@ static struct {
-         { &quot;updatehostkeys&quot;, oUpdateHostkeys },
</del><ins>+         oPubkeyAcceptedKeyTypes,
+@@ -278,6 +281,9 @@ static struct {
</ins><span class="cx">          { &quot;hostbasedkeytypes&quot;, oHostbasedKeyTypes },
</span><ins>+         { &quot;pubkeyacceptedkeytypes&quot;, oPubkeyAcceptedKeyTypes },
</ins><span class="cx">          { &quot;ignoreunknown&quot;, oIgnoreUnknown },
</span><span class="cx"> +#ifdef __APPLE_KEYCHAIN__
</span><span class="cx"> +        { &quot;askpassgui&quot;, oAskPassGUI },
</span><span class="lines">@@ -1110,7 +1110,7 @@
</span><span class="cx">  
</span><span class="cx">          { NULL, oBadOption }
</span><span class="cx">  };
</span><del>-@@ -1386,6 +1392,12 @@ parse_int:
</del><ins>+@@ -1391,6 +1397,12 @@ parse_keytypes:
</ins><span class="cx">                  charptr = &amp;options-&gt;ignored_unknown;
</span><span class="cx">                  goto parse_string;
</span><span class="cx">  
</span><span class="lines">@@ -1133,7 +1133,7 @@
</span><span class="cx">          options-&gt;num_canonical_domains = 0;
</span><span class="cx">          options-&gt;num_permitted_cnames = 0;
</span><span class="cx">          options-&gt;canonicalize_max_dots = -1;
</span><del>-@@ -1845,6 +1860,10 @@ fill_default_options(Options * options)
</del><ins>+@@ -1843,6 +1858,10 @@ fill_default_options(Options * options)
</ins><span class="cx">                  options-&gt;ip_qos_bulk = IPTOS_THROUGHPUT;
</span><span class="cx">          if (options-&gt;request_tty == -1)
</span><span class="cx">                  options-&gt;request_tty = REQUEST_TTY_AUTO;
</span><span class="lines">@@ -1144,10 +1144,10 @@
</span><span class="cx">          if (options-&gt;proxy_use_fdpass == -1)
</span><span class="cx">                  options-&gt;proxy_use_fdpass = 0;
</span><span class="cx">          if (options-&gt;canonicalize_max_dots == -1)
</span><del>---- 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;
</del><ins>+--- 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;
</ins><span class="cx">  
</span><span class="cx">          char        *ignored_unknown; /* Pattern list of unknown tokens to ignore */
</span><span class="cx"> +
</span><span class="lines">@@ -1157,8 +1157,8 @@
</span><span class="cx">  }       Options;
</span><span class="cx">  
</span><span class="cx">  #define SSH_CANONICALISE_NO        0
</span><del>---- a/scp.1        2015-07-02 18:44:43.000000000 +0200
-+++ b/scp.1        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/scp.1        2015-08-21 06:49:03.000000000 +0200
++++ b/scp.1        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -19,7 +19,7 @@
</span><span class="cx">  .Sh SYNOPSIS
</span><span class="cx">  .Nm scp
</span><span class="lines">@@ -1177,8 +1177,8 @@
</span><span class="cx">  .It Fl c Ar cipher
</span><span class="cx">  Selects the cipher to use for encrypting the data transfer.
</span><span class="cx">  This option is directly passed to
</span><del>---- a/scp.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/scp.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/scp.c        2015-08-21 06:49:03.000000000 +0200
++++ b/scp.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -78,6 +78,9 @@
</span><span class="cx">  #ifdef HAVE_SYS_STAT_H
</span><span class="cx">  # include &lt;sys/stat.h&gt;
</span><span class="lines">@@ -1431,8 +1431,8 @@
</span><span class="cx">              &quot;           [-l limit] [-o ssh_option] [-P port] [-S program]\n&quot;
</span><span class="cx">              &quot;           [[user@]host1:]file1 ... [[user@]host2:]file2\n&quot;);
</span><span class="cx">          exit(1);
</span><del>---- a/servconf.c        2015-07-02 18:44:44.000000000 +0200
-+++ b/servconf.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/servconf.c        2015-10-24 21:56:23.000000000 +0200
++++ b/servconf.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -280,7 +280,7 @@ fill_default_server_options(ServerOption
</span><span class="cx">          if (options-&gt;gss_strict_acceptor == -1)
</span><span class="cx">                  options-&gt;gss_strict_acceptor = 0;
</span><span class="lines">@@ -1442,7 +1442,7 @@
</span><span class="cx">          if (options-&gt;kbd_interactive_authentication == -1)
</span><span class="cx">                  options-&gt;kbd_interactive_authentication = 0;
</span><span class="cx">          if (options-&gt;challenge_response_authentication == -1)
</span><del>-@@ -739,7 +739,7 @@ match_cfg_line_group(const char *grps, i
</del><ins>+@@ -751,7 +751,7 @@ match_cfg_line_group(const char *grps, i
</ins><span class="cx">          if ((pw = getpwnam(user)) == NULL) {
</span><span class="cx">                  debug(&quot;Can't match group at line %d because user %.100s does &quot;
</span><span class="cx">                      &quot;not exist&quot;, line, user);
</span><span class="lines">@@ -1451,8 +1451,8 @@
</span><span class="cx">                  debug(&quot;Can't Match group because user %.100s not in any group &quot;
</span><span class="cx">                      &quot;at line %d&quot;, user, line);
</span><span class="cx">          } else if (ga_match_pattern_list(grps) != 1) {
</span><del>---- a/session.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/session.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/session.c        2015-08-21 06:49:03.000000000 +0200
++++ b/session.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -2114,8 +2114,10 @@ session_pty_req(Session *s)
</span><span class="cx">                  n_bytes = packet_remaining();
</span><span class="cx">          tty_parse_modes(s-&gt;ttyfd, &amp;n_bytes);
</span><span class="lines">@@ -1476,8 +1476,8 @@
</span><span class="cx">  
</span><span class="cx">          /*
</span><span class="cx">           * Close the server side of the socket pairs.  We must do this after
</span><del>---- a/ssh-add.0        2015-07-02 18:44:44.000000000 +0200
-+++ b/ssh-add.0        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/ssh-add.0        2015-08-21 07:08:30.000000000 +0200
++++ b/ssh-add.0        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -4,7 +4,7 @@ NAME
</span><span class="cx">       ssh-add M-bM-^@M-^S adds private key identities to the authentication agent
</span><span class="cx">  
</span><span class="lines">@@ -1501,8 +1501,8 @@
</span><span class="cx">       -s pkcs11
</span><span class="cx">               Add keys provided by the PKCS#11 shared library pkcs11.
</span><span class="cx">  
</span><del>---- a/ssh-add.1        2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-add.1        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/ssh-add.1        2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-add.1        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -43,7 +43,7 @@
</span><span class="cx">  .Nd adds private key identities to the authentication agent
</span><span class="cx">  .Sh SYNOPSIS
</span><span class="lines">@@ -1526,8 +1526,8 @@
</span><span class="cx">  .It Fl s Ar pkcs11
</span><span class="cx">  Add keys provided by the PKCS#11 shared library
</span><span class="cx">  .Ar pkcs11 .
</span><del>---- a/ssh-add.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-add.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/ssh-add.c        2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-add.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -65,6 +65,7 @@
</span><span class="cx">  #include &quot;misc.h&quot;
</span><span class="cx">  #include &quot;ssherr.h&quot;
</span><span class="lines">@@ -1607,7 +1607,7 @@
</span><span class="cx">                          else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
</span><span class="cx">                                  fprintf(stderr,
</span><span class="cx">                                      &quot;Error loading key \&quot;%s\&quot;: %s\n&quot;,
</span><del>-@@ -445,13 +470,13 @@ lock_agent(int agent_fd, int lock)
</del><ins>+@@ -444,13 +469,13 @@ lock_agent(int agent_fd, int lock)
</ins><span class="cx">  }
</span><span class="cx">  
</span><span class="cx">  static int
</span><span class="lines">@@ -1624,7 +1624,7 @@
</span><span class="cx">                          return -1;
</span><span class="cx">          }
</span><span class="cx">          return 0;
</span><del>-@@ -474,6 +499,11 @@ usage(void)
</del><ins>+@@ -473,6 +498,11 @@ usage(void)
</ins><span class="cx">          fprintf(stderr, &quot;  -X          Unlock agent.\n&quot;);
</span><span class="cx">          fprintf(stderr, &quot;  -s pkcs11   Add keys from PKCS#11 provider.\n&quot;);
</span><span class="cx">          fprintf(stderr, &quot;  -e pkcs11   Remove keys provided by PKCS#11 provider.\n&quot;);
</span><span class="lines">@@ -1636,7 +1636,7 @@
</span><span class="cx">  }
</span><span class="cx">  
</span><span class="cx">  int
</span><del>-@@ -485,6 +515,7 @@ main(int argc, char **argv)
</del><ins>+@@ -484,6 +514,7 @@ main(int argc, char **argv)
</ins><span class="cx">          char *pkcs11provider = NULL;
</span><span class="cx">          int r, i, ch, deleting = 0, ret = 0, key_only = 0;
</span><span class="cx">          int xflag = 0, lflag = 0, Dflag = 0;
</span><span class="lines">@@ -1644,7 +1644,7 @@
</span><span class="cx">  
</span><span class="cx">          /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
</span><span class="cx">          sanitise_stdfd();
</span><del>-@@ -511,7 +542,7 @@ main(int argc, char **argv)
</del><ins>+@@ -510,7 +541,7 @@ main(int argc, char **argv)
</ins><span class="cx">                  exit(2);
</span><span class="cx">          }
</span><span class="cx">  
</span><span class="lines">@@ -1653,7 +1653,7 @@
</span><span class="cx">                  switch (ch) {
</span><span class="cx">                  case 'E':
</span><span class="cx">                          fingerprint_hash = ssh_digest_alg_by_name(optarg);
</span><del>-@@ -556,6 +587,13 @@ main(int argc, char **argv)
</del><ins>+@@ -555,6 +586,13 @@ main(int argc, char **argv)
</ins><span class="cx">                                  goto done;
</span><span class="cx">                          }
</span><span class="cx">                          break;
</span><span class="lines">@@ -1667,7 +1667,7 @@
</span><span class="cx">                  default:
</span><span class="cx">                          usage();
</span><span class="cx">                          ret = 1;
</span><del>-@@ -604,7 +642,7 @@ main(int argc, char **argv)
</del><ins>+@@ -603,7 +641,7 @@ main(int argc, char **argv)
</ins><span class="cx">                              default_files[i]);
</span><span class="cx">                          if (stat(buf, &amp;st) &lt; 0)
</span><span class="cx">                                  continue;
</span><span class="lines">@@ -1676,7 +1676,7 @@
</span><span class="cx">                                  ret = 1;
</span><span class="cx">                          else
</span><span class="cx">                                  count++;
</span><del>-@@ -613,7 +651,7 @@ main(int argc, char **argv)
</del><ins>+@@ -612,7 +650,7 @@ main(int argc, char **argv)
</ins><span class="cx">                          ret = 1;
</span><span class="cx">          } else {
</span><span class="cx">                  for (i = 0; i &lt; argc; i++) {
</span><span class="lines">@@ -1685,8 +1685,8 @@
</span><span class="cx">                              argv[i]) == -1)
</span><span class="cx">                                  ret = 1;
</span><span class="cx">                  }
</span><del>---- a/ssh-agent.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-agent.c        2015-07-02 18:54:09.000000000 +0200
</del><ins>+--- a/ssh-agent.c        2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-agent.c        2015-10-24 23:19:13.000000000 +0200
</ins><span class="cx"> @@ -71,6 +71,9 @@
</span><span class="cx">  #ifdef HAVE_UTIL_H
</span><span class="cx">  # include &lt;util.h&gt;
</span><span class="lines">@@ -1695,9 +1695,9 @@
</span><span class="cx"> +#include &lt;launch.h&gt;
</span><span class="cx"> +#endif
</span><span class="cx">  
</span><del>- #include &quot;key.h&quot;        /* XXX for typedef */
- #include &quot;buffer.h&quot;        /* XXX for typedef */
-@@ -81,11 +84,13 @@
</del><ins>+ #include &quot;xmalloc.h&quot;
+ #include &quot;ssh.h&quot;
+@@ -78,11 +81,14 @@
</ins><span class="cx">  #include &quot;sshbuf.h&quot;
</span><span class="cx">  #include &quot;sshkey.h&quot;
</span><span class="cx">  #include &quot;authfd.h&quot;
</span><span class="lines">@@ -1708,10 +1708,11 @@
</span><span class="cx">  #include &quot;digest.h&quot;
</span><span class="cx">  #include &quot;ssherr.h&quot;
</span><span class="cx"> +#include &quot;keychain.h&quot;
</span><ins>++#include &quot;key.h&quot;
</ins><span class="cx">  
</span><span class="cx">  #ifdef ENABLE_PKCS11
</span><span class="cx">  #include &quot;ssh-pkcs11.h&quot;
</span><del>-@@ -831,6 +836,61 @@ process_remove_smartcard_key(SocketEntry
</del><ins>+@@ -828,6 +834,61 @@ process_remove_smartcard_key(SocketEntry
</ins><span class="cx">  }
</span><span class="cx">  #endif /* ENABLE_PKCS11 */
</span><span class="cx">  
</span><span class="lines">@@ -1764,8 +1765,8 @@
</span><span class="cx"> +
</span><span class="cx"> +        /* e will be NULL when ssh-agent adds keys on its own at startup */
</span><span class="cx"> +        if (e) {
</span><del>-+                buffer_put_int(&amp;e-&gt;output, 1);
-+                buffer_put_char(&amp;e-&gt;output,
</del><ins>++                buffer_put_int(e-&gt;output, 1);
++                buffer_put_char(e-&gt;output,
</ins><span class="cx"> +                    result ? SSH_AGENT_FAILURE : SSH_AGENT_SUCCESS);
</span><span class="cx"> +        }
</span><span class="cx"> +}
</span><span class="lines">@@ -1773,7 +1774,7 @@
</span><span class="cx">  /* dispatch incoming messages */
</span><span class="cx">  
</span><span class="cx">  static void
</span><del>-@@ -925,6 +985,9 @@ process_message(SocketEntry *e)
</del><ins>+@@ -922,6 +983,9 @@ process_message(SocketEntry *e)
</ins><span class="cx">                  process_remove_smartcard_key(e);
</span><span class="cx">                  break;
</span><span class="cx">  #endif /* ENABLE_PKCS11 */
</span><span class="lines">@@ -1783,7 +1784,7 @@
</span><span class="cx">          default:
</span><span class="cx">                  /* Unknown message.  Respond with failure. */
</span><span class="cx">                  error(&quot;Unknown message %d&quot;, type);
</span><del>-@@ -1175,7 +1238,11 @@ usage(void)
</del><ins>+@@ -1172,7 +1236,11 @@ usage(void)
</ins><span class="cx">  int
</span><span class="cx">  main(int ac, char **av)
</span><span class="cx">  {
</span><span class="lines">@@ -1795,7 +1796,7 @@
</span><span class="cx">          int sock, fd, ch, result, saved_errno;
</span><span class="cx">          u_int nalloc;
</span><span class="cx">          char *shell, *format, *pidstr, *agentsocket = NULL;
</span><del>-@@ -1210,7 +1277,11 @@ main(int ac, char **av)
</del><ins>+@@ -1207,7 +1275,11 @@ main(int ac, char **av)
</ins><span class="cx">          __progname = ssh_get_progname(av[0]);
</span><span class="cx">          seed_rng();
</span><span class="cx">  
</span><span class="lines">@@ -1807,7 +1808,7 @@
</span><span class="cx">                  switch (ch) {
</span><span class="cx">                  case 'E':
</span><span class="cx">                          fingerprint_hash = ssh_digest_alg_by_name(optarg);
</span><del>-@@ -1225,6 +1296,11 @@ main(int ac, char **av)
</del><ins>+@@ -1222,6 +1294,11 @@ main(int ac, char **av)
</ins><span class="cx">                  case 'k':
</span><span class="cx">                          k_flag++;
</span><span class="cx">                          break;
</span><span class="lines">@@ -1819,7 +1820,7 @@
</span><span class="cx">                  case 's':
</span><span class="cx">                          if (c_flag)
</span><span class="cx">                                  usage();
</span><del>-@@ -1256,7 +1332,11 @@ main(int ac, char **av)
</del><ins>+@@ -1253,7 +1330,11 @@ main(int ac, char **av)
</ins><span class="cx">          ac -= optind;
</span><span class="cx">          av += optind;
</span><span class="cx">  
</span><span class="lines">@@ -1831,7 +1832,7 @@
</span><span class="cx">                  usage();
</span><span class="cx">  
</span><span class="cx">          if (ac == 0 &amp;&amp; !c_flag &amp;&amp; !s_flag) {
</span><del>-@@ -1312,6 +1392,53 @@ main(int ac, char **av)
</del><ins>+@@ -1309,6 +1390,53 @@ main(int ac, char **av)
</ins><span class="cx">           * Create socket early so it will exist before command gets run from
</span><span class="cx">           * the parent.
</span><span class="cx">           */
</span><span class="lines">@@ -1885,7 +1886,7 @@
</span><span class="cx">          prev_mask = umask(0177);
</span><span class="cx">          sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0);
</span><span class="cx">          if (sock &lt; 0) {
</span><del>-@@ -1320,6 +1447,14 @@ main(int ac, char **av)
</del><ins>+@@ -1317,6 +1445,14 @@ main(int ac, char **av)
</ins><span class="cx">                  cleanup_exit(1);
</span><span class="cx">          }
</span><span class="cx">          umask(prev_mask);
</span><span class="lines">@@ -1900,7 +1901,7 @@
</span><span class="cx">  
</span><span class="cx">          /*
</span><span class="cx">           * Fork, and have the parent execute the command, if any, or present
</span><del>-@@ -1396,6 +1531,7 @@ skip:
</del><ins>+@@ -1393,6 +1529,7 @@ skip:
</ins><span class="cx">          pkcs11_init(0);
</span><span class="cx">  #endif
</span><span class="cx">          new_socket(AUTH_SOCKET, sock);
</span><span class="lines">@@ -1908,7 +1909,7 @@
</span><span class="cx">          if (ac &gt; 0)
</span><span class="cx">                  parent_alive_interval = 10;
</span><span class="cx">          idtab_init();
</span><del>-@@ -1405,6 +1541,10 @@ skip:
</del><ins>+@@ -1402,6 +1539,10 @@ skip:
</ins><span class="cx">          signal(SIGTERM, cleanup_handler);
</span><span class="cx">          nalloc = 0;
</span><span class="cx">  
</span><span class="lines">@@ -1919,8 +1920,8 @@
</span><span class="cx">          while (1) {
</span><span class="cx">                  prepare_select(&amp;readsetp, &amp;writesetp, &amp;max_fd, &amp;nalloc, &amp;tvp);
</span><span class="cx">                  result = select(max_fd + 1, readsetp, writesetp, NULL, tvp);
</span><del>---- a/ssh-keysign.8        2015-07-02 18:44:43.000000000 +0200
-+++ b/ssh-keysign.8        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/ssh-keysign.8        2015-08-21 06:49:03.000000000 +0200
++++ b/ssh-keysign.8        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -72,6 +72,9 @@ accessible to others.
</span><span class="cx">  Since they are readable only by root,
</span><span class="cx">  .Nm
</span><span class="lines">@@ -1931,8 +1932,8 @@
</span><span class="cx">  .Pp
</span><span class="cx">  .It Pa /etc/ssh/ssh_host_dsa_key-cert.pub
</span><span class="cx">  .It Pa /etc/ssh/ssh_host_ecdsa_key-cert.pub
</span><del>---- a/sshconnect1.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/sshconnect1.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/sshconnect1.c        2015-08-21 06:49:03.000000000 +0200
++++ b/sshconnect1.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -51,6 +51,7 @@
</span><span class="cx">  #include &quot;auth.h&quot;
</span><span class="cx">  #include &quot;digest.h&quot;
</span><span class="lines">@@ -1952,8 +1953,8 @@
</span><span class="cx">                          passphrase = read_passphrase(buf, 0);
</span><span class="cx">                          if (strcmp(passphrase, &quot;&quot;) != 0) {
</span><span class="cx">                                  private = key_load_private_type(KEY_RSA1,
</span><del>---- a/sshconnect2.c        2015-07-02 18:44:43.000000000 +0200
-+++ b/sshconnect2.c        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/sshconnect2.c        2015-08-21 06:49:03.000000000 +0200
++++ b/sshconnect2.c        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -71,6 +71,7 @@
</span><span class="cx">  #include &quot;uidswap.h&quot;
</span><span class="cx">  #include &quot;hostfile.h&quot;
</span><span class="lines">@@ -1962,7 +1963,7 @@
</span><span class="cx">  
</span><span class="cx">  #ifdef GSSAPI
</span><span class="cx">  #include &quot;ssh-gss.h&quot;
</span><del>-@@ -1143,6 +1144,10 @@ load_identity_file(char *filename, int u
</del><ins>+@@ -1136,6 +1137,10 @@ load_identity_file(char *filename, int u
</ins><span class="cx">                  if (i == 0)
</span><span class="cx">                          passphrase = &quot;&quot;;
</span><span class="cx">                  else {
</span><span class="lines">@@ -1973,9 +1974,9 @@
</span><span class="cx">                          passphrase = read_passphrase(prompt, 0);
</span><span class="cx">                          if (*passphrase == '\0') {
</span><span class="cx">                                  debug2(&quot;no passphrase given, try next key&quot;);
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">  
</span><span class="cx">  SEE ALSO
</span><span class="cx">       scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),
</span><span class="lines">@@ -1985,9 +1986,9 @@
</span><span class="cx">  
</span><span class="cx">  AUTHORS
</span><span class="cx">       OpenSSH is a derivative of the original and free ssh 1.2.12 release by
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">  .Xr ssh-keygen 1 ,
</span><span class="cx">  .Xr ssh-keyscan 1 ,
</span><span class="cx">  .Xr chroot 2 ,
</span><span class="lines">@@ -1998,9 +1999,9 @@
</span><span class="cx">  .Xr sftp-server 8
</span><span class="cx">  .Sh AUTHORS
</span><span class="cx">  OpenSSH is a derivative of the original and free
</span><del>---- 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)
</del><ins>+--- 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)
</ins><span class="cx">          audit_event(SSH_AUTH_SUCCESS);
</span><span class="cx">  #endif
</span><span class="cx">  
</span><span class="lines">@@ -2013,7 +2014,7 @@
</span><span class="cx">  #ifdef GSSAPI
</span><span class="cx">          if (options.gss_authentication) {
</span><span class="cx">                  temporarily_use_uid(authctxt-&gt;pw);
</span><del>-@@ -2236,12 +2242,6 @@ main(int ac, char **av)
</del><ins>+@@ -2240,12 +2246,6 @@ main(int ac, char **av)
</ins><span class="cx">                  restore_uid();
</span><span class="cx">          }
</span><span class="cx">  #endif
</span><span class="lines">@@ -2026,8 +2027,8 @@
</span><span class="cx">  
</span><span class="cx">          /*
</span><span class="cx">           * In privilege separation, we fork another child and prepare
</span><del>---- a/sshd_config        2015-07-02 18:44:43.000000000 +0200
-+++ b/sshd_config        2015-07-02 18:48:51.000000000 +0200
</del><ins>+--- a/sshd_config        2015-08-21 06:49:03.000000000 +0200
++++ b/sshd_config        2015-10-24 21:56:30.000000000 +0200
</ins><span class="cx"> @@ -35,7 +35,7 @@
</span><span class="cx">  
</span><span class="cx">  # Logging
</span><span class="lines">@@ -2061,9 +2062,9 @@
</span><span class="cx">  
</span><span class="cx">  #AllowAgentForwarding yes
</span><span class="cx">  #AllowTcpForwarding yes
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">  
</span><span class="cx">       PasswordAuthentication
</span><span class="cx">               Specifies whether password authentication is allowed.  The
</span><span class="lines">@@ -2072,7 +2073,7 @@
</span><span class="cx">  
</span><span class="cx">       PermitEmptyPasswords
</span><span class="cx">               When password authentication is allowed, it specifies whether the
</span><del>-@@ -891,7 +891,7 @@ DESCRIPTION
</del><ins>+@@ -948,7 +948,7 @@ DESCRIPTION
</ins><span class="cx">               either PasswordAuthentication or ChallengeResponseAuthentication.
</span><span class="cx">  
</span><span class="cx">               If UsePAM is enabled, you will not be able to run sshd(8) as a
</span><span class="lines">@@ -2081,9 +2082,9 @@
</span><span class="cx">  
</span><span class="cx">       UsePrivilegeSeparation
</span><span class="cx">               Specifies whether sshd(8) separates privileges by creating an
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">  .It Cm PasswordAuthentication
</span><span class="cx">  Specifies whether password authentication is allowed.
</span><span class="cx">  The default is
</span><span class="lines">@@ -2092,7 +2093,7 @@
</span><span class="cx">  .It Cm PermitEmptyPasswords
</span><span class="cx">  When password authentication is allowed, it specifies whether the
</span><span class="cx">  server allows login to accounts with empty password strings.
</span><del>-@@ -1498,7 +1498,7 @@ is enabled, you will not be able to run
</del><ins>+@@ -1574,7 +1574,7 @@ is enabled, you will not be able to run
</ins><span class="cx">  .Xr sshd 8
</span><span class="cx">  as a non-root user.
</span><span class="cx">  The default is
</span></span></pre></div>
<a id="trunkdportsnetopensshfileslaunchdpatch"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/launchd.patch (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><del>---- a/channels.c        2015-07-02 18:36:28.000000000 +0200
-+++ b/channels.c        2015-07-02 18:37:07.000000000 +0200
</del><ins>+--- a/channels.c        2015-08-21 06:49:03.000000000 +0200
++++ b/channels.c        2015-10-24 04:37:00.000000000 +0200
</ins><span class="cx"> @@ -4037,15 +4037,35 @@ x11_connect_display(void)
</span><span class="cx">           * connection to the real X server.
</span><span class="cx">           */
</span><span class="lines">@@ -43,9 +43,9 @@
</span><span class="cx">          }
</span><span class="cx">  #endif
</span><span class="cx">          /*
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">          struct stat st;
</span><span class="cx">          u_int now, x11_timeout_real;
</span><span class="cx">  
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">          xauthdir = xauthfile = NULL;
</span><span class="cx">          *_proto = proto;
</span><span class="cx">          *_data = data;
</span><del>-@@ -329,6 +333,33 @@ client_x11_get_proto(const char *display
</del><ins>+@@ -330,6 +334,33 @@ client_x11_get_proto(const char *display
</ins><span class="cx">                          debug(&quot;x11_get_proto: DISPLAY not set&quot;);
</span><span class="cx">                          return;
</span><span class="cx">                  }
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">                  /*
</span><span class="cx">                   * Handle FamilyLocal case where $DISPLAY does
</span><span class="cx">                   * not match an authorization entry.  For this we
</span><del>-@@ -420,6 +451,9 @@ client_x11_get_proto(const char *display
</del><ins>+@@ -421,6 +452,9 @@ client_x11_get_proto(const char *display
</ins><span class="cx">          if (!got_data) {
</span><span class="cx">                  u_int32_t rnd = 0;
</span><span class="cx">  
</span></span></pre></div>
<a id="trunkdportsnetopensshfilesopenssh67p1gsskexall20141021284f364patch"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/openssh-6.7p1-gsskex-all-20141021-284f364.patch (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -24,12 +24,12 @@
</span><span class="cx"> 
</span><span class="cx"> Updated by: Mihai Moldovan &lt;ionic@macports.org&gt;
</span><span class="cx"> Patch-Name: openssh-6.7p1-gsskex-all-20141021-284f364.patch
</span><del>-Abstract: Updated for OpenSSH 6.8p1 with MacPorts patches for integration
</del><ins>+Abstract: Updated for OpenSSH 7.1p1 with MacPorts patches for integration
</ins><span class="cx">           with Apple's launchd, pam, sandbox and KeyChain.
</span><span class="cx">           WARNING: the commit ID does NOT match this patch. It is merely
</span><span class="cx">                    provided for reference.
</span><del>-Last-Updated: 2015-07-02
-X-Ref: http://pkgs.fedoraproject.org/cgit/openssh.git/tree/openssh-6.6p1-gsskex.patch?id=1cfd53f089c7c8b2afa839c80c90b56b4c16fb78
</del><ins>+Last-Updated: 2015-10-24
+X-Ref: http://pkgs.fedoraproject.org/cgit/openssh.git/tree/openssh-6.6p1-gsskex.patch?id=2feb7b59e2ffab2b5cde0d6d2b2af33515b30ee2
</ins><span class="cx"> ---
</span><span class="cx">  ChangeLog.gssapi | 113 +++++++++++++++++++
</span><span class="cx">  Makefile.in      |   3 +-
</span><span class="lines">@@ -69,11 +69,8 @@
</span><span class="cx">  create mode 100644 kexgssc.c
</span><span class="cx">  create mode 100644 kexgsss.c
</span><span class="cx"> 
</span><del>-diff --git a/ChangeLog.gssapi b/ChangeLog.gssapi
-new file mode 100644
-index 0000000..f117a33
---- /dev/null
-+++ b/ChangeLog.gssapi
</del><ins>+--- /dev/null        1970-01-01 00:00:00.000000000 +0000
++++ b/ChangeLog.gssapi        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -0,0 +1,113 @@
</span><span class="cx"> +20110101
</span><span class="cx"> +  - Finally update for OpenSSH 5.6p1
</span><span class="lines">@@ -188,10 +185,8 @@
</span><span class="cx"> +    add support for GssapiTrustDns option for gssapi-with-mic
</span><span class="cx"> +    (from jbasney AT ncsa.uiuc.edu)
</span><span class="cx"> +    &lt;gssapi-with-mic support is Bugzilla #1008&gt;
</span><del>-diff --git a/Makefile.in b/Makefile.in
-index 06be3d5..086d8dd 100644
---- a/Makefile.in
-+++ b/Makefile.in
</del><ins>+--- a/Makefile.in        2015-10-24 08:11:05.000000000 +0200
++++ b/Makefile.in        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -92,7 +92,8 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
</span><span class="cx">          sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o \
</span><span class="cx">          kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
</span><span class="lines">@@ -211,10 +206,8 @@
</span><span class="cx">          loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
</span><span class="cx">          sftp-server.o sftp-common.o \
</span><span class="cx">          roaming_common.o roaming_serv.o \
</span><del>-diff --git a/auth-krb5.c b/auth-krb5.c
-index 0089b18..ec47869 100644
---- a/auth-krb5.c
-+++ b/auth-krb5.c
</del><ins>+--- a/auth-krb5.c        2015-10-24 08:11:05.000000000 +0200
++++ b/auth-krb5.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -183,8 +183,13 @@ auth_krb5_password(Authctxt *authctxt, c
</span><span class="cx">  
</span><span class="cx">          len = strlen(authctxt-&gt;krb5_ticket_file) + 6;
</span><span class="lines">@@ -262,10 +255,8 @@
</span><span class="cx">  
</span><span class="cx">          return (krb5_cc_resolve(ctx, ccname, ccache));
</span><span class="cx">  }
</span><del>-diff --git a/auth2-gss.c b/auth2-gss.c
-index 447f896..284f364 100644
---- a/auth2-gss.c
-+++ b/auth2-gss.c
</del><ins>+--- a/auth2-gss.c        2015-10-24 08:11:05.000000000 +0200
++++ b/auth2-gss.c        2015-10-24 08:43:51.000000000 +0200
</ins><span class="cx"> @@ -1,7 +1,7 @@
</span><span class="cx">  /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
</span><span class="cx">  
</span><span class="lines">@@ -275,11 +266,10 @@
</span><span class="cx">   *
</span><span class="cx">   * Redistribution and use in source and binary forms, with or without
</span><span class="cx">   * modification, are permitted provided that the following conditions
</span><del>-@@ -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);
</del><ins>+@@ -54,6 +54,40 @@ static int input_gssapi_exchange_complet
</ins><span class="cx">  static int input_gssapi_errtok(int, u_int32_t, void *);
</span><span class="cx">  
</span><del>-+/* 
</del><ins>+ /*
</ins><span class="cx"> + * The 'gssapi_keyex' userauth mechanism.
</span><span class="cx"> + */
</span><span class="cx"> +static int
</span><span class="lines">@@ -302,20 +292,21 @@
</span><span class="cx"> +        gssbuf.length = buffer_len(&amp;b);
</span><span class="cx"> +
</span><span class="cx"> +        /* gss_kex_context is NULL with privsep, so we can't check it here */
</span><del>-+        if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context, 
</del><ins>++        if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context,
</ins><span class="cx"> +            &amp;gssbuf, &amp;mic))))
</span><span class="cx"> +                authenticated = PRIVSEP(ssh_gssapi_userok(authctxt-&gt;user,
</span><span class="cx"> +                    authctxt-&gt;pw));
</span><del>-+        
</del><ins>++
</ins><span class="cx"> +        buffer_free(&amp;b);
</span><span class="cx"> +        free(mic.value);
</span><span class="cx"> +
</span><span class="cx"> +        return (authenticated);
</span><span class="cx"> +}
</span><span class="cx"> +
</span><del>- /*
</del><ins>++/*
</ins><span class="cx">   * We only support those mechanisms that we know about (ie ones that we know
</span><span class="cx">   * how to check local user kuserok and the like)
</span><ins>+  */
</ins><span class="cx"> @@ -238,7 +272,8 @@ input_gssapi_exchange_complete(int type,
</span><span class="cx">  
</span><span class="cx">          packet_check_eom();
</span><span class="lines">@@ -331,7 +322,7 @@
</span><span class="cx">  
</span><span class="cx">          if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &amp;gssbuf, &amp;mic))))
</span><span class="cx"> -                authenticated = PRIVSEP(ssh_gssapi_userok(authctxt-&gt;user));
</span><del>-+                authenticated = 
</del><ins>++                authenticated =
</ins><span class="cx"> +                    PRIVSEP(ssh_gssapi_userok(authctxt-&gt;user, authctxt-&gt;pw));
</span><span class="cx">          else
</span><span class="cx">                  logit(&quot;GSSAPI MIC check failed&quot;);
</span><span class="lines">@@ -349,10 +340,8 @@
</span><span class="cx">  Authmethod method_gssapi = {
</span><span class="cx">          &quot;gssapi-with-mic&quot;,
</span><span class="cx">          userauth_gssapi,
</span><del>-diff --git a/auth2.c b/auth2.c
-index d9b440a..2f0d565 100644
---- a/auth2.c
-+++ b/auth2.c
</del><ins>+--- a/auth2.c        2015-10-24 08:11:05.000000000 +0200
++++ b/auth2.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -70,6 +70,7 @@ extern Authmethod method_passwd;
</span><span class="cx">  extern Authmethod method_kbdint;
</span><span class="cx">  extern Authmethod method_hostbased;
</span><span class="lines">@@ -369,11 +358,9 @@
</span><span class="cx">          &amp;method_gssapi,
</span><span class="cx">  #endif
</span><span class="cx">          &amp;method_passwd,
</span><del>-diff --git a/clientloop.c b/clientloop.c
-index 397c965..f9175e3 100644
---- a/clientloop.c
-+++ b/clientloop.c
-@@ -114,6 +114,10 @@
</del><ins>+--- 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 @@
</ins><span class="cx">  #include &quot;ssherr.h&quot;
</span><span class="cx">  #include &quot;hostfile.h&quot;
</span><span class="cx">  
</span><span class="lines">@@ -384,7 +371,7 @@
</span><span class="cx">  /* import options */
</span><span class="cx">  extern Options options;
</span><span class="cx">  
</span><del>-@@ -1643,6 +1647,15 @@ client_loop(int have_pty, int escape_cha
</del><ins>+@@ -1644,6 +1648,15 @@ client_loop(int have_pty, int escape_cha
</ins><span class="cx">                  /* Do channel operations unless rekeying in progress. */
</span><span class="cx">                  if (!rekeying) {
</span><span class="cx">                          channel_after_select(readset, writeset);
</span><span class="lines">@@ -400,10 +387,8 @@
</span><span class="cx">                          if (need_rekeying || packet_need_rekeying()) {
</span><span class="cx">                                  debug(&quot;need rekeying&quot;);
</span><span class="cx">                                  active_state-&gt;kex-&gt;done = 0;
</span><del>-diff --git a/config.h.in b/config.h.in
-index 16d6206..a9a8b7a 100644
---- a/config.h.in
-+++ b/config.h.in
</del><ins>+--- a/config.h.in        2015-10-24 08:11:05.000000000 +0200
++++ b/config.h.in        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -1635,6 +1635,9 @@
</span><span class="cx">  /* Use btmp to log bad logins */
</span><span class="cx">  #undef USE_BTMP
</span><span class="lines">@@ -424,78 +409,8 @@
</span><span class="cx">  /* Define if you have Solaris process contracts */
</span><span class="cx">  #undef USE_SOLARIS_PROCESS_CONTRACTS
</span><span class="cx">  
</span><del>-diff --git a/configure b/configure
-index 6815388..ea5f200 100755
---- a/configure
-+++ b/configure
-@@ -7281,6 +7281,63 @@ cat &gt;&gt;confdefs.h &lt;&lt;\_ACEOF
- #define NO_ATTRIBUTE_ON_RETURN_TYPE 1
- _ACEOF

-+        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking if we have the Security Authorization Session API&quot; &gt;&amp;5
-+$as_echo_n &quot;checking if we have the Security Authorization Session API... &quot; &gt;&amp;6; }
-+        cat confdefs.h - &lt;&lt;_ACEOF &gt;conftest.$ac_ext
-+/* end confdefs.h.  */
-+#include &lt;Security/AuthSession.h&gt;
-+int
-+main ()
-+{
-+SessionCreate(0, 0);
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_compile &quot;$LINENO&quot;; then :
-+  ac_cv_use_security_session_api=&quot;yes&quot;
-+
-+$as_echo &quot;#define USE_SECURITY_SESSION_API 1&quot; &gt;&gt;confdefs.h
-+
-+                 LIBS=&quot;$LIBS -framework Security&quot;
-+                 { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: yes&quot; &gt;&amp;5
-+$as_echo &quot;yes&quot; &gt;&amp;6; }
-+else
-+  ac_cv_use_security_session_api=&quot;no&quot;
-+                 { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-+$as_echo &quot;no&quot; &gt;&amp;6; }
-+fi
-+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-+        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking if we have an in-memory credentials cache&quot; &gt;&amp;5
-+$as_echo_n &quot;checking if we have an in-memory credentials cache... &quot; &gt;&amp;6; }
-+        cat confdefs.h - &lt;&lt;_ACEOF &gt;conftest.$ac_ext
-+/* end confdefs.h.  */
-+#include &lt;Kerberos/Kerberos.h&gt;
-+int
-+main ()
-+{
-+cc_context_t c;
-+                 (void) cc_initialize (&amp;c, 0, NULL, NULL);
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_compile &quot;$LINENO&quot;; then :
-+
-+$as_echo &quot;#define USE_CCAPI 1&quot; &gt;&gt;confdefs.h
-+
-+                 LIBS=&quot;$LIBS -framework Security&quot;
-+                 { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: yes&quot; &gt;&amp;5
-+$as_echo &quot;yes&quot; &gt;&amp;6; }
-+                 if test &quot;x$ac_cv_use_security_session_api&quot; = &quot;xno&quot;; then
-+                        as_fn_error $? &quot;*** Need a security framework to use the credentials cache API ***&quot; &quot;$LINENO&quot; 5
-+                fi
-+else
-+  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-+$as_echo &quot;no&quot; &gt;&amp;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
</del><ins>+--- a/configure.ac        2015-10-24 08:11:05.000000000 +0200
++++ b/configure.ac        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -625,6 +625,30 @@ main() { if (NSVersionOfRunTimeLibrary(&quot;
</span><span class="cx">              [Use tunnel device compatibility to OpenBSD])
</span><span class="cx">          AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
</span><span class="lines">@@ -527,10 +442,8 @@
</span><span class="cx">          m4_pattern_allow([AU_IPv])
</span><span class="cx">          AC_CHECK_DECL([AU_IPv4], [], 
</span><span class="cx">              AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
</span><del>-diff --git a/gss-genr.c b/gss-genr.c
-index b39281b..1e569ad 100644
---- a/gss-genr.c
-+++ b/gss-genr.c
</del><ins>+--- a/gss-genr.c        2015-10-24 08:11:05.000000000 +0200
++++ b/gss-genr.c        2015-10-24 08:56:32.000000000 +0200
</ins><span class="cx"> @@ -1,7 +1,7 @@
</span><span class="cx">  /* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
</span><span class="cx">  
</span><span class="lines">@@ -568,7 +481,7 @@
</span><span class="cx"> +
</span><span class="cx"> +static ssh_gss_kex_mapping *gss_enc2oid = NULL;
</span><span class="cx"> +
</span><del>-+int 
</del><ins>++int
</ins><span class="cx"> +ssh_gssapi_oid_table_ok(void) {
</span><span class="cx"> +        return (gss_enc2oid != NULL);
</span><span class="cx"> +}
</span><span class="lines">@@ -641,7 +554,7 @@
</span><span class="cx"> +                            sizeof(KEX_GSS_GEX_SHA1_ID) - 1);
</span><span class="cx"> +                        buffer_append(&amp;buf, encoded, enclen);
</span><span class="cx"> +                        buffer_put_char(&amp;buf, ',');
</span><del>-+                        buffer_append(&amp;buf, KEX_GSS_GRP1_SHA1_ID, 
</del><ins>++                        buffer_append(&amp;buf, KEX_GSS_GRP1_SHA1_ID,
</ins><span class="cx"> +                            sizeof(KEX_GSS_GRP1_SHA1_ID) - 1);
</span><span class="cx"> +                        buffer_append(&amp;buf, encoded, enclen);
</span><span class="cx"> +                        buffer_put_char(&amp;buf, ',');
</span><span class="lines">@@ -674,7 +587,7 @@
</span><span class="cx"> +gss_OID
</span><span class="cx"> +ssh_gssapi_id_kex(Gssctxt *ctx, char *name, int kex_type) {
</span><span class="cx"> +        int i = 0;
</span><del>-+        
</del><ins>++
</ins><span class="cx"> +        switch (kex_type) {
</span><span class="cx"> +        case KEX_GSS_GRP1_SHA1:
</span><span class="cx"> +                if (strlen(name) &lt; sizeof(KEX_GSS_GRP1_SHA1_ID))
</span><span class="lines">@@ -877,10 +790,8 @@
</span><span class="cx"> +}
</span><span class="cx"> +
</span><span class="cx">  #endif /* GSSAPI */
</span><del>-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
</del><ins>+--- 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
</ins><span class="cx"> @@ -1,7 +1,7 @@
</span><span class="cx">  /* $OpenBSD: gss-serv-krb5.c,v 1.8 2013/07/20 01:55:13 djm Exp $ */
</span><span class="cx">  
</span><span class="lines">@@ -941,7 +852,7 @@
</span><span class="cx">  }
</span><span class="cx">  
</span><span class="cx"> +int
</span><del>-+ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store, 
</del><ins>++ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store,
</ins><span class="cx"> +    ssh_gssapi_client *client)
</span><span class="cx"> +{
</span><span class="cx"> +        krb5_ccache ccache = NULL;
</span><span class="lines">@@ -957,7 +868,7 @@
</span><span class="cx"> +               }
</span><span class="cx"> +        
</span><span class="cx"> +        /* Find out who the principal in this cache is */
</span><del>-+        if ((problem = krb5_cc_get_principal(krb_context, ccache, 
</del><ins>++        if ((problem = krb5_cc_get_principal(krb_context, ccache,
</ins><span class="cx"> +            &amp;principal))) {
</span><span class="cx"> +                logit(&quot;krb5_cc_get_principal(): %.100s&quot;,
</span><span class="cx"> +                    krb5_get_err_text(krb_context, problem));
</span><span class="lines">@@ -1018,10 +929,8 @@
</span><span class="cx">  };
</span><span class="cx">  
</span><span class="cx">  #endif /* KRB5 */
</span><del>-diff --git a/gss-serv.c b/gss-serv.c
-index 5c59924..50fa438 100644
---- a/gss-serv.c
-+++ b/gss-serv.c
</del><ins>+--- a/gss-serv.c        2015-10-24 08:11:05.000000000 +0200
++++ b/gss-serv.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -1,7 +1,7 @@
</span><span class="cx">  /* $OpenBSD: gss-serv.c,v 1.29 2015/05/22 03:50:02 djm Exp $ */
</span><span class="cx">  
</span><span class="lines">@@ -1314,10 +1223,8 @@
</span><span class="cx">  }
</span><span class="cx">  
</span><span class="cx">  #endif
</span><del>-diff --git a/kex.c b/kex.c
-index a173e70..891852b 100644
---- a/kex.c
-+++ b/kex.c
</del><ins>+--- a/kex.c        2015-10-24 08:11:05.000000000 +0200
++++ b/kex.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -55,6 +55,10 @@
</span><span class="cx">  #include &quot;sshbuf.h&quot;
</span><span class="cx">  #include &quot;digest.h&quot;
</span><span class="lines">@@ -1357,10 +1264,8 @@
</span><span class="cx">          return NULL;
</span><span class="cx">  }
</span><span class="cx">  
</span><del>-diff --git a/kex.h b/kex.h
-index 4c40ec8..c179a4d 100644
---- a/kex.h
-+++ b/kex.h
</del><ins>+--- a/kex.h        2015-10-24 08:11:05.000000000 +0200
++++ b/kex.h        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -93,6 +93,11 @@ enum kex_exchange {
</span><span class="cx">          KEX_DH_GEX_SHA256,
</span><span class="cx">          KEX_ECDH_SHA2,
</span><span class="lines">@@ -1385,8 +1290,8 @@
</span><span class="cx"> +#endif
</span><span class="cx">          char        *client_version_string;
</span><span class="cx">          char        *server_version_string;
</span><del>-         int        (*verify_host_key)(struct sshkey *, struct ssh *);
-@@ -184,6 +195,11 @@ int         kexecdh_server(struct ssh *);
</del><ins>+         char        *failed_choice;
+@@ -187,6 +198,11 @@ int         kexecdh_server(struct ssh *);
</ins><span class="cx">  int         kexc25519_client(struct ssh *);
</span><span class="cx">  int         kexc25519_server(struct ssh *);
</span><span class="cx">  
</span><span class="lines">@@ -1398,11 +1303,8 @@
</span><span class="cx">  int         kex_dh_hash(const char *, const char *,
</span><span class="cx">      const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
</span><span class="cx">      const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
</span><del>-diff --git a/kexgssc.c b/kexgssc.c
-new file mode 100644
-index 0000000..92a31c5
---- /dev/null
-+++ b/kexgssc.c
</del><ins>+--- /dev/null        1970-01-01 00:00:00.000000000 +0000
++++ b/kexgssc.c        2015-10-24 09:15:13.000000000 +0200
</ins><span class="cx"> @@ -0,0 +1,339 @@
</span><span class="cx"> +/*
</span><span class="cx"> + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
</span><span class="lines">@@ -1460,11 +1362,11 @@
</span><span class="cx"> +        Gssctxt *ctxt;
</span><span class="cx"> +        OM_uint32 maj_status, min_status, ret_flags;
</span><span class="cx"> +        u_int klen, kout, slen = 0, strlen;
</span><del>-+        DH *dh; 
</del><ins>++        DH *dh;
</ins><span class="cx"> +        BIGNUM *dh_server_pub = NULL;
</span><span class="cx"> +        BIGNUM *shared_secret = NULL;
</span><span class="cx"> +        BIGNUM *p = NULL;
</span><del>-+        BIGNUM *g = NULL;        
</del><ins>++        BIGNUM *g = NULL;
</ins><span class="cx"> +        u_char *kbuf;
</span><span class="cx"> +        u_char *serverhostkey = NULL;
</span><span class="cx"> +        u_char *empty = &quot;&quot;;
</span><span class="lines">@@ -1476,16 +1378,16 @@
</span><span class="cx"> +        u_char hash[SSH_DIGEST_MAX_LENGTH];
</span><span class="cx"> +        size_t hashlen;
</span><span class="cx"> +
</span><del>-+        /* Initialise our GSSAPI world */        
</del><ins>++        /* Initialise our GSSAPI world */
</ins><span class="cx"> +        ssh_gssapi_build_ctx(&amp;ctxt);
</span><del>-+        if (ssh_gssapi_id_kex(ctxt, kex-&gt;name, kex-&gt;kex_type) 
</del><ins>++        if (ssh_gssapi_id_kex(ctxt, kex-&gt;name, kex-&gt;kex_type)
</ins><span class="cx"> +            == GSS_C_NO_OID)
</span><span class="cx"> +                fatal(&quot;Couldn't identify host exchange&quot;);
</span><span class="cx"> +
</span><span class="cx"> +        if (ssh_gssapi_import_name(ctxt, kex-&gt;gss_host))
</span><span class="cx"> +                fatal(&quot;Couldn't import hostname&quot;);
</span><span class="cx"> +
</span><del>-+        if (kex-&gt;gss_client &amp;&amp; 
</del><ins>++        if (kex-&gt;gss_client &amp;&amp;
</ins><span class="cx"> +            ssh_gssapi_client_identity(ctxt, kex-&gt;gss_client))
</span><span class="cx"> +                fatal(&quot;Couldn't acquire client credentials&quot;);
</span><span class="cx"> +
</span><span class="lines">@@ -1525,7 +1427,7 @@
</span><span class="cx"> +        default:
</span><span class="cx"> +                fatal(&quot;%s: Unexpected KEX type %d&quot;, __func__, kex-&gt;kex_type);
</span><span class="cx"> +        }
</span><del>-+        
</del><ins>++
</ins><span class="cx"> +        /* Step 1 - e is dh-&gt;pub_key */
</span><span class="cx"> +        dh_gen_key(dh, kex-&gt;we_need * 8);
</span><span class="cx"> +
</span><span class="lines">@@ -1535,7 +1437,7 @@
</span><span class="cx"> +                fatal(&quot;dh_server_pub == NULL&quot;);
</span><span class="cx"> +
</span><span class="cx"> +        token_ptr = GSS_C_NO_BUFFER;
</span><del>-+                         
</del><ins>++
</ins><span class="cx"> +        do {
</span><span class="cx"> +                debug(&quot;Calling gss_init_sec_context&quot;);
</span><span class="cx"> +                
</span><span class="lines">@@ -1566,9 +1468,9 @@
</span><span class="cx"> +                                fatal(&quot;Integrity check failed&quot;);
</span><span class="cx"> +                }
</span><span class="cx"> +
</span><del>-+                /* 
</del><ins>++                /*
</ins><span class="cx"> +                 * If we have data to send, then the last message that we
</span><del>-+                 * received cannot have been a 'complete'. 
</del><ins>++                 * received cannot have been a 'complete'.
</ins><span class="cx"> +                 */
</span><span class="cx"> +                if (send_tok.length != 0) {
</span><span class="cx"> +                        if (first) {
</span><span class="lines">@@ -1586,13 +1488,13 @@
</span><span class="cx"> +                        gss_release_buffer(&amp;min_status, &amp;send_tok);
</span><span class="cx"> +
</span><span class="cx"> +                        /* If we've sent them data, they should reply */
</span><del>-+                        do {        
</del><ins>++                        do {
</ins><span class="cx"> +                                type = packet_read();
</span><span class="cx"> +                                if (type == SSH2_MSG_KEXGSS_HOSTKEY) {
</span><span class="cx"> +                                        debug(&quot;Received KEXGSS_HOSTKEY&quot;);
</span><span class="cx"> +                                        if (serverhostkey)
</span><span class="cx"> +                                                fatal(&quot;Server host key received more than once&quot;);
</span><del>-+                                        serverhostkey = 
</del><ins>++                                        serverhostkey =
</ins><span class="cx"> +                                            packet_get_string(&amp;slen);
</span><span class="cx"> +                                }
</span><span class="cx"> +                        } while (type == SSH2_MSG_KEXGSS_HOSTKEY);
</span><span class="lines">@@ -1600,20 +1502,20 @@
</span><span class="cx"> +                        switch (type) {
</span><span class="cx"> +                        case SSH2_MSG_KEXGSS_CONTINUE:
</span><span class="cx"> +                                debug(&quot;Received GSSAPI_CONTINUE&quot;);
</span><del>-+                                if (maj_status == GSS_S_COMPLETE) 
</del><ins>++                                if (maj_status == GSS_S_COMPLETE)
</ins><span class="cx"> +                                        fatal(&quot;GSSAPI Continue received from server when complete&quot;);
</span><span class="cx"> +                                recv_tok.value = packet_get_string(&amp;strlen);
</span><del>-+                                recv_tok.length = strlen; 
</del><ins>++                                recv_tok.length = strlen;
</ins><span class="cx"> +                                break;
</span><span class="cx"> +                        case SSH2_MSG_KEXGSS_COMPLETE:
</span><span class="cx"> +                                debug(&quot;Received GSSAPI_COMPLETE&quot;);
</span><span class="cx"> +                                packet_get_bignum2(dh_server_pub);
</span><span class="cx"> +                                msg_tok.value =  packet_get_string(&amp;strlen);
</span><del>-+                                msg_tok.length = strlen; 
</del><ins>++                                msg_tok.length = strlen;
</ins><span class="cx"> +
</span><span class="cx"> +                                /* Is there a token included? */
</span><span class="cx"> +                                if (packet_get_char()) {
</span><del>-+                                        recv_tok.value=
</del><ins>++                                        recv_tok.value =
</ins><span class="cx"> +                                            packet_get_string(&amp;strlen);
</span><span class="cx"> +                                        recv_tok.length = strlen;
</span><span class="cx"> +                                        /* If we're already complete - protocol error */
</span><span class="lines">@@ -1634,7 +1536,7 @@
</span><span class="cx"> +                                fatal(&quot;GSSAPI Error: \n%.400s&quot;,msg);
</span><span class="cx"> +                        default:
</span><span class="cx"> +                                packet_disconnect(&quot;Protocol error: didn't expect packet type %d&quot;,
</span><del>-+                                    type);
</del><ins>++                                type);
</ins><span class="cx"> +                        }
</span><span class="cx"> +                        token_ptr = &amp;recv_tok;
</span><span class="cx"> +                } else {
</span><span class="lines">@@ -1644,9 +1546,9 @@
</span><span class="cx"> +                }
</span><span class="cx"> +        } while (maj_status &amp; GSS_S_CONTINUE_NEEDED);
</span><span class="cx"> +
</span><del>-+        /* 
-+         * We _must_ have received a COMPLETE message in reply from the 
-+         * server, which will have set dh_server_pub and msg_tok 
</del><ins>++        /*
++         * We _must_ have received a COMPLETE message in reply from the
++         * server, which will have set dh_server_pub and msg_tok
</ins><span class="cx"> +         */
</span><span class="cx"> +
</span><span class="cx"> +        if (type != SSH2_MSG_KEXGSS_COMPLETE)
</span><span class="lines">@@ -1677,7 +1579,7 @@
</span><span class="cx"> +        switch (kex-&gt;kex_type) {
</span><span class="cx"> +        case KEX_GSS_GRP1_SHA1:
</span><span class="cx"> +        case KEX_GSS_GRP14_SHA1:
</span><del>-+                kex_dh_hash( kex-&gt;client_version_string, 
</del><ins>++                kex_dh_hash( kex-&gt;client_version_string,
</ins><span class="cx"> +                    kex-&gt;server_version_string,
</span><span class="cx"> +                    buffer_ptr(kex-&gt;my), buffer_len(kex-&gt;my),
</span><span class="cx"> +                    buffer_ptr(kex-&gt;peer), buffer_len(kex-&gt;peer),
</span><span class="lines">@@ -1696,7 +1598,7 @@
</span><span class="cx"> +                    buffer_ptr(kex-&gt;my), buffer_len(kex-&gt;my),
</span><span class="cx"> +                    buffer_ptr(kex-&gt;peer), buffer_len(kex-&gt;peer),
</span><span class="cx"> +                    (serverhostkey ? serverhostkey : empty), slen,
</span><del>-+                     min, nbits, max,
</del><ins>++                    min, nbits, max,
</ins><span class="cx"> +                    dh-&gt;p, dh-&gt;g,
</span><span class="cx"> +                    dh-&gt;pub_key,
</span><span class="cx"> +                    dh_server_pub,
</span><span class="lines">@@ -1743,11 +1645,8 @@
</span><span class="cx"> +}
</span><span class="cx"> +
</span><span class="cx"> +#endif /* GSSAPI */
</span><del>-diff --git a/kexgsss.c b/kexgsss.c
-new file mode 100644
-index 0000000..6a0ece8
---- /dev/null
-+++ b/kexgsss.c
</del><ins>+--- /dev/null        1970-01-01 00:00:00.000000000 +0000
++++ b/kexgsss.c        2015-10-24 09:22:08.000000000 +0200
</ins><span class="cx"> @@ -0,0 +1,300 @@
</span><span class="cx"> +/*
</span><span class="cx"> + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
</span><span class="lines">@@ -1807,12 +1706,12 @@
</span><span class="cx"> +        int r = 0;
</span><span class="cx"> +
</span><span class="cx"> +        OM_uint32 maj_status, min_status;
</span><del>-+        
-+        /* 
</del><ins>++
++        /*
</ins><span class="cx"> +         * Some GSSAPI implementations use the input value of ret_flags (an
</span><del>-+          * output variable) as a means of triggering mechanism specific 
-+          * features. Initializing it to zero avoids inadvertently 
-+          * activating this non-standard behaviour.
</del><ins>++         * output variable) as a means of triggering mechanism specific
++         * features. Initializing it to zero avoids inadvertently
++         * activating this non-standard behaviour.
</ins><span class="cx"> +         */
</span><span class="cx"> +
</span><span class="cx"> +        OM_uint32 ret_flags = 0;
</span><span class="lines">@@ -1846,7 +1745,7 @@
</span><span class="cx"> +        debug2(&quot;%s: Identifying %s&quot;, __func__, kex-&gt;name);
</span><span class="cx"> +        oid = ssh_gssapi_id_kex(NULL, kex-&gt;name, kex-&gt;kex_type);
</span><span class="cx"> +        if (oid == GSS_C_NO_OID)
</span><del>-+           fatal(&quot;Unknown gssapi mechanism&quot;);
</del><ins>++                fatal(&quot;Unknown gssapi mechanism&quot;);
</ins><span class="cx"> +
</span><span class="cx"> +        debug2(&quot;%s: Acquiring credentials&quot;, __func__);
</span><span class="cx"> +
</span><span class="lines">@@ -1894,10 +1793,10 @@
</span><span class="cx"> +                type = packet_read();
</span><span class="cx"> +                switch(type) {
</span><span class="cx"> +                case SSH2_MSG_KEXGSS_INIT:
</span><del>-+                        if (dh_client_pub != NULL) 
</del><ins>++                        if (dh_client_pub != NULL)
</ins><span class="cx"> +                                fatal(&quot;Received KEXGSS_INIT after initialising&quot;);
</span><span class="cx"> +                        recv_tok.value = packet_get_string(&amp;slen);
</span><del>-+                        recv_tok.length = slen; 
</del><ins>++                        recv_tok.length = slen;
</ins><span class="cx"> +
</span><span class="cx"> +                        if ((dh_client_pub = BN_new()) == NULL)
</span><span class="cx"> +                                fatal(&quot;dh_client_pub == NULL&quot;);
</span><span class="lines">@@ -1908,7 +1807,7 @@
</span><span class="cx"> +                        break;
</span><span class="cx"> +                case SSH2_MSG_KEXGSS_CONTINUE:
</span><span class="cx"> +                        recv_tok.value = packet_get_string(&amp;slen);
</span><del>-+                        recv_tok.length = slen; 
</del><ins>++                        recv_tok.length = slen;
</ins><span class="cx"> +                        break;
</span><span class="cx"> +                default:
</span><span class="cx"> +                        packet_disconnect(
</span><span class="lines">@@ -1916,7 +1815,7 @@
</span><span class="cx"> +                            type);
</span><span class="cx"> +                }
</span><span class="cx"> +
</span><del>-+                maj_status = PRIVSEP(ssh_gssapi_accept_ctx(ctxt, &amp;recv_tok, 
</del><ins>++                maj_status = PRIVSEP(ssh_gssapi_accept_ctx(ctxt, &amp;recv_tok,
</ins><span class="cx"> +                    &amp;send_tok, &amp;ret_flags));
</span><span class="cx"> +
</span><span class="cx"> +                free(recv_tok.value);
</span><span class="lines">@@ -1926,7 +1825,7 @@
</span><span class="cx"> +
</span><span class="cx"> +                if (dh_client_pub == NULL)
</span><span class="cx"> +                        fatal(&quot;No client public key&quot;);
</span><del>-+                
</del><ins>++
</ins><span class="cx"> +                if (maj_status &amp; GSS_S_CONTINUE_NEEDED) {
</span><span class="cx"> +                        debug(&quot;Sending GSSAPI_CONTINUE&quot;);
</span><span class="cx"> +                        packet_start(SSH2_MSG_KEXGSS_CONTINUE);
</span><span class="lines">@@ -1950,12 +1849,12 @@
</span><span class="cx"> +
</span><span class="cx"> +        if (!(ret_flags &amp; GSS_C_INTEG_FLAG))
</span><span class="cx"> +                fatal(&quot;Integrity flag wasn't set&quot;);
</span><del>-+        
</del><ins>++
</ins><span class="cx"> +        if (!dh_pub_is_valid(dh, dh_client_pub))
</span><span class="cx"> +                packet_disconnect(&quot;bad client public DH value&quot;);
</span><span class="cx"> +
</span><span class="cx"> +        klen = DH_size(dh);
</span><del>-+        kbuf = xmalloc(klen); 
</del><ins>++        kbuf = xmalloc(klen);
</ins><span class="cx"> +        kout = DH_compute_key(kbuf, dh_client_pub, dh);
</span><span class="cx"> +        if ((int)kout &lt; 0)
</span><span class="cx"> +                fatal(&quot;DH_compute_key: failed&quot;);
</span><span class="lines">@@ -2033,7 +1932,7 @@
</span><span class="cx"> +
</span><span class="cx"> +        if (gss_kex_context == NULL)
</span><span class="cx"> +                gss_kex_context = ctxt;
</span><del>-+        else 
</del><ins>++        else
</ins><span class="cx"> +                ssh_gssapi_delete_ctx(&amp;ctxt);
</span><span class="cx"> +
</span><span class="cx"> +        DH_free(dh);
</span><span class="lines">@@ -2043,16 +1942,14 @@
</span><span class="cx"> +        r = kex_send_newkeys(ssh);
</span><span class="cx"> +
</span><span class="cx"> +        /* If this was a rekey, then save out any delegated credentials we
</span><del>-+         * just exchanged.  */
</del><ins>++         * just exchanged. */
</ins><span class="cx"> +        if (options.gss_store_rekey)
</span><span class="cx"> +                ssh_gssapi_rekey_creds();
</span><span class="cx"> +        return r;
</span><span class="cx"> +}
</span><span class="cx"> +#endif /* GSSAPI */
</span><del>-diff --git a/monitor.c b/monitor.c
-index dbe29f1..b0896ef 100644
---- a/monitor.c
-+++ b/monitor.c
</del><ins>+--- a/monitor.c        2015-10-24 08:11:05.000000000 +0200
++++ b/monitor.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -157,6 +157,8 @@ int mm_answer_gss_setup_ctx(int, Buffer 
</span><span class="cx">  int mm_answer_gss_accept_ctx(int, Buffer *);
</span><span class="cx">  int mm_answer_gss_userok(int, Buffer *);
</span><span class="lines">@@ -2242,10 +2139,8 @@
</span><span class="cx"> +
</span><span class="cx">  #endif /* GSSAPI */
</span><span class="cx">  
</span><del>-diff --git a/monitor.h b/monitor.h
-index 5bc41b5..7f32b0c 100644
---- a/monitor.h
-+++ b/monitor.h
</del><ins>+--- a/monitor.h        2015-10-24 08:11:05.000000000 +0200
++++ b/monitor.h        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -65,6 +65,9 @@ enum monitor_reqtype {
</span><span class="cx">          MONITOR_REQ_PAM_FREE_CTX = 110, MONITOR_ANS_PAM_FREE_CTX = 111,
</span><span class="cx">          MONITOR_REQ_AUDIT_EVENT = 112, MONITOR_REQ_AUDIT_COMMAND = 113,
</span><span class="lines">@@ -2256,11 +2151,9 @@
</span><span class="cx">  };
</span><span class="cx">  
</span><span class="cx">  struct mm_master;
</span><del>-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
</del><ins>+--- 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
</ins><span class="cx">  }
</span><span class="cx">  
</span><span class="cx">  int
</span><span class="lines">@@ -2269,7 +2162,7 @@
</span><span class="cx">  {
</span><span class="cx">          Buffer m;
</span><span class="cx">          int authenticated = 0;
</span><del>-@@ -1086,5 +1086,50 @@ mm_ssh_gssapi_userok(char *user)
</del><ins>+@@ -1085,5 +1085,50 @@ mm_ssh_gssapi_userok(char *user)
</ins><span class="cx">          debug3(&quot;%s: user %sauthenticated&quot;,__func__, authenticated ? &quot;&quot; : &quot;not &quot;);
</span><span class="cx">          return (authenticated);
</span><span class="cx">  }
</span><span class="lines">@@ -2320,10 +2213,8 @@
</span><span class="cx"> +
</span><span class="cx">  #endif /* GSSAPI */
</span><span class="cx">  
</span><del>-diff --git a/monitor_wrap.h b/monitor_wrap.h
-index 18c2501..a4e9d24 100644
---- a/monitor_wrap.h
-+++ b/monitor_wrap.h
</del><ins>+--- a/monitor_wrap.h        2015-10-24 08:11:05.000000000 +0200
++++ b/monitor_wrap.h        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -58,8 +58,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(K
</span><span class="cx">  OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
</span><span class="cx">  OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *,
</span><span class="lines">@@ -2336,10 +2227,8 @@
</span><span class="cx">  #endif
</span><span class="cx">  
</span><span class="cx">  #ifdef USE_PAM
</span><del>-diff --git a/readconf.c b/readconf.c
-index 7948ce1..9127e93 100644
---- a/readconf.c
-+++ b/readconf.c
</del><ins>+--- a/readconf.c        2015-10-24 08:11:05.000000000 +0200
++++ b/readconf.c        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -147,6 +147,8 @@ typedef enum {
</span><span class="cx">          oClearAllForwardings, oNoHostAuthenticationForLocalhost,
</span><span class="cx">          oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
</span><span class="lines">@@ -2349,7 +2238,7 @@
</span><span class="cx">          oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
</span><span class="cx">          oSendEnv, oControlPath, oControlMaster, oControlPersist,
</span><span class="cx">          oHashKnownHosts,
</span><del>-@@ -194,10 +196,19 @@ static struct {
</del><ins>+@@ -195,10 +197,19 @@ static struct {
</ins><span class="cx">          { &quot;afstokenpassing&quot;, oUnsupported },
</span><span class="cx">  #if defined(GSSAPI)
</span><span class="cx">          { &quot;gssapiauthentication&quot;, oGssAuthentication },
</span><span class="lines">@@ -2369,7 +2258,7 @@
</span><span class="cx">  #endif
</span><span class="cx">          { &quot;fallbacktorsh&quot;, oDeprecated },
</span><span class="cx">          { &quot;usersh&quot;, oDeprecated },
</span><del>-@@ -898,10 +909,30 @@ parse_time:
</del><ins>+@@ -900,10 +911,30 @@ parse_time:
</ins><span class="cx">                  intptr = &amp;options-&gt;gss_authentication;
</span><span class="cx">                  goto parse_flag;
</span><span class="cx">  
</span><span class="lines">@@ -2413,7 +2302,7 @@
</span><span class="cx">          options-&gt;password_authentication = -1;
</span><span class="cx">          options-&gt;kbd_interactive_authentication = -1;
</span><span class="cx">          options-&gt;kbd_interactive_devices = NULL;
</span><del>-@@ -1743,8 +1779,14 @@ fill_default_options(Options * options)
</del><ins>+@@ -1744,8 +1780,14 @@ fill_default_options(Options * options)
</ins><span class="cx">                  options-&gt;challenge_response_authentication = 1;
</span><span class="cx">          if (options-&gt;gss_authentication == -1)
</span><span class="cx">                  options-&gt;gss_authentication = 0;
</span><span class="lines">@@ -2428,10 +2317,8 @@
</span><span class="cx">          if (options-&gt;password_authentication == -1)
</span><span class="cx">                  options-&gt;password_authentication = 1;
</span><span class="cx">          if (options-&gt;kbd_interactive_authentication == -1)
</span><del>-diff --git a/readconf.h b/readconf.h
-index 0b9cb77..0e29889 100644
---- a/readconf.h
-+++ b/readconf.h
</del><ins>+--- a/readconf.h        2015-10-24 08:11:05.000000000 +0200
++++ b/readconf.h        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -45,7 +45,12 @@ typedef struct {
</span><span class="cx">          int     challenge_response_authentication;
</span><span class="cx">                                          /* Try S/Key or TIS, authentication. */
</span><span class="lines">@@ -2445,11 +2332,9 @@
</span><span class="cx">          int     password_authentication;        /* Try password
</span><span class="cx">                                                   * authentication. */
</span><span class="cx">          int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
</span><del>-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 
</del><ins>+--- 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 
</ins><span class="cx">          options-&gt;kerberos_ticket_cleanup = -1;
</span><span class="cx">          options-&gt;kerberos_get_afs_token = -1;
</span><span class="cx">          options-&gt;gss_authentication=-1;
</span><span class="lines">@@ -2475,15 +2360,15 @@
</span><span class="cx">          if (options-&gt;password_authentication == -1)
</span><span class="cx">                  options-&gt;password_authentication = 0;
</span><span class="cx">          if (options-&gt;kbd_interactive_authentication == -1)
</span><del>-@@ -401,6 +407,7 @@ typedef enum {
-         sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
</del><ins>+@@ -412,6 +418,7 @@ typedef enum {
+         sHostKeyAlgorithms,
</ins><span class="cx">          sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
</span><span class="cx">          sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
</span><span class="cx"> +        sGssKeyEx, sGssStoreRekey,
</span><span class="cx">          sAcceptEnv, sPermitTunnel,
</span><span class="cx">          sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
</span><span class="cx">          sUsePrivilegeSeparation, sAllowAgentForwarding,
</span><del>-@@ -474,11 +481,17 @@ static struct {
</del><ins>+@@ -486,11 +493,17 @@ static struct {
</ins><span class="cx">          { &quot;gssapiauthentication&quot;, sGssAuthentication, SSHCFG_ALL },
</span><span class="cx">          { &quot;gssapicleanupcredentials&quot;, sGssCleanupCreds, SSHCFG_GLOBAL },
</span><span class="cx">          { &quot;gssapistrictacceptorcheck&quot;, sGssStrictAcceptor, SSHCFG_GLOBAL },
</span><span class="lines">@@ -2501,7 +2386,7 @@
</span><span class="cx">          { &quot;passwordauthentication&quot;, sPasswordAuthentication, SSHCFG_ALL },
</span><span class="cx">          { &quot;kbdinteractiveauthentication&quot;, sKbdInteractiveAuthentication, SSHCFG_ALL },
</span><span class="cx">          { &quot;challengeresponseauthentication&quot;, sChallengeResponseAuthentication, SSHCFG_GLOBAL },
</span><del>-@@ -1214,6 +1227,10 @@ process_server_config_line(ServerOptions
</del><ins>+@@ -1231,6 +1244,10 @@ process_server_config_line(ServerOptions
</ins><span class="cx">                  intptr = &amp;options-&gt;gss_authentication;
</span><span class="cx">                  goto parse_flag;
</span><span class="cx">  
</span><span class="lines">@@ -2512,7 +2397,7 @@
</span><span class="cx">          case sGssCleanupCreds:
</span><span class="cx">                  intptr = &amp;options-&gt;gss_cleanup_creds;
</span><span class="cx">                  goto parse_flag;
</span><del>-@@ -1222,6 +1239,10 @@ process_server_config_line(ServerOptions
</del><ins>+@@ -1239,6 +1256,10 @@ process_server_config_line(ServerOptions
</ins><span class="cx">                  intptr = &amp;options-&gt;gss_strict_acceptor;
</span><span class="cx">                  goto parse_flag;
</span><span class="cx">  
</span><span class="lines">@@ -2523,7 +2408,7 @@
</span><span class="cx">          case sPasswordAuthentication:
</span><span class="cx">                  intptr = &amp;options-&gt;password_authentication;
</span><span class="cx">                  goto parse_flag;
</span><del>-@@ -2229,7 +2250,10 @@ dump_config(ServerOptions *o)
</del><ins>+@@ -2246,7 +2267,10 @@ dump_config(ServerOptions *o)
</ins><span class="cx">  #endif
</span><span class="cx">  #ifdef GSSAPI
</span><span class="cx">          dump_cfg_fmtint(sGssAuthentication, o-&gt;gss_authentication);
</span><span class="lines">@@ -2534,11 +2419,9 @@
</span><span class="cx">  #endif
</span><span class="cx">          dump_cfg_fmtint(sPasswordAuthentication, o-&gt;password_authentication);
</span><span class="cx">          dump_cfg_fmtint(sKbdInteractiveAuthentication,
</span><del>-diff --git a/servconf.h b/servconf.h
-index 766db3a..f8265a8 100644
---- a/servconf.h
-+++ b/servconf.h
-@@ -117,8 +117,10 @@ typedef struct {
</del><ins>+--- 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 {
</ins><span class="cx">          int     kerberos_get_afs_token;                /* If true, try to get AFS token if
</span><span class="cx">                                                   * authenticated with Kerberos. */
</span><span class="cx">          int     gss_authentication;        /* If true, permit GSSAPI authentication */
</span><span class="lines">@@ -2549,10 +2432,8 @@
</span><span class="cx">          int     password_authentication;        /* If true, permit password
</span><span class="cx">                                                   * authentication. */
</span><span class="cx">          int     kbd_interactive_authentication;        /* If true, permit */
</span><del>-diff --git a/ssh-gss.h b/ssh-gss.h
-index a99d7f0..914701b 100644
---- a/ssh-gss.h
-+++ b/ssh-gss.h
</del><ins>+--- a/ssh-gss.h        2015-10-24 08:11:05.000000000 +0200
++++ b/ssh-gss.h        2015-10-24 09:39:38.000000000 +0200
</ins><span class="cx"> @@ -1,6 +1,6 @@
</span><span class="cx">  /* $OpenBSD: ssh-gss.h,v 1.11 2014/02/26 20:28:44 djm Exp $ */
</span><span class="cx">  /*
</span><span class="lines">@@ -2565,11 +2446,11 @@
</span><span class="cx">  
</span><span class="cx">  #define SSH_GSS_OIDTYPE 0x06
</span><span class="cx">  
</span><del>-+#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
</del><ins>++#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
</ins><span class="cx"> +#define SSH2_MSG_KEXGSS_GROUPREQ                        40
</span><span class="cx"> +#define SSH2_MSG_KEXGSS_GROUP                                41
</span><span class="cx"> +#define KEX_GSS_GRP1_SHA1_ID                                &quot;gss-group1-sha1-&quot;
</span><span class="lines">@@ -2627,13 +2508,13 @@
</span><span class="cx"> +int ssh_gssapi_credentials_updated(Gssctxt *);
</span><span class="cx">  
</span><span class="cx">  /* In the server */
</span><del>-+typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *, 
</del><ins>++typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *,
</ins><span class="cx"> +    const char *);
</span><span class="cx"> +char *ssh_gssapi_client_mechanisms(const char *, const char *);
</span><span class="cx"> +char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, const char *,
</span><span class="cx"> +    const char *);
</span><span class="cx"> +gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int);
</span><del>-+int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *, 
</del><ins>++int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *,
</ins><span class="cx"> +    const char *);
</span><span class="cx">  OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
</span><span class="cx"> -int ssh_gssapi_userok(char *name);
</span><span class="lines">@@ -2652,10 +2533,8 @@
</span><span class="cx">  #endif /* GSSAPI */
</span><span class="cx">  
</span><span class="cx">  #endif /* _SSH_GSS_H */
</span><del>-diff --git a/ssh_config b/ssh_config
-index 03a228f..228e5ab 100644
---- a/ssh_config
-+++ b/ssh_config
</del><ins>+--- a/ssh_config        2015-10-24 08:11:05.000000000 +0200
++++ b/ssh_config        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -26,6 +26,8 @@
</span><span class="cx">  #   HostbasedAuthentication no
</span><span class="cx">  #   GSSAPIAuthentication no
</span><span class="lines">@@ -2665,11 +2544,9 @@
</span><span class="cx">  #   BatchMode no
</span><span class="cx">  #   CheckHostIP yes
</span><span class="cx">  #   AddressFamily any
</span><del>-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
</del><ins>+--- 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
</ins><span class="cx">  The default is
</span><span class="cx">  .Dq no .
</span><span class="cx">  Note that this option applies to protocol version 2 only.
</span><span class="lines">@@ -2714,10 +2591,8 @@
</span><span class="cx">  .It Cm HashKnownHosts
</span><span class="cx">  Indicates that
</span><span class="cx">  .Xr ssh 1
</span><del>-diff --git a/sshconnect2.c b/sshconnect2.c
-index 68f7f4f..7b478f1 100644
---- a/sshconnect2.c
-+++ b/sshconnect2.c
</del><ins>+--- a/sshconnect2.c        2015-10-24 08:11:05.000000000 +0200
++++ b/sshconnect2.c        2015-10-24 08:30:26.000000000 +0200
</ins><span class="cx"> @@ -161,9 +161,34 @@ ssh_kex2(char *host, struct sockaddr *ho
</span><span class="cx">          struct kex *kex;
</span><span class="cx">          int r;
</span><span class="lines">@@ -2732,9 +2607,9 @@
</span><span class="cx">  
</span><span class="cx"> +#ifdef GSSAPI
</span><span class="cx"> +        if (options.gss_keyex) {
</span><del>-+                /* Add the GSSAPI mechanisms currently supported on this 
</del><ins>++                /* Add the GSSAPI mechanisms currently supported on this
</ins><span class="cx"> +                 * client to the key exchange algorithm proposal */
</span><del>-+                orig = myproposal[PROPOSAL_KEX_ALGS];
</del><ins>++                orig = options.kex_algorithms;
</ins><span class="cx"> +
</span><span class="cx"> +                if (options.gss_trust_dns)
</span><span class="cx"> +                        gss_host = (char *)get_canonical_hostname(1);
</span><span class="lines">@@ -2744,25 +2619,25 @@
</span><span class="cx"> +                gss = ssh_gssapi_client_mechanisms(gss_host, options.gss_client_identity);
</span><span class="cx"> +                if (gss) {
</span><span class="cx"> +                        debug(&quot;Offering GSSAPI proposal: %s&quot;, gss);
</span><del>-+                        xasprintf(&amp;myproposal[PROPOSAL_KEX_ALGS],
</del><ins>++                        xasprintf(&amp;options.kex_algorithms,
</ins><span class="cx"> +                            &quot;%s,%s&quot;, gss, orig);
</span><span class="cx"> +                }
</span><span class="cx"> +        }
</span><span class="cx"> +#endif
</span><span class="cx"> +
</span><del>-         if (options.ciphers == (char *)-1) {
-                 logit(&quot;No valid ciphers for protocol version 2 given, using defaults.&quot;);
-                 options.ciphers = NULL;
-@@ -201,6 +226,17 @@ ssh_kex2(char *host, struct sockaddr *ho
</del><span class="cx">          myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
</span><del>-             myproposal[PROPOSAL_KEX_ALGS]);
</del><ins>+             options.kex_algorithms);
+         myproposal[PROPOSAL_ENC_ALGS_CTOS] =
+@@ -194,6 +219,17 @@ ssh_kex2(char *host, struct sockaddr *ho
+                     order_hostkeyalgs(host, hostaddr, port));
+         }
</ins><span class="cx">  
</span><span class="cx"> +#ifdef GSSAPI
</span><span class="cx"> +        /* If we've got GSSAPI algorithms, then we also support the
</span><span class="cx"> +         * 'null' hostkey, as a last resort */
</span><span class="cx"> +        if (options.gss_keyex &amp;&amp; gss) {
</span><span class="cx"> +                orig = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS];
</span><del>-+                xasprintf(&amp;myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS], 
</del><ins>++                xasprintf(&amp;myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS],
</ins><span class="cx"> +                    &quot;%s,null&quot;, orig);
</span><span class="cx"> +                free(gss);
</span><span class="cx"> +        }
</span><span class="lines">@@ -2771,7 +2646,7 @@
</span><span class="cx">          if (options.rekey_limit || options.rekey_interval)
</span><span class="cx">                  packet_set_rekey_limits((u_int32_t)options.rekey_limit,
</span><span class="cx">                      (time_t)options.rekey_interval);
</span><del>-@@ -219,10 +255,30 @@ ssh_kex2(char *host, struct sockaddr *ho
</del><ins>+@@ -212,10 +248,30 @@ ssh_kex2(char *host, struct sockaddr *ho
</ins><span class="cx">  # endif
</span><span class="cx">  #endif
</span><span class="cx">          kex-&gt;kex[KEX_C25519_SHA256] = kexc25519_client;
</span><span class="lines">@@ -2802,7 +2677,7 @@
</span><span class="cx">          dispatch_run(DISPATCH_BLOCK, &amp;kex-&gt;done, active_state);
</span><span class="cx">  
</span><span class="cx">          if (options.use_roaming &amp;&amp; !kex-&gt;roaming) {
</span><del>-@@ -314,6 +370,7 @@ int        input_gssapi_token(int type, u_int32
</del><ins>+@@ -307,6 +363,7 @@ int        input_gssapi_token(int type, u_int32
</ins><span class="cx">  int        input_gssapi_hash(int type, u_int32_t, void *);
</span><span class="cx">  int        input_gssapi_error(int, u_int32_t, void *);
</span><span class="cx">  int        input_gssapi_errtok(int, u_int32_t, void *);
</span><span class="lines">@@ -2810,7 +2685,7 @@
</span><span class="cx">  #endif
</span><span class="cx">  
</span><span class="cx">  void        userauth(Authctxt *, char *);
</span><del>-@@ -329,6 +386,11 @@ static char *authmethods_get(void);
</del><ins>+@@ -322,6 +379,11 @@ static char *authmethods_get(void);
</ins><span class="cx">  
</span><span class="cx">  Authmethod authmethods[] = {
</span><span class="cx">  #ifdef GSSAPI
</span><span class="lines">@@ -2822,7 +2697,7 @@
</span><span class="cx">          {&quot;gssapi-with-mic&quot;,
</span><span class="cx">                  userauth_gssapi,
</span><span class="cx">                  NULL,
</span><del>-@@ -635,19 +697,31 @@ userauth_gssapi(Authctxt *authctxt)
</del><ins>+@@ -628,19 +690,31 @@ userauth_gssapi(Authctxt *authctxt)
</ins><span class="cx">          static u_int mech = 0;
</span><span class="cx">          OM_uint32 min;
</span><span class="cx">          int ok = 0;
</span><span class="lines">@@ -2856,7 +2731,7 @@
</span><span class="cx">                          ok = 1; /* Mechanism works */
</span><span class="cx">                  } else {
</span><span class="cx">                          mech++;
</span><del>-@@ -744,8 +818,8 @@ input_gssapi_response(int type, u_int32_
</del><ins>+@@ -737,8 +811,8 @@ input_gssapi_response(int type, u_int32_
</ins><span class="cx">  {
</span><span class="cx">          Authctxt *authctxt = ctxt;
</span><span class="cx">          Gssctxt *gssctxt;
</span><span class="lines">@@ -2867,7 +2742,7 @@
</span><span class="cx">  
</span><span class="cx">          if (authctxt == NULL)
</span><span class="cx">                  fatal(&quot;input_gssapi_response: no authentication context&quot;);
</span><del>-@@ -858,6 +932,48 @@ input_gssapi_error(int type, u_int32_t p
</del><ins>+@@ -851,6 +925,48 @@ input_gssapi_error(int type, u_int32_t p
</ins><span class="cx">          free(lang);
</span><span class="cx">          return 0;
</span><span class="cx">  }
</span><span class="lines">@@ -2916,11 +2791,9 @@
</span><span class="cx">  #endif /* GSSAPI */
</span><span class="cx">  
</span><span class="cx">  int
</span><del>-diff --git a/sshd.c b/sshd.c
-index 481d001..e6706a8 100644
---- a/sshd.c
-+++ b/sshd.c
-@@ -125,6 +125,10 @@
</del><ins>+--- 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 @@
</ins><span class="cx">  #include &quot;version.h&quot;
</span><span class="cx">  #include &quot;ssherr.h&quot;
</span><span class="cx">  
</span><span class="lines">@@ -2931,7 +2804,19 @@
</span><span class="cx">  #ifndef O_NOCTTY
</span><span class="cx">  #define O_NOCTTY        0
</span><span class="cx">  #endif
</span><del>-@@ -1830,10 +1834,13 @@ main(int ac, char **av)
</del><ins>+@@ -969,8 +973,9 @@ notify_hostkeys(struct ssh *ssh)
+         }
+         debug3(&quot;%s: sent %d hostkeys&quot;, __func__, nkeys);
+         if (nkeys == 0)
+-                fatal(&quot;%s: no hostkeys&quot;, __func__);
+-        packet_send();
++                debug3(&quot;%s: no hostkeys&quot;, __func__);
++        else
++                packet_send();
+         sshbuf_free(buf);
+ }

+@@ -1834,10 +1839,13 @@ main(int ac, char **av)
</ins><span class="cx">                  logit(&quot;Disabling protocol version 1. Could not load host key&quot;);
</span><span class="cx">                  options.protocol &amp;= ~SSH_PROTO_1;
</span><span class="cx">          }
</span><span class="lines">@@ -2945,7 +2830,7 @@
</span><span class="cx">          if (!(options.protocol &amp; (SSH_PROTO_1|SSH_PROTO_2))) {
</span><span class="cx">                  logit(&quot;sshd: no hostkeys available -- exiting.&quot;);
</span><span class="cx">                  exit(1);
</span><del>-@@ -2148,6 +2155,60 @@ main(int ac, char **av)
</del><ins>+@@ -2152,6 +2160,60 @@ main(int ac, char **av)
</ins><span class="cx">              remote_ip, remote_port, laddr,  get_local_port());
</span><span class="cx">          free(laddr);
</span><span class="cx">  
</span><span class="lines">@@ -3006,7 +2891,7 @@
</span><span class="cx">          /*
</span><span class="cx">           * We don't want to listen forever unless the other side
</span><span class="cx">           * successfully authenticates itself.  So we set up an alarm which is
</span><del>-@@ -2577,6 +2638,48 @@ do_ssh2_kex(void)
</del><ins>+@@ -2570,6 +2632,48 @@ do_ssh2_kex(void)
</ins><span class="cx">          myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(
</span><span class="cx">              list_hostkey_types());
</span><span class="cx">  
</span><span class="lines">@@ -3037,10 +2922,10 @@
</span><span class="cx"> +        else if (orig)
</span><span class="cx"> +                newstr = orig;
</span><span class="cx"> +
</span><del>-+        /* 
</del><ins>++        /*
</ins><span class="cx"> +         * If we've got GSSAPI mechanisms, then we've got the 'null' host
</span><span class="cx"> +         * key alg, but we can't tell people about it unless its the only
</span><del>-+           * host key algorithm we support
</del><ins>++         * host key algorithm we support
</ins><span class="cx"> +         */
</span><span class="cx"> +        if (gss &amp;&amp; (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS])) == 0)
</span><span class="cx"> +                myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = &quot;null&quot;;
</span><span class="lines">@@ -3055,7 +2940,7 @@
</span><span class="cx">          /* start key exchange */
</span><span class="cx">          if ((r = kex_setup(active_state, myproposal)) != 0)
</span><span class="cx">                  fatal(&quot;kex_setup: %s&quot;, ssh_err(r));
</span><del>-@@ -2591,6 +2694,13 @@ do_ssh2_kex(void)
</del><ins>+@@ -2584,6 +2688,13 @@ do_ssh2_kex(void)
</ins><span class="cx">  # endif
</span><span class="cx">  #endif
</span><span class="cx">          kex-&gt;kex[KEX_C25519_SHA256] = kexc25519_server;
</span><span class="lines">@@ -3069,10 +2954,8 @@
</span><span class="cx">          kex-&gt;server = 1;
</span><span class="cx">          kex-&gt;client_version_string=client_version_string;
</span><span class="cx">          kex-&gt;server_version_string=server_version_string;
</span><del>-diff --git a/sshd_config b/sshd_config
-index e9045bc..d9b8594 100644
---- a/sshd_config
-+++ b/sshd_config
</del><ins>+--- a/sshd_config        2015-10-24 08:11:05.000000000 +0200
++++ b/sshd_config        2015-10-24 08:11:41.000000000 +0200
</ins><span class="cx"> @@ -85,6 +85,8 @@ AuthorizedKeysFile        .ssh/authorized_keys
</span><span class="cx">  # GSSAPI options
</span><span class="cx">  #GSSAPIAuthentication no
</span><span class="lines">@@ -3082,11 +2965,9 @@
</span><span class="cx">  
</span><span class="cx">  # Set this to 'yes' to enable PAM authentication, account processing,
</span><span class="cx">  # and session processing. If this is enabled, PAM authentication will
</span><del>-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
</del><ins>+--- 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
</ins><span class="cx">  The default is
</span><span class="cx">  .Dq no .
</span><span class="cx">  Note that this option applies to protocol version 2 only.
</span><span class="lines">@@ -3099,7 +2980,7 @@
</span><span class="cx">  .It Cm GSSAPICleanupCredentials
</span><span class="cx">  Specifies whether to automatically destroy the user's credentials cache
</span><span class="cx">  on logout.
</span><del>-@@ -637,6 +643,11 @@ machine's default store.
</del><ins>+@@ -642,6 +648,11 @@ machine's default store.
</ins><span class="cx">  This facility is provided to assist with operation on multi homed machines.
</span><span class="cx">  The default is
</span><span class="cx">  .Dq yes .
</span><span class="lines">@@ -3111,19 +2992,17 @@
</span><span class="cx">  .It Cm HostbasedAcceptedKeyTypes
</span><span class="cx">  Specifies the key types that will be accepted for hostbased authentication
</span><span class="cx">  as a comma-separated pattern list.
</span><del>-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[] =
-         { &quot;ssh-dss-cert-v00@openssh.com&quot;, &quot;DSA-CERT-V00&quot;,
-             KEY_DSA_CERT_V00, 0, 1 },
</del><ins>+--- 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 */
</ins><span class="cx">  #endif /* WITH_OPENSSL */
</span><span class="cx"> +        { &quot;null&quot;, &quot;null&quot;, KEY_NULL, 0, 0 },
</span><span class="cx">          { NULL, NULL, -1, -1, 0 }
</span><span class="cx">  };
</span><span class="cx">  
</span><del>-@@ -204,7 +205,7 @@ key_alg_list(int certs_only, int plain_o
</del><ins>+@@ -200,7 +201,7 @@ key_alg_list(int certs_only, int plain_o
</ins><span class="cx">          const struct keytype *kt;
</span><span class="cx">  
</span><span class="cx">          for (kt = keytypes; kt-&gt;type != -1; kt++) {
</span><span class="lines">@@ -3132,15 +3011,23 @@
</span><span class="cx">                          continue;
</span><span class="cx">                  if ((certs_only &amp;&amp; !kt-&gt;cert) || (plain_only &amp;&amp; kt-&gt;cert))
</span><span class="cx">                          continue;
</span><del>-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 {
</del><ins>+--- 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,
</ins><span class="cx">          KEY_ED25519_CERT,
</span><del>-         KEY_RSA_CERT_V00,
-         KEY_DSA_CERT_V00,
</del><span class="cx"> +        KEY_NULL,
</span><span class="cx">          KEY_UNSPEC
</span><span class="cx">  };
</span><span class="cx">  
</span><ins>+--- 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, &quot;publickey&quot;) == 0 ||
+                     strcmp(method, &quot;hostbased&quot;) == 0 ||
++                    strcmp(method, &quot;gssapi-keyex&quot;) == 0 ||
+                     strcmp(method, &quot;gssapi-with-mic&quot;) == 0)
+                         return 1;
+                 break;
</ins></span></pre></div>
<a id="trunkdportsnetopensshfilesopenssh69p1hpnssh14v5diff"></a>
<div class="delfile"><h4>Deleted: trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,1290 +0,0 @@
</span><del>---- 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@host.com
-+                scp -oCipher=aes256-ctr file you@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@psc.edu)
-+         The majority of the actual coding for versions up to HPN12v1 was performed
-+         by Michael Stevens (mstevens@andrew.cmu.edu). The MT-AES-CTR cipher was 
-+         implemented by Ben Bennet (ben@psc.edu) and improved by Mike Tasota 
-+         (tasota@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-&gt;local_window_max = window;
-         c-&gt;local_consumed = 0;
-         c-&gt;local_maxpacket = maxpack;
-+#ifdef HPN_ENABLED
-+        c-&gt;dynamic_window = 0;
-+#endif
-         c-&gt;remote_id = -1;
-         c-&gt;remote_name = xstrdup(remote_name);
-         c-&gt;remote_window = 0;
-@@ -840,11 +849,41 @@ channel_pre_open_13(Channel *c, fd_set *
-                 FD_SET(c-&gt;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, &amp;tcpwinsz, &amp;optsz);
-+        /* return no more than SSHBUF_SIZE_MAX */
-+        if (ret == 0 &amp;&amp; tcpwinsz &gt; SSHBUF_SIZE_MAX)
-+                tcpwinsz = SSHBUF_SIZE_MAX;
-+        debug2(&quot;tcpwinsz: %d for connection: %d&quot;, 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-&gt;remote_window : packet_get_maxsize();

-+#ifdef HPN_ENABLED
-+        /* check buffer limits */
-+        if (!c-&gt;tcpwinsz || c-&gt;dynamic_window &gt; 0)
-+                c-&gt;tcpwinsz = channel_tcpwinsz();
-+
-+        limit = MIN(limit, 2 * c-&gt;tcpwinsz);
-+#endif
-+
-         if (c-&gt;istate == CHAN_INPUT_OPEN &amp;&amp;
-             limit &gt; 0 &amp;&amp;
-             buffer_len(&amp;c-&gt;input) &lt; limit &amp;&amp;
-@@ -1862,6 +1901,20 @@ channel_check_window(Channel *c)
-             c-&gt;local_maxpacket*3) ||
-             c-&gt;local_window &lt; c-&gt;local_window_max/2) &amp;&amp;
-             c-&gt;local_consumed &gt; 0) {
-+#ifdef HPN_ENABLED
-+                /* adjust max window size if we are in a dynamic environment */
-+                if (c-&gt;dynamic_window &amp;&amp; (c-&gt;tcpwinsz &gt; c-&gt;local_window_max)) {
-+                        u_int addition = 0;
-+
-+                        /*
-+                         * grow the window somewhat aggressively to maintain
-+                         * pressure
-+                         */
-+                        addition = 1.5*(c-&gt;tcpwinsz - c-&gt;local_window_max);
-+                        c-&gt;local_window_max += addition;
-+                        c-&gt;local_consumed += addition;
-+                }
-+#endif
-                 packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
-                 packet_put_int(c-&gt;remote_id);
-                 packet_put_int(c-&gt;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(&quot;HPN Disabled: %d, HPN Buffer Size: %d&quot;, 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(&quot;port listener&quot;, type, sock, sock, -1,
-+                            hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
-+                            0, &quot;port listener&quot;, 1);
-+                else
-+#endif
-                 c = channel_new(&quot;port listener&quot;, type, sock, sock, -1,
-                     CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
-                     0, &quot;port listener&quot;, 1);
-@@ -3975,6 +4050,14 @@ x11_create_display_inet(int x11_display_
-         *chanids = xcalloc(num_socks + 1, sizeof(**chanids));
-         for (n = 0; n &lt; num_socks; n++) {
-                 sock = socks[n];
-+#ifdef HPN_ENABLED
-+                if (!hpn_disabled)
-+                        nc = channel_new(&quot;x11 listener&quot;,
-+                            SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
-+                            hpn_buffer_size, CHAN_X11_PACKET_DEFAULT,
-+                            0, &quot;X11 inet listener&quot;, 1);
-+                else
-+#endif
-                 nc = channel_new(&quot;x11 listener&quot;,
-                     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(&amp;cp, CIPHER_SEP)); p &amp;&amp; *p != '\0';
-             (p = strsep(&amp;cp, CIPHER_SEP))) {
-                 c = cipher_by_name(p);
--                if (c == NULL || c-&gt;number != SSH_CIPHER_SSH2) {
-+                if (c == NULL || (c-&gt;number != SSH_CIPHER_SSH2 &amp;&amp;
-+#ifdef NONE_CIPHER_ENABLED
-+                                  c-&gt;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-&gt;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-&gt;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 &lt; 0)
-                 return NULL;
-+#ifdef HPN_ENABLED
-+        /* again is this really necessary for X11? */
-+        if (!options.hpn_disabled)
-+                c = channel_new(&quot;x11&quot;,
-+                    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
-+                    options.hpn_buffer_size,
-+                    CHAN_X11_PACKET_DEFAULT, 0, &quot;x11&quot;, 1);
-+        else
-+#endif
-         c = channel_new(&quot;x11&quot;,
-             SSH_CHANNEL_X11_OPEN, sock, sock, -1,
-             CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, &quot;x11&quot;, 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(&quot;authentication agent connection&quot;,
-+                    SSH_CHANNEL_OPEN, sock, sock, -1,
-+                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0,
-+                    &quot;authentication agent connection&quot;, 1);
-+        else
-+#endif
-         c = channel_new(&quot;authentication agent connection&quot;,
-             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(&quot;tun&quot;, SSH_CHANNEL_OPENING, fd, fd, -1,
-+                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
-+        else
-+#endif
-         c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPENING, fd, fd, -1,
-             CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
-         c-&gt;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(&quot;match: %s pat %s compat 0x%08x&quot;,
-                             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,&quot;OpenSSH&quot;) != NULL &amp;&amp;
-+                            strstr(version,&quot;hpn&quot;) == NULL) {
-+                                datafellows |= SSH_BUG_LARGEWINDOW;
-+                                debug(&quot;Remote is NON-HPN aware&quot;);
-+                        }
-+#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=&quot;no&quot;
-+AC_ARG_WITH(hpn,
-+        [  --with-hpn             Enable HPN support],
-+        [ if test &quot;x$withval&quot; != &quot;xno&quot; ; then
-+                AC_DEFINE(HPN_ENABLED,1,[Define if you want HPN support.])
-+                HPN_MSG=&quot;yes&quot;
-+        fi ]
-+)
-+#check whether user wants NONECIPHER support
-+NONECIPHER_MSG=&quot;no&quot;
-+AC_ARG_WITH(nonecipher,
-+        [  --with-nonecipher             Enable NONECIPHER support],
-+        [ if test &quot;x$withval&quot; != &quot;xno&quot; ; then
-+                AC_DEFINE(NONE_CIPHER_ENABLED,1,[Define if you want NONECIPHER support.])
-+                NONECIPHER_MSG=&quot;yes&quot;
-+        fi ]
-+)
-+
- if test ! -z &quot;$cross_compiling&quot; &amp;&amp; test &quot;x$cross_compiling&quot; = &quot;xyes&quot;; then
-         AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
-         disable_ptmx_check=yes
-@@ -4913,6 +4932,8 @@ echo &quot;           Translate v4 in v6 hack
- echo &quot;                  BSD Auth support: $BSD_AUTH_MSG&quot;
- echo &quot;              Random number source: $RAND_MSG&quot;
- echo &quot;             Privsep sandbox style: $SANDBOX_STYLE&quot;
-+echo &quot;                       HPN support: $HPN_MSG&quot;
-+echo &quot;                NONECIPHER support: $NONECIPHER_MSG&quot;

- echo &quot;&quot;

---- 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 (&quot;AUTH STATE IS %d&quot;, auth_flag);
-+#endif

-         if ((r = kex_buf2prop(kex-&gt;my, NULL, &amp;my)) != 0 ||
-             (r = kex_buf2prop(kex-&gt;peer, &amp;first_kex_follows, &amp;peer)) != 0)
-@@ -637,6 +644,17 @@ kex_choose_conf(struct ssh *ssh)
-                 if ((r = choose_comp(&amp;newkeys-&gt;comp, cprop[ncomp],
-                     sprop[ncomp])) != 0)
-                         goto out;
-+#ifdef NONE_CIPHER_ENABLED
-+                debug(&quot;REQUESTED ENC.NAME is '%s'&quot;, newkeys-&gt;enc.name);
-+                if (strcmp(newkeys-&gt;enc.name, &quot;none&quot;) == 0) {
-+                        debug(&quot;Requesting NONE. Authflag is %d&quot;, auth_flag);
-+                        if (auth_flag == 1) {
-+                                debug(&quot;None requested post authentication.&quot;);
-+                        } else {
-+                                fatal(&quot;Pre-authentication none cipher requests are not allowed.&quot;);
-+                        }
-+                }
-+#endif
-                 debug(&quot;kex: %s %s %s %s&quot;,
-                     ctos ? &quot;client-&gt;server&quot; : &quot;server-&gt;client&quot;,
-                     newkeys-&gt;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        &quot;none,zlib@openssh.com,zlib&quot;
- #define        KEX_DEFAULT_LANG        &quot;&quot;

-+#ifdef NONE_CIPHER_ENABLED
-+#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT &quot;,none&quot;
-+#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-&gt;state;
-+
-+        return(state-&gt;after_authentication);
-+}
-+#endif
-+
- #define MAX_PACKETS        (1U&lt;&lt;31)
- int
- ssh_packet_need_rekeying(struct ssh *ssh)
-@@ -2225,6 +2243,12 @@ ssh_packet_need_rekeying(struct ssh *ssh

-         if (ssh-&gt;compat &amp; SSH_BUG_NOREKEY)
-                 return 0;
-+#ifdef NONE_CIPHER_ENABLED
-+        if (rekey_requested == 1) {
-+               rekey_requested = 0;
-+               return 1;
-+        }
-+#endif
-         return
-             (state-&gt;p_send.packets &gt; MAX_PACKETS) ||
-             (state-&gt;p_read.packets &gt; 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 &quot;opacket.h&quot;
---- 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 {
-         { &quot;fingerprinthash&quot;, oFingerprintHash },
-         { &quot;updatehostkeys&quot;, oUpdateHostkeys },
-         { &quot;hostbasedkeytypes&quot;, oHostbasedKeyTypes },
-+#ifdef NONE_CIPHER_ENABLED
-+        { &quot;noneenabled&quot;, oNoneEnabled },
-+        { &quot;noneswitch&quot;, oNoneSwitch },
-+#endif
-+#ifdef HPN_ENABLED
-+        { &quot;tcprcvbufpoll&quot;, oTcpRcvBufPoll },
-+        { &quot;tcprcvbuf&quot;, oTcpRcvBuf },
-+        { &quot;hpndisabled&quot;, oHPNDisabled },
-+        { &quot;hpnbuffersize&quot;, oHPNBufferSize },
-+#endif
-         { &quot;ignoreunknown&quot;, oIgnoreUnknown },

-         { NULL, oBadOption }
-@@ -904,6 +920,44 @@ parse_time:
-                 intptr = &amp;options-&gt;check_host_ip;
-                 goto parse_flag;

-+#ifdef HPN_ENABLED
-+        case oHPNDisabled:
-+                intptr = &amp;options-&gt;hpn_disabled;
-+                goto parse_flag;
-+
-+        case oHPNBufferSize:
-+                intptr = &amp;options-&gt;hpn_buffer_size;
-+                goto parse_int;
-+
-+        case oTcpRcvBufPoll:
-+                intptr = &amp;options-&gt;tcp_rcv_buf_poll;
-+                goto parse_flag;
-+
-+        case oTcpRcvBuf:
-+                intptr = &amp;options-&gt;tcp_rcv_buf;
-+                goto parse_int;
-+#endif
-+
-+#ifdef NONE_CIPHER_ENABLED
-+        case oNoneEnabled:
-+                       intptr = &amp;options-&gt;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,&quot;command-line&quot;) == 0) {
-+                               intptr = &amp;options-&gt;none_switch;
-+                               goto parse_flag;
-+                       } else {
-+                               error(&quot;NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line&quot;, filename);
-+                               error(&quot;Continuing...&quot;);
-+                               debug(&quot;NoneSwitch directive found in %.200s.&quot;, filename);
-+                               return 0;
-+                       }
-+#endif
-+
-         case oVerifyHostKeyDNS:
-                 intptr = &amp;options-&gt;verify_host_key_dns;
-                 multistate_ptr = multistate_yesnoask;
-@@ -1665,6 +1719,16 @@ initialize_options(Options * options)
-         options-&gt;ip_qos_interactive = -1;
-         options-&gt;ip_qos_bulk = -1;
-         options-&gt;request_tty = -1;
-+#ifdef NONE_CIPHER_ENABLED
-+        options-&gt;none_switch = -1;
-+        options-&gt;none_enabled = -1;
-+#endif
-+#ifdef HPN_ENABLED
-+        options-&gt;hpn_disabled = -1;
-+        options-&gt;hpn_buffer_size = -1;
-+        options-&gt;tcp_rcv_buf_poll = -1;
-+        options-&gt;tcp_rcv_buf = -1;
-+#endif
-         options-&gt;proxy_use_fdpass = -1;
-         options-&gt;ignored_unknown = NULL;
-         options-&gt;num_canonical_domains = 0;
-@@ -1819,6 +1883,35 @@ fill_default_options(Options * options)
-                 options-&gt;server_alive_interval = 0;
-         if (options-&gt;server_alive_count_max == -1)
-                 options-&gt;server_alive_count_max = 3;
-+#ifdef NONE_CIPHER_ENABLED
-+        if (options-&gt;none_switch == -1)
-+                options-&gt;none_switch = 0;
-+        if (options-&gt;none_enabled == -1)
-+                options-&gt;none_enabled = 0;
-+#endif
-+#ifdef HPN_ENABLED
-+        if (options-&gt;hpn_disabled == -1)
-+                options-&gt;hpn_disabled = 0;
-+        if (options-&gt;hpn_buffer_size &gt; -1) {
-+                /* if a user tries to set the size to 0 set it to 1KB */
-+                if (options-&gt;hpn_buffer_size == 0)
-+                        options-&gt;hpn_buffer_size = 1;
-+                /* limit the buffer to 64MB */
-+                if (options-&gt;hpn_buffer_size &gt; 64*1024) {
-+                        options-&gt;hpn_buffer_size = 64*1024*1024;
-+                        debug(&quot;User requested buffer larger than 64MB. Request&quot;
-+                            &quot; reverted to 64MB&quot;);
-+                } else
-+                        options-&gt;hpn_buffer_size *= 1024;
-+                debug(&quot;hpn_buffer_size set to %d&quot;, options-&gt;hpn_buffer_size);
-+        }
-+        if (options-&gt;tcp_rcv_buf == 0)
-+                options-&gt;tcp_rcv_buf = 1;
-+        if (options-&gt;tcp_rcv_buf &gt; -1)
-+                options-&gt;tcp_rcv_buf *=1024;
-+        if (options-&gt;tcp_rcv_buf_poll == -1)
-+                options-&gt;tcp_rcv_buf_poll = 1;
-+#endif
-         if (options-&gt;control_master == -1)
-                 options-&gt;control_master = 0;
-         if (options-&gt;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 &lt; 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-&gt;authorized_principals_file = NULL;
-         options-&gt;authorized_principals_command = NULL;
-         options-&gt;authorized_principals_command_user = NULL;
-+#ifdef NONE_CIPHER_ENABLED
-+        options-&gt;none_enabled = -1;
-+#endif
-+#ifdef HPN_ENABLED
-+        options-&gt;tcp_rcv_buf_poll = -1;
-+        options-&gt;hpn_disabled = -1;
-+        options-&gt;hpn_buffer_size = -1;
-+#endif
-         options-&gt;ip_qos_interactive = -1;
-         options-&gt;ip_qos_bulk = -1;
-         options-&gt;version_addendum = NULL;
-@@ -329,6 +337,57 @@ fill_default_server_options(ServerOption
-         }
-         if (options-&gt;permit_tun == -1)
-                 options-&gt;permit_tun = SSH_TUNMODE_NO;
-+#ifdef NONE_CIPHER_ENABLED
-+        if (options-&gt;none_enabled == -1) 
-+                options-&gt;none_enabled = 0;
-+#endif
-+#ifdef HPN_ENABLED
-+        if (options-&gt;hpn_disabled == -1) 
-+                options-&gt;hpn_disabled = 0;
-+
-+        if (options-&gt;hpn_buffer_size == -1) {
-+                /*
-+                 * option not explicitly set. Now we have to figure out
-+                 * what value to use.
-+                 */
-+                if (options-&gt;hpn_disabled == 1) {
-+                        options-&gt;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, 
-+                            &amp;socksize, &amp;socksizelen);
-+                        close(sock);
-+                        options-&gt;hpn_buffer_size = socksize;
-+                        debug (&quot;HPN Buffer Size: %d&quot;, options-&gt;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-&gt;hpn_disabled &lt;= 0) {
-+                        if (options-&gt;hpn_buffer_size == 0)
-+                                options-&gt;hpn_buffer_size = 1;
-+                        /* limit the maximum buffer to 64MB */
-+                        if (options-&gt;hpn_buffer_size &gt; 64*1024) {
-+                                options-&gt;hpn_buffer_size = 64*1024*1024;
-+                        } else {
-+                                options-&gt;hpn_buffer_size *= 1024;
-+                        }
-+                } else
-+                        options-&gt;hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT;
-+        }
-+#endif
-+
-         if (options-&gt;ip_qos_interactive == -1)
-                 options-&gt;ip_qos_interactive = IPTOS_LOWDELAY;
-         if (options-&gt;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 {
-         { &quot;revokedkeys&quot;, sRevokedKeys, SSHCFG_ALL },
-         { &quot;trustedusercakeys&quot;, sTrustedUserCAKeys, SSHCFG_ALL },
-         { &quot;authorizedprincipalsfile&quot;, sAuthorizedPrincipalsFile, SSHCFG_ALL },
-+#ifdef NONE_CIPHER_ENABLED
-+        { &quot;noneenabled&quot;, sNoneEnabled, SSHCFG_ALL },
-+#endif
-+#ifdef HPN_ENABLED
-+        { &quot;hpndisabled&quot;, sHPNDisabled, SSHCFG_ALL },
-+        { &quot;hpnbuffersize&quot;, sHPNBufferSize, SSHCFG_ALL },
-+        { &quot;tcprcvbufpoll&quot;, sTcpRcvBufPoll, SSHCFG_ALL },
-+#endif
-         { &quot;kexalgorithms&quot;, sKexAlgorithms, SSHCFG_GLOBAL },
-         { &quot;ipqos&quot;, sIPQoS, SSHCFG_ALL },
-         { &quot;authorizedkeyscommand&quot;, sAuthorizedKeysCommand, SSHCFG_ALL },
-@@ -1156,6 +1229,25 @@ process_server_config_line(ServerOptions
-                 intptr = &amp;options-&gt;ignore_user_known_hosts;
-                 goto parse_flag;

-+#ifdef NONE_CIPHER_ENABLED
-+        case sNoneEnabled:
-+                intptr = &amp;options-&gt;none_enabled;
-+                goto parse_flag;
-+#endif
-+#ifdef HPN_ENABLED
-+        case sTcpRcvBufPoll:
-+                intptr = &amp;options-&gt;tcp_rcv_buf_poll;
-+                goto parse_flag;
-+
-+        case sHPNDisabled:
-+                intptr = &amp;options-&gt;hpn_disabled;
-+                goto parse_flag;
-+
-+        case sHPNBufferSize:
-+                intptr = &amp;options-&gt;hpn_buffer_size;
-+                goto parse_int;
-+#endif
-+
-         case sRhostsRSAAuthentication:
-                 intptr = &amp;options-&gt;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 &lt; 0)
-                 goto done;
-+#ifdef HPN_ENABLED
-+        if (!options.hpn_disabled)
-+                c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPEN, sock, sock, -1,
-+                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
-+        else
-+#endif
-         c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPEN, sock, sock, -1,
-             CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
-         c-&gt;datagram = 1;
-@@ -1088,6 +1094,10 @@ server_request_session(void)
-         c = channel_new(&quot;session&quot;, SSH_CHANNEL_LARVAL,
-             -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
-             0, &quot;server-session&quot;, 1);
-+#ifdef HPN_ENABLED
-+        if (options.tcp_rcv_buf_poll &amp;&amp; !options.hpn_disabled)
-+                c-&gt;dynamic_window = 1;
-+#endif
-         if (session_open(the_authctxt, c-&gt;self) != 1) {
-                 debug(&quot;session open failed, free channel %d&quot;, c-&gt;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-&gt;chanid == -1)
-                 fatal(&quot;no channel for session %d&quot;, s-&gt;self);
-+#ifdef HPN_ENABLED
-+        if (!options.hpn_disabled)
-+                channel_set_fds(s-&gt;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-&gt;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 &quot;sftp-client.h&quot;

- #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 &amp; SSH_BUG_LARGEWINDOW) {
-+                debug(&quot;HPN to Non-HPN Connection&quot;);
-+        } else {
-+                int sock, socksize;
-+                socklen_t socksizelen = sizeof(socksize);
-+
-+                if (options.tcp_rcv_buf_poll &lt;= 0) {
-+                        sock = socket(AF_INET, SOCK_STREAM, 0);
-+                        getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-+                            &amp;socksize, &amp;socksizelen);
-+                        close(sock);
-+                        debug(&quot;socksize %d&quot;, socksize);
-+                        options.hpn_buffer_size = socksize;
-+                        debug (&quot;HPNBufferSize set to TCP RWIN: %d&quot;,
-+                            options.hpn_buffer_size);
-+                } else {
-+                        if (options.tcp_rcv_buf &gt; 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 *)&amp;options.tcp_rcv_buf,
-+                                            sizeof(options.tcp_rcv_buf));
-+                                getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-+                                    &amp;socksize, &amp;socksizelen);
-+                                close(sock);
-+                                debug(&quot;socksize %d&quot;, socksize);
-+                                options.hpn_buffer_size = socksize;
-+                                debug (&quot;HPNBufferSize set to user TCPRcvBuf: &quot;
-+                                    &quot;%d&quot;, options.hpn_buffer_size);
-+                        }
-+                }
-+        }
-+
-+        debug(&quot;Final hpn_buffer_size = %d&quot;, 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 &gt;&gt;= 1;
-                 packetmax &gt;&gt;= 1;
-         }
-@@ -1844,6 +1928,12 @@ ssh_session2_open(void)
-             window, packetmax, CHAN_EXTENDED_WRITE,
-             &quot;client-session&quot;, /*nonblock*/0);

-+#ifdef HPN_ENABLED
-+        if (options.tcp_rcv_buf_poll &gt; 0 &amp;&amp; !options.hpn_disabled) {
-+                c-&gt;dynamic_window = 1;
-+                debug (&quot;Enabled Dynamic Window Scaling&quot;);
-+        }
-+#endif
-         debug3(&quot;ssh_session2_open: channel_new: %d&quot;, c-&gt;self);

-         channel_send_open(c-&gt;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 *)&amp;options.tcp_rcv_buf;
-+        int sz = sizeof(options.tcp_rcv_buf);
-+        int socksize;
-+        socklen_t socksizelen = sizeof(socksize);
-+
-+        debug(&quot;setsockopt Attempting to set SO_RCVBUF to %d&quot;, options.tcp_rcv_buf);
-+        if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) &gt;= 0) {
-+          getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &amp;socksize, &amp;socksizelen);
-+          debug(&quot;setsockopt SO_RCVBUF: %.100s %d&quot;, strerror(errno), socksize);
-+        } else
-+                error(&quot;Couldn't set socket receive buffer to %d: %.100s&quot;,
-+                    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 &gt; 0)
-+                ssh_set_socket_recvbuf(sock);
-+#endif
-+
-         /* Bind the socket to an alternative local IP address */
-         if (options.bind_address == NULL &amp;&amp; !privileged)
-                 return sock;
-@@ -523,11 +553,23 @@ send_client_banner(int connection_out, i
- {
-         /* Send our own protocol version identification. */
-         if (compat20) {
--                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s\r\n&quot;,
--                    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
-+                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s%s\r\n&quot;,
-+                    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+                    options.hpn_disabled ? &quot;&quot; : SSH_HPN
-+#else
-+                    &quot;&quot;
-+#endif
-+                    );
-         } else {
--                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s\n&quot;,
--                    PROTOCOL_MAJOR_1, minor1, SSH_VERSION);
-+                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s%s\n&quot;,
-+                    PROTOCOL_MAJOR_1, minor1, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+                    options.hpn_disabled ? &quot;&quot; : SSH_HPN
-+#else
-+                    &quot;&quot;
-+#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(&amp;myproposal, &amp;myproposal_default, sizeof(myproposal));
-+
-         xxx_host = host;
-         xxx_hostaddr = hostaddr;

-@@ -222,6 +233,10 @@ ssh_kex2(char *host, struct sockaddr *ho
-         kex-&gt;server_version_string=server_version_string;
-         kex-&gt;verify_host_key=&amp;verify_host_key_callback;

-+#ifdef NONE_CIPHER_ENABLED
-+        xxx_kex = kex;
-+#endif
-+
-         dispatch_run(DISPATCH_BLOCK, &amp;kex-&gt;done, active_state);

-         if (options.use_roaming &amp;&amp; !kex-&gt;roaming) {
-@@ -423,6 +438,29 @@ ssh_userauth2(const char *local_user, co
-         pubkey_cleanup(&amp;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) &amp;&amp; (options.none_enabled == 1)) {
-+                if (!tty_flag) { /* no null on tty sessions */
-+                        debug(&quot;Requesting none rekeying...&quot;);
-+                        myproposal[PROPOSAL_ENC_ALGS_STOC] = &quot;none&quot;;
-+                        myproposal[PROPOSAL_ENC_ALGS_CTOS] = &quot;none&quot;;
-+                        kex_prop2buf(xxx_kex-&gt;my, myproposal);
-+                        packet_request_rekeying();
-+                        fprintf(stderr, &quot;WARNING: ENABLED NONE CIPHER\n&quot;);
-+                } else {
-+                        /* requested NONE cipher when in a tty */
-+                        debug(&quot;Cannot switch to NONE cipher with tty allocated&quot;);
-+                        fprintf(stderr, &quot;NONE cipher switch disabled when a TTY is allocated\n&quot;);
-+                }
-+        }
-+#endif
-+
-         debug(&quot;Authentication succeeded (%s).&quot;, authctxt.method-&gt;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(&amp;server_version_string, &quot;SSH-%d.%d-%.100s%s%s%s&quot;,
-+        xasprintf(&amp;server_version_string, &quot;SSH-%d.%d-%.100s%s%s%s%s&quot;,
-             major, minor, SSH_VERSION,
-+#ifdef HPN_ENABLED
-+            options.hpn_disabled ? &quot;&quot; : SSH_HPN,
-+#endif
-             *options.version_addendum == '\0' ? &quot;&quot; : &quot; &quot;,
-             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-&gt;ai_next) {
-                 if (ai-&gt;ai_family != AF_INET &amp;&amp; ai-&gt;ai_family != AF_INET6)
-@@ -1198,6 +1205,13 @@ server_listen(void)

-                 debug(&quot;Bind to port %s on %s.&quot;, strport, ntop);

-+#ifdef HPN_ENABLED
-+                getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF,
-+                                   &amp;socksize, &amp;socksizelen);
-+                debug(&quot;Server TCP RWIN socket size: %d&quot;, socksize);
-+                debug(&quot;HPN Buffer Size: %d&quot;, options.hpn_buffer_size);
-+#endif
-+
-                 /* Bind the socket to the desired port. */
-                 if (bind(listen_sock, ai-&gt;ai_addr, ai-&gt;ai_addrlen) &lt; 0) {
-                         error(&quot;Bind to port %s on %s failed: %.200s.&quot;,
-@@ -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 (&quot;WARNING: None cipher enabled&quot;);
-+                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        &quot;p1&quot;
- #define SSH_RELEASE        SSH_VERSION SSH_PORTABLE
-+#define SSH_HPN         &quot;-hpn14v5&quot;
</del></span></pre></div>
<a id="trunkdportsnetopensshfilesopenssh71p1hpnssh14v5difffromrev141606trunkdportsnetopensshfilesopenssh69p1hpnssh14v5diff"></a>
<div class="copfile"><h4>Copied: trunk/dports/net/openssh/files/openssh-7.1p1-hpnssh14v5.diff (from rev 141606, trunk/dports/net/openssh/files/openssh-6.9p1-hpnssh14v5.diff) (0 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,1292 @@
</span><ins>+--- /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@host.com
++               scp -oCipher=aes256-ctr file you@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@psc.edu)
++         The majority of the actual coding for versions up to HPN12v1 was performed
++         by Michael Stevens (mstevens@andrew.cmu.edu). The MT-AES-CTR cipher was
++        implemented by Ben Bennet (ben@psc.edu) and improved by Mike Tasota
++        (tasota@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-&gt;local_window_max = window;
+         c-&gt;local_consumed = 0;
+         c-&gt;local_maxpacket = maxpack;
++#ifdef HPN_ENABLED
++        c-&gt;dynamic_window = 0;
++#endif
+         c-&gt;remote_id = -1;
+         c-&gt;remote_name = xstrdup(remote_name);
+         c-&gt;remote_window = 0;
+@@ -840,11 +849,41 @@ channel_pre_open_13(Channel *c, fd_set *
+                 FD_SET(c-&gt;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, &amp;tcpwinsz, &amp;optsz);
++        /* return no more than SSHBUF_SIZE_MAX */
++        if (ret == 0 &amp;&amp; tcpwinsz &gt; SSHBUF_SIZE_MAX)
++                tcpwinsz = SSHBUF_SIZE_MAX;
++        debug2(&quot;tcpwinsz: %d for connection: %d&quot;, 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-&gt;remote_window : packet_get_maxsize();

++#ifdef HPN_ENABLED
++        /* check buffer limits */
++        if (!c-&gt;tcpwinsz || c-&gt;dynamic_window &gt; 0)
++                c-&gt;tcpwinsz = channel_tcpwinsz();
++
++        limit = MIN(limit, 2 * c-&gt;tcpwinsz);
++#endif
++
+         if (c-&gt;istate == CHAN_INPUT_OPEN &amp;&amp;
+             limit &gt; 0 &amp;&amp;
+             buffer_len(&amp;c-&gt;input) &lt; limit &amp;&amp;
+@@ -1862,6 +1901,20 @@ channel_check_window(Channel *c)
+             c-&gt;local_maxpacket*3) ||
+             c-&gt;local_window &lt; c-&gt;local_window_max/2) &amp;&amp;
+             c-&gt;local_consumed &gt; 0) {
++#ifdef HPN_ENABLED
++                /* adjust max window size if we are in a dynamic environment */
++                if (c-&gt;dynamic_window &amp;&amp; (c-&gt;tcpwinsz &gt; c-&gt;local_window_max)) {
++                        u_int addition = 0;
++
++                        /*
++                         * grow the window somewhat aggressively to maintain
++                         * pressure
++                         */
++                        addition = 1.5*(c-&gt;tcpwinsz - c-&gt;local_window_max);
++                        c-&gt;local_window_max += addition;
++                        c-&gt;local_consumed += addition;
++                }
++#endif
+                 packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
+                 packet_put_int(c-&gt;remote_id);
+                 packet_put_int(c-&gt;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(&quot;HPN Disabled: %d, HPN Buffer Size: %d&quot;, 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(&quot;port listener&quot;, type, sock, sock, -1,
++                            hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
++                            0, &quot;port listener&quot;, 1);
++                else
++#endif
+                 c = channel_new(&quot;port listener&quot;, type, sock, sock, -1,
+                     CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
+                     0, &quot;port listener&quot;, 1);
+@@ -3975,6 +4050,14 @@ x11_create_display_inet(int x11_display_
+         *chanids = xcalloc(num_socks + 1, sizeof(**chanids));
+         for (n = 0; n &lt; num_socks; n++) {
+                 sock = socks[n];
++#ifdef HPN_ENABLED
++                if (!hpn_disabled)
++                        nc = channel_new(&quot;x11 listener&quot;,
++                            SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
++                            hpn_buffer_size, CHAN_X11_PACKET_DEFAULT,
++                            0, &quot;X11 inet listener&quot;, 1);
++                else
++#endif
+                 nc = channel_new(&quot;x11 listener&quot;,
+                     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(&amp;cp, CIPHER_SEP)); p &amp;&amp; *p != '\0';
+             (p = strsep(&amp;cp, CIPHER_SEP))) {
+                 c = cipher_by_name(p);
+-                if (c == NULL || c-&gt;number != SSH_CIPHER_SSH2) {
++                if (c == NULL || (c-&gt;number != SSH_CIPHER_SSH2 &amp;&amp;
++#ifdef NONE_CIPHER_ENABLED
++                                  c-&gt;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-&gt;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-&gt;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 &lt; 0)
+                 return NULL;
++#ifdef HPN_ENABLED
++        /* again is this really necessary for X11? */
++        if (!options.hpn_disabled)
++                c = channel_new(&quot;x11&quot;,
++                    SSH_CHANNEL_X11_OPEN, sock, sock, -1,
++                    options.hpn_buffer_size,
++                    CHAN_X11_PACKET_DEFAULT, 0, &quot;x11&quot;, 1);
++        else
++#endif
+         c = channel_new(&quot;x11&quot;,
+             SSH_CHANNEL_X11_OPEN, sock, sock, -1,
+             CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, &quot;x11&quot;, 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(&quot;authentication agent connection&quot;,
++                    SSH_CHANNEL_OPEN, sock, sock, -1,
++                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0,
++                    &quot;authentication agent connection&quot;, 1);
++        else
++#endif
+         c = channel_new(&quot;authentication agent connection&quot;,
+             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(&quot;tun&quot;, SSH_CHANNEL_OPENING, fd, fd, -1,
++                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
++        else
++#endif
+         c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPENING, fd, fd, -1,
+             CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
+         c-&gt;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(&quot;match: %s pat %s compat 0x%08x&quot;,
+                             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,&quot;OpenSSH&quot;) != NULL &amp;&amp;
++                            strstr(version,&quot;hpn&quot;) == NULL) {
++                                datafellows |= SSH_BUG_LARGEWINDOW;
++                                debug(&quot;Remote is NON-HPN aware&quot;);
++                        }
++#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=&quot;no&quot;
++AC_ARG_WITH(hpn,
++        [  --with-hpn             Enable HPN support],
++        [ if test &quot;x$withval&quot; != &quot;xno&quot; ; then
++                AC_DEFINE(HPN_ENABLED,1,[Define if you want HPN support.])
++                HPN_MSG=&quot;yes&quot;
++        fi ]
++)
++#check whether user wants NONECIPHER support
++NONECIPHER_MSG=&quot;no&quot;
++AC_ARG_WITH(nonecipher,
++        [  --with-nonecipher             Enable NONECIPHER support],
++        [ if test &quot;x$withval&quot; != &quot;xno&quot; ; then
++                AC_DEFINE(NONE_CIPHER_ENABLED,1,[Define if you want NONECIPHER support.])
++                NONECIPHER_MSG=&quot;yes&quot;
++        fi ]
++)
++
+ if test ! -z &quot;$cross_compiling&quot; &amp;&amp; test &quot;x$cross_compiling&quot; = &quot;xyes&quot;; then
+         AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
+         disable_ptmx_check=yes
+@@ -4938,6 +4957,8 @@ echo &quot;           Translate v4 in v6 hack
+ echo &quot;                  BSD Auth support: $BSD_AUTH_MSG&quot;
+ echo &quot;              Random number source: $RAND_MSG&quot;
+ echo &quot;             Privsep sandbox style: $SANDBOX_STYLE&quot;
++echo &quot;                       HPN support: $HPN_MSG&quot;
++echo &quot;                NONECIPHER support: $NONECIPHER_MSG&quot;

+ echo &quot;&quot;

+--- 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 (&quot;AUTH STATE IS %d&quot;, auth_flag);
++#endif

+         if ((r = kex_buf2prop(kex-&gt;my, NULL, &amp;my)) != 0 ||
+             (r = kex_buf2prop(kex-&gt;peer, &amp;first_kex_follows, &amp;peer)) != 0)
+@@ -709,6 +716,17 @@ kex_choose_conf(struct ssh *ssh)
+                         peer[ncomp] = NULL;
+                         goto out;
+                 }
++#ifdef NONE_CIPHER_ENABLED
++                debug(&quot;REQUESTED ENC.NAME is '%s'&quot;, newkeys-&gt;enc.name);
++                if (strcmp(newkeys-&gt;enc.name, &quot;none&quot;) == 0) {
++                        debug(&quot;Requesting NONE. Authflag is %d&quot;, auth_flag);
++                        if (auth_flag == 1) {
++                                debug(&quot;None requested post authentication.&quot;);
++                        } else {
++                                fatal(&quot;Pre-authentication none cipher requests are not allowed.&quot;);
++                        }
++                }
++#endif
+                 debug(&quot;kex: %s %s %s %s&quot;,
+                     ctos ? &quot;client-&gt;server&quot; : &quot;server-&gt;client&quot;,
+                     newkeys-&gt;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        &quot;none,zlib@openssh.com,zlib&quot;
+ #define        KEX_DEFAULT_LANG        &quot;&quot;

++#ifdef NONE_CIPHER_ENABLED
++#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT &quot;,none&quot;
++#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-&gt;state;
++
++        return(state-&gt;after_authentication);
++}
++#endif
++
+ #define MAX_PACKETS        (1U&lt;&lt;31)
+ int
+ ssh_packet_need_rekeying(struct ssh *ssh)
+@@ -2236,6 +2254,12 @@ ssh_packet_need_rekeying(struct ssh *ssh

+         if (ssh-&gt;compat &amp; SSH_BUG_NOREKEY)
+                 return 0;
++#ifdef NONE_CIPHER_ENABLED
++        if (rekey_requested == 1) {
++               rekey_requested = 0;
++               return 1;
++        }
++#endif
+         return
+             (state-&gt;p_send.packets &gt; MAX_PACKETS) ||
+             (state-&gt;p_read.packets &gt; 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 &quot;opacket.h&quot;
+--- 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 {
+         { &quot;updatehostkeys&quot;, oUpdateHostkeys },
+         { &quot;hostbasedkeytypes&quot;, oHostbasedKeyTypes },
+         { &quot;pubkeyacceptedkeytypes&quot;, oPubkeyAcceptedKeyTypes },
++#ifdef NONE_CIPHER_ENABLED
++        { &quot;noneenabled&quot;, oNoneEnabled },
++        { &quot;noneswitch&quot;, oNoneSwitch },
++#endif
++#ifdef HPN_ENABLED
++        { &quot;tcprcvbufpoll&quot;, oTcpRcvBufPoll },
++        { &quot;tcprcvbuf&quot;, oTcpRcvBuf },
++        { &quot;hpndisabled&quot;, oHPNDisabled },
++        { &quot;hpnbuffersize&quot;, oHPNBufferSize },
++#endif
+         { &quot;ignoreunknown&quot;, oIgnoreUnknown },

+         { NULL, oBadOption }
+@@ -906,6 +922,44 @@ parse_time:
+                 intptr = &amp;options-&gt;check_host_ip;
+                 goto parse_flag;

++#ifdef HPN_ENABLED
++        case oHPNDisabled:
++                intptr = &amp;options-&gt;hpn_disabled;
++                goto parse_flag;
++
++        case oHPNBufferSize:
++                intptr = &amp;options-&gt;hpn_buffer_size;
++                goto parse_int;
++
++        case oTcpRcvBufPoll:
++                intptr = &amp;options-&gt;tcp_rcv_buf_poll;
++                goto parse_flag;
++
++        case oTcpRcvBuf:
++                intptr = &amp;options-&gt;tcp_rcv_buf;
++                goto parse_int;
++#endif
++
++#ifdef NONE_CIPHER_ENABLED
++        case oNoneEnabled:
++                intptr = &amp;options-&gt;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,&quot;command-line&quot;) == 0) {
++                        intptr = &amp;options-&gt;none_switch;
++                        goto parse_flag;
++                } else {
++                        error(&quot;NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line&quot;, filename);
++                        error(&quot;Continuing...&quot;);
++                        debug(&quot;NoneSwitch directive found in %.200s.&quot;, filename);
++                        return 0;
++                }
++#endif
++
+         case oVerifyHostKeyDNS:
+                 intptr = &amp;options-&gt;verify_host_key_dns;
+                 multistate_ptr = multistate_yesnoask;
+@@ -1665,6 +1719,16 @@ initialize_options(Options * options)
+         options-&gt;ip_qos_interactive = -1;
+         options-&gt;ip_qos_bulk = -1;
+         options-&gt;request_tty = -1;
++#ifdef NONE_CIPHER_ENABLED
++        options-&gt;none_switch = -1;
++        options-&gt;none_enabled = -1;
++#endif
++#ifdef HPN_ENABLED
++        options-&gt;hpn_disabled = -1;
++        options-&gt;hpn_buffer_size = -1;
++        options-&gt;tcp_rcv_buf_poll = -1;
++        options-&gt;tcp_rcv_buf = -1;
++#endif
+         options-&gt;proxy_use_fdpass = -1;
+         options-&gt;ignored_unknown = NULL;
+         options-&gt;num_canonical_domains = 0;
+@@ -1817,6 +1881,35 @@ fill_default_options(Options * options)
+                 options-&gt;server_alive_interval = 0;
+         if (options-&gt;server_alive_count_max == -1)
+                 options-&gt;server_alive_count_max = 3;
++#ifdef NONE_CIPHER_ENABLED
++        if (options-&gt;none_switch == -1)
++                options-&gt;none_switch = 0;
++        if (options-&gt;none_enabled == -1)
++                options-&gt;none_enabled = 0;
++#endif
++#ifdef HPN_ENABLED
++        if (options-&gt;hpn_disabled == -1)
++                options-&gt;hpn_disabled = 0;
++        if (options-&gt;hpn_buffer_size &gt; -1) {
++                /* if a user tries to set the size to 0 set it to 1KB */
++                if (options-&gt;hpn_buffer_size == 0)
++                        options-&gt;hpn_buffer_size = 1;
++                /* limit the buffer to 64MB */
++                if (options-&gt;hpn_buffer_size &gt; 64*1024) {
++                        options-&gt;hpn_buffer_size = 64*1024*1024;
++                        debug(&quot;User requested buffer larger than 64MB. Request&quot;
++                            &quot; reverted to 64MB&quot;);
++                } else
++                        options-&gt;hpn_buffer_size *= 1024;
++                debug(&quot;hpn_buffer_size set to %d&quot;, options-&gt;hpn_buffer_size);
++        }
++        if (options-&gt;tcp_rcv_buf == 0)
++                options-&gt;tcp_rcv_buf = 1;
++        if (options-&gt;tcp_rcv_buf &gt; -1)
++                options-&gt;tcp_rcv_buf *=1024;
++        if (options-&gt;tcp_rcv_buf_poll == -1)
++                options-&gt;tcp_rcv_buf_poll = 1;
++#endif
+         if (options-&gt;control_master == -1)
+                 options-&gt;control_master = 0;
+         if (options-&gt;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 &lt; 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-&gt;authorized_principals_file = NULL;
+         options-&gt;authorized_principals_command = NULL;
+         options-&gt;authorized_principals_command_user = NULL;
++#ifdef NONE_CIPHER_ENABLED
++        options-&gt;none_enabled = -1;
++#endif
++#ifdef HPN_ENABLED
++        options-&gt;tcp_rcv_buf_poll = -1;
++        options-&gt;hpn_disabled = -1;
++        options-&gt;hpn_buffer_size = -1;
++#endif
+         options-&gt;ip_qos_interactive = -1;
+         options-&gt;ip_qos_bulk = -1;
+         options-&gt;version_addendum = NULL;
+@@ -329,6 +337,57 @@ fill_default_server_options(ServerOption
+         }
+         if (options-&gt;permit_tun == -1)
+                 options-&gt;permit_tun = SSH_TUNMODE_NO;
++#ifdef NONE_CIPHER_ENABLED
++        if (options-&gt;none_enabled == -1)
++                options-&gt;none_enabled = 0;
++#endif
++#ifdef HPN_ENABLED
++        if (options-&gt;hpn_disabled == -1)
++                options-&gt;hpn_disabled = 0;
++
++        if (options-&gt;hpn_buffer_size == -1) {
++                /*
++                 * option not explicitly set. Now we have to figure out
++                 * what value to use.
++                 */
++                if (options-&gt;hpn_disabled == 1) {
++                        options-&gt;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,
++                            &amp;socksize, &amp;socksizelen);
++                        close(sock);
++                        options-&gt;hpn_buffer_size = socksize;
++                        debug (&quot;HPN Buffer Size: %d&quot;, options-&gt;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-&gt;hpn_disabled &lt;= 0) {
++                        if (options-&gt;hpn_buffer_size == 0)
++                                options-&gt;hpn_buffer_size = 1;
++                        /* limit the maximum buffer to 64MB */
++                        if (options-&gt;hpn_buffer_size &gt; 64*1024) {
++                                options-&gt;hpn_buffer_size = 64*1024*1024;
++                        } else {
++                                options-&gt;hpn_buffer_size *= 1024;
++                        }
++                } else
++                        options-&gt;hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT;
++        }
++#endif
++
+         if (options-&gt;ip_qos_interactive == -1)
+                 options-&gt;ip_qos_interactive = IPTOS_LOWDELAY;
+         if (options-&gt;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 {
+         { &quot;revokedkeys&quot;, sRevokedKeys, SSHCFG_ALL },
+         { &quot;trustedusercakeys&quot;, sTrustedUserCAKeys, SSHCFG_ALL },
+         { &quot;authorizedprincipalsfile&quot;, sAuthorizedPrincipalsFile, SSHCFG_ALL },
++#ifdef NONE_CIPHER_ENABLED
++        { &quot;noneenabled&quot;, sNoneEnabled, SSHCFG_ALL },
++#endif
++#ifdef HPN_ENABLED
++        { &quot;hpndisabled&quot;, sHPNDisabled, SSHCFG_ALL },
++        { &quot;hpnbuffersize&quot;, sHPNBufferSize, SSHCFG_ALL },
++        { &quot;tcprcvbufpoll&quot;, sTcpRcvBufPoll, SSHCFG_ALL },
++#endif
+         { &quot;kexalgorithms&quot;, sKexAlgorithms, SSHCFG_GLOBAL },
+         { &quot;ipqos&quot;, sIPQoS, SSHCFG_ALL },
+         { &quot;authorizedkeyscommand&quot;, sAuthorizedKeysCommand, SSHCFG_ALL },
+@@ -1169,6 +1242,25 @@ process_server_config_line(ServerOptions
+                 intptr = &amp;options-&gt;ignore_user_known_hosts;
+                 goto parse_flag;

++#ifdef NONE_CIPHER_ENABLED
++        case sNoneEnabled:
++                intptr = &amp;options-&gt;none_enabled;
++                goto parse_flag;
++#endif
++#ifdef HPN_ENABLED
++        case sTcpRcvBufPoll:
++                intptr = &amp;options-&gt;tcp_rcv_buf_poll;
++                goto parse_flag;
++
++        case sHPNDisabled:
++                intptr = &amp;options-&gt;hpn_disabled;
++                goto parse_flag;
++
++        case sHPNBufferSize:
++                intptr = &amp;options-&gt;hpn_buffer_size;
++                goto parse_int;
++#endif
++
+         case sRhostsRSAAuthentication:
+                 intptr = &amp;options-&gt;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 &lt; 0)
+                 goto done;
++#ifdef HPN_ENABLED
++        if (!options.hpn_disabled)
++                c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPEN, sock, sock, -1,
++                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
++        else
++#endif
+         c = channel_new(&quot;tun&quot;, SSH_CHANNEL_OPEN, sock, sock, -1,
+             CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, &quot;tun&quot;, 1);
+         c-&gt;datagram = 1;
+@@ -1088,6 +1094,10 @@ server_request_session(void)
+         c = channel_new(&quot;session&quot;, SSH_CHANNEL_LARVAL,
+             -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
+             0, &quot;server-session&quot;, 1);
++#ifdef HPN_ENABLED
++        if (options.tcp_rcv_buf_poll &amp;&amp; !options.hpn_disabled)
++                c-&gt;dynamic_window = 1;
++#endif
+         if (session_open(the_authctxt, c-&gt;self) != 1) {
+                 debug(&quot;session open failed, free channel %d&quot;, c-&gt;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-&gt;chanid == -1)
+                 fatal(&quot;no channel for session %d&quot;, s-&gt;self);
++#ifdef HPN_ENABLED
++        if (!options.hpn_disabled)
++                channel_set_fds(s-&gt;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-&gt;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 &quot;sftp-client.h&quot;

+ #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 &amp; SSH_BUG_LARGEWINDOW) {
++                debug(&quot;HPN to Non-HPN Connection&quot;);
++        } else {
++                int sock, socksize;
++                socklen_t socksizelen = sizeof(socksize);
++
++                if (options.tcp_rcv_buf_poll &lt;= 0) {
++                        sock = socket(AF_INET, SOCK_STREAM, 0);
++                        getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++                            &amp;socksize, &amp;socksizelen);
++                        close(sock);
++                        debug(&quot;socksize %d&quot;, socksize);
++                        options.hpn_buffer_size = socksize;
++                        debug (&quot;HPNBufferSize set to TCP RWIN: %d&quot;,
++                            options.hpn_buffer_size);
++                } else {
++                        if (options.tcp_rcv_buf &gt; 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 *)&amp;options.tcp_rcv_buf,
++                                            sizeof(options.tcp_rcv_buf));
++                                getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
++                                    &amp;socksize, &amp;socksizelen);
++                                close(sock);
++                                debug(&quot;socksize %d&quot;, socksize);
++                                options.hpn_buffer_size = socksize;
++                                debug (&quot;HPNBufferSize set to user TCPRcvBuf: &quot;
++                                    &quot;%d&quot;, options.hpn_buffer_size);
++                        }
++                }
++        }
++
++        debug(&quot;Final hpn_buffer_size = %d&quot;, 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 &gt;&gt;= 1;
+                 packetmax &gt;&gt;= 1;
+         }
+@@ -1845,6 +1929,12 @@ ssh_session2_open(void)
+             window, packetmax, CHAN_EXTENDED_WRITE,
+             &quot;client-session&quot;, /*nonblock*/0);

++#ifdef HPN_ENABLED
++        if (options.tcp_rcv_buf_poll &gt; 0 &amp;&amp; !options.hpn_disabled) {
++                c-&gt;dynamic_window = 1;
++                debug (&quot;Enabled Dynamic Window Scaling&quot;);
++        }
++#endif
+         debug3(&quot;ssh_session2_open: channel_new: %d&quot;, c-&gt;self);

+         channel_send_open(c-&gt;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 *)&amp;options.tcp_rcv_buf;
++        int sz = sizeof(options.tcp_rcv_buf);
++        int socksize;
++        socklen_t socksizelen = sizeof(socksize);
++
++        debug(&quot;setsockopt Attempting to set SO_RCVBUF to %d&quot;, options.tcp_rcv_buf);
++        if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) &gt;= 0) {
++          getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &amp;socksize, &amp;socksizelen);
++          debug(&quot;setsockopt SO_RCVBUF: %.100s %d&quot;, strerror(errno), socksize);
++        } else
++                error(&quot;Couldn't set socket receive buffer to %d: %.100s&quot;,
++                    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 &gt; 0)
++                ssh_set_socket_recvbuf(sock);
++#endif
++
+         /* Bind the socket to an alternative local IP address */
+         if (options.bind_address == NULL &amp;&amp; !privileged)
+                 return sock;
+@@ -523,11 +553,23 @@ send_client_banner(int connection_out, i
+ {
+         /* Send our own protocol version identification. */
+         if (compat20) {
+-                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s\r\n&quot;,
+-                    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
++                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s%s\r\n&quot;,
++                    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
++#ifdef HPN_ENABLED
++                    options.hpn_disabled ? &quot;&quot; : SSH_HPN
++#else
++                    &quot;&quot;
++#endif
++                    );
+         } else {
+-                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s\n&quot;,
+-                    PROTOCOL_MAJOR_1, minor1, SSH_VERSION);
++                xasprintf(&amp;client_version_string, &quot;SSH-%d.%d-%.100s%s\n&quot;,
++                    PROTOCOL_MAJOR_1, minor1, SSH_VERSION,
++#ifdef HPN_ENABLED
++                    options.hpn_disabled ? &quot;&quot; : SSH_HPN
++#else
++                    &quot;&quot;
++#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(&amp;myproposal, &amp;myproposal_default, sizeof(myproposal));
++
+         xxx_host = host;
+         xxx_hostaddr = hostaddr;

+@@ -215,6 +226,10 @@ ssh_kex2(char *host, struct sockaddr *ho
+         kex-&gt;server_version_string=server_version_string;
+         kex-&gt;verify_host_key=&amp;verify_host_key_callback;

++#ifdef NONE_CIPHER_ENABLED
++        xxx_kex = kex;
++#endif
++
+         dispatch_run(DISPATCH_BLOCK, &amp;kex-&gt;done, active_state);

+         if (options.use_roaming &amp;&amp; !kex-&gt;roaming) {
+@@ -416,6 +431,29 @@ ssh_userauth2(const char *local_user, co
+         pubkey_cleanup(&amp;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) &amp;&amp; (options.none_enabled == 1)) {
++                if (!tty_flag) { /* no null on tty sessions */
++                        debug(&quot;Requesting none rekeying...&quot;);
++                        myproposal[PROPOSAL_ENC_ALGS_STOC] = &quot;none&quot;;
++                        myproposal[PROPOSAL_ENC_ALGS_CTOS] = &quot;none&quot;;
++                        kex_prop2buf(xxx_kex-&gt;my, myproposal);
++                        packet_request_rekeying();
++                        fprintf(stderr, &quot;WARNING: ENABLED NONE CIPHER\n&quot;);
++                } else {
++                        /* requested NONE cipher when in a tty */
++                        debug(&quot;Cannot switch to NONE cipher with tty allocated&quot;);
++                        fprintf(stderr, &quot;NONE cipher switch disabled when a TTY is allocated\n&quot;);
++                }
++        }
++#endif
++
+         debug(&quot;Authentication succeeded (%s).&quot;, authctxt.method-&gt;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(&amp;server_version_string, &quot;SSH-%d.%d-%.100s%s%s%s&quot;,
++        xasprintf(&amp;server_version_string, &quot;SSH-%d.%d-%.100s%s%s%s%s&quot;,
+             major, minor, SSH_VERSION,
++#ifdef HPN_ENABLED
++            options.hpn_disabled ? &quot;&quot; : SSH_HPN,
++#endif
+             *options.version_addendum == '\0' ? &quot;&quot; : &quot; &quot;,
+             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-&gt;ai_next) {
+                 if (ai-&gt;ai_family != AF_INET &amp;&amp; ai-&gt;ai_family != AF_INET6)
+@@ -1202,6 +1209,13 @@ server_listen(void)

+                 debug(&quot;Bind to port %s on %s.&quot;, strport, ntop);

++#ifdef HPN_ENABLED
++                getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF,
++                                   &amp;socksize, &amp;socksizelen);
++                debug(&quot;Server TCP RWIN socket size: %d&quot;, socksize);
++                debug(&quot;HPN Buffer Size: %d&quot;, options.hpn_buffer_size);
++#endif
++
+                 /* Bind the socket to the desired port. */
+                 if (bind(listen_sock, ai-&gt;ai_addr, ai-&gt;ai_addrlen) &lt; 0) {
+                         error(&quot;Bind to port %s on %s failed: %.200s.&quot;,
+@@ -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 (&quot;WARNING: None cipher enabled&quot;);
++                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] = &quot;none&quot;;
+--- 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        &quot;p1&quot;
+ #define SSH_RELEASE        SSH_VERSION SSH_PORTABLE
++#define SSH_HPN         &quot;-hpn14v5&quot;
</ins></span></pre></div>
<a id="trunkdportsnetopensshfilespampatch"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/pam.patch (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>---- 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
</del><ins>+--- 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
</ins><span class="cx">  
</span><span class="cx">          /* Portable-specific options */
</span><span class="cx">          if (options-&gt;use_pam == -1)
</span></span></pre></div>
<a id="trunkdportsnetopensshfilespatchsandboxdarwincapplesandboxnamedexternaldiff"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/patch-sandbox-darwin.c-apple-sandbox-named-external.diff (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>---- 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 @@
</del><ins>+--- 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
</ins><span class="cx">          struct rlimit rl_zero;
</span><span class="cx">  
</span><span class="cx">          debug3(&quot;%s: starting Darwin sandbox&quot;, __func__);
</span></span></pre></div>
<a id="trunkdportsnetopensshfilespatchsshdcapplesandboxnamedexternaldiff"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/openssh/files/patch-sshd.c-apple-sandbox-named-external.diff (141652 => 141653)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>---- 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)
</del><ins>+--- 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)
</ins><span class="cx">                  set_log_handler(mm_log_handler, pmonitor);
</span><span class="cx">  
</span><span class="cx">                  /* Demote the child */
</span></span></pre>
</div>
</div>

</body>
</html>