diff dbutil.c @ 835:4095b6d7c9fc ecc

Merge in changes from the past couple of releases
author Matt Johnston <matt@ucc.asn.au>
date Fri, 18 Oct 2013 21:38:01 +0800
parents 7dcb46da72d9 a625f9e135a4
children 30ab30e46452
line wrap: on
line diff
--- a/dbutil.c	Sat May 25 00:54:19 2013 +0800
+++ b/dbutil.c	Fri Oct 18 21:38:01 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;
+}
+