summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/ge_tobytes.c
blob: 31b3d33e095014e9ee68eef27dfadba6a10adf99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "ge.h"

void ge_tobytes(unsigned char *s,const ge_p2 *h)
{
  fe recip;
  fe x;
  fe y;

  fe_invert(recip,h->Z);
  fe_mul(x,h->X,recip);
  fe_mul(y,h->Y,recip);
  fe_tobytes(s,y);
  s[31] ^= fe_isnegative(x) << 7;
}