File: ge_p3_to_montx.c

package info (click to toggle)
python-axolotl-curve25519 0.4.1.post2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 664 kB
  • sloc: ansic: 5,207; python: 34; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 440 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "fe.h"
#include "crypto_additions.h"

void ge_p3_to_montx(fe u, const ge_p3 *ed)
{
  /* 
     u = (y + 1) / (1 - y)
     or
     u = (y + z) / (z - y)

     NOTE: y=1 is converted to u=0 since fe_invert is mod-exp
  */

  fe y_plus_one, one_minus_y, inv_one_minus_y;

  fe_add(y_plus_one, ed->Y, ed->Z);
  fe_sub(one_minus_y, ed->Z, ed->Y);  
  fe_invert(inv_one_minus_y, one_minus_y);
  fe_mul(u, y_plus_one, inv_one_minus_y);
}