grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Imminent bugfix release (1.97.1)


From: Bean
Subject: Re: Imminent bugfix release (1.97.1)
Date: Tue, 10 Nov 2009 20:37:50 +0800

Hi,

Oh, I just come up with a better way to do this:

typedef char grub_password_t[1024];

int
grub_auth_strcmp (const grub_password_t s1, const grub_password_t s2)
{
 char r1 = 0;
 char r2 = 0;
 char *p;
 int i, c;

 p = &r1;
 c = 0;
 for (i = 0; i < sizeof (grub_password_t); i++, s1++, s2++)
   {
     *p | = (*s1 ^ *s2);
     if ((int) *s1 == c)
       {
         p = &r2;
         c = 0x100;
       }
   }

 return (r1 != 0);
}

The condition (int) *s1 == c would be true exactly once.

-- 
Bean

My repository: https://launchpad.net/burg
Document: https://help.ubuntu.com/community/Burg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]