components/openssh/patches/028-relax_bits_needed_check.patch
changeset 5025 bdd7dc7d2af4
parent 5023 93fb5351ff40
child 5026 12114fad0da4
equal deleted inserted replaced
5023:93fb5351ff40 5025:bdd7dc7d2af4
     1 #
       
     2 # Relax bits needed check to allow diffie-hellman-group1-sha1 key exchange to
       
     3 # complete when chacha20-poly1305 was selected as the cipher.
       
     4 # 
       
     5 # OpenSSH 6.8 regression causing test case failure.
       
     6 # 
       
     7 # Fixed in 6.9:
       
     8 # https://github.com/openssh/openssh-portable/commit/b8afbe2c1aaf573565e4da775261dfafc8b1ba9c
       
     9 # 
       
    10 # This patch will be removed when upgrading to 6.9 or higher.
       
    11 # 
       
    12 diff -pur old/dh.c new/dh.c
       
    13 --- old/dh.c	2015-03-16 22:49:20.000000000 -0700
       
    14 +++ new/dh.c	2015-06-01 05:24:39.007860187 -0700
       
    15 @@ -261,7 +261,7 @@ dh_gen_key(DH *dh, int need)
       
    16  
       
    17  	if (need < 0 || dh->p == NULL ||
       
    18  	    (pbits = BN_num_bits(dh->p)) <= 0 ||
       
    19 -	    need > INT_MAX / 2 || 2 * need >= pbits)
       
    20 +	    need > INT_MAX / 2 || 2 * need > pbits)
       
    21  		return SSH_ERR_INVALID_ARGUMENT;
       
    22  	dh->length = MIN(need * 2, pbits - 1);
       
    23  	if (DH_generate_key(dh) == 0 ||