[Top][All Lists]
[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 17:05:03 +0800 |
On Tue, Nov 10, 2009 at 4:52 PM, Bean <address@hidden> wrote:
> Hi,
>
> Perhaps this one, it's more symmetrical:
>
> 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 r3 = 0;
> char *p1, *p2;
> int i;
>
> p1 = &r1;
> p2 = &r3;
> for (i = 0; i < sizeof (grub_password_t); i++, s1++, s2++)
> {
> char c;
>
> c = (*s1 ^ *s2);
> *p1 |= c;
> *p2 |= c;
> if (*s1 == '\0')
> p1 = &r2;
> else
> p2 = &r2;
> }
>
> return (r1 != 0);
> }
Hi,
BTW, just in case there is delay in hardware when the same memory
address r2 is accessed repeatedly:
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 r3 = 0;
char r4 = 0;
char *p1, *p2;
int i;
p1 = &r1;
p2 = &r3;
for (i = 0; i < sizeof (grub_password_t); i++, s1++, s2++)
{
char c;
c = (*s1 ^ *s2);
*p1 |= c;
*p2 |= c;
if (*s1 == '\0')
p1 = &r2;
else
p2 = &r4;
}
return (r1 != 0);
}
--
Bean
My repository: https://launchpad.net/burg
Document: https://help.ubuntu.com/community/Burg
- Re: Imminent bugfix release (1.97.1), (continued)
- Re: Imminent bugfix release (1.97.1), Robert Millan, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Darron Black, 2009/11/09
- Re: Imminent bugfix release (1.97.1), address@hidden, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Darron Black, 2009/11/09
- Re: Imminent bugfix release (1.97.1), address@hidden, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1),
Bean <=
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Vladimir 'phcoder' Serbinenko, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Vladimir 'phcoder' Serbinenko, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/10
- Re: Imminent bugfix release (1.97.1), address@hidden, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/10