rust_sodium-sys 0.1.2

Raw bindings to libsodium
Documentation
// crypto_aead_chacha20poly1305.h

pub const crypto_aead_chacha20poly1305_KEYBYTES: usize = 32;
pub const crypto_aead_chacha20poly1305_NSECBYTES: usize = 0;
pub const crypto_aead_chacha20poly1305_NPUBBYTES: usize = 8;
pub const crypto_aead_chacha20poly1305_ABYTES: usize = 16;


extern "C" {
    pub fn crypto_aead_chacha20poly1305_keybytes() -> size_t;
    pub fn crypto_aead_chacha20poly1305_nsecbytes() -> size_t;
    pub fn crypto_aead_chacha20poly1305_npubbytes() -> size_t;
    pub fn crypto_aead_chacha20poly1305_abytes() -> size_t;
    pub fn crypto_aead_chacha20poly1305_encrypt(c: *mut u8,
                                                clen: *mut c_ulonglong,
                                                m: *const u8,
                                                mlen: c_ulonglong,
                                                ad: *const u8,
                                                adlen: c_ulonglong,
                                                nsec: *const u8,
                                                npub: *const u8,
                                                k: *const u8)
                                                -> c_int;
    pub fn crypto_aead_chacha20poly1305_decrypt(m: *mut u8,
                                                mlen: *mut c_ulonglong,
                                                nsec: *mut u8,
                                                c: *const u8,
                                                clen: c_ulonglong,
                                                ad: *const u8,
                                                adlen: c_ulonglong,
                                                npub: *const u8,
                                                k: *const u8)
                                                -> c_int;
}


#[test]
fn test_crypto_aead_chacha20poly1305_keybytes() {
    assert!(unsafe { crypto_aead_chacha20poly1305_keybytes() as usize } ==
            crypto_aead_chacha20poly1305_KEYBYTES)
}
#[test]
fn test_crypto_aead_chacha20poly1305_nsecbytes() {
    assert!(unsafe { crypto_aead_chacha20poly1305_nsecbytes() as usize } ==
            crypto_aead_chacha20poly1305_NSECBYTES)
}
#[test]
fn test_crypto_aead_chacha20poly1305_npubbytes() {
    assert!(unsafe { crypto_aead_chacha20poly1305_npubbytes() as usize } ==
            crypto_aead_chacha20poly1305_NPUBBYTES)
}
#[test]
fn test_crypto_aead_chacha20poly1305_abytes() {
    assert!(unsafe { crypto_aead_chacha20poly1305_abytes() as usize } ==
            crypto_aead_chacha20poly1305_ABYTES)
}