Skip to content

Commit 9e8d89b

Browse files
committed
Merge pull request bitcoin#234
4450e24 Add a comment about the avoidance of secret data in array indexes. (Gregory Maxwell)
2 parents 65e70e7 + 4450e24 commit 9e8d89b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/ecmult_gen_impl.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ static void secp256k1_ecmult_gen(secp256k1_gej_t *r, const secp256k1_scalar_t *g
116116
for (j = 0; j < 64; j++) {
117117
bits = secp256k1_scalar_get_bits(gn, j * 4, 4);
118118
for (i = 0; i < 16; i++) {
119+
/** This uses a conditional move to avoid any secret data in array indexes.
120+
* _Any_ use of secret indexes has been demonstrated to result in timing
121+
* sidechannels, even when the cache-line access patterns are uniform.
122+
* See also:
123+
* "A word of warning", CHES 2013 Rump Session, by Daniel J. Bernstein and Peter Schwabe
124+
* (https://cryptojedi.org/peter/data/chesrump-20130822.pdf) and
125+
* "Cache Attacks and Countermeasures: the Case of AES", RSA 2006,
126+
* by Dag Arne Osvik, Adi Shamir, and Eran Tromer
127+
* (http://www.tau.ac.il/~tromer/papers/cache.pdf)
128+
*/
119129
secp256k1_ge_storage_cmov(&adds, &c->prec[j][i], i == bits);
120130
}
121131
secp256k1_ge_from_storage(&add, &adds);

0 commit comments

Comments
 (0)