x25519.h (483B)
1 // https://martin.kleppmann.com/papers/curve25519.pdf 2 3 #include <stdint.h> 4 #include <string.h> 5 6 struct x25519_point { 7 uint8_t vs[32]; 8 }; 9 10 struct x25519_field_element { 11 int64_t vs[16]; // array of 16, 16-bit numbers (stored as 64-bit) 12 }; 13 14 void 15 x25519_genpubkey(struct x25519_point *restrict pk, 16 struct x25519_point const *restrict sk); 17 18 void 19 x25519(struct x25519_point *restrict out, 20 struct x25519_point const *restrict pk, 21 struct x25519_point const *restrict sk);