Remove byteorder dep

This requires something other than literally zero code to replace, but
is another opportunity to deny packagers the fun of experimenting with
replacing crate versions with incompatible patched crate versions.
This commit is contained in:
Jubilee Young 2024-09-03 00:15:29 -07:00
parent 1a5b11db3f
commit a1122aced2
5 changed files with 5 additions and 17 deletions

8
Cargo.lock generated
View File

@ -71,7 +71,6 @@ version = "1.12.0"
dependencies = [
"anyhow",
"bch_bindgen",
"byteorder",
"clap",
"clap_complete",
"either",
@ -96,7 +95,6 @@ dependencies = [
"bindgen",
"bitfield",
"bitflags 1.3.2",
"byteorder",
"paste",
"pkg-config",
"uuid",
@ -143,12 +141,6 @@ version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
version = "1.0.83"

View File

@ -20,7 +20,6 @@ uuid = "1.2.2"
errno = "0.2"
either = "1.5"
bch_bindgen = { path = "bch_bindgen" }
byteorder = "1.3"
strum = { version = "0.26", features = ["derive"] }
strum_macros = "0.26"
zeroize = { version = "1", features = ["std", "zeroize_derive"] }

View File

@ -13,7 +13,6 @@ crate-type = ["lib"]
anyhow = "1.0"
uuid = "1.2.2"
bitfield = "0.14.0"
byteorder = "1.3"
bitflags = "1.3.2"
paste = "1.0.11"

View File

@ -67,10 +67,9 @@ impl bch_sb {
/// Get the nonce used to encrypt the superblock
pub fn nonce(&self) -> nonce {
use byteorder::{LittleEndian, ReadBytesExt};
let mut internal_uuid = &self.uuid.b[..];
let dword1 = internal_uuid.read_u32::<LittleEndian>().unwrap();
let dword2 = internal_uuid.read_u32::<LittleEndian>().unwrap();
let [a, b, c, d, e, f, g, h, _rest @ ..] = self.uuid.b;
let dword1 = u32::from_le_bytes([a, b, c, d]);
let dword2 = u32::from_le_bytes([e, f, g, h]);
nonce {
d: [0, 0, dword1, dword2],
}

View File

@ -14,7 +14,6 @@ use bch_bindgen::{
c::{bch2_chacha_encrypt_key, bch_encrypted_key, bch_sb_field_crypt},
keyutils::{self, keyctl_search},
};
use byteorder::{LittleEndian, ReadBytesExt};
use log::{debug, info};
use rustix::termios;
use uuid::Uuid;
@ -22,7 +21,7 @@ use zeroize::{ZeroizeOnDrop, Zeroizing};
use crate::{c_str, ErrnoError};
const BCH_KEY_MAGIC: &str = "bch**key";
const BCH_KEY_MAGIC: &[u8; 8] = b"bch**key";
#[derive(Clone, Debug, clap::ValueEnum, strum::Display)]
pub enum UnlockPolicy {
@ -225,7 +224,7 @@ impl Passphrase {
}
pub fn check(&self, sb: &bch_sb_handle) -> Result<(bch_key, bch_encrypted_key)> {
let bch_key_magic = BCH_KEY_MAGIC.as_bytes().read_u64::<LittleEndian>().unwrap();
let bch_key_magic = u64::from_le_bytes(*BCH_KEY_MAGIC);
let crypt = sb
.sb()