1 /*
2 Written in the D programming language.
3 For git maintenance (ensure at least one congruent line with originating C header):
4 #define crypto_core_ed25519_H
5 */
6 
7 module deimos.sodium.crypto_core_ed25519;
8 
9 version(SODIUM_LIBRARY_MINIMAL) {}
10 else {
11 
12 
13 extern(C) @nogc :
14 
15 
16 enum crypto_core_ed25519_BYTES = 32U;
17 
18 size_t crypto_core_ed25519_bytes() pure @trusted;
19 
20 enum crypto_core_ed25519_UNIFORMBYTES = 32U;
21 
22 size_t crypto_core_ed25519_uniformbytes() pure @trusted;
23 
24 enum crypto_core_ed25519_HASHBYTES = 64U;
25 
26 size_t crypto_core_ed25519_hashbytes() pure @trusted;
27 
28 enum crypto_core_ed25519_SCALARBYTES = 32U;
29 
30 size_t crypto_core_ed25519_scalarbytes() pure @trusted;
31 
32 enum crypto_core_ed25519_NONREDUCEDSCALARBYTES = 64;
33 
34 size_t crypto_core_ed25519_nonreducedscalarbytes() pure @trusted;
35 
36 int crypto_core_ed25519_is_valid_point(const(ubyte)* p) nothrow; // __attribute__ ((nonnull));
37 
38 int crypto_core_ed25519_add(ubyte* r,
39                             const(ubyte)* p, const(ubyte)* q) nothrow; // __attribute__ ((nonnull));
40 
41 int crypto_core_ed25519_sub(ubyte* r,
42                             const(ubyte)* p, const(ubyte)* q) nothrow; // __attribute__ ((nonnull));
43 
44 int crypto_core_ed25519_from_uniform(ubyte* p, const(ubyte)* r) nothrow; // __attribute__ ((nonnull));
45 
46 int crypto_core_ed25519_from_hash(ubyte* p, const(ubyte)* h) nothrow; // __attribute__ ((nonnull));
47 
48 void crypto_core_ed25519_random(ubyte* p) nothrow; // __attribute__ ((nonnull));
49 
50 void crypto_core_ed25519_scalar_random(ubyte* r) nothrow; // __attribute__ ((nonnull));
51 
52 int crypto_core_ed25519_scalar_invert(ubyte* recip, const(ubyte)* s) nothrow; // __attribute__ ((nonnull));
53 
54 void crypto_core_ed25519_scalar_negate(ubyte* neg, const(ubyte)* s) nothrow; // __attribute__ ((nonnull));
55 
56 void crypto_core_ed25519_scalar_complement(ubyte* comp, const(ubyte)* s) nothrow; // __attribute__ ((nonnull));
57 
58 void crypto_core_ed25519_scalar_add(ubyte* z, const(ubyte)* x,
59                                     const(ubyte)* y) nothrow; // __attribute__ ((nonnull));
60 
61 void crypto_core_ed25519_scalar_sub(ubyte* z, const(ubyte)* x,
62                                     const(ubyte)* y) nothrow; // __attribute__ ((nonnull));
63 
64 void crypto_core_ed25519_scalar_mul(ubyte* z, const(ubyte)* x,
65                                     const(ubyte)* y) nothrow; // __attribute__ ((nonnull));
66 
67 /*
68  * The interval `s` is sampled from should be at least 317 bits to ensure almost
69  * uniformity of `r` over `L`.
70  */
71 void crypto_core_ed25519_scalar_reduce(ubyte* r, const(ubyte)* s) nothrow; // __attribute__ ((nonnull));
72 
73 }