From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7m5n-00051K-AU for mharc-grub-devel@gnu.org; Tue, 10 Nov 2009 03:28:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7m5l-00050N-Lr for grub-devel@gnu.org; Tue, 10 Nov 2009 03:28:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7m5g-0004y9-TY for grub-devel@gnu.org; Tue, 10 Nov 2009 03:28:45 -0500 Received: from [199.232.76.173] (port=38509 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7m5g-0004xy-M8 for grub-devel@gnu.org; Tue, 10 Nov 2009 03:28:40 -0500 Received: from mail-px0-f178.google.com ([209.85.216.178]:47162) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7m5g-0000mB-CK for grub-devel@gnu.org; Tue, 10 Nov 2009 03:28:40 -0500 Received: by pxi8 with SMTP id 8so2804406pxi.27 for ; Tue, 10 Nov 2009 00:28:39 -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=Maq/3GqfQjdSDYzaJKBEummisZx57U/7OtXtJcutl1Q=; b=ZxL+Va6PxPtLwkG/vQ4kidFAyBDZ4hLgC7L7fN+lspwMT9p6YXuylqgOeOk+a/sQmV 0R1B+AzdZaqcJhsH8oztHz6Y8GhSgbwImyb95hCUKMBq2AYhXxxc/O6B6XllMmS9JJiS s8eXZ3ht1kWK/9geQDDDgNyV4veGUFkfoY5TI= 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=aIUXjnGocl1B4wFUoPsB+IssNfZiHEewC5+OUC4PJJW2YvR4KekwYxpKYvObN7hpdU vCHNEURG/y8iRRFZ6dG1u9Txzrs9VpC8QrgCC70Sf1zP2xxnS4cfAKytpbmxvSK4Md67 B2GUSAFeHvX5cQZO1XLMvJlUAgpbH62MwsC3U= MIME-Version: 1.0 Received: by 10.141.13.19 with SMTP id q19mr445912rvi.31.1257841719512; Tue, 10 Nov 2009 00:28:39 -0800 (PST) In-Reply-To: References: <20091109010422.GA23417@thorin> <20091109181010.GA7372@thorin> <4AF85C54.3080302@gmail.com> <20091109182518.GA14767@thorin> <4AF86387.7090307@gmail.com> <4AF885EE.7000709@duboucher.eu> <4AF88AEF.8010102@gmail.com> Date: Tue, 10 Nov 2009 16:28:39 +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:28:46 -0000 On Tue, Nov 10, 2009 at 1:39 PM, Bean wrote: > On Tue, Nov 10, 2009 at 5:34 AM, Vladimir 'phcoder' Serbinenko > 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 >>> =A0 =A0 Also, because s1 and s2 have two differents roles, I think it w= ould 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) > { > =A0int r1 =3D 0; > =A0int r2 =3D 0; > =A0int i, *p; > > =A0p =3D &r1; > =A0for (i =3D 0; i < sizeof (grub_password_t); i++, s1++, s2++) > =A0 =A0{ > =A0 =A0 =A0*p |=3D (*s1 ^ *s2); > =A0 =A0 =A0if (*s1 =3D=3D '\0') > =A0 =A0 =A0 =A0p =3D &r2; > =A0 =A0} > > =A0return (r1 !=3D 0); > } Hi, Oh sorry, this one still have some issue, this should work: typedef char grub_password_t[1024]; int grub_auth_strcmp (const grub_password_t s1, const grub_password_t s2) { int r1 =3D 0; int r2 =3D 0; int i, *p1, *p2; p1 =3D p2 =3D &r1; for (i =3D 0; i < sizeof (grub_password_t); i++, s1++, s2++) { *p1 |=3D (*s1 ^ *s2); 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