fixes formatting

This commit is contained in:
Fabian Kaczmarczyck
2020-12-04 14:57:11 +01:00
parent 21b8ad18ce
commit 0b55ff3c3a
2 changed files with 17 additions and 152 deletions

View File

@@ -388,7 +388,6 @@ impl Ctap1Command {
mod test { mod test {
use super::super::{key_material, CREDENTIAL_ID_BASE_SIZE, USE_SIGNATURE_COUNTER}; use super::super::{key_material, CREDENTIAL_ID_BASE_SIZE, USE_SIGNATURE_COUNTER};
use super::*; use super::*;
use byteorder::{BigEndian, ByteOrder};
use crypto::rng256::ThreadRng256; use crypto::rng256::ThreadRng256;
use crypto::Hash256; use crypto::Hash256;
@@ -645,9 +644,7 @@ mod test {
fn check_signature_counter(response: &[u8; 4], signature_counter: u32) { fn check_signature_counter(response: &[u8; 4], signature_counter: u32) {
if USE_SIGNATURE_COUNTER { if USE_SIGNATURE_COUNTER {
let mut signature_counter_bytes = [0u8; 4]; assert_eq!(u32::from_be_bytes(*response), signature_counter);
BigEndian::write_u32(&mut signature_counter_bytes, signature_counter);
assert_eq!(response, &signature_counter_bytes);
} else { } else {
assert_eq!(response, &[0x00, 0x00, 0x00, 0x00]); assert_eq!(response, &[0x00, 0x00, 0x00, 0x00]);
} }

View File

@@ -1097,44 +1097,11 @@ mod test {
// The expected response is split to only assert the non-random parts. // The expected response is split to only assert the non-random parts.
assert_eq!(fmt, "packed"); assert_eq!(fmt, "packed");
let mut expected_auth_data = vec![ let mut expected_auth_data = vec![
0xA3, 0xA3, 0x79, 0xA6, 0xF6, 0xEE, 0xAF, 0xB9, 0xA5, 0x5E, 0x37, 0x8C, 0x11, 0x80,
0x79, 0x34, 0xE2, 0x75, 0x1E, 0x68, 0x2F, 0xAB, 0x9F, 0x2D, 0x30, 0xAB, 0x13, 0xD2,
0xA6, 0x12, 0x55, 0x86, 0xCE, 0x19, 0x47, 0x41, 0x00, 0x00, 0x00,
0xF6,
0xEE,
0xAF,
0xB9,
0xA5,
0x5E,
0x37,
0x8C,
0x11,
0x80,
0x34,
0xE2,
0x75,
0x1E,
0x68,
0x2F,
0xAB,
0x9F,
0x2D,
0x30,
0xAB,
0x13,
0xD2,
0x12,
0x55,
0x86,
0xCE,
0x19,
0x47,
0x41,
0x00,
0x00,
0x00,
INITIAL_SIGNATURE_COUNTER as u8,
]; ];
expected_auth_data.push(INITIAL_SIGNATURE_COUNTER as u8);
expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap()); expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_auth_data.extend(&[0x00, 0x20]); expected_auth_data.extend(&[0x00, 0x20]);
assert_eq!( assert_eq!(
@@ -1168,44 +1135,11 @@ mod test {
// The expected response is split to only assert the non-random parts. // The expected response is split to only assert the non-random parts.
assert_eq!(fmt, "packed"); assert_eq!(fmt, "packed");
let mut expected_auth_data = vec![ let mut expected_auth_data = vec![
0xA3, 0xA3, 0x79, 0xA6, 0xF6, 0xEE, 0xAF, 0xB9, 0xA5, 0x5E, 0x37, 0x8C, 0x11, 0x80,
0x79, 0x34, 0xE2, 0x75, 0x1E, 0x68, 0x2F, 0xAB, 0x9F, 0x2D, 0x30, 0xAB, 0x13, 0xD2,
0xA6, 0x12, 0x55, 0x86, 0xCE, 0x19, 0x47, 0x41, 0x00, 0x00, 0x00,
0xF6,
0xEE,
0xAF,
0xB9,
0xA5,
0x5E,
0x37,
0x8C,
0x11,
0x80,
0x34,
0xE2,
0x75,
0x1E,
0x68,
0x2F,
0xAB,
0x9F,
0x2D,
0x30,
0xAB,
0x13,
0xD2,
0x12,
0x55,
0x86,
0xCE,
0x19,
0x47,
0x41,
0x00,
0x00,
0x00,
INITIAL_SIGNATURE_COUNTER as u8,
]; ];
expected_auth_data.push(INITIAL_SIGNATURE_COUNTER as u8);
expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap()); expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_auth_data.extend(&[0x00, CREDENTIAL_ID_BASE_SIZE as u8]); expected_auth_data.extend(&[0x00, CREDENTIAL_ID_BASE_SIZE as u8]);
assert_eq!( assert_eq!(
@@ -1351,44 +1285,11 @@ mod test {
// The expected response is split to only assert the non-random parts. // The expected response is split to only assert the non-random parts.
assert_eq!(fmt, "packed"); assert_eq!(fmt, "packed");
let mut expected_auth_data = vec![ let mut expected_auth_data = vec![
0xA3, 0xA3, 0x79, 0xA6, 0xF6, 0xEE, 0xAF, 0xB9, 0xA5, 0x5E, 0x37, 0x8C, 0x11, 0x80,
0x79, 0x34, 0xE2, 0x75, 0x1E, 0x68, 0x2F, 0xAB, 0x9F, 0x2D, 0x30, 0xAB, 0x13, 0xD2,
0xA6, 0x12, 0x55, 0x86, 0xCE, 0x19, 0x47, 0xC1, 0x00, 0x00, 0x00,
0xF6,
0xEE,
0xAF,
0xB9,
0xA5,
0x5E,
0x37,
0x8C,
0x11,
0x80,
0x34,
0xE2,
0x75,
0x1E,
0x68,
0x2F,
0xAB,
0x9F,
0x2D,
0x30,
0xAB,
0x13,
0xD2,
0x12,
0x55,
0x86,
0xCE,
0x19,
0x47,
0xC1,
0x00,
0x00,
0x00,
INITIAL_SIGNATURE_COUNTER as u8,
]; ];
expected_auth_data.push(INITIAL_SIGNATURE_COUNTER as u8);
expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap()); expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_auth_data.extend(&[0x00, CREDENTIAL_ID_MAX_SIZE as u8]); expected_auth_data.extend(&[0x00, CREDENTIAL_ID_MAX_SIZE as u8]);
assert_eq!( assert_eq!(
@@ -1434,44 +1335,11 @@ mod test {
// The expected response is split to only assert the non-random parts. // The expected response is split to only assert the non-random parts.
assert_eq!(fmt, "packed"); assert_eq!(fmt, "packed");
let mut expected_auth_data = vec![ let mut expected_auth_data = vec![
0xA3, 0xA3, 0x79, 0xA6, 0xF6, 0xEE, 0xAF, 0xB9, 0xA5, 0x5E, 0x37, 0x8C, 0x11, 0x80,
0x79, 0x34, 0xE2, 0x75, 0x1E, 0x68, 0x2F, 0xAB, 0x9F, 0x2D, 0x30, 0xAB, 0x13, 0xD2,
0xA6, 0x12, 0x55, 0x86, 0xCE, 0x19, 0x47, 0xC1, 0x00, 0x00, 0x00,
0xF6,
0xEE,
0xAF,
0xB9,
0xA5,
0x5E,
0x37,
0x8C,
0x11,
0x80,
0x34,
0xE2,
0x75,
0x1E,
0x68,
0x2F,
0xAB,
0x9F,
0x2D,
0x30,
0xAB,
0x13,
0xD2,
0x12,
0x55,
0x86,
0xCE,
0x19,
0x47,
0xC1,
0x00,
0x00,
0x00,
INITIAL_SIGNATURE_COUNTER as u8,
]; ];
expected_auth_data.push(INITIAL_SIGNATURE_COUNTER as u8);
expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap()); expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_auth_data.extend(&[0x00, 0x20]); expected_auth_data.extend(&[0x00, 0x20]);
assert_eq!( assert_eq!(