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_aead_xchacha20poly1305_H 5 */ 6 7 module deimos.sodium.crypto_aead_xchacha20poly1305; 8 9 import deimos.sodium.export_; 10 11 extern(C) @nogc : 12 13 14 enum crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32U; 15 16 size_t crypto_aead_xchacha20poly1305_ietf_keybytes() pure @trusted; 17 18 enum crypto_aead_xchacha20poly1305_ietf_NSECBYTES = 0U; 19 20 size_t crypto_aead_xchacha20poly1305_ietf_nsecbytes() pure @trusted; 21 22 enum crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = 24U; 23 24 size_t crypto_aead_xchacha20poly1305_ietf_npubbytes() pure @trusted; 25 26 enum crypto_aead_xchacha20poly1305_ietf_ABYTES = 16U; 27 28 size_t crypto_aead_xchacha20poly1305_ietf_abytes() pure @trusted; 29 30 enum crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = 31 (SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES); 32 33 size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max() pure @trusted; 34 35 int crypto_aead_xchacha20poly1305_ietf_encrypt(ubyte* c, 36 ulong* clen_p, 37 const(ubyte)* m, 38 ulong mlen, 39 const(ubyte)* ad, 40 ulong adlen, 41 const(ubyte)* nsec, 42 const(ubyte)* npub, 43 const(ubyte)* k) pure; // __attribute__ ((nonnull(1, 8, 9))); 44 45 int crypto_aead_xchacha20poly1305_ietf_decrypt(ubyte* m, 46 ulong* mlen_p, 47 ubyte* nsec, 48 const(ubyte)* c, 49 ulong clen, 50 const(ubyte)* ad, 51 ulong adlen, 52 const(ubyte)* npub, 53 const(ubyte)* k) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9))); 54 55 int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(ubyte* c, 56 ubyte* mac, 57 ulong* maclen_p, 58 const(ubyte)* m, 59 ulong mlen, 60 const(ubyte)* ad, 61 ulong adlen, 62 const(ubyte)* nsec, 63 const(ubyte)* npub, 64 const(ubyte)* k) pure; // __attribute__ ((nonnull(1, 2, 9, 10))); 65 66 int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(ubyte* m, 67 ubyte* nsec, 68 const(ubyte)* c, 69 ulong clen, 70 const(ubyte)* mac, 71 const(ubyte)* ad, 72 ulong adlen, 73 const(ubyte)* npub, 74 const(ubyte)* k) pure nothrow; // __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9))); 75 76 void crypto_aead_xchacha20poly1305_ietf_keygen(ref ubyte[crypto_aead_xchacha20poly1305_ietf_KEYBYTES] k) nothrow @trusted; // __attribute__ ((nonnull)); 77 78 /* Aliases */ 79 80 alias crypto_aead_xchacha20poly1305_IETF_KEYBYTES = crypto_aead_xchacha20poly1305_ietf_KEYBYTES; 81 alias crypto_aead_xchacha20poly1305_IETF_NSECBYTES = crypto_aead_xchacha20poly1305_ietf_NSECBYTES; 82 alias crypto_aead_xchacha20poly1305_IETF_NPUBBYTES = crypto_aead_xchacha20poly1305_ietf_NPUBBYTES; 83 alias crypto_aead_xchacha20poly1305_IETF_ABYTES = crypto_aead_xchacha20poly1305_ietf_ABYTES; 84 alias crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX = crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX;