Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7Z6O-0008Nh-9e for mharc-grub-devel@gnu.org; Mon, 09 Nov 2009 13:36:32 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7Z6N-0008NQ-B6 for grub-devel@gnu.org; Mon, 09 Nov 2009 13:36:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7Z6I-0008MU-Q4 for grub-devel@gnu.org; Mon, 09 Nov 2009 13:36:30 -0500 Received: from [199.232.76.173] (port=57264 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7Z6I-0008MR-LN for grub-devel@gnu.org; Mon, 09 Nov 2009 13:36:26 -0500 Received: from mail-pw0-f47.google.com ([209.85.160.47]:54583) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7Z6I-0002ic-9q for grub-devel@gnu.org; Mon, 09 Nov 2009 13:36:26 -0500 Received: by pwi9 with SMTP id 9so405893pwi.26 for ; Mon, 09 Nov 2009 10:36:25 -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=jqJKlSCef/FzqGocphshr52JrhfyukCJtaDEMyqk8O8=; b=XF1f1rqWW6JYXBok1VGXhCa/ggpAGF4xHOpAR1fGXqvihHJA8NeIdAu4zJYDYdbiV+ gQNfnFEogNexfCAmJ78Dk0PSC332j4F7BO/45FB+WATteF1cmxe6ppERDZLbVFkH5sIm OQG6N4Mg+EMtOHiXMoPmdEZQr75pw9/iAiJD4= 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=lCIWVSQSqAvGORh/4ihEtXdeNQJNKJuf0w70Z5dTug3/zqz1hJbPRAOBALX8tIMAYU lFmVyk17BxGHnhuElxJydV4qa3by+2aOL2q83FpRvLaqVJvbJBprH5wevPt9h8jreJOO ioPARrSVnLoGSwQ4MV2ZHxiZFSfVKX98MoUZU= MIME-Version: 1.0 Received: by 10.140.161.14 with SMTP id j14mr465150rve.246.1257791784520; Mon, 09 Nov 2009 10:36:24 -0800 (PST) In-Reply-To: <20091109182518.GA14767@thorin> References: <20091109010422.GA23417@thorin> <4AF81E2C.2090700@gmail.com> <4AF82868.6090803@gmail.com> <4AF85568.7080105@duboucher.eu> <20091109181010.GA7372@thorin> <4AF85C54.3080302@gmail.com> <20091109182518.GA14767@thorin> Date: Tue, 10 Nov 2009 02:36:24 +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: Mon, 09 Nov 2009 18:36:31 -0000 On Tue, Nov 10, 2009 at 2:25 AM, Robert Millan wrote: > On Mon, Nov 09, 2009 at 07:15:48PM +0100, Vladimir 'phcoder' Serbinenko w= rote: >> Robert Millan wrote: >> > >> > Actually, modern CPUs are very complex and the number of operations (o= r >> > time taken by them) isn't easy to predict. >> > >> > >> It's generally a good practice to do exactly same operations >> independently of result just store the result in a separate variable >> it's how RSA is correctly implemented >> >> =A0 for (n =3D grub_strlen (s1); n >=3D 0; n--) >> =A0 { >> =A0 =A0 if (*s1 !=3D *s2) >> =A0 =A0 =A0 ret |=3D 1; >> =A0 =A0 else >> =A0 =A0 =A0 ret |=3D 0; > > Uhm I didn't check, but I'd suspect -Os would optimize this out. > > Anyhow, if we move the fixed time wait to the outer loop, it should no > longer be a problem. > > We could also check the approach taken by e.g. su from coreutils. Hi, How about this one: int grub_auth_strcmp (const char *s1, const char *s2) { int result =3D 0; for (; *s1 !=3D 0; s1++, s2++) result +=3D (*s1 !=3D *s2); return (result !=3D 0); } --=20 Bean My repository: https://launchpad.net/burg Document: https://help.ubuntu.com/community/Burg