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_sign_H
5 */
6 
7 module deimos.sodium.crypto_sign;
8 
9 /*
10  * THREAD SAFETY: crypto_sign_keypair() is thread-safe,
11  * provided that you called sodium_init() once before using any
12  * other libsodium function.
13  * Other functions, including crypto_sign_seed_keypair() are always thread-safe.
14  */
15 
16 import deimos.sodium.crypto_sign_ed25519 : crypto_sign_ed25519_BYTES,
17                                            crypto_sign_ed25519_SEEDBYTES,
18                                            crypto_sign_ed25519_PUBLICKEYBYTES,
19                                            crypto_sign_ed25519_SECRETKEYBYTES,
20                                            crypto_sign_ed25519_MESSAGEBYTES_MAX,
21                                            crypto_sign_ed25519ph_state;
22 
23 
24 extern(C) @nogc :
25 
26 alias crypto_sign_state = crypto_sign_ed25519ph_state;
27 
28 size_t  crypto_sign_statebytes() pure @trusted;
29 
30 alias crypto_sign_BYTES = crypto_sign_ed25519_BYTES;
31 
32 size_t  crypto_sign_bytes() pure @trusted;
33 
34 alias crypto_sign_SEEDBYTES = crypto_sign_ed25519_SEEDBYTES;
35 
36 size_t  crypto_sign_seedbytes() pure @trusted;
37 
38 alias crypto_sign_PUBLICKEYBYTES = crypto_sign_ed25519_PUBLICKEYBYTES;
39 
40 size_t  crypto_sign_publickeybytes() pure @trusted;
41 
42 alias crypto_sign_SECRETKEYBYTES = crypto_sign_ed25519_SECRETKEYBYTES;
43 
44 size_t  crypto_sign_secretkeybytes() pure @trusted;
45 
46 alias crypto_sign_MESSAGEBYTES_MAX = crypto_sign_ed25519_MESSAGEBYTES_MAX;
47 
48 size_t  crypto_sign_messagebytes_max() pure @trusted;
49 
50 enum crypto_sign_PRIMITIVE = "ed25519";
51 
52 const(char)* crypto_sign_primitive() pure @trusted;
53 
54 int crypto_sign_seed_keypair(ubyte* pk, ubyte* sk,
55                              const(ubyte)* seed) pure; //__attribute__ ((nonnull));
56 
57 int crypto_sign_keypair(ubyte* pk, ubyte* sk) nothrow; //__attribute__ ((nonnull));
58 
59 int crypto_sign(ubyte* sm, ulong* smlen_p,
60                 const(ubyte)* m, ulong mlen,
61                 const(ubyte)* sk) pure; // __attribute__ ((nonnull(1, 5)));
62 
63 int crypto_sign_open(ubyte* m, ulong* mlen_p,
64                      const(ubyte)* sm, ulong smlen,
65                      const(ubyte)* pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
66 
67 int crypto_sign_detached(ubyte* sig, ulong* siglen_p,
68                          const(ubyte)* m, ulong mlen,
69                          const(ubyte)* sk) pure; //  __attribute__ ((nonnull(1, 5)));
70 
71 int crypto_sign_verify_detached(const(ubyte)* sig,
72                                 const(ubyte)* m,
73                                 ulong mlen,
74                                 const(ubyte)* pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
75 
76 int crypto_sign_init(crypto_sign_state* state) pure;
77 
78 int crypto_sign_update(crypto_sign_state* state,
79                        const(ubyte)* m, ulong mlen) pure; // __attribute__ ((nonnull(1)));
80 
81 int crypto_sign_final_create(crypto_sign_state* state, ubyte* sig,
82                              ulong* siglen_p,
83                              const(ubyte)* sk) pure; // __attribute__ ((nonnull(1, 2, 4)));
84 
85 int crypto_sign_final_verify(crypto_sign_state* state, const(ubyte)* sig,
86                              const(ubyte)* pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));