From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7Yve-0001KW-Q3 for mharc-grub-devel@gnu.org; Mon, 09 Nov 2009 13:25:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7Yvd-0001K8-By for grub-devel@gnu.org; Mon, 09 Nov 2009 13:25:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7YvY-0001IX-PZ for grub-devel@gnu.org; Mon, 09 Nov 2009 13:25:24 -0500 Received: from [199.232.76.173] (port=42791 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7YvY-0001IU-Ku for grub-devel@gnu.org; Mon, 09 Nov 2009 13:25:20 -0500 Received: from xvm-190-8.ghst.net ([217.70.190.8]:52947 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N7YvY-0000yQ-71 for grub-devel@gnu.org; Mon, 09 Nov 2009 13:25:20 -0500 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1N7YvW-0000iJ-VU for grub-devel@gnu.org; Mon, 09 Nov 2009 19:25:19 +0100 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1N7YvW-00042D-Ex for grub-devel@gnu.org; Mon, 09 Nov 2009 19:25:18 +0100 Date: Mon, 9 Nov 2009 19:25:18 +0100 From: Robert Millan To: The development of GNU GRUB Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AF85C54.3080302@gmail.com> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:25:25 -0000 On Mon, Nov 09, 2009 at 07:15:48PM +0100, Vladimir 'phcoder' Serbinenko wrote: > Robert Millan wrote: > > > > Actually, modern CPUs are very complex and the number of operations (or > > 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 > > for (n = grub_strlen (s1); n >= 0; n--) > { > if (*s1 != *s2) > ret |= 1; > else > ret |= 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. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."