1 // Written in the D programming language.
2 
3 module wrapper.sodium;
4 
5 public:
6 
7 import wrapper.sodium.version_; /* unittest + code (both no-GC-alloc profiled) */
8 
9 //import wrapper.sodium.core;   /* unittest + code (both no-GC-alloc profiled) */ No public import any more: it get's imported privately in all other modules (except randombytes_*) to ensure running it's shared static this() first
10 
11 import wrapper.sodium.crypto_aead_aes256gcm; /* unittest + code  TODO update Precomputation interface, update doc. comments, check -m32_mscoff */
12 import wrapper.sodium.crypto_aead_chacha20poly1305; /* unittest + code  TODO update doc. comments */
13 import wrapper.sodium.crypto_aead_xchacha20poly1305; /* unittest + code  TODO update doc. comments */
14 
15 import wrapper.sodium.crypto_auth; /* unittest + code  */
16 import wrapper.sodium.crypto_auth_hmacsha256; /* unittest + code  */
17 import wrapper.sodium.crypto_auth_hmacsha512; /* unittest + code  */
18 import wrapper.sodium.crypto_auth_hmacsha512256; /* unittest + code  */
19 
20 import wrapper.sodium.crypto_box; /* unittest + code  */
21 import wrapper.sodium.crypto_box_curve25519xsalsa20poly1305; /* unittest + code; TODO update doc. comments */
22 
23 import wrapper.sodium.crypto_core_hsalsa20; /* currently mere redirection; TODO */
24 import wrapper.sodium.crypto_core_hchacha20; /* currently mere redirection; TODO */
25 import wrapper.sodium.crypto_core_salsa20; /* currently mere redirection; TODO */
26 import wrapper.sodium.crypto_core_salsa2012; /* currently mere redirection; TODO */
27 import wrapper.sodium.crypto_core_salsa208; /* currently mere redirection; TODO */
28 
29 import wrapper.sodium.crypto_generichash; /* unittest + code  */
30 import wrapper.sodium.crypto_generichash_blake2b; /* unittest not required; mere redirection */
31 import wrapper.sodium.crypto_hash; /* unittest + code  */
32 import wrapper.sodium.crypto_hash_sha256; /* unittest + code  */
33 import wrapper.sodium.crypto_hash_sha512; /* unittest + code  */
34 
35 import wrapper.sodium.crypto_kdf; /* unittest + code  */
36 import wrapper.sodium.crypto_kdf_blake2b; /* currently mere redirection; TODO */
37 import wrapper.sodium.crypto_kx; /* unittest + code  */
38 
39 import wrapper.sodium.crypto_onetimeauth; /* currently mere redirection; TODO */
40 import wrapper.sodium.crypto_onetimeauth_poly1305; /* currently mere redirection; TODO */
41 
42 import wrapper.sodium.crypto_pwhash; /* unittest + code; TODO v1.0.12 */
43 import wrapper.sodium.crypto_pwhash_argon2i; /* currently mere redirection; TODO */
44 
45 import wrapper.sodium.crypto_scalarmult; /* unittest + code  */
46 import wrapper.sodium.crypto_scalarmult_curve25519; /* unittest not required; mere redirection */
47 
48 import wrapper.sodium.crypto_secretbox; /* unittest + code  */
49 import wrapper.sodium.crypto_secretbox_xsalsa20poly1305; /* unittest not required; mere redirection of some symbols */
50 import wrapper.sodium.crypto_secretstream_xchacha20poly1305; /* currently mere redirection; TODO */
51 
52 import wrapper.sodium.crypto_shorthash; /* unittest + code  */
53 import wrapper.sodium.crypto_shorthash_siphash24; /* unittest */
54 import wrapper.sodium.crypto_sign; /* currently mere redirection; TODO */
55 import wrapper.sodium.crypto_sign_ed25519; /* unittest + code  TODO update doc. comments */
56 //import wrapper.sodium.crypto_sign_edwards25519sha512batch; /* currently mere redirection; TODO */
57 
58 import wrapper.sodium.crypto_stream; /* unittest + code  */
59 import wrapper.sodium.crypto_stream_chacha20; // no_compile
60 import wrapper.sodium.crypto_stream_salsa20; // no_compile
61 import wrapper.sodium.crypto_stream_xsalsa20; /* unittest */
62 
63 import wrapper.sodium.crypto_verify_16; /* unittest + code ; wrapper: @nogc */
64 import wrapper.sodium.crypto_verify_32; /* unittest + code ; wrapper: @nogc */
65 import wrapper.sodium.crypto_verify_64; /* unittest + code ; wrapper: @nogc */
66 
67 /* WARNING: randombytes_set_implementation doesn't get imported by 'wrapper' and shouldn't be used through 'deimos' either, except You exactly know it's interaction with sodium_init() */
68 import wrapper.sodium.randombytes; /* unittest + code */
69 import wrapper.sodium.randombytes_internal_random; /* unittest not required; mere redirection */
70 import wrapper.sodium.randombytes_sysrandom; /* unittest not required; mere redirection */
71 import wrapper.sodium.runtime; /* unittest (no-GC-alloc profiled) */
72 import wrapper.sodium.utils; /* unittest + code */
73 
74 version (SODIUM_LIBRARY_MINIMAL)
75 {
76 }
77 else
78 {
79     /* These declarations are accessible from the binary only if not compiled in minimal mode; module version_'s function sodium_library_minimal informs about that. */
80     import wrapper.sodium.crypto_box_curve25519xchacha20poly1305; /* currently mere redirection; TODO v1.0.12 */
81     import wrapper.sodium.crypto_core_ed25519; /* currently mere redirection; TODO v1.0.16 */
82     import wrapper.sodium.crypto_core_ristretto255; /* currently mere redirection; TODO v1.0.18 */
83     import wrapper.sodium.crypto_scalarmult_ed25519; /* currently mere redirection; TODO v1.0.16 */
84     import wrapper.sodium.crypto_scalarmult_ristretto255; /* currently mere redirection; TODO v1.0.18 */
85     import wrapper.sodium.crypto_secretbox_xchacha20poly1305; /* currently mere redirection; TODO v1.0.12 */
86     import wrapper.sodium.crypto_pwhash_scryptsalsa208sha256; /* currently mere redirection; TODO */
87     import wrapper.sodium.crypto_stream_salsa2012; /* currently mere redirection; TODO v1.0.12 */
88     import wrapper.sodium.crypto_stream_salsa208; /* currently mere redirection; TODO v1.0.12 */
89     import wrapper.sodium.crypto_stream_xchacha20; /* currently mere redirection; TODO v1.0.12 */
90 }
91 
92 /*
93  * The only reason for commenting-out the FunctionAttribute nothrow for some functions is this conflict:
94  * Some functions don't return void and effectively are strongly pure nothrow AND DON'T declare  __attribute__ ((warn_unused_result)) ! But,
95  * Since DMD 2.066.0, compiler switch -w warns about an unused return value of a strongly pure nothrow function call,
96  * thus these C function signatures can't be translated exactly to D, if compiler switch -w is thrown (assumed to be the case, e.g. it's the default for dub).
97  */