Felix Palmen :freebsd: :c64:<p>Next <a href="https://mastodon.bsd.cafe/tags/swad" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swad</span></a> improvement: Make sure to <a href="https://mastodon.bsd.cafe/tags/wipe" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>wipe</span></a> <a href="https://mastodon.bsd.cafe/tags/passwords" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>passwords</span></a> from RAM directly after used. That's more of a <a href="https://mastodon.bsd.cafe/tags/security" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>security</span></a> precaution, because there *should* be no way how an attacker can access a running process' memory, but you never know which bugs surface 🙈.</p><p>Unexpectedly, that posed <a href="https://mastodon.bsd.cafe/tags/portability" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>portability</span></a> issues. <a href="https://mastodon.bsd.cafe/tags/C11" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C11</span></a> has <a href="https://mastodon.bsd.cafe/tags/memset_s" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>memset_s</span></a> ... a pretty weird function, but suitable for wiping. It's there on <a href="https://mastodon.bsd.cafe/tags/FreeBSD" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FreeBSD</span></a> and on <a href="https://mastodon.bsd.cafe/tags/OpenBSD" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenBSD</span></a>. Not on <a href="https://mastodon.bsd.cafe/tags/NetBSD" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>NetBSD</span></a> though. But NetBSD offers the much saner <a href="https://mastodon.bsd.cafe/tags/C23" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C23</span></a> function <a href="https://mastodon.bsd.cafe/tags/memset_explicit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>memset_explicit</span></a>. Looking at <a href="https://mastodon.bsd.cafe/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a>, there's neither. But there is the (non-standard!) <a href="https://mastodon.bsd.cafe/tags/explicit_bzero" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>explicit_bzero</span></a> 🤯 .. and with glibc, it requires _DEFAULT_SOURCE to be defined as soon as you compile with a C standard version given to the compiler. This function exists on some other systems as well, but there's confusion whether it should be declared in string.h or strings.h. 🤪 </p><p>Here's the full set of compile-tests I'm now doing, only to find the best way to really erase memory:<br><a href="https://github.com/Zirias/swad/blob/master/src/bin/swad/swad.mk#L6" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/Zirias/swad/blob/ma</span><span class="invisible">ster/src/bin/swad/swad.mk#L6</span></a></p><p>And if none of these functions is found, swad uses the "hacky" way that most likely works as well: Access the normal memset function via a volatile pointer.</p>