Re: [VOTE] Timing attack safe string comparison function

From: Date: Wed, 12 Feb 2014 08:11:21 +0000
Subject: Re: [VOTE] Timing attack safe string comparison function
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-72504@lists.php.net to get a copy of this message
Hi all, On Wed, Feb 12, 2014 at 4:24 PM, Lester Caine <lester@lsces.co.uk> wrote: > Yasuo Ohgaki wrote: > >> We cannot assume word aligned data for strings. This is the reason why >> there is >> additional byte by byte comparison. It could be made to align memory to >> word size, >> but it requires memory allocation for comparison. I'm not sure which is >> better, though. >> > > Since PHP is controlling the memory management, there is no reason it > can't properly align data elements ... based on the target platform. When > you only had 640k of memory every byte counted, but these days the speed > gain provided by simply wasting a few bytes and always padding buffers to a > relevant word boundary is far greater than the space saving. Things have > changed somewhat since the original C compilers were written. But this is > better discussed on the 32/64bit optimization thread. Suffice to say that > Firebird recorded substantial speed improvement once the basic ground rules > were accepted and unnecessary 'byte related' processing dropped. Word aligned memory allocation can be done. It may be good for fragmentation also. I don't read current memory manager code, so I cannot answer this. Anyone? -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#72504) next »