Ticket #43556: openssh-bug_curve25519pad.diff

File openssh-bug_curve25519pad.diff, 5.7 KB (added by Ionic (Mihai Moldovan), 10 years ago)

Apply BUG_CURVE25519PAD patch.

  • net/openssh/Portfile

    old new PortSystem 1.0 
    55
    66name                openssh
    77version             6.6p1
    8 revision            1
     8revision            2
    99categories          net
    1010platforms           darwin
    1111maintainers         nomaintainer
    patch.args -p1 
    4848patchfiles          launchd.patch \
    4949                    pam.patch \
    5050                    patch-sandbox-darwin.c-apple-sandbox-named-external.diff \
    51                     patch-sshd.c-apple-sandbox-named-external.diff
     51                    patch-sshd.c-apple-sandbox-named-external.diff \
     52                    patch-bug_curve25519pad.diff
     53
    5254# We need a couple of patches
    5355# - pam.patch
    5456#   getpwnam(3) on OS X always returns "*********" in the pw_passwd field even
    variant hpn conflicts gsskex description {Apply high performance patch} { 
    133135    # http://www.psc.edu/index.php/hpn-ssh
    134136    # http://www.freshports.org/security/openssh-portable/ is usually quick in
    135137    # updating the HPN patch for new versions, take a look there, too.
    136     patch_sites-append      http://mirror.shatow.net/freebsd/openssh/
    137     set hpn_patchfile       ${name}-${version}-hpnssh14v2.diff.gz
     138    patch_sites-append      http://ionic.de/openssh/
     139    set hpn_patchfile       ${name}-${version}-hpnssh14v3.diff.gz
    138140    patchfiles-append       ${hpn_patchfile}
    139141    checksums-append        ${hpn_patchfile} \
    140                             rmd160  1e553ce6ba06237cfd0eb8c6ad9433df5eec8fee \
    141                             sha256  2a1b34dc3bf922e12cbca687e57b1fad2a0b087e38022e6782e99b45fcc1a315
     142                            rmd160  2931f137aa9852201d64c5652a70d94f63d126f3 \
     143                            sha256  b74cbe1a31ba8198d0bddeb989f9407d2699f3d072c9adb03b5b3b93785069eb
    142144}
    143145
    144146variant gsskex conflicts hpn requires kerberos5 description "Add OpenSSH GSSAPI key exchange patch" {
  • new file net/openssh/files/patch-bug_curve25519pad.diff

    - +  
     1--- a/version.h 27 Feb 2014 23:01:54 -0000      1.82
     2+++ b/version.h 20 Apr 2014 03:35:15 -0000
     3@@ -1,6 +1,6 @@
     4 /* $OpenBSD: version.h,v 1.70 2014/02/27 22:57:40 djm Exp $ */
     5 
     6-#define SSH_VERSION    "OpenSSH_6.6"
     7+#define SSH_VERSION    "OpenSSH_6.6.1"
     8 
     9 #define SSH_PORTABLE   "p1"
     10 #define SSH_RELEASE    SSH_VERSION SSH_PORTABLE
     11--- a/compat.c  31 Dec 2013 01:25:41 -0000      1.82
     12+++ b/compat.c  20 Apr 2014 03:33:59 -0000      1.85
     13@@ -95,6 +95,9 @@ compat_datafellows(const char *version)
     14                { "Sun_SSH_1.0*",       SSH_BUG_NOREKEY|SSH_BUG_EXTEOF},
     15                { "OpenSSH_4*",         0 },
     16                { "OpenSSH_5*",         SSH_NEW_OPENSSH|SSH_BUG_DYNAMIC_RPORT},
     17+               { "OpenSSH_6.6.1*",     SSH_NEW_OPENSSH},
     18+               { "OpenSSH_6.5*,"
     19+                 "OpenSSH_6.6*",       SSH_NEW_OPENSSH|SSH_BUG_CURVE25519PAD},
     20                { "OpenSSH*",           SSH_NEW_OPENSSH },
     21                { "*MindTerm*",         0 },
     22                { "2.1.0*",             SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
     23@@ -251,7 +254,6 @@ compat_cipher_proposal(char *cipher_prop
     24        return cipher_prop;
     25 }
     26 
     27-
     28 char *
     29 compat_pkalg_proposal(char *pkalg_prop)
     30 {
     31@@ -263,5 +265,18 @@ compat_pkalg_proposal(char *pkalg_prop)
     32        if (*pkalg_prop == '\0')
     33                fatal("No supported PK algorithms found");
     34        return pkalg_prop;
     35+}
     36+
     37+char *
     38+compat_kex_proposal(char *kex_prop)
     39+{
     40+       if (!(datafellows & SSH_BUG_CURVE25519PAD))
     41+               return kex_prop;
     42+       debug2("%s: original KEX proposal: %s", __func__, kex_prop);
     43+       kex_prop = filter_proposal(kex_prop, "curve25519-sha256@libssh.org");
     44+       debug2("%s: compat KEX proposal: %s", __func__, kex_prop);
     45+       if (*kex_prop == '\0')
     46+               fatal("No supported key exchange algorithms found");
     47+       return kex_prop;
     48 }
     49 
     50--- a/compat.h  31 Dec 2013 01:25:41 -0000      1.42
     51+++ b/compat.h  20 Apr 2014 03:25:31 -0000      1.43
     52@@ -59,6 +59,7 @@
     53 #define SSH_BUG_RFWD_ADDR      0x02000000
     54 #define SSH_NEW_OPENSSH                0x04000000
     55 #define SSH_BUG_DYNAMIC_RPORT  0x08000000
     56+#define SSH_BUG_CURVE25519PAD  0x10000000
     57 
     58 void     enable_compat13(void);
     59 void     enable_compat20(void);
     60@@ -66,6 +67,7 @@ void     compat_datafellows(const char *
     61 int     proto_spec(const char *);
     62 char   *compat_cipher_proposal(char *);
     63 char   *compat_pkalg_proposal(char *);
     64+char   *compat_kex_proposal(char *);
     65 
     66 extern int compat13;
     67 extern int compat20;
     68--- a/sshd.c    26 Feb 2014 23:20:08 -0000      1.448
     69+++ b/sshd.c    20 Apr 2014 03:28:41 -0000      1.453
     70@@ -2462,6 +2438,9 @@ do_ssh2_kex(void)
     71        if (options.kex_algorithms != NULL)
     72                myproposal[PROPOSAL_KEX_ALGS] = options.kex_algorithms;
     73 
     74+       myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
     75+           myproposal[PROPOSAL_KEX_ALGS]);
     76+
     77        if (options.rekey_limit || options.rekey_interval)
     78                packet_set_rekey_limits((u_int32_t)options.rekey_limit,
     79                    (time_t)options.rekey_interval);
     80--- a/sshconnect2.c     4 Feb 2014 00:20:16 -0000       1.197
     81+++ b/sshconnect2.c     20 Apr 2014 03:25:31 -0000      1.199
     82@@ -195,6 +196,8 @@ ssh_kex2(char *host, struct sockaddr *ho
     83        }
     84        if (options.kex_algorithms != NULL)
     85                myproposal[PROPOSAL_KEX_ALGS] = options.kex_algorithms;
     86+       myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
     87+           myproposal[PROPOSAL_KEX_ALGS]);
     88 
     89        if (options.rekey_limit || options.rekey_interval)
     90                packet_set_rekey_limits((u_int32_t)options.rekey_limit,
     91--- a/bufaux.c  4 Feb 2014 00:20:15 -0000       1.62
     92+++ b/bufaux.c  20 Apr 2014 03:24:50 -0000      1.63
     93@@ -1,4 +1,4 @@
     94-/* $OpenBSD: bufaux.c,v 1.56 2014/02/02 03:44:31 djm Exp $ */
     95+/* $OpenBSD: bufaux.c,v 1.57 2014/04/16 23:22:45 djm Exp $ */
     96 /*
     97  * Author: Tatu Ylonen <ylo@cs.hut.fi>
     98  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
     99@@ -372,6 +372,9 @@ buffer_put_bignum2_from_string(Buffer *b
     100 
     101        if (l > 8 * 1024)
     102                fatal("%s: length %u too long", __func__, l);
     103+       /* Skip leading zero bytes */
     104+       for (; l > 0 && *s == 0; l--, s++)
     105+               ;
     106        p = buf = xmalloc(l + 1);
     107        /*
     108         * If most significant bit is set then prepend a zero byte to