summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/additions/fe_mont_rhs.c
blob: c20657dec1e071047882909af2a618fdfdbd6566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "fe.h"

void fe_mont_rhs(fe v2, fe u) {
  fe A, one;
  fe u2, Au, inner;

  fe_1(one);
  fe_0(A);
  A[0] = 486662;                     /* A = 486662 */

  fe_sq(u2, u);                      /* u^2 */
  fe_mul(Au, A, u);                  /* Au */
  fe_add(inner, u2, Au);             /* u^2 + Au */
  fe_add(inner, inner, one);         /* u^2 + Au + 1 */
  fe_mul(v2, u, inner);              /* u(u^2 + Au + 1) */
}