Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7mf0-0003uV-Of for mharc-grub-devel@gnu.org; Tue, 10 Nov 2009 04:05:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7mez-0003u3-Hf for grub-devel@gnu.org; Tue, 10 Nov 2009 04:05:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7mev-0003sB-1L for grub-devel@gnu.org; Tue, 10 Nov 2009 04:05:09 -0500 Received: from [199.232.76.173] (port=51325 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7meu-0003s8-VA for grub-devel@gnu.org; Tue, 10 Nov 2009 04:05:04 -0500 Received: from mail-px0-f178.google.com ([209.85.216.178]:63521) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7meu-00070Q-FQ for grub-devel@gnu.org; Tue, 10 Nov 2009 04:05:04 -0500 Received: by pxi8 with SMTP id 8so2821737pxi.27 for ; Tue, 10 Nov 2009 01:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=wblBvR1k069UgCgiv2xW3ZzRouEJOlrwLVqExnweTWk=; b=kKMpDE8FukhV7YbywSwA52x6DKi40SEST64rPw2vwfNkL/OA72DxGSFJn8XIDrm5dZ EqZYEb0nCNGgWoC5N7Na+DBYWFONdT3a1iMtAP/wIGVWMkAy0erLAM6BVKsD+q4rFgKc B0UiVe9ra06laYVjaSZjVIQ9nPCBLmhjehG3g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=cBXziEdj9e8B+QQYtWEyB45XtdPcJAC1STehqKZPb6YJrFkNRiMa7aPEHI8aEjDKQe vZeTHsVZIbpIuv/H+lwq2WTWFviiqrz0qvM7KnbeTCBrqIyOdHzrhQN4v2oZFj6ZLCTp Twhh5ft1C09U5LoczU/T8pHwCF4WZ/NQMXf4g= MIME-Version: 1.0 Received: by 10.141.29.17 with SMTP id g17mr490825rvj.211.1257843903339; Tue, 10 Nov 2009 01:05:03 -0800 (PST) In-Reply-To: References: <20091109010422.GA23417@thorin> <4AF86387.7090307@gmail.com> <4AF885EE.7000709@duboucher.eu> <4AF88AEF.8010102@gmail.com> Date: Tue, 10 Nov 2009 17:05:03 +0800 Message-ID: From: Bean To: The development of GNU GRUB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Imminent bugfix release (1.97.1) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 09:05:09 -0000 On Tue, Nov 10, 2009 at 4:52 PM, Bean 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) > { > =A0char r1 =3D 0; > =A0char r2 =3D 0; > =A0char r3 =3D 0; > =A0char *p1, *p2; > =A0int i; > > =A0p1 =3D &r1; > =A0p2 =3D &r3; > =A0for (i =3D 0; i < sizeof (grub_password_t); i++, s1++, s2++) > =A0 =A0{ > =A0 =A0 =A0char c; > > =A0 =A0 =A0c =3D (*s1 ^ *s2); > =A0 =A0 =A0*p1 |=3D c; > =A0 =A0 =A0*p2 |=3D c; > =A0 =A0 =A0if (*s1 =3D=3D '\0') > =A0 =A0 =A0 =A0p1 =3D &r2; > =A0 =A0 =A0else > =A0 =A0 =A0 =A0p2 =3D &r2; > =A0 =A0} > > =A0return (r1 !=3D 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 =3D 0; char r2 =3D 0; char r3 =3D 0; char r4 =3D 0; char *p1, *p2; int i; p1 =3D &r1; p2 =3D &r3; for (i =3D 0; i < sizeof (grub_password_t); i++, s1++, s2++) { char c; c =3D (*s1 ^ *s2); *p1 |=3D c; *p2 |=3D c; if (*s1 =3D=3D '\0') p1 =3D &r2; else p2 =3D &r4; } return (r1 !=3D 0); } --=20 Bean My repository: https://launchpad.net/burg Document: https://help.ubuntu.com/community/Burg