diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2010-07-13 11:52:07 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2010-07-13 11:52:07 +0000 |
commit | 439a9e4cff4f679a09620b9192027341cadd74a9 (patch) | |
tree | c6dbcd86c0fad43fac691cee257d3494134ac0f8 /usr.bin/ssh/packet.c | |
parent | 8aff31586b277915a11936e9cdeae98ce64aaeb6 (diff) |
implement a timing_safe_cmp() function to compare memory without leaking
timing information by short-circuiting like memcmp() and use it for
some of the more sensitive comparisons (though nothing high-value was
readily attackable anyway); "looks ok" markus@
Diffstat (limited to 'usr.bin/ssh/packet.c')
-rw-r--r-- | usr.bin/ssh/packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index 0da9b51d58f..522d2f466f2 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.166 2009/06/27 09:29:06 andreas Exp $ */ +/* $OpenBSD: packet.c,v 1.167 2010/07/13 11:52:06 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1297,7 +1297,7 @@ packet_read_poll2(u_int32_t *seqnr_p) macbuf = mac_compute(mac, active_state->p_read.seqnr, buffer_ptr(&active_state->incoming_packet), buffer_len(&active_state->incoming_packet)); - if (memcmp(macbuf, buffer_ptr(&active_state->input), + if (timing_safe_cmp(macbuf, buffer_ptr(&active_state->input), mac->mac_len) != 0) { logit("Corrupted MAC on input."); if (need > PACKET_MAX_SIZE) |