crypto_mGnP/ed25519/ref10/ge_tobytes.c
raw| 1 | // linker define ge_tobytes |
| 2 | // linker use fe_invert fe_mul fe_tobytes fe_isnegative |
| 3 | |
| 4 | #include "ge.h" |
| 5 | |
| 6 | void ge_tobytes(unsigned char *s,const ge_p2 *h) |
| 7 | { |
| 8 | fe recip; |
| 9 | fe x; |
| 10 | fe y; |
| 11 | |
| 12 | fe_invert(recip,h->Z); |
| 13 | fe_mul(x,h->X,recip); |
| 14 | fe_mul(y,h->Y,recip); |
| 15 | fe_tobytes(s,y); |
| 16 | s[31] ^= fe_isnegative(x) << 7; |
| 17 | } |