On Mon, Nov 09, 2009 at 07:15:48PM +0100, Vladimir 'phcoder' Serbinenko wrote:
> Robert Millan wrote:
> >
> > Actually, modern CPUs are very complex and the number of operations (or
> > time taken by them) isn't easy to predict.
> >
> >   
> It's generally a good practice to do exactly same operations
> independently of result just store the result in a separate variable
> it's how RSA is correctly implemented
> 
>   for (n = grub_strlen (s1); n >= 0; n--)
>   {
>     if (*s1 != *s2)
>       ret |= 1;
>     else
>       ret |= 0;

Uhm I didn't check, but I'd suspect -Os would optimize this out.

Anyhow, if we move the fixed time wait to the outer loop, it should no
longer be a problem.

We could also check the approach taken by e.g. su from coreutils.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to