nettle_sys/
lib.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
6
7#[cfg(test)]
8mod tests {
9    use super::*;
10    use std::mem::zeroed;
11
12    #[test]
13    fn sha1_nothing() {
14        unsafe {
15            let mut digest = vec![0u8; SHA1_DIGEST_SIZE as usize];
16            let mut ctx = zeroed::<sha1_ctx>();
17
18            nettle_sha1_init(&mut ctx as *mut _);
19            nettle_sha1_digest(&mut ctx as *mut _, SHA1_DIGEST_SIZE as usize, digest.as_mut_ptr());
20            assert_eq!(digest, b"\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09");
21        }
22    }
23}