diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..807019a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,499 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "beslib" +version = "0.3.0" +dependencies = [ + "crc", + "serialport", + "tracing", +] + +[[package]] +name = "bestool" +version = "0.3.0" +dependencies = [ + "beslib", + "clap", + "crc", + "serialport", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "io-kit-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4769cb30e5dcf1710fc6730d3e94f78c47723a014a567de385e113c737394640" +dependencies = [ + "core-foundation-sys", + "mach2", +] + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libudev" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serialport" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f5a15d0be940df84846264b09b51b10b931fb2f275becb80934e3568a016828" +dependencies = [ + "bitflags 2.4.2", + "cfg-if", + "core-foundation-sys", + "io-kit-sys", + "libudev", + "mach2", + "nix", + "regex", + "scopeguard", + "unescaper", + "winapi", +] + +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + +[[package]] +name = "syn" +version = "2.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "unescaper" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adf6ad32eb5b3cadff915f7b770faaac8f7ff0476633aa29eb0d9584d889d34" +dependencies = [ + "thiserror", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d629564 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,24 @@ +[workspace] +resolver = "2" +members = [ + "src/beslib", + "src/bestool", +] + +[workspace.package] +authors = ["Ben V. Brown ", "Dom Rodriguez "] +edition = "2021" +homepage = "https://github.com/Ralim/bestool" +readme = "/README.md" +repository = "https://github.com/Ralim/bestool.git" +rust-version = "1.67.0" +version = "0.3.0" + +[workspace.dependencies] +clap = { version = "4.5.1", features = ["derive"] } +crc = "3.0.1" +serde = { version = "1.0.196", features = ["derive"] } +serde_json = "1.0.113" +serialport = "4.3.0" +tracing = "0.1.40" +tracing-subscriber = "0.3.18" diff --git a/src/beslib/Cargo.toml b/src/beslib/Cargo.toml new file mode 100644 index 0000000..59d053a --- /dev/null +++ b/src/beslib/Cargo.toml @@ -0,0 +1,15 @@ +[package] +authors = { workspace = true } +description = "Support library for `bestool`; a command-line utility for BES2300 chips." +edition = { workspace = true } +homepage = { workspace = true } +# license = { workspace = true } # TODO: Specify license with REUSE. +name = "beslib" +repository = { workspace = true } +rust-version = { workspace = true } +version = { workspace = true } + +[dependencies] +crc = { workspace = true } +serialport = { workspace = true } +tracing = { workspace = true } diff --git a/chunk1.bin b/src/beslib/blobs/chunk1.bin similarity index 100% rename from chunk1.bin rename to src/beslib/blobs/chunk1.bin diff --git a/chunk2.bin b/src/beslib/blobs/chunk2.bin similarity index 100% rename from chunk2.bin rename to src/beslib/blobs/chunk2.bin diff --git a/programmer.bin b/src/beslib/blobs/programmer.bin similarity index 100% rename from programmer.bin rename to src/beslib/blobs/programmer.bin diff --git a/src/beslib/src/consts.rs b/src/beslib/src/consts.rs new file mode 100644 index 0000000..a1a00a8 --- /dev/null +++ b/src/beslib/src/consts.rs @@ -0,0 +1,6 @@ +pub struct BesConsts; + +impl BesConsts { + pub const BES_DEFAULT_PROGRAMMING_BAUDRATE: u32 = 921_600; + pub const BES_SYNC: u8 = 0xBE; +} diff --git a/src/beslib/src/errors.rs b/src/beslib/src/errors.rs new file mode 100644 index 0000000..a3c8bde --- /dev/null +++ b/src/beslib/src/errors.rs @@ -0,0 +1,25 @@ +use std::fmt; +use std::error; +use std::io::Error as IoError; + +#[derive(Debug)] +pub enum BesLinkError { + IoError(IoError), +} + +impl error::Error for BesLinkError {} + +impl fmt::Display for BesLinkError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + BesLinkError::IoError(ref e) => write!(f, "IO error: {}", e) + + } + } +} + +impl From for BesLinkError { + fn from(e: IoError) -> Self { + BesLinkError::IoError(e) + } +} diff --git a/src/beslib/src/lib.rs b/src/beslib/src/lib.rs new file mode 100644 index 0000000..299f328 --- /dev/null +++ b/src/beslib/src/lib.rs @@ -0,0 +1,3 @@ +pub mod consts; +pub mod message; +pub mod utils; diff --git a/src/beslib/src/message.rs b/src/beslib/src/message.rs new file mode 100644 index 0000000..9b20e77 --- /dev/null +++ b/src/beslib/src/message.rs @@ -0,0 +1,138 @@ +use std::io::{Result as IoResult, Write}; +use crate::utils::calculate_message_checksum; +use tracing::{debug, info}; + +#[derive(Default, Debug, Eq, PartialEq, Clone, Copy)] +#[repr(u8)] +pub enum MessageKind { + DeviceCommand = 0x00, // General commands to the device + FlashRead = 0x03, // Debugging message that lets you dump from address space + Sync = 0x50, // Seems to be used at boot for locking with ROM + StartProgrammer = 0x53, + ProgrammerRunning = 0x54, + ProgrammerStart = 0x55, + ProgrammerInit = 0x60, + EraseBurnStart = 0x61, + FlashBurnData = 0x62, + FlashCommand = 0x65, // Suspect used to push extra commands to flash controller/chip/die + #[default] + UnknownOrInfo = 0x66, // Unknown at this point in time, but references "OR Info"; suspect NOR flash info +} + +impl From for u8 { + fn from(v: MessageKind) -> Self { + v as Self + } +} + +impl From for MessageKind { + fn from(v: u8) -> Self { + match v { + 0x00 => Self::DeviceCommand, + 0x03 => Self::FlashRead, + 0x50 => Self::Sync, + 0x53 => Self::StartProgrammer, + 0x54 => Self::ProgrammerRunning, + 0x55 => Self::ProgrammerStart, + 0x60 => Self::ProgrammerInit, + 0x61 => Self::EraseBurnStart, + 0x62 => Self::FlashBurnData, + 0x65 => Self::FlashCommand, + _ => Self::default(), + } + } +} + +#[derive(Debug, Eq, PartialEq, Clone)] +pub struct BesMessage { + pub sync: u8, + pub msg_type: MessageKind, + pub payload: Vec, + pub checksum: u8, +} + +impl From for Vec { + fn from(mut val: BesMessage) -> Self { + let mut packet: Vec = vec![]; + packet.push(val.sync); + packet.push(val.msg_type.into()); + packet.append(&mut val.payload); + packet.push(val.checksum); + + packet + } +} + +impl From<&mut BesMessage> for Vec { + fn from(val: &mut BesMessage) -> Self { + let mut packet: Vec = vec![]; + packet.push(val.sync); + packet.push(val.msg_type.into()); + packet.append(&mut val.payload); + packet.push(val.checksum); + + packet + } +} + +impl From<&BesMessage> for Vec { + fn from(val: &BesMessage) -> Self { + let mut val = val.clone(); + let mut packet: Vec = vec![]; + packet.push(val.sync); + packet.push(val.msg_type.into()); + packet.append(&mut val.payload); + packet.push(val.checksum); + + packet + } +} + +impl From> for BesMessage { + fn from(v: Vec) -> Self { + let mut msg = BesMessage { + sync: v[0], + msg_type: MessageKind::Sync, + payload: vec![], + checksum: v[v.len() - 1], + }; + + msg.msg_type = v[1].into(); + msg.payload = v[2..v.len() - 1].to_vec(); + + msg + } +} + +impl BesMessage { + pub fn set_checksum(&mut self) { + let mut v: Vec = self.into(); + v.pop(); + self.checksum = crate::utils::calculate_message_checksum(&v); + } + + pub fn send(self, out: &mut dyn Write) -> IoResult<()> + { + let packet: Vec; + + #[allow(clippy::unnecessary_fallible_conversions)] + if let Ok(p) = self.clone().try_into() { + packet = p; + } else { + panic!("Failed to convert BesMessage to Vec"); + }// Return Error. + + return match out.write_all(packet.as_slice()) { + Ok(_) => { + debug!("Sent message to chip: {packet:X?}", packet = packet); + debug!("Wrote {len} bytes.", len = packet.len()); + + // TODO: Should the caller flush the target device? (i.e, serial port). + + info!("Sent message type: {:?}", self.msg_type); + Ok(()) + } + Err(e) => Err(e), + }; + } +} diff --git a/src/beslib/src/utils.rs b/src/beslib/src/utils.rs new file mode 100644 index 0000000..846a679 --- /dev/null +++ b/src/beslib/src/utils.rs @@ -0,0 +1,3 @@ +mod checksum; + +pub use self::checksum::*; diff --git a/src/beslib/src/utils/checksum.rs b/src/beslib/src/utils/checksum.rs new file mode 100644 index 0000000..1314fc8 --- /dev/null +++ b/src/beslib/src/utils/checksum.rs @@ -0,0 +1,25 @@ +use std::io::Error as BESLinkError; + +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.to_vec(), +// got: packet[packet.len() - 1], +// wanted: checksum, +// }; +// warn!("Bad Checksum!! {:?}", e); + + Err(BESLinkError::other("Error.")) +} + +pub fn calculate_message_checksum(packet: &[u8]) -> u8 { + let mut sum: u32 = 0; + for b in packet { + sum += u32::from(*b); + sum &= 0xFF; + } + (0xFF - sum) as u8 +} diff --git a/src/beslib/supply-chain/audits.toml b/src/beslib/supply-chain/audits.toml new file mode 100644 index 0000000..29f91fd --- /dev/null +++ b/src/beslib/supply-chain/audits.toml @@ -0,0 +1,253 @@ + +# cargo-vet audits file + +[[audits.bitflags]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "2.4.1 -> 2.4.2" + +[[audits.io-kit-sys]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +version = "0.4.0" + +[[audits.pkg-config]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.3.26 -> 0.3.27" + +[[audits.pkg-config]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.3.29 -> 0.3.30" + +[[audits.serialport]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "4.2.2 -> 4.3.0" + +[[audits.strsim]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.10.0 -> 0.11.0" + +[[audits.unescaper]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +version = "0.1.4" + +[[trusted.aho-corasick]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-03-28" +end = "2024-11-26" + +[[trusted.anstream]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-16" +end = "2024-11-26" + +[[trusted.anstyle]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2022-05-18" +end = "2024-11-26" + +[[trusted.anstyle-parse]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-08" +end = "2024-11-26" + +[[trusted.anstyle-query]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-04-13" +end = "2024-11-26" + +[[trusted.anstyle-wincon]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-08" +end = "2024-11-26" + +[[trusted.clap]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2021-12-08" +end = "2024-11-26" + +[[trusted.clap_builder]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-28" +end = "2024-11-26" + +[[trusted.clap_derive]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2021-12-08" +end = "2024-11-26" + +[[trusted.clap_lex]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2022-04-15" +end = "2024-11-26" + +[[trusted.colorchoice]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-04-13" +end = "2024-11-26" + +[[trusted.libc]] +criteria = "safe-to-deploy" +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) +start = "2019-07-07" +end = "2024-11-26" + +[[trusted.proc-macro2]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-04-23" +end = "2024-11-26" + +[[trusted.quote]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-04-09" +end = "2024-11-26" + +[[trusted.regex]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-02-27" +end = "2024-11-26" + +[[trusted.regex-automata]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-02-25" +end = "2024-11-26" + +[[trusted.regex-syntax]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-03-30" +end = "2024-11-26" + +[[trusted.scopeguard]] +criteria = "safe-to-deploy" +user-id = 2915 # Amanieu d'Antras (Amanieu) +start = "2020-02-16" +end = "2024-11-26" + +[[trusted.smallvec]] +criteria = "safe-to-deploy" +user-id = 2017 # Matt Brubeck (mbrubeck) +start = "2019-10-28" +end = "2024-11-26" + +[[trusted.syn]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-03-01" +end = "2024-11-26" + +[[trusted.thiserror]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-10-09" +end = "2024-11-26" + +[[trusted.thiserror-impl]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-10-09" +end = "2024-11-26" + +[[trusted.thread_local]] +criteria = "safe-to-deploy" +user-id = 2915 # Amanieu d'Antras (Amanieu) +start = "2019-09-07" +end = "2024-11-26" + +[[trusted.unicode-ident]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2021-10-02" +end = "2024-11-26" + +[[trusted.valuable]] +criteria = "safe-to-deploy" +user-id = 10 # Carl Lerche (carllerche) +start = "2022-01-03" +end = "2024-11-26" + +[[trusted.windows-sys]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-11-15" +end = "2024-11-26" + +[[trusted.windows-targets]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-09" +end = "2024-11-26" + +[[trusted.windows_aarch64_gnullvm]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-01" +end = "2024-11-26" + +[[trusted.windows_aarch64_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-11-05" +end = "2024-11-26" + +[[trusted.windows_i686_gnu]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-28" +end = "2024-11-26" + +[[trusted.windows_i686_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-27" +end = "2024-11-26" + +[[trusted.windows_x86_64_gnu]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-28" +end = "2024-11-26" + +[[trusted.windows_x86_64_gnullvm]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-01" +end = "2024-11-26" + +[[trusted.windows_x86_64_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-27" +end = "2024-11-26" diff --git a/src/beslib/supply-chain/config.toml b/src/beslib/supply-chain/config.toml new file mode 100644 index 0000000..ee79313 --- /dev/null +++ b/src/beslib/supply-chain/config.toml @@ -0,0 +1,87 @@ + +# cargo-vet config file + +[cargo-vet] +version = "0.9" + +[imports.bytecode-alliance] +url = "https://raw.githubusercontent.com/bytecodealliance/wasmtime/main/supply-chain/audits.toml" + +[imports.fermyon] +url = "https://raw.githubusercontent.com/fermyon/spin/main/supply-chain/audits.toml" + +[imports.google] +url = "https://raw.githubusercontent.com/google/supply-chain/main/audits.toml" + +[imports.isrg] +url = "https://raw.githubusercontent.com/divviup/libprio-rs/main/supply-chain/audits.toml" + +[imports.mozilla] +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.bitflags]] +version = "1.3.2" +criteria = "safe-to-deploy" + +[[exemptions.crc]] +version = "3.0.1" +criteria = "safe-to-deploy" + +[[exemptions.crc-catalog]] +version = "2.4.0" +criteria = "safe-to-deploy" + +[[exemptions.libudev]] +version = "0.3.0" +criteria = "safe-to-deploy" + +[[exemptions.libudev-sys]] +version = "0.1.4" +criteria = "safe-to-deploy" + +[[exemptions.nix]] +version = "0.26.4" +criteria = "safe-to-deploy" + +[[exemptions.once_cell]] +version = "1.18.0" +criteria = "safe-to-deploy" + +[[exemptions.serialport]] +version = "4.2.2" +criteria = "safe-to-deploy" + +[[exemptions.strsim]] +version = "0.10.0" +criteria = "safe-to-deploy" + +[[exemptions.tracing]] +version = "0.1.40" +criteria = "safe-to-deploy" + +[[exemptions.tracing-attributes]] +version = "0.1.27" +criteria = "safe-to-deploy" + +[[exemptions.tracing-core]] +version = "0.1.32" +criteria = "safe-to-deploy" + +[[exemptions.tracing-log]] +version = "0.2.0" +criteria = "safe-to-deploy" + +[[exemptions.winapi]] +version = "0.3.9" +criteria = "safe-to-deploy" + +[[exemptions.winapi-i686-pc-windows-gnu]] +version = "0.4.0" +criteria = "safe-to-deploy" + +[[exemptions.winapi-x86_64-pc-windows-gnu]] +version = "0.4.0" +criteria = "safe-to-deploy" diff --git a/src/beslib/supply-chain/imports.lock b/src/beslib/supply-chain/imports.lock new file mode 100644 index 0000000..595672a --- /dev/null +++ b/src/beslib/supply-chain/imports.lock @@ -0,0 +1,495 @@ + +# cargo-vet imports lock + +[[publisher.aho-corasick]] +version = "1.1.2" +when = "2023-10-09" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.anstream]] +version = "0.6.11" +when = "2024-01-18" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle]] +version = "1.0.6" +when = "2024-02-05" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-parse]] +version = "0.2.3" +when = "2023-12-04" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-query]] +version = "1.0.2" +when = "2023-12-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-wincon]] +version = "3.0.2" +when = "2023-12-04" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap]] +version = "4.5.1" +when = "2024-02-16" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_builder]] +version = "4.5.1" +when = "2024-02-16" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_derive]] +version = "4.5.0" +when = "2024-02-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_lex]] +version = "0.7.0" +when = "2024-02-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.colorchoice]] +version = "1.0.0" +when = "2023-04-13" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.core-foundation-sys]] +version = "0.8.4" +when = "2023-04-03" +user-id = 5946 +user-login = "jrmuizel" +user-name = "Jeff Muizelaar" + +[[publisher.libc]] +version = "0.2.146" +when = "2023-06-06" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.mach2]] +version = "0.4.2" +when = "2023-12-19" +user-id = 51017 +user-login = "JohnTitor" +user-name = "Yuki Okushi" + +[[publisher.memchr]] +version = "2.7.1" +when = "2023-12-28" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.proc-macro2]] +version = "1.0.78" +when = "2024-01-21" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.quote]] +version = "1.0.35" +when = "2024-01-02" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.regex]] +version = "1.10.3" +when = "2024-01-21" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.regex-automata]] +version = "0.4.5" +when = "2024-01-25" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.regex-syntax]] +version = "0.8.2" +when = "2023-10-14" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.scopeguard]] +version = "1.2.0" +when = "2023-07-17" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.smallvec]] +version = "1.13.1" +when = "2024-01-19" +user-id = 2017 +user-login = "mbrubeck" +user-name = "Matt Brubeck" + +[[publisher.syn]] +version = "2.0.49" +when = "2024-02-16" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thiserror]] +version = "1.0.57" +when = "2024-02-11" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thiserror-impl]] +version = "1.0.57" +when = "2024-02-11" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thread_local]] +version = "1.1.7" +when = "2023-02-12" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.unicode-ident]] +version = "1.0.12" +when = "2023-09-13" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.valuable]] +version = "0.1.0" +when = "2022-01-03" +user-id = 10 +user-login = "carllerche" +user-name = "Carl Lerche" + +[[publisher.windows-sys]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows-targets]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_aarch64_gnullvm]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_aarch64_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_i686_gnu]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_i686_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_gnu]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_gnullvm]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[audits.bytecode-alliance.audits.bitflags]] +who = "Jamey Sharp " +criteria = "safe-to-deploy" +delta = "2.1.0 -> 2.2.1" +notes = """ +This version adds unsafe impls of traits from the bytemuck crate when built +with that library enabled, but I believe the impls satisfy the documented +safety requirements for bytemuck. The other changes are minor. +""" + +[[audits.bytecode-alliance.audits.bitflags]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "2.3.2 -> 2.3.3" +notes = """ +Nothing outside the realm of what one would expect from a bitflags generator, +all as expected. +""" + +[[audits.bytecode-alliance.audits.cfg-if]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "1.0.0" +notes = "I am the author of this crate." + +[[audits.bytecode-alliance.audits.core-foundation-sys]] +who = "Dan Gohman " +criteria = "safe-to-deploy" +delta = "0.8.4 -> 0.8.6" +notes = """ +The changes here are all typical bindings updates: new functions, types, and +constants. I have not audited all the bindings for ABI conformance. +""" + +[[audits.bytecode-alliance.audits.heck]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.4.0" +notes = "Contains `forbid_unsafe` and only uses `std::fmt` from the standard library. Otherwise only contains string manipulation." + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.146 -> 0.2.147" +notes = "Only new type definitions and updating others for some platforms, no major changes" + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.148 -> 0.2.149" +notes = "Lots of new functions and constants for new platforms and nothing out of the ordinary for what one would expect of the `libc` crate." + +[[audits.bytecode-alliance.audits.libc]] +who = "Dan Gohman " +criteria = "safe-to-deploy" +delta = "0.2.149 -> 0.2.151" +notes = "More new functions, types, and constants, as is usual for the `libc` crate, as well as various minor code cleanups." + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.151 -> 0.2.153" +notes = "More bindings for more platforms. I have not verified that everything is exactly as-is on the platform as specified but nothing major is otherwise introduced as part of this bump." + +[[audits.bytecode-alliance.audits.nu-ansi-term]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.46.0" +notes = "one use of unsafe to call windows specific api to get console handle." + +[[audits.bytecode-alliance.audits.overload]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.1.1" +notes = "small crate, only defines macro-rules!, nicely documented as well" + +[[audits.bytecode-alliance.audits.pkg-config]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.3.25" +notes = "This crate shells out to the pkg-config executable, but it appears to sanitize inputs reasonably." + +[[audits.bytecode-alliance.audits.pkg-config]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.3.26 -> 0.3.29" +notes = """ +No `unsafe` additions or anything outside of the purview of the crate in this +change. +""" + +[[audits.bytecode-alliance.audits.sharded-slab]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.1.4" +notes = "I always really enjoy reading eliza's code, she left perfect comments at every use of unsafe." + +[[audits.bytecode-alliance.audits.tracing-subscriber]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.3.17" + +[audits.fermyon.audits] + +[[audits.google.audits.pin-project-lite]] +who = "David Koloski " +criteria = "safe-to-deploy" +version = "0.2.9" +notes = "Reviewed on https://fxrev.dev/824504" +aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT" + +[[audits.google.audits.utf8parse]] +who = "David Koloski " +criteria = "safe-to-deploy" +version = "0.2.1" +notes = "Reviewed on https://fxrev.dev/904811" +aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT" + +[[audits.isrg.audits.once_cell]] +who = "Brandon Pitman " +criteria = "safe-to-deploy" +delta = "1.18.0 -> 1.19.0" + +[[audits.mozilla.wildcard-audits.core-foundation-sys]] +who = "Bobby Holley " +criteria = "safe-to-deploy" +user-id = 5946 # Jeff Muizelaar (jrmuizel) +start = "2020-10-14" +end = "2023-05-04" +renew = false +notes = "I've reviewed every source contribution that was neither authored nor reviewed by Mozilla." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Alex Franchuk " +criteria = "safe-to-deploy" +delta = "1.3.2 -> 2.0.2" +notes = "Removal of some unsafe code/methods. No changes to externals, just some refactoring (mostly internal)." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Nicolas Silva " +criteria = "safe-to-deploy" +delta = "2.0.2 -> 2.1.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Teodor Tanasoaia " +criteria = "safe-to-deploy" +delta = "2.2.1 -> 2.3.2" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "2.3.3 -> 2.4.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "2.4.0 -> 2.4.1" +notes = "Only allowing new clippy lints" +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.heck]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.4.1" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.lazy_static]] +who = "Nika Layzell " +criteria = "safe-to-deploy" +version = "1.4.0" +notes = "I have read over the macros, and audited the unsafe code." +aggregated-from = "https://raw.githubusercontent.com/mozilla/cargo-vet/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.libc]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.2.147 -> 0.2.148" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.log]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +version = "0.4.17" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.log]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.4.17 -> 0.4.18" +notes = "One dependency removed, others updated (which we don't rely on), some APIs (which we don't use) changed." +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.pkg-config]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.3.25 -> 0.3.26" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.zcash.audits.log]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.4.18 -> 0.4.19" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.log]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.4.19 -> 0.4.20" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.pin-project-lite]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.2.9 -> 0.2.13" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.sharded-slab]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.1.4 -> 0.1.7" +notes = "Only change to an `unsafe` block is to fix a clippy lint." +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.tracing-subscriber]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.3.17 -> 0.3.18" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" diff --git a/src/bestool/Cargo.toml b/src/bestool/Cargo.toml new file mode 100644 index 0000000..bdb2a0b --- /dev/null +++ b/src/bestool/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = { workspace = true } +description = "Command-line utility for BES2300 chips." +edition = { workspace = true } +homepage = { workspace = true } +# license = { workspace = true } # TODO: Specify license with REUSE. +name = "bestool" +repository = { workspace = true } +rust-version = { workspace = true } +version = { workspace = true } + +[dependencies] +beslib = { path = "../beslib" } +clap = { workspace = true } +crc = { workspace = true } +serialport = { workspace = true } diff --git a/src/bestool/src/command.rs b/src/bestool/src/command.rs new file mode 100644 index 0000000..f56315e --- /dev/null +++ b/src/bestool/src/command.rs @@ -0,0 +1,24 @@ +use clap::Subcommand; +use std::io::Result; + +mod flash; +mod serial; + +#[derive(Subcommand)] +#[command(infer_subcommands = true)] +pub enum BestoolCmd { + #[command(flatten)] + Flash(flash::Cmd), + + #[command(flatten)] + Serial(serial::Cmd), +} + +impl BestoolCmd { + pub fn run(self) -> Result<()> { + match self { + Self::Flash(flash) => flash.run(), + Self::Serial(serial) => serial.run(), + } + } +} diff --git a/src/bestool/src/command/flash.rs b/src/bestool/src/command/flash.rs new file mode 100644 index 0000000..66555fc --- /dev/null +++ b/src/bestool/src/command/flash.rs @@ -0,0 +1,21 @@ +use clap::Subcommand; +use std::io::Result; + +mod read_flash; +mod write_flash; + +#[derive(Subcommand, Debug)] +#[command(infer_subcommands = true)] +pub enum Cmd { + WriteFlash, // Use `(write_flash::Cmd)` (with args `--monitor`) + ReadFlash, // Use `(read_flash::Cmd)` +} + +impl Cmd { + pub fn run(self) -> Result<()> { + match self { + Self::WriteFlash => write_flash::run(), + Self::ReadFlash => read_flash::run(), + } + } +} diff --git a/src/bestool/src/command/flash/read_flash.rs b/src/bestool/src/command/flash/read_flash.rs new file mode 100644 index 0000000..c743333 --- /dev/null +++ b/src/bestool/src/command/flash/read_flash.rs @@ -0,0 +1,5 @@ +use std::io::Result; + +pub fn run() -> Result<()> { + unimplemented!() +} diff --git a/src/bestool/src/command/flash/write_flash.rs b/src/bestool/src/command/flash/write_flash.rs new file mode 100644 index 0000000..c743333 --- /dev/null +++ b/src/bestool/src/command/flash/write_flash.rs @@ -0,0 +1,5 @@ +use std::io::Result; + +pub fn run() -> Result<()> { + unimplemented!() +} diff --git a/src/bestool/src/command/serial.rs b/src/bestool/src/command/serial.rs new file mode 100644 index 0000000..8474fca --- /dev/null +++ b/src/bestool/src/command/serial.rs @@ -0,0 +1,22 @@ +use std::io::Result; + +use clap::Subcommand; + +mod enumerate_serial_ports; +mod monitor; + +#[derive(Subcommand, Debug)] +#[command(infer_subcommands = true)] +pub enum Cmd { + EnumerateSerialPorts, + Monitor, // Add `(monitor::Cmd)` here. +} + +impl Cmd { + pub fn run(self) -> Result<()> { + match self { + Self::EnumerateSerialPorts => enumerate_serial_ports::run(), + Self::Monitor => monitor::run(), + } + } +} diff --git a/src/bestool/src/command/serial/enumerate_serial_ports.rs b/src/bestool/src/command/serial/enumerate_serial_ports.rs new file mode 100644 index 0000000..c958ca2 --- /dev/null +++ b/src/bestool/src/command/serial/enumerate_serial_ports.rs @@ -0,0 +1,36 @@ +use serialport::SerialPortType; +use std::io::Result; + +fn get_port_type(port: SerialPortType) -> Option { + match port { + #[cfg(windows)] + SerialPortType::UsbPort(info) => Some(format!("USB {:04X}:{:04X}", info.vid, info.pid)), + #[cfg(unix)] + SerialPortType::UsbPort(info) => Some(format!("USB {:04x}:{:04x}", info.vid, info.pid)), + SerialPortType::PciPort => Some(String::from("PCI")), + SerialPortType::BluetoothPort => Some(String::from("Bluetooth")), + SerialPortType::Unknown => None, + } +} + +pub fn run() -> Result<()> { + match serialport::available_ports() { + Ok(ports) => { + if ports.is_empty() { + eprintln!("No serial ports found"); + } + println!("Detected serial ports and their type:"); + for port in ports { + if let Some(port_type) = get_port_type(port.port_type) { + println!("{}\t[{}]", port.port_name, port_type); + } + } + Ok(()) + } + Err(e) => { + eprintln!("Could not list ports due to {e:?}"); + // Implement err. + Ok(()) + } + } +} diff --git a/src/bestool/src/command/serial/monitor.rs b/src/bestool/src/command/serial/monitor.rs new file mode 100644 index 0000000..c743333 --- /dev/null +++ b/src/bestool/src/command/serial/monitor.rs @@ -0,0 +1,5 @@ +use std::io::Result; + +pub fn run() -> Result<()> { + unimplemented!() +} diff --git a/src/bestool/src/main.rs b/src/bestool/src/main.rs new file mode 100644 index 0000000..cfa7002 --- /dev/null +++ b/src/bestool/src/main.rs @@ -0,0 +1,39 @@ +#![warn(clippy::all)] + +use clap::Parser; +mod command; +use command::BestoolCmd; +use std::io::Result; + +const VERSION: &str = env!("CARGO_PKG_VERSION"); + +static HELP_TEMPLATE: &str = "\ +{before-help}{name} {version} +{author} +{about} + +{usage-heading} + {usage} + +{all-args}{after-help}"; + +#[derive(Parser)] +#[command( + author = "Ben V. Brown ", + version = VERSION, + help_template = HELP_TEMPLATE, +)] +struct Bestool { + #[command(subcommand)] + bestool: BestoolCmd, +} + +impl Bestool { + fn run(self) -> Result<()> { + self.bestool.run() + } +} + +fn main() -> Result<()> { + Bestool::parse().run() +} diff --git a/src/bestool/supply-chain/audits.toml b/src/bestool/supply-chain/audits.toml new file mode 100644 index 0000000..29f91fd --- /dev/null +++ b/src/bestool/supply-chain/audits.toml @@ -0,0 +1,253 @@ + +# cargo-vet audits file + +[[audits.bitflags]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "2.4.1 -> 2.4.2" + +[[audits.io-kit-sys]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +version = "0.4.0" + +[[audits.pkg-config]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.3.26 -> 0.3.27" + +[[audits.pkg-config]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.3.29 -> 0.3.30" + +[[audits.serialport]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "4.2.2 -> 4.3.0" + +[[audits.strsim]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +delta = "0.10.0 -> 0.11.0" + +[[audits.unescaper]] +who = "Ben V. Brown " +criteria = "safe-to-deploy" +version = "0.1.4" + +[[trusted.aho-corasick]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-03-28" +end = "2024-11-26" + +[[trusted.anstream]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-16" +end = "2024-11-26" + +[[trusted.anstyle]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2022-05-18" +end = "2024-11-26" + +[[trusted.anstyle-parse]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-08" +end = "2024-11-26" + +[[trusted.anstyle-query]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-04-13" +end = "2024-11-26" + +[[trusted.anstyle-wincon]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-08" +end = "2024-11-26" + +[[trusted.clap]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2021-12-08" +end = "2024-11-26" + +[[trusted.clap_builder]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-03-28" +end = "2024-11-26" + +[[trusted.clap_derive]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2021-12-08" +end = "2024-11-26" + +[[trusted.clap_lex]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2022-04-15" +end = "2024-11-26" + +[[trusted.colorchoice]] +criteria = "safe-to-deploy" +user-id = 6743 # Ed Page (epage) +start = "2023-04-13" +end = "2024-11-26" + +[[trusted.libc]] +criteria = "safe-to-deploy" +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) +start = "2019-07-07" +end = "2024-11-26" + +[[trusted.proc-macro2]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-04-23" +end = "2024-11-26" + +[[trusted.quote]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-04-09" +end = "2024-11-26" + +[[trusted.regex]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-02-27" +end = "2024-11-26" + +[[trusted.regex-automata]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-02-25" +end = "2024-11-26" + +[[trusted.regex-syntax]] +criteria = "safe-to-deploy" +user-id = 189 # Andrew Gallant (BurntSushi) +start = "2019-03-30" +end = "2024-11-26" + +[[trusted.scopeguard]] +criteria = "safe-to-deploy" +user-id = 2915 # Amanieu d'Antras (Amanieu) +start = "2020-02-16" +end = "2024-11-26" + +[[trusted.smallvec]] +criteria = "safe-to-deploy" +user-id = 2017 # Matt Brubeck (mbrubeck) +start = "2019-10-28" +end = "2024-11-26" + +[[trusted.syn]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-03-01" +end = "2024-11-26" + +[[trusted.thiserror]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-10-09" +end = "2024-11-26" + +[[trusted.thiserror-impl]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2019-10-09" +end = "2024-11-26" + +[[trusted.thread_local]] +criteria = "safe-to-deploy" +user-id = 2915 # Amanieu d'Antras (Amanieu) +start = "2019-09-07" +end = "2024-11-26" + +[[trusted.unicode-ident]] +criteria = "safe-to-deploy" +user-id = 3618 # David Tolnay (dtolnay) +start = "2021-10-02" +end = "2024-11-26" + +[[trusted.valuable]] +criteria = "safe-to-deploy" +user-id = 10 # Carl Lerche (carllerche) +start = "2022-01-03" +end = "2024-11-26" + +[[trusted.windows-sys]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-11-15" +end = "2024-11-26" + +[[trusted.windows-targets]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-09" +end = "2024-11-26" + +[[trusted.windows_aarch64_gnullvm]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-01" +end = "2024-11-26" + +[[trusted.windows_aarch64_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-11-05" +end = "2024-11-26" + +[[trusted.windows_i686_gnu]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-28" +end = "2024-11-26" + +[[trusted.windows_i686_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-27" +end = "2024-11-26" + +[[trusted.windows_x86_64_gnu]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-28" +end = "2024-11-26" + +[[trusted.windows_x86_64_gnullvm]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2022-09-01" +end = "2024-11-26" + +[[trusted.windows_x86_64_msvc]] +criteria = "safe-to-deploy" +user-id = 64539 # Kenny Kerr (kennykerr) +start = "2021-10-27" +end = "2024-11-26" diff --git a/src/bestool/supply-chain/config.toml b/src/bestool/supply-chain/config.toml new file mode 100644 index 0000000..ee79313 --- /dev/null +++ b/src/bestool/supply-chain/config.toml @@ -0,0 +1,87 @@ + +# cargo-vet config file + +[cargo-vet] +version = "0.9" + +[imports.bytecode-alliance] +url = "https://raw.githubusercontent.com/bytecodealliance/wasmtime/main/supply-chain/audits.toml" + +[imports.fermyon] +url = "https://raw.githubusercontent.com/fermyon/spin/main/supply-chain/audits.toml" + +[imports.google] +url = "https://raw.githubusercontent.com/google/supply-chain/main/audits.toml" + +[imports.isrg] +url = "https://raw.githubusercontent.com/divviup/libprio-rs/main/supply-chain/audits.toml" + +[imports.mozilla] +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.bitflags]] +version = "1.3.2" +criteria = "safe-to-deploy" + +[[exemptions.crc]] +version = "3.0.1" +criteria = "safe-to-deploy" + +[[exemptions.crc-catalog]] +version = "2.4.0" +criteria = "safe-to-deploy" + +[[exemptions.libudev]] +version = "0.3.0" +criteria = "safe-to-deploy" + +[[exemptions.libudev-sys]] +version = "0.1.4" +criteria = "safe-to-deploy" + +[[exemptions.nix]] +version = "0.26.4" +criteria = "safe-to-deploy" + +[[exemptions.once_cell]] +version = "1.18.0" +criteria = "safe-to-deploy" + +[[exemptions.serialport]] +version = "4.2.2" +criteria = "safe-to-deploy" + +[[exemptions.strsim]] +version = "0.10.0" +criteria = "safe-to-deploy" + +[[exemptions.tracing]] +version = "0.1.40" +criteria = "safe-to-deploy" + +[[exemptions.tracing-attributes]] +version = "0.1.27" +criteria = "safe-to-deploy" + +[[exemptions.tracing-core]] +version = "0.1.32" +criteria = "safe-to-deploy" + +[[exemptions.tracing-log]] +version = "0.2.0" +criteria = "safe-to-deploy" + +[[exemptions.winapi]] +version = "0.3.9" +criteria = "safe-to-deploy" + +[[exemptions.winapi-i686-pc-windows-gnu]] +version = "0.4.0" +criteria = "safe-to-deploy" + +[[exemptions.winapi-x86_64-pc-windows-gnu]] +version = "0.4.0" +criteria = "safe-to-deploy" diff --git a/src/bestool/supply-chain/imports.lock b/src/bestool/supply-chain/imports.lock new file mode 100644 index 0000000..595672a --- /dev/null +++ b/src/bestool/supply-chain/imports.lock @@ -0,0 +1,495 @@ + +# cargo-vet imports lock + +[[publisher.aho-corasick]] +version = "1.1.2" +when = "2023-10-09" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.anstream]] +version = "0.6.11" +when = "2024-01-18" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle]] +version = "1.0.6" +when = "2024-02-05" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-parse]] +version = "0.2.3" +when = "2023-12-04" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-query]] +version = "1.0.2" +when = "2023-12-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.anstyle-wincon]] +version = "3.0.2" +when = "2023-12-04" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap]] +version = "4.5.1" +when = "2024-02-16" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_builder]] +version = "4.5.1" +when = "2024-02-16" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_derive]] +version = "4.5.0" +when = "2024-02-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.clap_lex]] +version = "0.7.0" +when = "2024-02-08" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.colorchoice]] +version = "1.0.0" +when = "2023-04-13" +user-id = 6743 +user-login = "epage" +user-name = "Ed Page" + +[[publisher.core-foundation-sys]] +version = "0.8.4" +when = "2023-04-03" +user-id = 5946 +user-login = "jrmuizel" +user-name = "Jeff Muizelaar" + +[[publisher.libc]] +version = "0.2.146" +when = "2023-06-06" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.mach2]] +version = "0.4.2" +when = "2023-12-19" +user-id = 51017 +user-login = "JohnTitor" +user-name = "Yuki Okushi" + +[[publisher.memchr]] +version = "2.7.1" +when = "2023-12-28" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.proc-macro2]] +version = "1.0.78" +when = "2024-01-21" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.quote]] +version = "1.0.35" +when = "2024-01-02" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.regex]] +version = "1.10.3" +when = "2024-01-21" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.regex-automata]] +version = "0.4.5" +when = "2024-01-25" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.regex-syntax]] +version = "0.8.2" +when = "2023-10-14" +user-id = 189 +user-login = "BurntSushi" +user-name = "Andrew Gallant" + +[[publisher.scopeguard]] +version = "1.2.0" +when = "2023-07-17" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.smallvec]] +version = "1.13.1" +when = "2024-01-19" +user-id = 2017 +user-login = "mbrubeck" +user-name = "Matt Brubeck" + +[[publisher.syn]] +version = "2.0.49" +when = "2024-02-16" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thiserror]] +version = "1.0.57" +when = "2024-02-11" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thiserror-impl]] +version = "1.0.57" +when = "2024-02-11" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.thread_local]] +version = "1.1.7" +when = "2023-02-12" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + +[[publisher.unicode-ident]] +version = "1.0.12" +when = "2023-09-13" +user-id = 3618 +user-login = "dtolnay" +user-name = "David Tolnay" + +[[publisher.valuable]] +version = "0.1.0" +when = "2022-01-03" +user-id = 10 +user-login = "carllerche" +user-name = "Carl Lerche" + +[[publisher.windows-sys]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows-targets]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_aarch64_gnullvm]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_aarch64_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_i686_gnu]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_i686_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_gnu]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_gnullvm]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[publisher.windows_x86_64_msvc]] +version = "0.52.0" +when = "2023-11-15" +user-id = 64539 +user-login = "kennykerr" +user-name = "Kenny Kerr" + +[[audits.bytecode-alliance.audits.bitflags]] +who = "Jamey Sharp " +criteria = "safe-to-deploy" +delta = "2.1.0 -> 2.2.1" +notes = """ +This version adds unsafe impls of traits from the bytemuck crate when built +with that library enabled, but I believe the impls satisfy the documented +safety requirements for bytemuck. The other changes are minor. +""" + +[[audits.bytecode-alliance.audits.bitflags]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "2.3.2 -> 2.3.3" +notes = """ +Nothing outside the realm of what one would expect from a bitflags generator, +all as expected. +""" + +[[audits.bytecode-alliance.audits.cfg-if]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "1.0.0" +notes = "I am the author of this crate." + +[[audits.bytecode-alliance.audits.core-foundation-sys]] +who = "Dan Gohman " +criteria = "safe-to-deploy" +delta = "0.8.4 -> 0.8.6" +notes = """ +The changes here are all typical bindings updates: new functions, types, and +constants. I have not audited all the bindings for ABI conformance. +""" + +[[audits.bytecode-alliance.audits.heck]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.4.0" +notes = "Contains `forbid_unsafe` and only uses `std::fmt` from the standard library. Otherwise only contains string manipulation." + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.146 -> 0.2.147" +notes = "Only new type definitions and updating others for some platforms, no major changes" + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.148 -> 0.2.149" +notes = "Lots of new functions and constants for new platforms and nothing out of the ordinary for what one would expect of the `libc` crate." + +[[audits.bytecode-alliance.audits.libc]] +who = "Dan Gohman " +criteria = "safe-to-deploy" +delta = "0.2.149 -> 0.2.151" +notes = "More new functions, types, and constants, as is usual for the `libc` crate, as well as various minor code cleanups." + +[[audits.bytecode-alliance.audits.libc]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.151 -> 0.2.153" +notes = "More bindings for more platforms. I have not verified that everything is exactly as-is on the platform as specified but nothing major is otherwise introduced as part of this bump." + +[[audits.bytecode-alliance.audits.nu-ansi-term]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.46.0" +notes = "one use of unsafe to call windows specific api to get console handle." + +[[audits.bytecode-alliance.audits.overload]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.1.1" +notes = "small crate, only defines macro-rules!, nicely documented as well" + +[[audits.bytecode-alliance.audits.pkg-config]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.3.25" +notes = "This crate shells out to the pkg-config executable, but it appears to sanitize inputs reasonably." + +[[audits.bytecode-alliance.audits.pkg-config]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.3.26 -> 0.3.29" +notes = """ +No `unsafe` additions or anything outside of the purview of the crate in this +change. +""" + +[[audits.bytecode-alliance.audits.sharded-slab]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.1.4" +notes = "I always really enjoy reading eliza's code, she left perfect comments at every use of unsafe." + +[[audits.bytecode-alliance.audits.tracing-subscriber]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.3.17" + +[audits.fermyon.audits] + +[[audits.google.audits.pin-project-lite]] +who = "David Koloski " +criteria = "safe-to-deploy" +version = "0.2.9" +notes = "Reviewed on https://fxrev.dev/824504" +aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT" + +[[audits.google.audits.utf8parse]] +who = "David Koloski " +criteria = "safe-to-deploy" +version = "0.2.1" +notes = "Reviewed on https://fxrev.dev/904811" +aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT" + +[[audits.isrg.audits.once_cell]] +who = "Brandon Pitman " +criteria = "safe-to-deploy" +delta = "1.18.0 -> 1.19.0" + +[[audits.mozilla.wildcard-audits.core-foundation-sys]] +who = "Bobby Holley " +criteria = "safe-to-deploy" +user-id = 5946 # Jeff Muizelaar (jrmuizel) +start = "2020-10-14" +end = "2023-05-04" +renew = false +notes = "I've reviewed every source contribution that was neither authored nor reviewed by Mozilla." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Alex Franchuk " +criteria = "safe-to-deploy" +delta = "1.3.2 -> 2.0.2" +notes = "Removal of some unsafe code/methods. No changes to externals, just some refactoring (mostly internal)." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Nicolas Silva " +criteria = "safe-to-deploy" +delta = "2.0.2 -> 2.1.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Teodor Tanasoaia " +criteria = "safe-to-deploy" +delta = "2.2.1 -> 2.3.2" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "2.3.3 -> 2.4.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.bitflags]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "2.4.0 -> 2.4.1" +notes = "Only allowing new clippy lints" +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.heck]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.4.1" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.lazy_static]] +who = "Nika Layzell " +criteria = "safe-to-deploy" +version = "1.4.0" +notes = "I have read over the macros, and audited the unsafe code." +aggregated-from = "https://raw.githubusercontent.com/mozilla/cargo-vet/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.libc]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.2.147 -> 0.2.148" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.log]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +version = "0.4.17" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.log]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.4.17 -> 0.4.18" +notes = "One dependency removed, others updated (which we don't rely on), some APIs (which we don't use) changed." +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + +[[audits.mozilla.audits.pkg-config]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.3.25 -> 0.3.26" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.zcash.audits.log]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.4.18 -> 0.4.19" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.log]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.4.19 -> 0.4.20" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.pin-project-lite]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.2.9 -> 0.2.13" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.sharded-slab]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.1.4 -> 0.1.7" +notes = "Only change to an `unsafe` block is to fix a clippy lint." +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + +[[audits.zcash.audits.tracing-subscriber]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.3.17 -> 0.3.18" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" diff --git a/bestool/.gitignore b/src/oldbestool/.gitignore similarity index 100% rename from bestool/.gitignore rename to src/oldbestool/.gitignore diff --git a/bestool/Cargo.lock b/src/oldbestool/Cargo.lock similarity index 100% rename from bestool/Cargo.lock rename to src/oldbestool/Cargo.lock diff --git a/bestool/Cargo.toml b/src/oldbestool/Cargo.toml similarity index 90% rename from bestool/Cargo.toml rename to src/oldbestool/Cargo.toml index 31a5fe3..00240f8 100644 --- a/bestool/Cargo.toml +++ b/src/oldbestool/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "bestool" -version = "0.1.2" +name = "oldbestool" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/bestool/src/beslink/bootloader.rs b/src/oldbestool/src/beslink/bootloader.rs similarity index 100% rename from bestool/src/beslink/bootloader.rs rename to src/oldbestool/src/beslink/bootloader.rs diff --git a/bestool/src/beslink/errors.rs b/src/oldbestool/src/beslink/errors.rs similarity index 100% rename from bestool/src/beslink/errors.rs rename to src/oldbestool/src/beslink/errors.rs diff --git a/bestool/src/beslink/helper_sync_and_load_programmer.rs b/src/oldbestool/src/beslink/helper_sync_and_load_programmer.rs similarity index 100% rename from bestool/src/beslink/helper_sync_and_load_programmer.rs rename to src/oldbestool/src/beslink/helper_sync_and_load_programmer.rs diff --git a/bestool/src/beslink/memory_info.rs b/src/oldbestool/src/beslink/memory_info.rs similarity index 99% rename from bestool/src/beslink/memory_info.rs rename to src/oldbestool/src/beslink/memory_info.rs index 8d7851b..1b940b1 100644 --- a/bestool/src/beslink/memory_info.rs +++ b/src/oldbestool/src/beslink/memory_info.rs @@ -14,6 +14,7 @@ pub fn query_memory_info(serial_port: &mut Box) -> Result<(), BE payload: vec![0x03, 0x01, 0x12], checksum: 0xC6, }; + send_message(serial_port, get_flash_id_cmd)?; let flash_id = sync(serial_port, MessageTypes::FlashCommand)?; send_message(serial_port, get_flash_unique_id_cmd)?; diff --git a/bestool/src/beslink/message.rs b/src/oldbestool/src/beslink/message.rs similarity index 100% rename from bestool/src/beslink/message.rs rename to src/oldbestool/src/beslink/message.rs diff --git a/bestool/src/beslink/mod.rs b/src/oldbestool/src/beslink/mod.rs similarity index 100% rename from bestool/src/beslink/mod.rs rename to src/oldbestool/src/beslink/mod.rs diff --git a/bestool/src/beslink/read_flash.rs b/src/oldbestool/src/beslink/read_flash.rs similarity index 100% rename from bestool/src/beslink/read_flash.rs rename to src/oldbestool/src/beslink/read_flash.rs diff --git a/bestool/src/beslink/reboot.rs b/src/oldbestool/src/beslink/reboot.rs similarity index 100% rename from bestool/src/beslink/reboot.rs rename to src/oldbestool/src/beslink/reboot.rs diff --git a/bestool/src/beslink/sync.rs b/src/oldbestool/src/beslink/sync.rs similarity index 100% rename from bestool/src/beslink/sync.rs rename to src/oldbestool/src/beslink/sync.rs diff --git a/bestool/src/beslink/test_port.rs b/src/oldbestool/src/beslink/test_port.rs similarity index 100% rename from bestool/src/beslink/test_port.rs rename to src/oldbestool/src/beslink/test_port.rs diff --git a/bestool/src/beslink/write_flash.rs b/src/oldbestool/src/beslink/write_flash.rs similarity index 100% rename from bestool/src/beslink/write_flash.rs rename to src/oldbestool/src/beslink/write_flash.rs diff --git a/bestool/src/cmds/list_ports.rs b/src/oldbestool/src/cmds/list_ports.rs similarity index 100% rename from bestool/src/cmds/list_ports.rs rename to src/oldbestool/src/cmds/list_ports.rs diff --git a/bestool/src/cmds/mod.rs b/src/oldbestool/src/cmds/mod.rs similarity index 100% rename from bestool/src/cmds/mod.rs rename to src/oldbestool/src/cmds/mod.rs diff --git a/bestool/src/cmds/read_image.rs b/src/oldbestool/src/cmds/read_image.rs similarity index 100% rename from bestool/src/cmds/read_image.rs rename to src/oldbestool/src/cmds/read_image.rs diff --git a/bestool/src/cmds/serial_monitor.rs b/src/oldbestool/src/cmds/serial_monitor.rs similarity index 100% rename from bestool/src/cmds/serial_monitor.rs rename to src/oldbestool/src/cmds/serial_monitor.rs diff --git a/bestool/src/cmds/write_image.rs b/src/oldbestool/src/cmds/write_image.rs similarity index 100% rename from bestool/src/cmds/write_image.rs rename to src/oldbestool/src/cmds/write_image.rs diff --git a/bestool/src/cmds/write_image_then_monitor.rs b/src/oldbestool/src/cmds/write_image_then_monitor.rs similarity index 100% rename from bestool/src/cmds/write_image_then_monitor.rs rename to src/oldbestool/src/cmds/write_image_then_monitor.rs diff --git a/bestool/src/main.rs b/src/oldbestool/src/main.rs similarity index 100% rename from bestool/src/main.rs rename to src/oldbestool/src/main.rs diff --git a/bestool/src/serial_monitor/mod.rs b/src/oldbestool/src/serial_monitor/mod.rs similarity index 100% rename from bestool/src/serial_monitor/mod.rs rename to src/oldbestool/src/serial_monitor/mod.rs diff --git a/bestool/src/serial_monitor/monitor.rs b/src/oldbestool/src/serial_monitor/monitor.rs similarity index 100% rename from bestool/src/serial_monitor/monitor.rs rename to src/oldbestool/src/serial_monitor/monitor.rs diff --git a/bestool/src/serial_port_opener.rs b/src/oldbestool/src/serial_port_opener.rs similarity index 100% rename from bestool/src/serial_port_opener.rs rename to src/oldbestool/src/serial_port_opener.rs diff --git a/bestool/supply-chain/audits.toml b/src/oldbestool/supply-chain/audits.toml similarity index 100% rename from bestool/supply-chain/audits.toml rename to src/oldbestool/supply-chain/audits.toml diff --git a/bestool/supply-chain/config.toml b/src/oldbestool/supply-chain/config.toml similarity index 100% rename from bestool/supply-chain/config.toml rename to src/oldbestool/supply-chain/config.toml diff --git a/bestool/supply-chain/imports.lock b/src/oldbestool/supply-chain/imports.lock similarity index 100% rename from bestool/supply-chain/imports.lock rename to src/oldbestool/supply-chain/imports.lock