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_secretbox_xchacha20poly1305_H 5 */ 6 7 module deimos.sodium.crypto_secretbox_xchacha20poly1305; 8 9 version(SODIUM_LIBRARY_MINIMAL) {} 10 else { 11 12 import deimos.sodium.crypto_stream_xchacha20 : crypto_stream_xchacha20_MESSAGEBYTES_MAX; 13 14 extern(C) pure @nogc : 15 16 17 enum crypto_secretbox_xchacha20poly1305_KEYBYTES = 32U; 18 19 size_t crypto_secretbox_xchacha20poly1305_keybytes() @trusted; 20 21 enum crypto_secretbox_xchacha20poly1305_NONCEBYTES = 24U; 22 23 size_t crypto_secretbox_xchacha20poly1305_noncebytes() @trusted; 24 25 enum crypto_secretbox_xchacha20poly1305_MACBYTES = 16U; 26 27 size_t crypto_secretbox_xchacha20poly1305_macbytes() @trusted; 28 29 enum crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX = 30 (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES); 31 32 size_t crypto_secretbox_xchacha20poly1305_messagebytes_max() @trusted; 33 34 int crypto_secretbox_xchacha20poly1305_easy(ubyte* c, 35 const(ubyte)* m, 36 ulong mlen, 37 const(ubyte)* n, 38 const(ubyte)* k); // __attribute__ ((nonnull(1, 4, 5))); 39 40 int crypto_secretbox_xchacha20poly1305_open_easy(ubyte* m, 41 const(ubyte)* c, 42 ulong clen, 43 const(ubyte)* n, 44 const(ubyte)* k) nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5))); 45 46 int crypto_secretbox_xchacha20poly1305_detached(ubyte* c, 47 ubyte* mac, 48 const(ubyte)* m, 49 ulong mlen, 50 const(ubyte)* n, 51 const(ubyte)* k); // __attribute__ ((nonnull(1, 2, 5, 6))); 52 53 int crypto_secretbox_xchacha20poly1305_open_detached(ubyte* m, 54 const(ubyte)* c, 55 const(ubyte)* mac, 56 ulong clen, 57 const(ubyte)* n, 58 const(ubyte)* k) nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6))); 59 60 }