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_ed25519_H
5 */
6 
7 module deimos.sodium.crypto_sign_ed25519;
8 
9 import deimos.sodium.crypto_hash_sha512;
10 import deimos.sodium.export_;
11 
12 
13 extern(C) @nogc :
14 
15 
16 struct crypto_sign_ed25519ph_state {
17     crypto_hash_sha512_state hs;
18 }
19 
20 size_t crypto_sign_ed25519ph_statebytes() pure @trusted;
21 
22 enum crypto_sign_ed25519_BYTES = 64U;
23 
24 size_t crypto_sign_ed25519_bytes() pure @trusted;
25 
26 enum crypto_sign_ed25519_SEEDBYTES = 32U;
27 
28 size_t crypto_sign_ed25519_seedbytes() pure @trusted;
29 
30 enum crypto_sign_ed25519_PUBLICKEYBYTES = 32U;
31 
32 size_t crypto_sign_ed25519_publickeybytes() pure @trusted;
33 
34 enum crypto_sign_ed25519_SECRETKEYBYTES = (32U + 32U);
35 
36 size_t crypto_sign_ed25519_secretkeybytes() pure @trusted;
37 
38 enum crypto_sign_ed25519_MESSAGEBYTES_MAX = (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES);
39 
40 size_t crypto_sign_ed25519_messagebytes_max() pure @trusted;
41 
42 int crypto_sign_ed25519(ubyte* sm, ulong* smlen_p,
43                         const(ubyte)* m, ulong mlen,
44                         const(ubyte)* sk) pure; // __attribute__ ((nonnull(1, 5)));
45 
46 int crypto_sign_ed25519_open(ubyte* m, ulong* mlen_p,
47                              const(ubyte)* sm, ulong smlen,
48                              const(ubyte)* pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
49 
50 int crypto_sign_ed25519_detached(ubyte* sig,
51                                  ulong* siglen_p,
52                                  const(ubyte)* m,
53                                  ulong mlen,
54                                  const(ubyte)* sk) pure; // __attribute__ ((nonnull(1, 5)));
55 
56 int crypto_sign_ed25519_verify_detached(const(ubyte)* sig,
57                                         const(ubyte)* m,
58                                         ulong mlen,
59                                         const(ubyte)* pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
60 
61 int crypto_sign_ed25519_keypair(ubyte* pk, ubyte* sk) nothrow; // __attribute__ ((nonnull));
62 
63 int crypto_sign_ed25519_seed_keypair(ubyte* pk, ubyte* sk,
64                                      const(ubyte)* seed) pure; // __attribute__ ((nonnull));
65 
66 int crypto_sign_ed25519_pk_to_curve25519(ubyte* curve25519_pk,
67                                          const(ubyte)* ed25519_pk) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
68 
69 int crypto_sign_ed25519_sk_to_curve25519(ubyte* curve25519_sk,
70                                          const(ubyte)* ed25519_sk) pure; // __attribute__ ((nonnull));
71 
72 int crypto_sign_ed25519_sk_to_seed(ubyte* seed,
73                                    const(ubyte)* sk) pure; // __attribute__ ((nonnull));
74 
75 int crypto_sign_ed25519_sk_to_pk(ubyte* pk, const(ubyte)* sk) pure; // __attribute__ ((nonnull));
76 
77 int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state* state) pure; // __attribute__ ((nonnull));
78 
79 int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state* state,
80                                  const(ubyte)* m,
81                                  ulong mlen) pure; // __attribute__ ((nonnull(1)));
82 
83 int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state* state,
84                                        ubyte* sig,
85                                        ulong* siglen_p,
86                                        const(ubyte)* sk) pure; // __attribute__ ((nonnull(1, 2, 4)));
87 
88 int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state* state,
89                                        const(ubyte)* sig,              // v1.0.17 changed: ubyte* sig -> const(ubyte)* sig
90                                        const(ubyte)* pk) pure nothrow; //  __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));