Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jun 2010 03:43:08 +0200
From:      "C. P. Ghost" <cpghost@cordula.ws>
To:        ticso@cicely.de
Cc:        FreeBSD Current <current@freebsd.org>
Subject:   Re: Cleanup for cryptographic algorithms vs. compiler optimizations
Message-ID:  <AANLkTimiTMS4igjY5VFTLkXXH-CkaUH6crN0pgNWlDyz@mail.gmail.com>
In-Reply-To: <20100613213512.GG87112@cicely7.cicely.de>
References:  <20100611162118.GR39829@acme.spoerlein.net> <867hm5tl6u.fsf@ds4.des.no> <20100612153526.GA3632@acme.spoerlein.net> <20100612163208.GS87112@cicely7.cicely.de> <864oh86tnl.fsf@ds4.des.no> <20100612225216.GT87112@cicely7.cicely.de> <86k4q33pk2.fsf@ds4.des.no> <20100613160035.GD87112@cicely7.cicely.de> <20100613162026.GQ40531@camelot.theinternet.com.au> <20100613213512.GG87112@cicely7.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 13, 2010 at 11:35 PM, Bernd Walter <ticso@cicely7.cicely.de> wrote:
> Crypto code wasn't aware of this problem and this is a way more
> obviuous optimization than function exchange.
> And I do believe that the programmers were clever people.
> Alarming, isn't it?
> Maybe paranoid users might consider compiling their OS with -O0, but
> I don't think this is the right way.

I think that most crypto code isn't compiled with strong optimizations
anyway, even when the rest of the OS or program is (or can be). After all,
we do have separate compilation units... as long as you don't enable LTO,
of course.

Turning off strong optimizations for crypto code may seem paradoxical,
but since most performance-critical routines often contain hand-optimized
assembly anyway, and compiler-optimizations may be counter-productive
here, the point is rather moot, usually.

> It is amazing how strong the influence of optimization is and how weak
> the programmers assumptions are.

Indeed. That's a classic trap that trips a lot of crypto programmers
in particular, and even seasoned C programmers occasionally.

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimiTMS4igjY5VFTLkXXH-CkaUH6crN0pgNWlDyz>