1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_core_ed25519.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_core_ed25519;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 
15 extern (C):
16 
17 enum crypto_core_ed25519_BYTES = 32;
18 size_t crypto_core_ed25519_bytes ();
19 
20 enum crypto_core_ed25519_UNIFORMBYTES = 32;
21 size_t crypto_core_ed25519_uniformbytes ();
22 
23 enum crypto_core_ed25519_SCALARBYTES = 32;
24 size_t crypto_core_ed25519_scalarbytes ();
25 
26 enum crypto_core_ed25519_NONREDUCEDSCALARBYTES = 64;
27 size_t crypto_core_ed25519_nonreducedscalarbytes ();
28 
29 int crypto_core_ed25519_is_valid_point (const(ubyte)* p);
30 
31 int crypto_core_ed25519_add (ubyte* r, const(ubyte)* p, const(ubyte)* q);
32 
33 int crypto_core_ed25519_sub (ubyte* r, const(ubyte)* p, const(ubyte)* q);
34 
35 int crypto_core_ed25519_from_uniform (ubyte* p, const(ubyte)* r);
36 
37 void crypto_core_ed25519_scalar_random (ubyte* r);
38 
39 int crypto_core_ed25519_scalar_invert (ubyte* recip, const(ubyte)* s);
40 
41 void crypto_core_ed25519_scalar_negate (ubyte* neg, const(ubyte)* s);
42 
43 void crypto_core_ed25519_scalar_complement (ubyte* comp, const(ubyte)* s);
44 
45 void crypto_core_ed25519_scalar_add (
46     ubyte* z,
47     const(ubyte)* x,
48     const(ubyte)* y);
49 
50 void crypto_core_ed25519_scalar_sub (
51     ubyte* z,
52     const(ubyte)* x,
53     const(ubyte)* y);
54 
55 /*
56  * The interval `s` is sampled from should be at least 317 bits to ensure almost
57  * uniformity of `r` over `L`.
58  */
59 void crypto_core_ed25519_scalar_reduce (ubyte* r, const(ubyte)* s);