Mercurial > dropbear
diff dbutil.c @ 837:fdf51d3f26e1 ecc
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 20 Oct 2013 21:07:05 +0800 |
parents | 4095b6d7c9fc |
children | 30ab30e46452 |
line wrap: on
line diff
--- a/dbutil.c Sun Oct 20 21:06:18 2013 +0800 +++ b/dbutil.c Sun Oct 20 21:07:05 2013 +0800 @@ -892,3 +892,16 @@ return DROPBEAR_SUCCESS; } } + +int constant_time_memcmp(const void* a, const void *b, size_t n) +{ + const char *xa = a, *xb = b; + uint8_t c = 0; + size_t i; + for (i = 0; i < n; i++) + { + c |= (xa[i] ^ xb[i]); + } + return c; +} +