From 3a78eb166233bb2688e6c95b9bfceb47385f6216 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 13 May 2024 12:23:24 -0600 Subject: [PATCH 1/2] Update deps - `bitflags`: 1.3.2 -> 2.5.0 - `coreboot-table`: a412297cbd -> e90d498fd4 - `memoffset`: 0.8.0 -> 0.9.1 - `orbclient`: 0.3.43 -> 0.3.47 - `redox_dmi`: 0.1.5 -> 0.1.6 - `redux_uefi_std`: 0.1.10 -> 0.1.11 - `system76_ectool`: 930f16b230 -> 88c77aa1 Signed-off-by: Tim Crawford --- Cargo.lock | 207 ++++++++++++----------------------------------------- Cargo.toml | 12 ++-- 2 files changed, 52 insertions(+), 167 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3873903..e79260c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" @@ -24,96 +24,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "cfg-if" -version = "1.0.0" +name = "bitflags" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "coreboot-table" version = "0.1.6" -source = "git+https://gitlab.redox-os.org/redox-os/coreboot-table.git#a412297cbd37afe04481ec0da16c145a16861e59" +source = "git+https://gitlab.redox-os.org/redox-os/coreboot-table.git#e90d498fd419445acc7739676ac659b00f29f349" [[package]] name = "downcast-rs" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] -name = "js-sys" -version = "0.3.61" +name = "libc" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libm" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] -name = "lock_api" -version = "0.4.9" +name = "libredox" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ - "autocfg", - "scopeguard", + "bitflags 2.5.0", + "libc", + "redox_syscall", ] [[package]] -name = "log" -version = "0.4.17" +name = "lock_api" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ - "cfg-if", + "autocfg", + "scopeguard", ] [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - [[package]] name = "orbclient" -version = "0.3.43" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "974465c5e83cf9df05c1e4137b271d29035c902e39e5ad4c1939837e22160af8" +checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" dependencies = [ - "cfg-if", - "redox_syscall", - "wasm-bindgen", - "web-sys", + "libredox", ] [[package]] @@ -142,29 +126,11 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "proc-macro2" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" -dependencies = [ - "proc-macro2", -] - [[package]] name = "redox_dmi" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99ca13e2ee4afe0fa2a646db6ac800f6d077a789ee759085f7313092535a45f" +checksum = "216218af5d41f90d4ed3fd7e136d359fb8ed567f641bb0c61c0e4960c7f7789c" dependencies = [ "plain", ] @@ -177,33 +143,33 @@ checksum = "8eb516ad341a84372b5b15a5a35cf136ba901a639c8536f521b108253d7fce74" [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "redox_uefi" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4143e69d22c9f79fd22cb37859a06af4936741c8ef70b5d6338953717feb68a5" +checksum = "a3dbb9124e850a6953efb6ea3957d84fc48930a6dfd844d963bc8516c16f24e5" [[package]] name = "redox_uefi_alloc" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d12654bc506da36550bbd8e77438be985b839afdc98c0956fc7fd10fa9b45022" +checksum = "e4ac0164918610031fe226ba74125aa03239eb86516131b8ee1e85de31b7c445" dependencies = [ "redox_uefi", ] [[package]] name = "redox_uefi_std" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9dea5dc3b2366e4611520a4983b27aa11f373c86f774eff1fd3f93d040c0ebd" +checksum = "d8e07da7709f8d1edbabf81657cd360886539c5c4a18fc047ed774bc1d6b466a" dependencies = [ "redox_uefi", "redox_uefi_alloc", @@ -222,9 +188,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "spin" @@ -235,21 +201,10 @@ dependencies = [ "lock_api", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "system76_ectool" version = "0.3.8" -source = "git+https://github.com/system76/ec.git#930f16b230a1574abddc1cf313c32f1a90c994e9" +source = "git+https://github.com/system76/ec.git#88c77aa1d322d2cca56038b396b31a96bc42fe59" dependencies = [ "downcast-rs", "redox_hwio", @@ -259,7 +214,7 @@ dependencies = [ name = "system76_firmware_setup" version = "1.0.0" dependencies = [ - "bitflags", + "bitflags 2.5.0", "coreboot-table", "memoffset", "orbclient", @@ -277,73 +232,3 @@ name = "ttf-parser" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" - -[[package]] -name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" -dependencies = [ - "js-sys", - "wasm-bindgen", -] diff --git a/Cargo.toml b/Cargo.toml index a9900e1..d0088fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,15 @@ license = "GPL-3.0-only" lto = true [dependencies] -bitflags = "1.3.2" +bitflags = "2.5.0" coreboot-table = { git = "https://gitlab.redox-os.org/redox-os/coreboot-table.git" } -memoffset = "0.8" -orbclient = { version = "0.3.39", default-features = false } -orbfont = { version = "0.1.11", default-features = false, features = ["no-std"] } +memoffset = "0.9" +orbclient = { version = "0.3.46", default-features = false } +orbfont = { version = "0.1.12", default-features = false, features = ["no-std"] } plain = "0.2.3" -redox_dmi = "0.1.5" +redox_dmi = "0.1.6" redox_hwio = { version = "0.1.6", default-features = false } -redox_uefi_std = "0.1.9" +redox_uefi_std = "0.1.11" spin = "0.9.4" [dependencies.system76_ectool] From 1d885a640a7c70aab6bab8a53a86557acfc741f2 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Fri, 6 Oct 2023 11:06:13 -0600 Subject: [PATCH 2/2] Address clippy lints Fix: - clippy::clone_on_copy - clippy::implicit_saturating_sub - clippy::single_match Signed-off-by: Tim Crawford --- src/coreboot.rs | 2 +- src/security.rs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/coreboot.rs b/src/coreboot.rs index 3da55f3..4575fcd 100644 --- a/src/coreboot.rs +++ b/src/coreboot.rs @@ -26,7 +26,7 @@ pub fn init() { #[allow(clippy::single_match)] match table { Table::Serial(serial) => { - *COREBOOT_SERIAL.lock() = Some(serial.clone()); + *COREBOOT_SERIAL.lock() = Some(*serial); }, _ => (), } diff --git a/src/security.rs b/src/security.rs index c677de1..652d522 100644 --- a/src/security.rs +++ b/src/security.rs @@ -240,9 +240,7 @@ fn confirm(display: &mut Display) -> Result<()> { } }, Key::Up => { - if button_i > 0 { - button_i -= 1; - } + button_i = button_i.saturating_sub(1); }, _ => {}, } @@ -275,15 +273,13 @@ extern "win64" fn run() -> bool { }; debugln!("security state: {:?}", security_state); - match security_state { + if security_state == SecurityState::Lock { // Already locked, so do not confirm - SecurityState::Lock => { - return false; - }, - // Not locked, require confirmation - _ => (), + return false; } + // Not locked, require confirmation + let res = match Output::one() { Ok(output) => { let mut display = Display::new(output);