From: Andy Polyakov Date: Thu, 26 May 2016 19:40:09 +0000 (+0200) Subject: bn/bn_exp.c: explain 'volatile' in MOD_EXP_CTIME_COPY_FROM_PREBUF. X-Git-Tag: OpenSSL_1_1_0-pre6~671 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=bb83c8796b9e708a881f7c49a2af7921e73b2298 bn/bn_exp.c: explain 'volatile' in MOD_EXP_CTIME_COPY_FROM_PREBUF. Reviewed-by: Tim Hudson --- diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index 25c05fadba..d334cf705b 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -527,6 +527,14 @@ static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, { int i, j; int width = 1 << window; + /* + * We declare table 'volatile' in order to discourage compiler + * from reordering loads from the table. Concern is that if + * reordered in specific manner loads might give away the + * information we are trying to conceal. Some would argue that + * compiler can reorder them anyway, but it can as well be + * argued that doing so would be violation of standard... + */ volatile BN_ULONG *table = (volatile BN_ULONG *)buf; if (bn_wexpand(b, top) == NULL)