/ src / secp256k1 / src / ecmult_const.h
ecmult_const.h
 1  /***********************************************************************
 2   * Copyright (c) 2015 Andrew Poelstra                                  *
 3   * Distributed under the MIT software license, see the accompanying    *
 4   * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
 5   ***********************************************************************/
 6  
 7  #ifndef SECP256K1_ECMULT_CONST_H
 8  #define SECP256K1_ECMULT_CONST_H
 9  
10  #include "scalar.h"
11  #include "group.h"
12  
13  /**
14   * Multiply: R = q*A (in constant-time for q)
15   */
16  static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q);
17  
18  /**
19   * Same as secp256k1_ecmult_const, but takes in an x coordinate of the base point
20   * only, specified as fraction n/d (numerator/denominator). Only the x coordinate of the result is
21   * returned.
22   *
23   * If known_on_curve is 0, a verification is performed that n/d is a valid X
24   * coordinate, and 0 is returned if not. Otherwise, 1 is returned.
25   *
26   * d being NULL is interpreted as d=1. If non-NULL, d must not be zero. q must not be zero.
27   *
28   * Constant time in the value of q, but not any other inputs.
29   */
30  static int secp256k1_ecmult_const_xonly(
31      secp256k1_fe *r,
32      const secp256k1_fe *n,
33      const secp256k1_fe *d,
34      const secp256k1_scalar *q,
35      int known_on_curve
36  );
37  
38  #endif /* SECP256K1_ECMULT_CONST_H */