rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-7.4p1-cbc-weakness.patch

b58e57
commit 0fb1a617a07b8df5de188dd5a0c8bf293d4bfc0e
b58e57
Author: markus@openbsd.org <markus@openbsd.org>
b58e57
Date:   Sat Mar 11 13:07:35 2017 +0000
b58e57
b58e57
    upstream commit
b58e57
    
b58e57
    Don't count the initial block twice when computing how
b58e57
    many bytes to discard for the work around for the attacks against CBC-mode.
b58e57
    ok djm@; report from Jean Paul, Kenny, Martin and Torben @ RHUL
b58e57
    
b58e57
    Upstream-ID: f445f509a4e0a7ba3b9c0dae7311cb42458dc1e2
b58e57
b58e57
diff --git a/packet.c b/packet.c
b58e57
index 01e2d45..2f3a2ec 100644
b58e57
--- a/packet.c
b58e57
+++ b/packet.c
b58e57
@@ -1850,11 +1850,11 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
b58e57
 			if (r != SSH_ERR_MAC_INVALID)
b58e57
 				goto out;
b58e57
 			logit("Corrupted MAC on input.");
b58e57
-			if (need > PACKET_MAX_SIZE)
b58e57
+			if (need + block_size > PACKET_MAX_SIZE)
b58e57
 				return SSH_ERR_INTERNAL_ERROR;
b58e57
 			return ssh_packet_start_discard(ssh, enc, mac,
b58e57
 			    sshbuf_len(state->incoming_packet),
b58e57
-			    PACKET_MAX_SIZE - need);
b58e57
+			    PACKET_MAX_SIZE - need - block_size);
b58e57
 		}
b58e57
 		/* Remove MAC from input buffer */
b58e57
 		DBG(debug("MAC #%d ok", state->p_read.seqnr));