Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2010 10:07:15 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        ticso@cicely.de
Cc:        current@freebsd.org
Subject:   Re: Cleanup for cryptographic algorithms vs. compiler optimizations
Message-ID:  <86wru3we30.fsf@ds4.des.no>
In-Reply-To: <20100612225216.GT87112@cicely7.cicely.de> (Bernd Walter's message of "Sun, 13 Jun 2010 00:52:16 %2B0200")
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>

next in thread | previous in thread | raw e-mail | index | archive | help
Bernd Walter <ticso@cicely7.cicely.de> writes:
> Dag-Erling Sm=C3=B8rgrav <des@des.no> writes:
> > Bernd Walter <ticso@cicely7.cicely.de> writes:
> > > I'm not sure when removing a memset is allowed.
> > Always, if the compiler can determine that the data will not be used
> > later.
> I'm at least sure that the compiler can't if it is linked from another
> object file.

When running in hosted mode, the compiler can *always* inline a memset()
call or eliminate it if it can determine that the result is not used.

> The problem with memset is that the compiler has an internal
> implementation.

That's a feature, not a problem.

> On the other hand I wonder what the deep sense is to clear memory
> which is unused later.  I know that crypto code can be tricky
> sometimes, but if someone is willing to explain the specific reason my
> curiosity would be satified.

You always overwrite passphrases, keys etc. as soon as you're done with
them so they don't end up in a crash dump or on a swap disk or
something.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



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