| 1 | #![allow (missing_docs)] |
| 2 | //! <https://langsec.org> cat says: |
| 3 | //! |
| 4 | //! ```text |
| 5 | //! ___ _ _ _ _ ___ ___ ___ ___ ___ _ _ ___ _____ ___ ___ _ _ |
| 6 | //! | __| | | | | | | | _ \ __/ __/ _ \ / __| \| |_ _|_ _|_ _/ _ \| \| | |
| 7 | //! | _|| |_| | |__| |__ | / _| (_| (_) | (_ | .` || | | | | | (_) | .` | |
| 8 | //! |_| \___/|____|____| |_|_\___\___\___/ \___|_|\_|___| |_| |___\___/|_|\_| |
| 9 | //! |
| 10 | //! |
| 11 | //! .__....._ _.....__, |
| 12 | //! .": o :': ;': o :". |
| 13 | //! `. `-' .'. .'. `-' .' |
| 14 | //! `---' `---' |
| 15 | //! |
| 16 | //! _...----... ... ... ...----..._ |
| 17 | //! .-'__..-""'---- `. `"` .' ----'""-..__`-. |
| 18 | //! '.-' _.--"""' `-._.-' '"""--._ `-.` |
| 19 | //! ' .-"' : `"-. ` |
| 20 | //! ' `. _.'"'._ .' ` |
| 21 | //! `. ,.-'" "'-., .' |
| 22 | //! `. .' |
| 23 | //! `-._ _.-' |
| 24 | //! `"'--...___...--'"` |
| 25 | //! |
| 26 | //! ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ _ _ ___ |
| 27 | //! | _ ) __| __/ _ \| _ \ __| | _ \ _ \/ _ \ / __| __/ __/ __|_ _| \| |/ __| |
| 28 | //! | _ \ _|| _| (_) | / _| | _/ / (_) | (__| _|\__ \__ \| || .` | (_ | |
| 29 | //! |___/___|_| \___/|_|_\___| |_| |_|_\\___/ \___|___|___/___/___|_|\_|\___| |
| 30 | //! ``` |
| 31 | //! |
| 32 | //! <https://langsec.org/ForWantOfANail-h2hc2014.pdf> |
| 33 | |
| 34 | #[macro_use ] |
| 35 | mod macros; |
| 36 | |
| 37 | pub(crate) mod alert; |
| 38 | pub(crate) mod base; |
| 39 | pub(crate) mod ccs; |
| 40 | pub(crate) mod codec; |
| 41 | pub(crate) mod deframer; |
| 42 | pub(crate) mod enums; |
| 43 | pub(crate) mod fragmenter; |
| 44 | pub(crate) mod handshake; |
| 45 | pub(crate) mod message; |
| 46 | pub(crate) mod persist; |
| 47 | |
| 48 | #[cfg (test)] |
| 49 | mod handshake_test; |
| 50 | |
| 51 | pub mod ffdhe_groups; |
| 52 | #[cfg (test)] |
| 53 | mod message_test; |
| 54 | |
| 55 | #[cfg (test)] |
| 56 | mod tests { |
| 57 | use super::codec::Reader; |
| 58 | use super::message::{Message, OutboundOpaqueMessage}; |
| 59 | |
| 60 | #[test ] |
| 61 | fn smoketest() { |
| 62 | let bytes = include_bytes!("../testdata/handshake-test.1.bin" ); |
| 63 | let mut r = Reader::init(bytes); |
| 64 | |
| 65 | while r.any_left() { |
| 66 | let m = OutboundOpaqueMessage::read(&mut r).unwrap(); |
| 67 | |
| 68 | let out = m.clone().encode(); |
| 69 | assert!(!out.is_empty()); |
| 70 | |
| 71 | Message::try_from(m.into_plain_message()).unwrap(); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |