<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2021:05:10</title>
        <description></description>
        <link>https://baszerr.eu/</link>
        <lastBuildDate>Tue, 28 Apr 2026 14:03:33 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://baszerr.eu/</link>
        </image>
        <item>
            <title>2021-05-10_-_securely_clearing_memory</title>
            <link>https://baszerr.eu/doku.php?id=blog:2021:05:10:2021-05-10_-_securely_clearing_memory</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;securely_clearing_memory&quot;&gt;2021-05-10 - securely clearing memory&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
whenever you read secrets into the application memory, you should &lt;a href=&quot;https://www.sjoerdlangkemper.nl/2016/05/22/should-passwords-be-cleared-from-memory/&quot; class=&quot;urlextern&quot; title=&quot;https://www.sjoerdlangkemper.nl/2016/05/22/should-passwords-be-cleared-from-memory/&quot; rel=&quot;ugc nofollow&quot;&gt;clear it from the memory&lt;/a&gt;. tricky part in managed languages (like C#/Java/Python), but straight forward in C/C++, right? right? no… it&amp;#039;s not. &lt;a href=&quot;http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html&quot; rel=&quot;ugc nofollow&quot;&gt;obvious things like memset() can be optimized away&lt;/a&gt; (&lt;a href=&quot;https://en.cppreference.com/w/cpp/string/byte/memset&quot; class=&quot;urlextern&quot; title=&quot;https://en.cppreference.com/w/cpp/string/byte/memset&quot; rel=&quot;ugc nofollow&quot;&gt;&amp;quot;as-if&amp;quot; rule -- &amp;quot;dead code&amp;quot; can be removed&lt;/a&gt;).
&lt;/p&gt;

&lt;p&gt;
in order to the way to go is to use function that is guaranteed not to be optimized away – for example &lt;a href=&quot;https://www.freebsd.org/cgi/man.cgi?query=explicit_bzero&quot; class=&quot;urlextern&quot; title=&quot;https://www.freebsd.org/cgi/man.cgi?query=explicit_bzero&quot; rel=&quot;ugc nofollow&quot;&gt;explicit_bzero()&lt;/a&gt; on Linux/FreeBSD. and we&amp;#039;re good, right? right? no… not exactly… the next problem is that these secrets are typically used for something and &lt;a href=&quot;http://www.daemonology.net/blog/2014-09-06-zeroing-buffers-is-insufficient.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.daemonology.net/blog/2014-09-06-zeroing-buffers-is-insufficient.html&quot; rel=&quot;ugc nofollow&quot;&gt;encryption/hashing algorithms can leave their internal state in the memory&lt;/a&gt;, that can make it easier to extract certain pieces of information… and this problem does not have a reasonable solution to this point.
&lt;/p&gt;

&lt;p&gt;
so for the time being – just &lt;code&gt;explicit_bzero()&lt;/code&gt; secrets that you have.
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:43 +0000</pubDate>
        </item>
    </channel>
</rss>
