Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Feb 17, 2024
1 parent 5ee5dcc commit ee49168
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 200 deletions.
198 changes: 97 additions & 101 deletions bestool/Cargo.lock

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions bestool/src/beslink/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,20 @@ pub fn read_message(serial_port: &mut Box<dyn SerialPort>) -> Result<BesMessage,
Err(e) => Err(e),
}
}
pub fn validate_packet_checksum(packet: &Vec<u8>) -> Result<(), BESLinkError> {
let mut inner_packet = packet.clone();
let _ = inner_packet.pop();
let checksum = calculate_message_checksum(&inner_packet);
pub fn validate_packet_checksum(packet: &[u8]) -> Result<(), BESLinkError> {
let checksum = calculate_message_checksum(&packet[1..packet.len()]);
if checksum == packet[packet.len() - 1] {
return Ok(());
}
let e = BESLinkError::BadChecksumError {
failed_packet: packet.clone(),
failed_packet: packet.to_vec(),
got: packet[packet.len() - 1],
wanted: checksum,
};
warn!("Bad Checksum!! {:?}", e);
Err(e)
}
pub fn calculate_message_checksum(packet: &Vec<u8>) -> u8 {
pub fn calculate_message_checksum(packet: &[u8]) -> u8 {
let mut sum: u32 = 0;
for b in packet {
sum += u32::from(*b);
Expand Down
2 changes: 1 addition & 1 deletion bestool/src/beslink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use bootloader::start_programmer_runtime_binary_blob;
pub use errors::BESLinkError;
pub use helper_sync_and_load_programmer::helper_sync_and_load_programmer;
pub use memory_info::query_memory_info;
pub use message::read_message;

pub use message::send_message;
pub use message::BesMessage;
pub use message::MessageTypes;
Expand Down
4 changes: 1 addition & 3 deletions bestool/src/beslink/write_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ fn get_flash_chunk_msg(payload: Vec<u8>, chunk: usize) -> BesMessage {
let mut digest = crc.digest();
digest.update(&payload);
let crc_value = digest.finalize();
data_message
.payload
.extend(crc_value.to_le_bytes());
data_message.payload.extend(crc_value.to_le_bytes());
data_message.payload.extend(vec![chunk as u8, 0x00, 0x00]);
data_message.set_checksum();
data_message
Expand Down
4 changes: 1 addition & 3 deletions bestool/src/cmds/read_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ use tracing::info;

pub fn cmd_read_image(input_file: String, serial_port: String, start: usize, length: usize) {
//First gain sync to the device
println!(
"Reading binary data from {serial_port} @ {BES_PROGRAMMING_BAUDRATE}"
);
println!("Reading binary data from {serial_port} @ {BES_PROGRAMMING_BAUDRATE}");
let mut serial_port = serialport::new(serial_port, BES_PROGRAMMING_BAUDRATE);
serial_port = serial_port.timeout(Duration::from_millis(5000));

Expand Down
4 changes: 1 addition & 3 deletions bestool/src/cmds/write_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ use tracing::info;

pub fn cmd_write_image(input_file: String, serial_port: String) {
//First gain sync to the device
println!(
"Writing binary data to {serial_port} @ {BES_PROGRAMMING_BAUDRATE}"
);
println!("Writing binary data to {serial_port} @ {BES_PROGRAMMING_BAUDRATE}");
let mut serial_port = serialport::new(serial_port, BES_PROGRAMMING_BAUDRATE);
serial_port = serial_port.timeout(Duration::from_millis(5000));

Expand Down
36 changes: 36 additions & 0 deletions bestool/supply-chain/audits.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@

# cargo-vet audits file

[[audits.bitflags]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
delta = "2.4.1 -> 2.4.2"

[[audits.io-kit-sys]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
version = "0.4.0"

[[audits.pkg-config]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.3.26 -> 0.3.27"

[[audits.pkg-config]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.3.29 -> 0.3.30"

[[audits.serialport]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
delta = "4.2.2 -> 4.3.0"

[[audits.strsim]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.10.0 -> 0.11.0"

[[audits.unescaper]]
who = "Ben V. Brown <[email protected]>"
criteria = "safe-to-deploy"
version = "0.1.4"

[[trusted.aho-corasick]]
criteria = "safe-to-deploy"
user-id = 189 # Andrew Gallant (BurntSushi)
Expand Down Expand Up @@ -78,6 +108,12 @@ user-id = 2915 # Amanieu d'Antras (Amanieu)
start = "2021-01-27"
end = "2024-11-26"

[[trusted.mach2]]
criteria = "safe-to-deploy"
user-id = 51017 # Yuki Okushi (JohnTitor)
start = "2021-11-15"
end = "2025-02-17"

[[trusted.memchr]]
criteria = "safe-to-deploy"
user-id = 189 # Andrew Gallant (BurntSushi)
Expand Down
22 changes: 1 addition & 21 deletions bestool/supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# cargo-vet config file

[cargo-vet]
version = "0.8"
version = "0.9"

[imports.bytecode-alliance]
url = "https://raw.githubusercontent.com/bytecodealliance/wasmtime/main/supply-chain/audits.toml"
Expand All @@ -22,14 +22,6 @@ url = "https://raw.githubusercontent.com/mozilla/supply-chain/main/audits.toml"
[imports.zcash]
url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/audits.toml"

[[exemptions.CoreFoundation-sys]]
version = "0.1.4"
criteria = "safe-to-deploy"

[[exemptions.IOKit-sys]]
version = "0.1.5"
criteria = "safe-to-deploy"

[[exemptions.bitflags]]
version = "1.3.2"
criteria = "safe-to-deploy"
Expand All @@ -50,10 +42,6 @@ criteria = "safe-to-deploy"
version = "0.1.4"
criteria = "safe-to-deploy"

[[exemptions.mach]]
version = "0.1.2"
criteria = "safe-to-deploy"

[[exemptions.nix]]
version = "0.26.4"
criteria = "safe-to-deploy"
Expand All @@ -66,10 +54,6 @@ criteria = "safe-to-deploy"
version = "4.2.2"
criteria = "safe-to-deploy"

[[exemptions.sharded-slab]]
version = "0.1.7"
criteria = "safe-to-deploy"

[[exemptions.strsim]]
version = "0.10.0"
criteria = "safe-to-deploy"
Expand All @@ -90,10 +74,6 @@ criteria = "safe-to-deploy"
version = "0.2.0"
criteria = "safe-to-deploy"

[[exemptions.tracing-subscriber]]
version = "0.3.18"
criteria = "safe-to-deploy"

[[exemptions.winapi]]
version = "0.3.9"
criteria = "safe-to-deploy"
Expand Down
Loading

0 comments on commit ee49168

Please sign in to comment.