File: fe_montx_to_edy.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 (19 lines) | stat: -rw-r--r-- 319 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

#include "fe.h"
#include "crypto_additions.h"

void fe_montx_to_edy(fe y, const fe u)
{
  /* 
     y = (u - 1) / (u + 1)

     NOTE: u=-1 is converted to y=0 since fe_invert is mod-exp
  */
  fe one, um1, up1;

  fe_1(one);
  fe_sub(um1, u, one);
  fe_add(up1, u, one);
  fe_invert(up1, up1);
  fe_mul(y, um1, up1);
}