Add value_barriers in constant time select functions
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 21 Jun 2019 19:26:19 +0000 (21:26 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 18 Jul 2019 14:02:20 +0000 (16:02 +0200)
commit7fab4310409189767e86b9d2f5fa6d3fa3fd6270
tree397356850a65b056dd9ca924672eb37b17d8922b
parent0a9a7540d4850dc39e69d5ccd0f382e604bdfee4
Add value_barriers in constant time select functions

The barriers prevent the compiler from narrowing down the
possible value range of the mask and ~mask in the select
statements, which avoids the recognition of the select
and turning it into a conditional load or branch.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/9217)

(cherry picked from commit 04edd688b3727835f9b2c7cca7e4c963bf3ed2ba)
include/internal/constant_time_locl.h