projects
/
crypto_lab1.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test the new syntax 'if let'.
[crypto_lab1.git]
/
lab1_rust
/
src
/
oracle_machine.rs
diff --git
a/lab1_rust/src/oracle_machine.rs
b/lab1_rust/src/oracle_machine.rs
index
8bf3933
..
018e2a5
100644
(file)
--- a/
lab1_rust/src/oracle_machine.rs
+++ b/
lab1_rust/src/oracle_machine.rs
@@
-3,7
+3,8
@@
use std::io::TcpStream;
use std::iter::range_inclusive;
use std::slice::bytes::copy_memory;
use packet;
use std::iter::range_inclusive;
use std::slice::bytes::copy_memory;
use packet;
-use packet::{ Packet, Error };
+use packet::Packet;
+use packet::PacketType::Error;
use end_point::EndPoint;
/// Tries to decipher a ciphered data block by using the previous XOR operand and an oracle on the provided address and port.
use end_point::EndPoint;
/// Tries to decipher a ciphered data block by using the previous XOR operand and an oracle on the provided address and port.
@@
-49,8
+50,8
@@
pub fn decipher(address: &str, port: u16, original_xor_operand: &[u8, ..16], cip
forged_xor_operand(&mut final_packet)[byte] = v;
forged_xor_operand(&mut final_packet)[byte] = v;
- match end_point.send_raw_with_result(final_packet) {
- Ok(Ok(p @ Packet { t: Error(packet::
AuthError
), .. })) => {
+ match end_point.send_raw_with_result(
&
final_packet) {
+ Ok(Ok(p @ Packet { t: Error(packet::
ErrorType::Auth
), .. })) => {
println!("We received a MAC Error: {}", p);
// If we already got a MAC mismatch for the first byte then
println!("We received a MAC Error: {}", p);
// If we already got a MAC mismatch for the first byte then
@@
-79,7
+80,7
@@
pub fn decipher(address: &str, port: u16, original_xor_operand: &[u8, ..16], cip
break;
}
},
break;
}
},
- Ok(Ok(Packet { t: Error(packet::
CryptError
), .. })) => (), // Ignored case: the padding is wrong.
+ Ok(Ok(Packet { t: Error(packet::
ErrorType::Crypt
), .. })) => (), // Ignored case: the padding is wrong.
other => {
println!("Unexcepted response, aborting. {}", other);
return None
other => {
println!("Unexcepted response, aborting. {}", other);
return None