components/openssh/patches/028-relax_bits_needed_check.patch
author Tomas Kuthan <tomas.kuthan@oracle.com>
Thu, 18 Jun 2015 07:01:42 -0700
changeset 4503 bf30d46ab06e
permissions -rw-r--r--
PSARC/2015/179 OpenSSH 6.8 20919294 upgrade OpenSSH to 6.8p1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4503
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     1
#
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     2
# Relax bits needed check to allow diffie-hellman-group1-sha1 key exchange to
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     3
# complete when chacha20-poly1305 was selected as the cipher.
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     4
# 
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     5
# OpenSSH 6.8 regression causing test case failure.
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     6
# 
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     7
# Fixed in 6.9:
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     8
# https://github.com/openssh/openssh-portable/commit/b8afbe2c1aaf573565e4da775261dfafc8b1ba9c
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     9
# 
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    10
# This patch will be removed when upgrading to 6.9 or higher.
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    11
# 
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    12
diff -pur old/dh.c new/dh.c
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    13
--- old/dh.c	2015-03-16 22:49:20.000000000 -0700
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    14
+++ new/dh.c	2015-06-01 05:24:39.007860187 -0700
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    15
@@ -261,7 +261,7 @@ dh_gen_key(DH *dh, int need)
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    16
 
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    17
 	if (need < 0 || dh->p == NULL ||
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    18
 	    (pbits = BN_num_bits(dh->p)) <= 0 ||
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    19
-	    need > INT_MAX / 2 || 2 * need >= pbits)
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    20
+	    need > INT_MAX / 2 || 2 * need > pbits)
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    21
 		return SSH_ERR_INVALID_ARGUMENT;
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    22
 	dh->length = MIN(need * 2, pbits - 1);
bf30d46ab06e PSARC/2015/179 OpenSSH 6.8
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    23
 	if (DH_generate_key(dh) == 0 ||