Make secp256k1_ecmult_const handle infinity

Infinity isn't currently needed here, but correctly handling it is a
little more safe against future changes.

Update docs for it to make it clear that it is not constant time in A
(the input point). It never was constant time in Q (and would be a little
complicated to make constant time in A).

If it was later made constant time in A, infinity support would be easy
to preserve, e.g. by running it on a dummy value and cmoving infinity into
the output.
This commit is contained in:
Gregory Maxwell
2020-08-08 03:52:34 +00:00
committed by Pieter Wuille
parent 24c768ae09
commit a0e696fd4d
3 changed files with 8 additions and 4 deletions

View File

@@ -11,8 +11,7 @@
#include "group.h"
/**
* Multiply: R = q*A (in constant-time)
* A must not be infinity.
* Multiply: R = q*A (in constant-time for q)
*/
static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q);