X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=lab1_rust%2Fsrc%2Fpacket.rs;h=7e9c38ccb362b4a51153aebb2e55bed38e7c17a5;hb=9cdc634f2ce4d0e88f4d3af1d6f555a5449da189;hp=f45332434fb620744ffe5ddb8b834822ec712857;hpb=4d892f864a1f47eb1aab23f1c70ccb143081849c;p=crypto_lab1.git diff --git a/lab1_rust/src/packet.rs b/lab1_rust/src/packet.rs index f453324..7e9c38c 100644 --- a/lab1_rust/src/packet.rs +++ b/lab1_rust/src/packet.rs @@ -77,12 +77,12 @@ pub enum PacketType { /// 0x0A: Decrypt error /// 0x0B: Authentication error /// TTTTTTTT: Timestamp (64 bits) -/// D...D: Encrypted data (AES-256 CBC mode) of: -/// |I|C...C|P...P| for command and answer packet: -/// I: Command ID -/// C: Command payload (from 7 to 39 bytes) -/// P: Padding from 1 to 16, |I|C...C|P...P| size must be a multiple of 16 -/// |0000000000000000| for error packet (16 bytes length) +/// D...D: Encrypted data (AES-256 CBC mode) of: +/// |I|C...C|P...P| for command and answer packet: +/// I: Command ID +/// C: Command payload (from 7 to 39 bytes) +/// P: Padding from 1 to 16, |I|C...C|P...P| size must be a multiple of 16 +/// |0000000000000000| for error packet (16 bytes length) /// MMMMMMMMMM: first 10 bytes (most significant) of the HMAC-SHA256 of: /// for command and answer packet: /// |I|C...C| for weak variant @@ -273,5 +273,5 @@ fn iv_from_timestamp(timestamp: u64) -> Vec { let mut iv = io::MemWriter::with_capacity(16); let _ = iv.write_be_u64(0u64); let _ = iv.write_be_u64(timestamp); - iv.unwrap() + iv.into_inner() }