]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
auth: Use consttime_memequal(3) to compare hashes
authorRoy Marples <roy@marples.name>
Fri, 19 Apr 2019 20:40:14 +0000 (21:40 +0100)
committerRoy Marples <roy@marples.name>
Fri, 19 Apr 2019 20:40:14 +0000 (21:40 +0100)
This stops any attacker from trying to infer secrets from latency.

Thanks to Maxime Villard <max@m00nbsd.net>

src/auth.c

index 9e24998c17b34300c0d206547c795ca7f5e112a2..ce97051ea37ff5921dd5f58328e173798d5144e5 100644 (file)
@@ -354,7 +354,7 @@ gottoken:
        }
 
        free(mm);
-       if (memcmp(d, &hmac_code, dlen)) {
+       if (!consttime_memequal(d, &hmac_code, dlen)) {
                errno = EPERM;
                return NULL;
        }