Re: [RFC] Timing attack safe string comparison function

From: Date: Mon, 23 Dec 2013 11:25:35 +0000
Subject: Re: [RFC] Timing attack safe string comparison function
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-70862@lists.php.net to get a copy of this message
On 23 December 2013 12:16, Joe Watkins <krakjoe@php.net> wrote: > > 291 /* We're using this method instead of == in order to provide > 292 * resistence towards timing attacks. This is a constant time > 293 * equality check that will always check every byte of both > 294 * values. */ > 295 for (i = 0; i < hash_len; i++) { > 296 status |= (ret[i] ^ hash[i]); > 297 } > > So that puts in perspective the what if it borks argument, and the > complication argument too, since the new function and old can share a > static inline implementation of the same logic ... do you really want me to > explain why static inline c is better than PHP, or is that obvious at this > point ?? > The performance question is irrelevant to me - I don't think I'd ever code a performance-sensitive API with this sort of function, but maybe someone has a real world example for that. Slower is probably even better here :P Let me re-state: "performance is not a problem here". > I would love it if at some point in the future you could point at bits of > PHP and say "that's a good implementation", That's admirable, but the userland implementation seems ok for me as well. > Anyone who doesn't see that, is barking mad, barking, mad ... > > I'm always barking mad :-) Cheers, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/

« previous php.internals (#70862) next »