On Tue, Nov 10, 2009 at 5:34 AM, Vladimir 'phcoder' Serbinenko
<[email protected]> wrote:
> But now it has a technical problem: it may read post array definitions.
> If any of post-array memory is MMIO or absent reading from it may have
> peculiar consequences
>> Also, because s1 and s2 have two differents roles, I think it would be
>> best to give them names that better suits them. ;)
Hi,
Right, I think it'd be better to use fixed size array, perhaps we can
define a type grub_password_t for it.
BTW, with fixed size array, the following algorithm should run exactly
the same amount of instruction each time:
typedef char grub_password_t[1024];
int
grub_auth_strcmp (const grub_password_t s1, const grub_password_t s2)
{
int r1 = 0;
int r2 = 0;
int i, *p;
p = &r1;
for (i = 0; i < sizeof (grub_password_t); i++, s1++, s2++)
{
*p |= (*s1 ^ *s2);
if (*s1 == '\0')
p = &r2;
}
return (r1 != 0);
}
--
Bean
My repository: https://launchpad.net/burg
Document: https://help.ubuntu.com/community/Burg
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel