ge25519_pack.c 309 B

12345678910111213
  1. #include "fe25519.h"
  2. #include "sc25519.h"
  3. #include "ge25519.h"
  4. void ge25519_pack(unsigned char r[32], const ge25519_p3 *p)
  5. {
  6. fe25519 tx, ty, zi;
  7. fe25519_invert(&zi, &p->z);
  8. fe25519_mul(&tx, &p->x, &zi);
  9. fe25519_mul(&ty, &p->y, &zi);
  10. fe25519_pack(r, &ty);
  11. r[31] ^= fe25519_getparity(&tx) << 7;
  12. }