Hi Internals! I've submitted a PR based on Frank Denis's work in libsodium that makes bin2hex() run in constant time () as an improvement to mitigate cache-timing attacks. My motivation for doing so is that many developers (including myself) use base-16 and base-64 encoding to store cryptographic secrets in configuration files.
Stanislav Malyshev wrote: > If we worry about such things just replacing random functions is not enough - you should be sure *all* functions that handle your secret are constant-time, including the engine primitives, etc. I'm not sure just having one function does anything. But maybe I'm missing something here. I would like to, at the minimum, suggest making the following functions run in constant time: * bin2hex() * hex2bin() * base64_encode() * base64_decode() * mcrypt_encrypt() -- requires delving into libmcrypt, which has been collecting dust since 2007 and probably doesn't support AES-NI * mcrypt_decrypt() -- ditto This is only the ones I'm aware of; there are probably many others that may be used that could benefit from similar enhancements. ---------- Forwarded message ---------- From: Xinchen Hui <notificati...@github.com> Date: Tue, Nov 25, 2014 at 12:07 AM Subject: Re: [php-src] Constant-Time bin2hex() implementation (#909) To: php/php-src <php-...@noreply.github.com> Cc: Scott Arciszewski <sc...@arciszewski.me> @sarciszewski <https://github.com/sarciszewski> you can drop a mail to internals at lists.php.net :) — Reply to this email directly or view it on GitHub <https://github.com/php/php-src/pull/909#issuecomment-64311029>.