Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7mSz-0006Ca-Pd for mharc-grub-devel@gnu.org; Tue, 10 Nov 2009 03:52:45 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7mSy-0006BT-0d for grub-devel@gnu.org; Tue, 10 Nov 2009 03:52:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7mSt-00068X-Br for grub-devel@gnu.org; Tue, 10 Nov 2009 03:52:43 -0500 Received: from [199.232.76.173] (port=46831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7mSt-00068S-6a for grub-devel@gnu.org; Tue, 10 Nov 2009 03:52:39 -0500 Received: from mail-pz0-f192.google.com ([209.85.222.192]:34142) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7mSr-00059U-98 for grub-devel@gnu.org; Tue, 10 Nov 2009 03:52:37 -0500 Received: by pzk30 with SMTP id 30so2883705pzk.24 for ; Tue, 10 Nov 2009 00:52:36 -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=PGL8WsjQbUT6Q6SY9HxsfvLotlh/Gt/B96Dm/ngrdCI=; b=QgQbokUQSwFeVMpnfFrjDwtt+21QBs2KSRMqfnmWHV+cScl8jQi+gD4QiZ21axfm7E RlcwTnxdUcWo/0NfkmDE3XZP7LtzUVd93WSoeMdo11ILWXYsYwI9RMHa0sNM2MjEJrQJ uG/dco3Ug0r04Ylh29NxXkvahRyON8GnzqtSM= 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=d6xZ8H2LoZhjh2RtOLpGEMBkt4HOzAjVmh4mpgghMGrtRdGqoLR+UYo/VgAsvtV01+ EwJKn8Quyu7QNKtN+48pzQ8k3G+3SdJd86G5gg3nInflT6ziBs1g882Bx3TF7mR+E5GQ IkG9ReB7GjGUGT1jg9TaarmdDKQiCa3Amkp1E= MIME-Version: 1.0 Received: by 10.140.125.15 with SMTP id x15mr220549rvc.0.1257843156201; Tue, 10 Nov 2009 00:52:36 -0800 (PST) In-Reply-To: References: <20091109010422.GA23417@thorin> <20091109182518.GA14767@thorin> <4AF86387.7090307@gmail.com> <4AF885EE.7000709@duboucher.eu> <4AF88AEF.8010102@gmail.com> Date: Tue, 10 Nov 2009 16:52:36 +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 08:52:44 -0000 On Tue, Nov 10, 2009 at 4:46 PM, Bean wrote: > Hi, > > Just in case p2 is optimized out by gcc: > > 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 =A0*p1 |=3D (*s1 ^ *s2); > =A0 =A0 =A0if (*s1 =3D=3D '\0') > =A0 =A0 =A0 =A0p1 =3D &r2; > =A0 =A0 =A0else > =A0 =A0 =A0 =A0p2 =3D &r2; > =A0 =A0 (*p2)++; > =A0 =A0} > > =A0return (r1 !=3D 0); > } 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 =3D 0; char r2 =3D 0; char r3 =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 &r2; } return (r1 !=3D 0); } --=20 Bean My repository: https://launchpad.net/burg Document: https://help.ubuntu.com/community/Burg