From 68e9fe573e1d672d7a4bd7dc4612cdc19692495b Mon Sep 17 00:00:00 2001 From: roblabla Date: Tue, 20 Aug 2019 13:30:51 +0000 Subject: [PATCH 1/3] Implement NPDM support --- Cargo.lock | 28 +++- Cargo.toml | 1 + src/bin/linkle_clap.rs | 22 ++- src/error.rs | 11 ++ src/format/mod.rs | 2 +- src/format/npdm.rs | 315 ++++++++++++++++++++++++++++++++++++++++- src/format/utils.rs | 40 +++++- 7 files changed, 405 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 195ab27..99a92be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -69,6 +69,11 @@ dependencies = [ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "backtrace" version = "0.3.9" @@ -90,6 +95,16 @@ dependencies = [ "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bincode" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bit_field" version = "0.10.0" @@ -153,7 +168,7 @@ name = "blz-nx" version = "0.1.0" source = "git+https://github.com/Thog/blz-nx-rs#7e2dccf2a3e1ccb52408e1db995e8f3971de4f2c" dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -178,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.2.3" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -417,10 +432,11 @@ name = "linkle" version = "0.2.7" dependencies = [ "aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "block-modes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "blz-nx 0.1.0 (git+https://github.com/Thog/blz-nx-rs)", - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.0 (git+https://github.com/roblabla/cargo_metadata)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "cmac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -865,8 +881,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum arrayref 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0fd1479b7c29641adbd35ff3b5c293922d696a92f25c8c975da3e0acbc87258f" "checksum arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f405cc4c21cd8b784f6c8fc2adf9bc00f59558f0049b5ec21517f875963040cc" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" "checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" @@ -880,7 +898,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" "checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" -"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1efca0b863ca03ed4c109fb1c55e0bc4bbeb221d3e103d86251046b06a526bd0" "checksum cargo_metadata 0.6.0 (git+https://github.com/roblabla/cargo_metadata)" = "" "checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92" diff --git a/Cargo.toml b/Cargo.toml index 8de395c..f704faf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ derive_more = "0.13" cmac = "0.2.0" blz-nx = { git = "https://github.com/Thog/blz-nx-rs" } bit_field = "0.10.0" +bincode = "1.1.4" [features] binaries = ["structopt", "cargo_metadata", "scroll", "goblin", "clap"] diff --git a/src/bin/linkle_clap.rs b/src/bin/linkle_clap.rs index 843a0cb..487bbe3 100644 --- a/src/bin/linkle_clap.rs +++ b/src/bin/linkle_clap.rs @@ -94,6 +94,16 @@ enum Opt { /// Key file to use #[structopt(parse(from_os_str), short = "k", long = "keyset")] keyfile: Option, + }, + /// Create an NPDM from a JSON-NPDM formatted file. + #[structopt(name = "npdm")] + Npdm { + /// Sets the input JSON file to use. + #[structopt(parse(from_os_str))] + input_file: PathBuf, + /// Sets the output NPDM file to use. + #[structopt(parse(from_os_str))] + output_file: PathBuf, } } @@ -134,7 +144,7 @@ fn create_kip(input_file: &str, npdm_file: &str, output_file: &str) -> Result<() let mut option = OpenOptions::new(); let output_option = option.write(true).create(true).truncate(true); output_option.open(output_file)?; - + nxo.write_kip1(&mut output_option.open(output_file).map_err(|err| (err, output_file))?, &npdm).map_err(|err| (err, output_file))?; Ok(()) } @@ -193,6 +203,15 @@ fn print_keys(is_dev: bool, key_path: Option<&Path>) -> Result<(), linkle::error Ok(()) } +fn create_npdm(input_file: &Path, output_file: &Path) -> Result<(), linkle::error::Error> { + let mut npdm = linkle::format::npdm::NpdmJson::from_file(&input_file)?; + let mut option = OpenOptions::new(); + let output_option = option.write(true).create(true).truncate(true); + let mut out_file = output_option.open(output_file).map_err(|err| (err, output_file))?; + npdm.into_npdm(&mut out_file, false)?; + Ok(()) +} + fn to_opt_ref>(s: &Option) -> Option<&U> { s.as_ref().map(AsRef::as_ref) } @@ -207,6 +226,7 @@ fn process_args(app: &Opt) { Opt::Nacp { ref input_file, ref output_file } => create_nacp(input_file, output_file), Opt::Romfs { ref input_directory, ref output_file } => create_romfs(input_directory, output_file), Opt::Keygen { dev, ref keyfile } => print_keys(*dev, to_opt_ref(keyfile)), + Opt::Npdm { ref input_file, ref output_file } => create_npdm(input_file, output_file) }; if let Err(e) = res { diff --git a/src/error.rs b/src/error.rs index 9e2195e..2654b4e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,6 +7,7 @@ use failure::Backtrace; use block_modes::BlockModeError; use failure::Fail; use derive_more::Display; +use std::borrow::Cow; #[derive(Debug, Fail, Display)] pub enum Error { @@ -32,6 +33,10 @@ pub enum Error { RomFsSymlink(PathBuf, Backtrace), #[display(fmt = "Unknown file type at {}", "_0.display()")] RomFsFiletype(PathBuf, Backtrace), + #[display(fmt = "Invalid NPDM value for field {}", "_0")] + InvalidNpdmValue(Cow<'static, str>, Backtrace), + #[display(fmt = "Failed to serialize NPDM.")] + BincodeError(#[cause] Box, Backtrace), } impl Error { @@ -96,3 +101,9 @@ impl From<(usize, cmac::crypto_mac::MacError)> for Error { Error::MacError(err, id, Backtrace::new()) } } + +impl From> for Error { + fn from(err: Box) -> Error { + Error::BincodeError(err, Backtrace::new()) + } +} diff --git a/src/format/mod.rs b/src/format/mod.rs index e921d5c..6ec7630 100644 --- a/src/format/mod.rs +++ b/src/format/mod.rs @@ -2,5 +2,5 @@ pub mod nacp; pub mod nxo; pub mod pfs0; pub mod romfs; -mod npdm; +pub mod npdm; mod utils; diff --git a/src/format/npdm.rs b/src/format/npdm.rs index f301a7d..3201d74 100644 --- a/src/format/npdm.rs +++ b/src/format/npdm.rs @@ -1,15 +1,15 @@ -use byteorder::{LittleEndian, WriteBytesExt}; -use crate::format::utils; use std; -use std::fmt; -use std::fs::File; use std::io::Write; use std::collections::HashMap; -use crate::format::utils::HexOrNum; +use crate::format::utils::{SigOrPubKey, Reserved64, HexOrNum}; +use crate::error::Error; use serde_derive::{Serialize, Deserialize}; use serde_json; use bit_field::BitField; use std::convert::TryFrom; +use std::path::Path; +use std::mem::size_of; +use failure::Backtrace; #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "type", content = "value")] @@ -60,7 +60,7 @@ impl KernelCapability { for (idx, mask) in masks.iter_mut().enumerate() { mask.set_bits(29..32, idx as u32); } - for (syscall_name, syscall_val) in syscalls { + for (_syscall_name, syscall_val) in syscalls { masks[syscall_val.0 as usize / 24].set_bit(usize::try_from((syscall_val.0 % 24) + 5).unwrap(), true); used[syscall_val.0 as usize / 24] = true; } @@ -118,3 +118,306 @@ impl KernelCapability { } } } + +fn sac_encoded_len(sacs: &[String]) -> usize { + sacs.iter().map(|v| 1 + v.len()).sum() +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct NPDMFilesystemAccess { + permissions: HexOrNum, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct NpdmJson { + // META fields. + name: String, + main_thread_stack_size: HexOrNum, + main_thread_priority: u8, + default_cpu_id: u8, + // We thought this field was the process_category. We were wrong. 🤦 + #[serde(alias = "process_category")] + version: u32, + address_space_type: u8, + is_64_bit: bool, + + // ACID fields + is_retail: bool, + pool_partition: u32, + title_id_range_min: HexOrNum, + title_id_range_max: HexOrNum, + developer_key: Option, + + // ACI0 + title_id: HexOrNum, + + // FAC + filesystem_access: NPDMFilesystemAccess, + + // SAC + service_access: Vec, + service_host: Vec, + + // KAC + kernel_capabilities: Vec, +} + +enum ACIDBehavior<'a> { + Sign, + Empty, + Use(&'a [u8]) +} + +impl NpdmJson { + pub fn from_file(file: &Path) -> Result { + let file = std::fs::File::open(file)?; + match serde_json::from_reader(file) { + Ok(res) => Ok(res), + Err(error) => Err(Error::from(error)), + } + } + + // TODO: Optionally pass a (signed) ACID here. + pub fn into_npdm(&self, mut file: W, _signed: bool) -> Result<(), Error> { + let mut meta: RawMeta = RawMeta::default(); + + meta.magic = *b"META"; + + if self.address_space_type & !3 != 0 { + return Err(Error::InvalidNpdmValue("address_space_type".into(), Backtrace::new())); + } + meta.mmu_flags = (self.address_space_type & 3) << 1; + if self.is_64_bit { meta.mmu_flags |= 1; } + + meta.main_thread_prio = self.main_thread_priority; + meta.main_thread_core_num = self.default_cpu_id; + + meta.system_resources = 0; + meta.version = 0; + + meta.main_thread_stack_size = self.main_thread_stack_size.0 as _; + + let title_name_len = std::cmp::min(self.name.as_bytes().len(), 12); + meta.title_name = [0; 16]; + meta.title_name[..title_name_len].copy_from_slice(&self.name.as_bytes()[..title_name_len]); + + meta.product_code = [0; 0x10]; + + meta.aci_offset = (size_of::() + size_of::() + + size_of::() + + sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + + self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; + meta.aci_size = (size_of::() + size_of::() + + sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + + self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; + + meta.acid_offset = 0x80; + meta.acid_size = (size_of::() + size_of::() + + sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + + self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; + + bincode::config().little_endian().serialize_into(&mut file, &meta)?; + + let mut acid = RawAcid::default(); + acid.rsa_acid_sig = SigOrPubKey([0; 0x100]); + acid.rsa_nca_pubkey = SigOrPubKey([0; 0x100]); + acid.magic = *b"ACID"; + acid.signed_size = meta.acid_size - 0x100; + + acid.flags = 0u32; + if self.is_retail { acid.flags |= 1; } + + if self.pool_partition & !3 != 0 { + return Err(Error::InvalidNpdmValue("pool_partition".into(), Backtrace::new())); + } + acid.flags |= (self.pool_partition & 3) << 2; + // TODO: Unqualified approval. Zefuk is this? + + acid.titleid_range_min = self.title_id_range_min.0; + acid.titleid_range_max = self.title_id_range_max.0; + + acid.fs_access_control_offset = meta.acid_offset + size_of::() as u32; + acid.fs_access_control_size = size_of::() as u32; + + acid.service_access_control_offset = acid.fs_access_control_offset + acid.fs_access_control_size; + acid.service_access_control_size = (sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access)) as u32; + + acid.kernel_access_control_offset = acid.service_access_control_offset + acid.service_access_control_size; + acid.kernel_access_control_size = self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::() as u32; + + + bincode::config().little_endian().serialize_into(&mut file, &acid)?; + + let mut fac = RawFileSystemAccessControl::default(); + fac.version = 1; + fac.padding = [0; 3]; + fac.permissions_bitmask = self.filesystem_access.permissions.0; + + bincode::config().little_endian().serialize_into(&mut file, &fac)?; + + for elem in &self.service_access { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_access.{}", elem).into(), Backtrace::new())) + } + file.write_all(&[elem.len() as u8 - 1])?; + file.write_all(elem.as_bytes())?; + } + + for elem in &self.service_host { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_host.{}", elem).into(), Backtrace::new())) + } + file.write_all(&[0x80 | (elem.len() as u8 - 1)])?; + file.write_all(elem.as_bytes())?; + } + + for elem in &self.kernel_capabilities { + bincode::config().little_endian().serialize_into(&mut file, &elem)?; + } + + // ACI0 + let mut aci0 = RawAci::default(); + aci0.magic = *b"ACI0"; + aci0.titleid = self.title_id.0; + aci0.fs_access_header_offset = meta.aci_offset + size_of::() as u32; + aci0.fs_access_header_size = size_of::() as u32; + aci0.service_access_control_offset = aci0.fs_access_header_offset + aci0.fs_access_header_size; + aci0.service_access_control_size = (sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access)) as u32; + aci0.service_access_control_offset = aci0.service_access_control_offset + aci0.service_access_control_size; + aci0.kernel_access_control_size = self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::() as u32; + + bincode::config().little_endian().serialize_into(&mut file, &aci0)?; + + let mut fah = RawFileSystemAccessHeader::default(); + fah.version = 1; + fah.padding = [0; 3]; + fah.permissions_bitmask = self.filesystem_access.permissions.0; + fah.data_size = 0x1C; // Always 0x1C + fah.size_of_content_owner_id = 0; + fah.data_size_plus_content_owner_size = 0x1C; + fah.size_of_save_data_owners = 0; + + bincode::config().little_endian().serialize_into(&mut file, &fac)?; + + for elem in &self.service_access { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_access.{}", elem).into(), Backtrace::new())) + } + file.write_all(&[elem.len() as u8 - 1])?; + file.write_all(elem.as_bytes())?; + } + + for elem in &self.service_host { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_host.{}", elem).into(), Backtrace::new())) + } + file.write_all(&[0x80 | (elem.len() as u8 - 1)])?; + file.write_all(elem.as_bytes())?; + } + + for elem in &self.kernel_capabilities { + bincode::config().little_endian().serialize_into(&mut file, &elem)?; + } + + + Ok(()) + } +} + +#[repr(C)] +#[derive(Default, Clone, Copy, Serialize)] +struct RawFileSystemAccessControl { + version: u8, + padding: [u8; 3], + permissions_bitmask: u64, + reserved: [u8; 0x20] +} + +#[repr(C)] +#[derive(Default, Clone, Copy, Serialize)] +struct RawFileSystemAccessHeader { + version: u8, + padding: [u8; 3], + permissions_bitmask: u64, + data_size: u32, // Always 0x1C + size_of_content_owner_id: u32, + data_size_plus_content_owner_size: u32, + size_of_save_data_owners: u32, + // TODO: there's more optional stuff afterwards. +} + +#[repr(C)] +#[derive(Default, Clone, Copy, Serialize)] +struct RawMeta { + magic: [u8; 4], + #[doc(hidden)] + reserved4: u32, + reserved8: u32, + mmu_flags: u8, + #[doc(hidden)] + reserved13: u8, + main_thread_prio: u8, + main_thread_core_num: u8, + #[doc(hidden)] + reserved16: u32, + system_resources: u32, + version: u32, + main_thread_stack_size: u32, + title_name: [u8; 16], + product_code: [u8; 16], + #[doc(hidden)] + reserved64: Reserved64, + aci_offset: u32, + aci_size: u32, + acid_offset: u32, + acid_size: u32, +} + +/// Restriced Access Controls, signed by Nintendo. +#[repr(C)] +#[derive(Default, Clone, Copy, Serialize)] +struct RawAcid { + /// RSA-2048 Signature starting from `rsa_nca_pubkey` and spanning + /// `signed_size` bytes, using a fixed key owned by Nintendo. The pubkey + /// part can be found in hactool, `acid_fixed_key_modulus`. + rsa_acid_sig: SigOrPubKey, // [u8; 0x100], + /// RSA-2048 public key for the second NCA signature + rsa_nca_pubkey: SigOrPubKey, // [u8; 0x100], + /// Magic identifying a valid ACID. Should be `b"ACID"`. + magic: [u8; 4], + signed_size: u32, + #[doc(hidden)] + reserved: u32, + flags: u32, + titleid_range_min: u64, + titleid_range_max: u64, + fs_access_control_offset: u32, + fs_access_control_size: u32, + service_access_control_offset: u32, + service_access_control_size: u32, + kernel_access_control_offset: u32, + kernel_access_control_size: u32, + #[doc(hidden)] + reserved38: u64 +} + +/// Access Control Information. +/// +/// Protected by the NCA signature, which devs control via their pubkey. +#[repr(C)] +#[derive(Default, Clone, Copy, Serialize)] +struct RawAci { + /// Magic identifying a valid ACI. Should be `ACI0`. + magic: [u8; 4], + #[doc(hidden)] + reserved4: [u8; 0xC], + titleid: u64, + #[doc(hidden)] + reserved24: u64, + fs_access_header_offset: u32, + fs_access_header_size: u32, + service_access_control_offset: u32, + service_access_control_size: u32, + kernel_access_control_offset: u32, + kernel_access_control_size: u32, +} \ No newline at end of file diff --git a/src/format/utils.rs b/src/format/utils.rs index 94246ad..ee880c3 100644 --- a/src/format/utils.rs +++ b/src/format/utils.rs @@ -6,6 +6,7 @@ use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use sha2::{Sha256, Digest}; use serde::{Serialize, Serializer, Deserialize, Deserializer}; +use serde::ser::SerializeTuple; use serde::de::{Visitor, Unexpected}; pub fn align(size: usize, padding: usize) -> usize { @@ -85,7 +86,7 @@ impl<'de> Deserialize<'de> for HexOrNum { where E: serde::de::Error { - if (v.starts_with("0x")) { + if v.starts_with("0x") { u64::from_str_radix(&v[2..], 16).map_err(|_| { E::invalid_value(Unexpected::Str(v), &"a hex-encoded string") }) @@ -108,3 +109,40 @@ impl Serialize for HexOrNum { serializer.collect_str(&format_args!("{:#010x}", self.0)) } } + +macro_rules! array_impls { + ($($ty:ident: $len:literal),+) => { + $( + #[derive(Clone, Copy)] + pub struct $ty(pub [u8; $len]); + + impl Default for $ty { + fn default() -> Self { + $ty([0; $len]) + } + } + + impl fmt::Debug for $ty { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{:02x?}", &self.0[..])) + } + } + + impl Serialize for $ty { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let mut seq = serializer.serialize_tuple($len)?; + for e in &self.0[..] { + seq.serialize_element(e)?; + } + seq.end() + } + } + )+ + } +} + +array_impls!(SigOrPubKey: 0x100, Reserved64: 0x30); \ No newline at end of file From fd7af29c2481514fdd7e3ea1e9fa37820658190f Mon Sep 17 00:00:00 2001 From: roblabla Date: Sun, 1 Sep 2019 20:58:32 +0000 Subject: [PATCH 2/3] Fix a bunch of mistakes, allow signing NPDMs, include sunriseos extensions --- Cargo.lock | 416 ++++++++++++++++++++++++++++++++---- Cargo.toml | 6 +- src/bin/linkle_clap.rs | 29 ++- src/error.rs | 24 +++ src/format/npdm.rs | 320 ++++++++++++++++++--------- src/format/npdm/syscalls.rs | 129 +++++++++++ 6 files changed, 779 insertions(+), 145 deletions(-) create mode 100644 src/format/npdm/syscalls.rs diff --git a/Cargo.lock b/Cargo.lock index 99a92be..21872d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,14 @@ dependencies = [ "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "aho-corasick" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -46,11 +54,6 @@ dependencies = [ "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "arrayref" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "arrayvec" version = "0.4.8" @@ -95,6 +98,14 @@ dependencies = [ "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bincode" version = "1.1.4" @@ -131,11 +142,13 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.3.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayref 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -171,11 +184,6 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "byte-tools" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byte-tools" version = "0.3.0" @@ -244,6 +252,14 @@ dependencies = [ "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cmac" version = "0.2.0" @@ -289,10 +305,10 @@ dependencies = [ [[package]] name = "digest" -version = "0.7.5" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -331,16 +347,16 @@ dependencies = [ [[package]] name = "failure" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -354,6 +370,11 @@ name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -368,14 +389,6 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "generic-array" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "generic-array" version = "0.12.0" @@ -407,6 +420,11 @@ dependencies = [ "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "idna" version = "0.1.5" @@ -422,11 +440,24 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "spin 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libc" version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "linkle" version = "0.2.7" @@ -443,18 +474,22 @@ dependencies = [ "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "elf 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pem 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rsa 0.1.4-alpha.0", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "scroll 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "yasna 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -489,11 +524,62 @@ name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "memchr" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "num-bigint" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint-dig" +version = "0.3.1-alpha.0" +source = "git+https://github.com/SunriseOS/num-bigint?branch=nostd#47d3be37a36995c462ed7bdd70c325e00270e583" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" version = "0.2.6" @@ -504,6 +590,17 @@ name = "opaque-debug" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "pem" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -548,6 +645,110 @@ dependencies = [ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" version = "0.1.40" @@ -567,11 +768,27 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "regex" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "remove_dir_all" version = "0.5.1" @@ -580,6 +797,26 @@ dependencies = [ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rsa" +version = "0.1.4-alpha.0" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint-dig 0.3.1-alpha.0 (git+https://github.com/SunriseOS/num-bigint?branch=nostd)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "signature 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-ini" version = "0.13.0" @@ -673,17 +910,33 @@ dependencies = [ "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha-1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sha2" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "signature" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "skeptic" version = "0.13.3" @@ -699,6 +952,16 @@ dependencies = [ "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "smallvec" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "spin" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "strsim" version = "0.7.0" @@ -729,6 +992,11 @@ name = "subtle" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "subtle" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.14.7" @@ -787,6 +1055,14 @@ dependencies = [ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" version = "1.10.0" @@ -872,29 +1148,55 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "yasna" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zeroize" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "zeroize_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zeroize_derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] "checksum aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" "checksum aes-soft 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "acdc19c789666840bb86d1df8ee1f458418f74a6b9c8f10538fb700de5829cb8" "checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayref 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0fd1479b7c29641adbd35ff3b5c293922d696a92f25c8c975da3e0acbc87258f" "checksum arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f405cc4c21cd8b784f6c8fc2adf9bc00f59558f0049b5ec21517f875963040cc" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" "checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" +"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-modes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "283fa06a14026feac8912bf35328fc074f5d68907fd4b9cccad5658a3fc62a30" "checksum block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc4358306e344bf9775d0197fd00d2603e5afb0771bb353538630f022068ea3" "checksum blz-nx 0.1.0 (git+https://github.com/Thog/blz-nx-rs)" = "" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" "checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" @@ -904,45 +1206,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cmac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f4a435124bcc292eba031f1f725d7abacdaf13cbf9f935450e8c45aa9e96cad" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum dbl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6c40b13b561e11560d7b12785e74113a3163df617e2fbce60ce1764e0b270eaa" "checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" -"checksum digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b29c278aa8fd30796bd977169e8004b4aa88cdcd2f32a6eb22bc2d5d38df94a" +"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum elf 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4841de15dbe0e49b9b62a417589299e3be0d557e0900d36acb87e6dae47197f5" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" -"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5911d7df7b8f65ab676c5327b50acea29d3c6a1a4ad05e444cf5dce321b26db2" "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "413f3dfc802c5dc91dc570b05125b6cda9855edfaa9825c9849807876376e70e" +"checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" "checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43c94a9f09a60017f373020cc93d4291db4cd92b0db64ff25927f27d09dc23d5" "checksum lz4-sys 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "20ab022822e9331c58d373acdd6b98085bace058ac6837b8266f213a2fccdafe" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" +"checksum num-bigint-dig 0.3.1-alpha.0 (git+https://github.com/SunriseOS/num-bigint?branch=nostd)" = "" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" +"checksum pem 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39eb474073dfddbf7156515344266245d91ce698ddbf15e0498cef22b836f45a" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" "checksum quote 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b71f9f575d55555aa9c06188be9d4e2bfc83ed02537948ac0d520c24d0419f1a" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" @@ -957,18 +1282,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" "checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" +"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" +"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" +"checksum signature 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "144b5d1138a4339c839603f15f69ffe3195e51b5caa92f815b47d4553db47337" "checksum skeptic 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c4474d6da9593171bcb086890fc344a3a12783cb24e5b141f8a5d0e43561f4b6" +"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" +"checksum spin 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbdb51a221842709c2dd65b62ad4b78289fc3e706a02c17a26104528b6aa7837" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" "checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e13df71f29f9440b50261a5882c86eac334f1badb3134ec26f0de2f1418e44" "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" @@ -982,3 +1313,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum yasna 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a563d10ead87e2d798e357d44f40f495ad70bcee4d5c0d3f77a5b1b7376645d9" +"checksum zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e68403b858b6af538b11614e62dfe9ab2facba9f13a0cafb974855cfb495ec95" +"checksum zeroize_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3f07490820219949839d0027b965ffdd659d75be9220c00798762e36c6cd281" diff --git a/Cargo.toml b/Cargo.toml index f704faf..d6ed6af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ byteorder = "1" lz4 = "1.23.1" clap = { version = "2", optional = true } structopt = { version = "0.2", optional = true } -sha2 = "0.7.1" +sha2 = "0.8.0" scroll = { version = "0.9.0", optional = true } serde = "1" serde_derive = "1" @@ -42,6 +42,10 @@ cmac = "0.2.0" blz-nx = { git = "https://github.com/Thog/blz-nx-rs" } bit_field = "0.10.0" bincode = "1.1.4" +yasna = { version = "0.3", features = ["num-bigint"] } +pem = "0.6" +rsa = { path = "../RSA" } +hex = "0.3" [features] binaries = ["structopt", "cargo_metadata", "scroll", "goblin", "clap"] diff --git a/src/bin/linkle_clap.rs b/src/bin/linkle_clap.rs index 487bbe3..8d784a8 100644 --- a/src/bin/linkle_clap.rs +++ b/src/bin/linkle_clap.rs @@ -101,9 +101,18 @@ enum Opt { /// Sets the input JSON file to use. #[structopt(parse(from_os_str))] input_file: PathBuf, + /// Sets the output NPDM file to use. #[structopt(parse(from_os_str))] output_file: PathBuf, + + /// Use the given file for the ACID section. + #[structopt(long = "use-acid", parse(from_os_str), conflicts_with = "pem_file")] + acid_file: Option, + + /// Sign the ACID section with the given RSA private key. + #[structopt(long = "sign-with", parse(from_os_str))] + pem_file: Option, } } @@ -203,12 +212,24 @@ fn print_keys(is_dev: bool, key_path: Option<&Path>) -> Result<(), linkle::error Ok(()) } -fn create_npdm(input_file: &Path, output_file: &Path) -> Result<(), linkle::error::Error> { - let mut npdm = linkle::format::npdm::NpdmJson::from_file(&input_file)?; +fn create_npdm(input_file: &Path, input_acid: Option<&Path>, sign_acid: Option<&Path>, output_file: &Path) -> Result<(), linkle::error::Error> { + use linkle::format::npdm::{NpdmJson, ACIDBehavior}; + + let npdm = NpdmJson::from_file(&input_file)?; let mut option = OpenOptions::new(); let output_option = option.write(true).create(true).truncate(true); let mut out_file = output_option.open(output_file).map_err(|err| (err, output_file))?; - npdm.into_npdm(&mut out_file, false)?; + let behavior = if sign_acid.is_some() && input_acid.is_some() { + // They are set as conflicting in clap, so we can't reach here. + unreachable!("Can't pass both sign_acid and input_acid."); + } else if let Some(input_pem) = sign_acid { + ACIDBehavior::Sign { pem_file_path: input_pem } + } else if let Some(input_acid) = input_acid { + ACIDBehavior::Use { acid_file_path: input_acid } + } else { + ACIDBehavior::Empty + }; + npdm.into_npdm(&mut out_file, behavior)?; Ok(()) } @@ -226,7 +247,7 @@ fn process_args(app: &Opt) { Opt::Nacp { ref input_file, ref output_file } => create_nacp(input_file, output_file), Opt::Romfs { ref input_directory, ref output_file } => create_romfs(input_directory, output_file), Opt::Keygen { dev, ref keyfile } => print_keys(*dev, to_opt_ref(keyfile)), - Opt::Npdm { ref input_file, ref output_file } => create_npdm(input_file, output_file) + Opt::Npdm { ref input_file, ref pem_file, ref acid_file, ref output_file } => create_npdm(input_file, to_opt_ref(acid_file), to_opt_ref(pem_file), output_file) }; if let Err(e) = res { diff --git a/src/error.rs b/src/error.rs index 2654b4e..8cde0da 100644 --- a/src/error.rs +++ b/src/error.rs @@ -37,6 +37,12 @@ pub enum Error { InvalidNpdmValue(Cow<'static, str>, Backtrace), #[display(fmt = "Failed to serialize NPDM.")] BincodeError(#[cause] Box, Backtrace), + #[display(fmt = "Failed to sign NPDM.")] + RsaError(#[cause] rsa::errors::Error, Backtrace), + #[display(fmt = "Failed to sign NPDM, invalid PEM.")] + PemError(#[cause] pem::PemError, Backtrace), + #[display(fmt = "Failed to sign NPDM, invalid PEM.")] + Asn1Error(#[cause] yasna::ASN1Error, Backtrace), } impl Error { @@ -107,3 +113,21 @@ impl From> for Error { Error::BincodeError(err, Backtrace::new()) } } + +impl From for Error { + fn from(err: rsa::errors::Error) -> Error { + Error::RsaError(err, Backtrace::new()) + } +} + +impl From for Error { + fn from(err: pem::PemError) -> Error { + Error::PemError(err, Backtrace::new()) + } +} + +impl From for Error { + fn from(err: yasna::ASN1Error) -> Error { + Error::Asn1Error(err, Backtrace::new()) + } +} \ No newline at end of file diff --git a/src/format/npdm.rs b/src/format/npdm.rs index 3201d74..bfd1dcf 100644 --- a/src/format/npdm.rs +++ b/src/format/npdm.rs @@ -10,6 +10,20 @@ use std::convert::TryFrom; use std::path::Path; use std::mem::size_of; use failure::Backtrace; +use sha2::{Digest, Sha256}; +use rsa::{BigUint, RSAPrivateKey}; + +pub mod syscalls; + +// TODO: Pretty errors if the user messes up. +#[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] +pub enum Syscalls { + /// Accepts the standard svcName: 0xsvc_hex + KeyValue(HashMap), + /// Accepts syscall names. Those must be correctly spelled. + Name(Vec), +} #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "type", content = "value")] @@ -21,7 +35,7 @@ pub enum KernelCapability { highest_cpu_id: u8, lowest_cpu_id: u8, }, - Syscalls(HashMap), + Syscalls(Syscalls), Map { address: HexOrNum, size: HexOrNum, @@ -39,6 +53,24 @@ pub enum KernelCapability { }, } +fn encode_syscalls>(syscalls: I) -> Vec { + let mut masks = vec![0b1111u32; 6]; + let mut used = [false; 6]; + for (idx, mask) in masks.iter_mut().enumerate() { + mask.set_bits(29..32, idx as u32); + } + for syscall_val in syscalls { + masks[syscall_val as usize / 24].set_bit(usize::try_from((syscall_val % 24) + 5).unwrap(), true); + used[syscall_val as usize / 24] = true; + } + for (idx, used) in used.iter().enumerate().rev() { + if !used { + masks.remove(idx); + } + } + masks +} + impl KernelCapability { pub fn encode(&self) -> Vec { match self { @@ -54,22 +86,11 @@ impl KernelCapability { .set_bits(16..24, u32::from(*lowest_cpu_id)) .set_bits(24..32, u32::from(*highest_cpu_id))] }, - KernelCapability::Syscalls(syscalls) => { - let mut masks = vec![0b1111u32; 6]; - let mut used = [false; 6]; - for (idx, mask) in masks.iter_mut().enumerate() { - mask.set_bits(29..32, idx as u32); - } - for (_syscall_name, syscall_val) in syscalls { - masks[syscall_val.0 as usize / 24].set_bit(usize::try_from((syscall_val.0 % 24) + 5).unwrap(), true); - used[syscall_val.0 as usize / 24] = true; - } - for (idx, used) in used.iter().enumerate().rev() { - if !used { - masks.remove(idx); - } - } - masks + KernelCapability::Syscalls(Syscalls::Name(syscalls)) => { + encode_syscalls(syscalls.iter().map(|v| *v as u32)) + }, + KernelCapability::Syscalls(Syscalls::KeyValue(syscalls)) => { + encode_syscalls(syscalls.iter().map(|(_, v)| v.0 as u32)) }, KernelCapability::Map { address, @@ -144,8 +165,8 @@ pub struct NpdmJson { // ACID fields is_retail: bool, pool_partition: u32, - title_id_range_min: HexOrNum, - title_id_range_max: HexOrNum, + title_id_range_min: Option, + title_id_range_max: Option, developer_key: Option, // ACI0 @@ -162,10 +183,10 @@ pub struct NpdmJson { kernel_capabilities: Vec, } -enum ACIDBehavior<'a> { - Sign, +pub enum ACIDBehavior<'a> { + Sign { pem_file_path: &'a Path }, Empty, - Use(&'a [u8]) + Use { acid_file_path: &'a Path } } impl NpdmJson { @@ -178,7 +199,7 @@ impl NpdmJson { } // TODO: Optionally pass a (signed) ACID here. - pub fn into_npdm(&self, mut file: W, _signed: bool) -> Result<(), Error> { + pub fn into_npdm(&self, mut file: W, acid_behavior: ACIDBehavior) -> Result<(), Error> { let mut meta: RawMeta = RawMeta::default(); meta.magic = *b"META"; @@ -203,101 +224,76 @@ impl NpdmJson { meta.product_code = [0; 0x10]; - meta.aci_offset = (size_of::() + size_of::() + - size_of::() + - sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + - self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; - meta.aci_size = (size_of::() + size_of::() + - sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + - self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; + meta.acid_offset = size_of::() as u32; + meta.acid_size = match acid_behavior { + ACIDBehavior::Sign { .. } | ACIDBehavior::Empty => { + (0x100 + size_of::() + size_of::() + + sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + + self.kernel_capabilities.iter().map(|v| v.encode().len() * 4).sum::()) as u32 + }, + ACIDBehavior::Use { acid_file_path } => std::fs::metadata(acid_file_path)?.len() as u32, + }; - meta.acid_offset = 0x80; - meta.acid_size = (size_of::() + size_of::() + + meta.aci_offset = meta.acid_offset + meta.acid_size; + meta.aci_size = (size_of::() + size_of::() + sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access) + - self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::()) as u32; + self.kernel_capabilities.iter().map(|v| v.encode().len() * 4).sum::()) as u32; bincode::config().little_endian().serialize_into(&mut file, &meta)?; - let mut acid = RawAcid::default(); - acid.rsa_acid_sig = SigOrPubKey([0; 0x100]); - acid.rsa_nca_pubkey = SigOrPubKey([0; 0x100]); - acid.magic = *b"ACID"; - acid.signed_size = meta.acid_size - 0x100; - - acid.flags = 0u32; - if self.is_retail { acid.flags |= 1; } - - if self.pool_partition & !3 != 0 { - return Err(Error::InvalidNpdmValue("pool_partition".into(), Backtrace::new())); - } - acid.flags |= (self.pool_partition & 3) << 2; - // TODO: Unqualified approval. Zefuk is this? - - acid.titleid_range_min = self.title_id_range_min.0; - acid.titleid_range_max = self.title_id_range_max.0; - - acid.fs_access_control_offset = meta.acid_offset + size_of::() as u32; - acid.fs_access_control_size = size_of::() as u32; - - acid.service_access_control_offset = acid.fs_access_control_offset + acid.fs_access_control_size; - acid.service_access_control_size = (sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access)) as u32; - - acid.kernel_access_control_offset = acid.service_access_control_offset + acid.service_access_control_size; - acid.kernel_access_control_size = self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::() as u32; - - - bincode::config().little_endian().serialize_into(&mut file, &acid)?; - - let mut fac = RawFileSystemAccessControl::default(); - fac.version = 1; - fac.padding = [0; 3]; - fac.permissions_bitmask = self.filesystem_access.permissions.0; - - bincode::config().little_endian().serialize_into(&mut file, &fac)?; - - for elem in &self.service_access { - if elem.len() & !7 != 0 || elem.len() == 0 { - return Err(Error::InvalidNpdmValue(format!("service_access.{}", elem).into(), Backtrace::new())) + match acid_behavior { + ACIDBehavior::Sign { pem_file_path } => { + // Parse PEM file + let pkey = get_pkey_from_pem(pem_file_path)?; + + let mut v = Vec::new(); + write_acid(&mut v, self, &meta)?; + println!("Signing over {:02x?}", v); + + // calculate signature. + let mut hash = Sha256::new(); + write_acid(&mut hash, self, &meta)?; + let hash = hash.result(); + println!("Signing over {:02x?}", hash); + let sig = pkey.sign(rsa::PaddingScheme::PSS, Some(&rsa::hash::Hashes::SHA2_256), &hash)?; + assert_eq!(sig.len(), 0x100, "Signature of wrong length generated"); + file.write_all(&sig)?; + + write_acid(&mut file, self, &meta)?; + }, + ACIDBehavior::Empty => { + file.write_all(&[0; 0x100])?; + write_acid(&mut file, self, &meta)?; } - file.write_all(&[elem.len() as u8 - 1])?; - file.write_all(elem.as_bytes())?; - } - - for elem in &self.service_host { - if elem.len() & !7 != 0 || elem.len() == 0 { - return Err(Error::InvalidNpdmValue(format!("service_host.{}", elem).into(), Backtrace::new())) + ACIDBehavior::Use { acid_file_path } => { + let mut acid_file = std::fs::File::open(acid_file_path)?; + std::io::copy(&mut acid_file, &mut file)?; } - file.write_all(&[0x80 | (elem.len() as u8 - 1)])?; - file.write_all(elem.as_bytes())?; - } - - for elem in &self.kernel_capabilities { - bincode::config().little_endian().serialize_into(&mut file, &elem)?; } // ACI0 let mut aci0 = RawAci::default(); aci0.magic = *b"ACI0"; aci0.titleid = self.title_id.0; - aci0.fs_access_header_offset = meta.aci_offset + size_of::() as u32; + aci0.fs_access_header_offset = size_of::() as u32; aci0.fs_access_header_size = size_of::() as u32; aci0.service_access_control_offset = aci0.fs_access_header_offset + aci0.fs_access_header_size; aci0.service_access_control_size = (sac_encoded_len(&self.service_host) + sac_encoded_len(&self.service_access)) as u32; - aci0.service_access_control_offset = aci0.service_access_control_offset + aci0.service_access_control_size; - aci0.kernel_access_control_size = self.kernel_capabilities.iter().map(|v| v.encode().len()).sum::() as u32; + aci0.kernel_access_control_offset = aci0.service_access_control_offset + aci0.service_access_control_size; + aci0.kernel_access_control_size = self.kernel_capabilities.iter().map(|v| v.encode().len() * 4).sum::() as u32; bincode::config().little_endian().serialize_into(&mut file, &aci0)?; let mut fah = RawFileSystemAccessHeader::default(); fah.version = 1; fah.padding = [0; 3]; - fah.permissions_bitmask = self.filesystem_access.permissions.0; + fah.permissions_bitmask.copy_from_slice(&self.filesystem_access.permissions.0.to_le_bytes()); fah.data_size = 0x1C; // Always 0x1C fah.size_of_content_owner_id = 0; fah.data_size_plus_content_owner_size = 0x1C; fah.size_of_save_data_owners = 0; - bincode::config().little_endian().serialize_into(&mut file, &fac)?; + bincode::config().little_endian().serialize_into(&mut file, &fah)?; for elem in &self.service_access { if elem.len() & !7 != 0 || elem.len() == 0 { @@ -316,20 +312,141 @@ impl NpdmJson { } for elem in &self.kernel_capabilities { - bincode::config().little_endian().serialize_into(&mut file, &elem)?; + let encoded = elem.encode().iter().map(|v| v.to_le_bytes().to_vec()).flatten().collect::>(); + file.write_all(&encoded)?; } - Ok(()) } } +fn get_pkey_from_pem(path: &Path) -> Result { + let data = std::fs::read_to_string(path)?; + let data = pem::parse(data)?.contents; + + let (n, e, d, prime1, prime2) = yasna::parse_der(&data, |reader| { + reader.read_sequence(|reader| { + let _v = reader.next().read_i64()?; + let _oid = reader.next().read_sequence(|reader| { + reader.next().read_oid() + })?; + let bytes = reader.next().read_bytes()?; + yasna::parse_der(&bytes, |reader| reader.read_sequence(|reader| { + let _v = reader.next().read_i64()?; + let modulus = reader.next().read_biguint()?; + let pubexp = reader.next().read_biguint()?; + let privexp = reader.next().read_biguint()?; + let prime1 = reader.next().read_biguint()?; + let prime2 = reader.next().read_biguint()?; + let _exp1 = reader.next().read_biguint()?; + let _exp2 = reader.next().read_biguint()?; + let _coeff = reader.next().read_biguint()?; + Ok((modulus, pubexp, privexp, prime1, prime2)) + })) + }) + })?; + + let pkey = rsa::RSAPrivateKey::from_components( + BigUint::from_bytes_be(&n.to_bytes_be()), + BigUint::from_bytes_be(&e.to_bytes_be()), + BigUint::from_bytes_be(&d.to_bytes_be()), + vec![ + BigUint::from_bytes_be(&prime1.to_bytes_be()), + BigUint::from_bytes_be(&prime2.to_bytes_be()), + ] + ); + pkey.validate()?; + + Ok(pkey) +} + +fn write_acid(mut writer: &mut T, npdm: &NpdmJson, meta: &RawMeta) -> Result<(), Error> { + let mut acid = RawAcid::default(); + + if let Some(devkey) = &npdm.developer_key { + acid.rsa_nca_pubkey.0.copy_from_slice(&hex::decode(devkey).unwrap()); + } + + acid.magic = *b"ACID"; + acid.signed_size = meta.acid_size - 0x100; + + acid.flags = 0u32; + if npdm.is_retail { acid.flags |= 1; } + + if npdm.pool_partition & !3 != 0 { + return Err(Error::InvalidNpdmValue("pool_partition".into(), Backtrace::new())); + } + acid.flags |= (npdm.pool_partition & 3) << 2; + // TODO: Unqualified approval. Zefuk is this? + + acid.titleid_range_min = npdm.title_id_range_min.as_ref().unwrap_or(&npdm.title_id).0; + acid.titleid_range_max = npdm.title_id_range_max.as_ref().unwrap_or(&npdm.title_id).0; + + acid.fs_access_control_offset = 0x100 + size_of::() as u32; + acid.fs_access_control_size = size_of::() as u32; + + acid.service_access_control_offset = acid.fs_access_control_offset + acid.fs_access_control_size; + acid.service_access_control_size = (sac_encoded_len(&npdm.service_host) + sac_encoded_len(&npdm.service_access)) as u32; + + acid.kernel_access_control_offset = acid.service_access_control_offset + acid.service_access_control_size; + acid.kernel_access_control_size = npdm.kernel_capabilities.iter().map(|v| v.encode().len() * 4).sum::() as u32; + + let mut fac = RawFileSystemAccessControl::default(); + fac.version = 1; + fac.padding = [0; 3]; + fac.permissions_bitmask.copy_from_slice(&npdm.filesystem_access.permissions.0.to_le_bytes()); + + let mut final_size = bincode::config().little_endian().serialized_size(&acid)?; + assert_eq!(final_size as usize, size_of::(), "Serialized ACID has wrong size"); + bincode::config().little_endian().serialize_into(&mut writer, &acid)?; + + final_size += bincode::config().little_endian().serialized_size(&fac)?; + assert_eq!(final_size as usize, size_of::() + size_of::(), "Serialized FAC has wrong size"); + bincode::config().little_endian().serialize_into(&mut writer, &fac)?; + + for elem in &npdm.service_access { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_access.{}", elem).into(), Backtrace::new())) + } + final_size += 1; + writer.write_all(&[elem.len() as u8 - 1])?; + final_size += elem.as_bytes().len() as u64; + writer.write_all(elem.as_bytes())?; + } + + for elem in &npdm.service_host { + if elem.len() & !7 != 0 || elem.len() == 0 { + return Err(Error::InvalidNpdmValue(format!("service_host.{}", elem).into(), Backtrace::new())) + } + final_size += 1; + writer.write_all(&[0x80 | (elem.len() as u8 - 1)])?; + final_size += elem.as_bytes().len() as u64; + writer.write_all(elem.as_bytes())?; + } + + assert_eq!(final_size as usize, size_of::() + size_of::() + + sac_encoded_len(&npdm.service_access) + sac_encoded_len(&npdm.service_host), "Serialized SAC has wrong size"); + + for elem in &npdm.kernel_capabilities { + let encoded = elem.encode().iter().map(|v| v.to_le_bytes().to_vec()).flatten().collect::>(); + final_size += encoded.len() as u64; + writer.write_all(&encoded)?; + } + + assert_eq!(final_size as usize, size_of::() + size_of::() + + sac_encoded_len(&npdm.service_access) + sac_encoded_len(&npdm.service_host) + + npdm.kernel_capabilities.iter().map(|v| v.encode().len() * 4).sum::(), "Serialized KAC has wrong size"); + + Ok(()) +} + #[repr(C)] #[derive(Default, Clone, Copy, Serialize)] struct RawFileSystemAccessControl { version: u8, padding: [u8; 3], - permissions_bitmask: u64, + // Work around broken alignment. It sucks. + permissions_bitmask: [u8; 8], reserved: [u8; 0x20] } @@ -338,7 +455,8 @@ struct RawFileSystemAccessControl { struct RawFileSystemAccessHeader { version: u8, padding: [u8; 3], - permissions_bitmask: u64, + // Work around broken alignment. It sucks. + permissions_bitmask: [u8; 8], data_size: u32, // Always 0x1C size_of_content_owner_id: u32, data_size_plus_content_owner_size: u32, @@ -377,10 +495,12 @@ struct RawMeta { #[repr(C)] #[derive(Default, Clone, Copy, Serialize)] struct RawAcid { - /// RSA-2048 Signature starting from `rsa_nca_pubkey` and spanning - /// `signed_size` bytes, using a fixed key owned by Nintendo. The pubkey - /// part can be found in hactool, `acid_fixed_key_modulus`. - rsa_acid_sig: SigOrPubKey, // [u8; 0x100], + // RSA-2048 Signature starting from `rsa_nca_pubkey` and spanning + // `signed_size` bytes, using a fixed key owned by Nintendo. The pubkey + // part can be found in hactool, `acid_fixed_key_modulus`. + // + // Written separately. + // rsa_acid_sig: SigOrPubKey, // [u8; 0x100], /// RSA-2048 public key for the second NCA signature rsa_nca_pubkey: SigOrPubKey, // [u8; 0x100], /// Magic identifying a valid ACID. Should be `b"ACID"`. @@ -420,4 +540,6 @@ struct RawAci { service_access_control_size: u32, kernel_access_control_offset: u32, kernel_access_control_size: u32, + #[doc(hidden)] + reserved38: u64 } \ No newline at end of file diff --git a/src/format/npdm/syscalls.rs b/src/format/npdm/syscalls.rs new file mode 100644 index 0000000..75fad1e --- /dev/null +++ b/src/format/npdm/syscalls.rs @@ -0,0 +1,129 @@ +//! Straight from SunriseOS' libkern +use serde_derive::{Serialize, Deserialize}; + +#[repr(u32)] +#[derive(Serialize, Deserialize, Debug, Clone, Copy)] +pub enum SyscallNames { + SetHeapSize = 0x01, + SetMemoryPermission = 0x02, + SetMemoryAttribute = 0x03, + MapMemory = 0x04, + UnmapMemory = 0x05, + QueryMemory = 0x06, + ExitProcess = 0x07, + CreateThread = 0x08, + StartThread = 0x09, + ExitThread = 0x0A, + SleepThread = 0x0B, + GetThreadPriority = 0x0C, + SetThreadPriority = 0x0D, + GetThreadCoreMask = 0x0E, + SetThreadCoreMask = 0x0F, + GetCurrentProcessorNumber = 0x10, + SignalEvent = 0x11, + ClearEvent = 0x12, + MapSharedMemory = 0x13, + UnmapSharedMemory = 0x14, + CreateTransferMemory = 0x15, + CloseHandle = 0x16, + ResetSignal = 0x17, + WaitSynchronization = 0x18, + CancelSynchronization = 0x19, + ArbitrateLock = 0x1A, + ArbitrateUnlock = 0x1B, + WaitProcessWideKeyAtomic = 0x1C, + SignalProcessWideKey = 0x1D, + GetSystemTick = 0x1E, + ConnectToNamedPort = 0x1F, + SendSyncRequestLight = 0x20, + SendSyncRequest = 0x21, + SendSyncRequestWithUserBuffer = 0x22, + SendAsyncRequestWithUserBuffer = 0x23, + GetProcessId = 0x24, + GetThreadId = 0x25, + Break = 0x26, + OutputDebugString = 0x27, + ReturnFromException = 0x28, + GetInfo = 0x29, + FlushEntireDataCache = 0x2A, + FlushDataCache = 0x2B, + MapPhysicalMemory = 0x2C, + UnmapPhysicalMemory = 0x2D, + GetFutureThreadInfo = 0x2E, + GetLastThreadInfo = 0x2F, + GetResourceLimitLimitValue = 0x30, + GetResourceLimitCurrentValue = 0x31, + SetThreadActivity = 0x32, + GetThreadContext3 = 0x33, + WaitForAddress = 0x34, + SignalToAddress = 0x35, + DumpInfo = 0x3C, + DumpInfoNew = 0x3D, + CreateSession = 0x40, + AcceptSession = 0x41, + ReplyAndReceiveLight = 0x42, + ReplyAndReceive = 0x43, + ReplyAndReceiveWithUserBuffer = 0x44, + CreateEvent = 0x45, + MapPhysicalMemoryUnsafe = 0x48, + UnmapPhysicalMemoryUnsafe = 0x49, + SetUnsafeLimit = 0x4A, + CreateCodeMemory = 0x4B, + ControlCodeMemory = 0x4C, + SleepSystem = 0x4D, + ReadWriteRegister = 0x4E, + SetProcessActivity = 0x4F, + CreateSharedMemory = 0x50, + MapTransferMemory = 0x51, + UnmapTransferMemory = 0x52, + CreateInterruptEvent = 0x53, + QueryPhysicalAddress = 0x54, + QueryIoMapping = 0x55, + CreateDeviceAddressSpace = 0x56, + AttachDeviceAddressSpace = 0x57, + DetachDeviceAddressSpace = 0x58, + MapDeviceAddressSpaceByForce = 0x59, + MapDeviceAddressSpaceAligned = 0x5A, + MapDeviceAddressSpace = 0x5B, + UnmapDeviceAddressSpace = 0x5C, + InvalidateProcessDataCache = 0x5D, + StoreProcessDataCache = 0x5E, + FlushProcessDataCache = 0x5F, + DebugActiveProcess = 0x60, + BreakDebugProcess = 0x61, + TerminateDebugProcess = 0x62, + GetDebugEvent = 0x63, + ContinueDebugEvent = 0x64, + GetProcessList = 0x65, + GetThreadList = 0x66, + GetDebugThreadContext = 0x67, + SetDebugThreadContext = 0x68, + QueryDebugProcessMemory = 0x69, + ReadDebugProcessMemory = 0x6A, + WriteDebugProcessMemory = 0x6B, + SetHardwareBreakPoint = 0x6C, + GetDebugThreadParam = 0x6D, + GetSystemInfo = 0x6F, + CreatePort = 0x70, + ManageNamedPort = 0x71, + ConnectToPort = 0x72, + SetProcessMemoryPermission = 0x73, + MapProcessMemory = 0x74, + UnmapProcessMemory = 0x75, + QueryProcessMemory = 0x76, + MapProcessCodeMemory = 0x77, + UnmapProcessCodeMemory = 0x78, + CreateProcess = 0x79, + StartProcess = 0x7A, + TerminateProcess = 0x7B, + GetProcessInfo = 0x7C, + CreateResourceLimit = 0x7D, + SetResourceLimitLimitValue = 0x7E, + CallSecureMonitor = 0x7F, + + // Sunrise extensions + MapFramebuffer = 0x80, + StartProcessEntrypoint = 0x81, + MapMmioRegion = 0x82, + SetThreadArea = 0x83, +} \ No newline at end of file From 9d0a9dc1161c1f7a07e2fa8db75742fb6d6002c0 Mon Sep 17 00:00:00 2001 From: roblabla Date: Tue, 7 Apr 2020 14:23:29 +0000 Subject: [PATCH 3/3] Use latest experiment in RSA crate for PSS integration --- Cargo.lock | 387 +++++++++++++++++++++++++-------------------- Cargo.toml | 3 +- src/format/npdm.rs | 2 +- 3 files changed, 215 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21872d9..d5bf68a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,7 +67,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -84,7 +84,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -95,7 +95,7 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -106,6 +106,11 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bincode" version = "1.1.4" @@ -239,25 +244,27 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "clap" -version = "2.32.0" +name = "chrono" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cloudabi" -version = "0.0.3" +name = "clap" +version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,7 +323,7 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -370,11 +377,6 @@ name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -397,6 +399,16 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "glob" version = "0.2.11" @@ -445,17 +457,17 @@ name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "spin 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.2.49" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libm" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -469,7 +481,7 @@ dependencies = [ "blz-nx 0.1.0 (git+https://github.com/Thog/blz-nx-rs)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.0 (git+https://github.com/roblabla/cargo_metadata)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "cmac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -480,7 +492,8 @@ dependencies = [ "lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "pem 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rsa 0.1.4-alpha.0", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rsa 0.2.0 (git+https://github.com/RustCrypto/RSA?rev=11500ed)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "scroll 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -505,7 +518,7 @@ name = "lz4" version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "lz4-sys 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "skeptic 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -516,7 +529,7 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -545,20 +558,20 @@ dependencies = [ [[package]] name = "num-bigint-dig" -version = "0.3.1-alpha.0" -source = "git+https://github.com/SunriseOS/num-bigint?branch=nostd#47d3be37a36995c462ed7bdd70c325e00270e583" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -601,6 +614,16 @@ dependencies = [ "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pem" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -611,6 +634,11 @@ name = "plain" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ppv-lite86" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro2" version = "0.4.24" @@ -619,6 +647,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "pulldown-cmark" version = "0.1.2" @@ -636,117 +672,58 @@ dependencies = [ ] [[package]] -name = "rand" -version = "0.4.3" +name = "quote" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.6.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_chacha" -version = "0.1.1" +name = "rand" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.3.1" +name = "rand_chacha" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rdrand" -version = "0.4.0" +name = "rand_hc" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -799,22 +776,23 @@ dependencies = [ [[package]] name = "rsa" -version = "0.1.4-alpha.0" +version = "0.2.0" +source = "git+https://github.com/RustCrypto/RSA?rev=11500ed#11500ed5e920b916a147107b89eaeced6dba0617" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-bigint-dig 0.3.1-alpha.0 (git+https://github.com/SunriseOS/num-bigint?branch=nostd)", + "num-bigint-dig 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "signature 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "simple_asn1 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -910,17 +888,6 @@ dependencies = [ "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "sha-1" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sha2" version = "0.8.0" @@ -933,9 +900,14 @@ dependencies = [ ] [[package]] -name = "signature" -version = "0.2.0" +name = "simple_asn1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "skeptic" @@ -954,17 +926,17 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.10" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "spin" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "strsim" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -972,7 +944,7 @@ name = "structopt" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -994,7 +966,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.1.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1017,6 +989,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" version = "0.10.1" @@ -1028,6 +1010,17 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synstructure" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tempdir" version = "0.3.7" @@ -1042,19 +1035,37 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thiserror" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thiserror-impl 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread_local" version = "0.3.6" @@ -1063,6 +1074,16 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" version = "1.10.0" @@ -1096,6 +1117,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.7.1" @@ -1121,6 +1147,11 @@ dependencies = [ "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.5" @@ -1158,20 +1189,21 @@ dependencies = [ [[package]] name = "zeroize" -version = "0.6.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "zeroize_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize_derive" -version = "0.1.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -1187,6 +1219,7 @@ dependencies = [ "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" "checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" "checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" @@ -1205,8 +1238,8 @@ dependencies = [ "checksum cargo_metadata 0.6.0 (git+https://github.com/roblabla/cargo_metadata)" = "" "checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cmac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f4a435124bcc292eba031f1f725d7abacdaf13cbf9f935450e8c45aa9e96cad" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" @@ -1220,10 +1253,10 @@ dependencies = [ "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" +"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5911d7df7b8f65ab676c5327b50acea29d3c6a1a4ad05e444cf5dce321b26db2" "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" @@ -1231,8 +1264,8 @@ dependencies = [ "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "413f3dfc802c5dc91dc570b05125b6cda9855edfaa9825c9849807876376e70e" -"checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" +"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" +"checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" "checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43c94a9f09a60017f373020cc93d4291db4cd92b0db64ff25927f27d09dc23d5" "checksum lz4-sys 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "20ab022822e9331c58d373acdd6b98085bace058ac6837b8266f213a2fccdafe" @@ -1240,35 +1273,33 @@ dependencies = [ "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" -"checksum num-bigint-dig 0.3.1-alpha.0 (git+https://github.com/SunriseOS/num-bigint?branch=nostd)" = "" +"checksum num-bigint-dig 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3d03c330f9f7a2c19e3c0b42698e48141d0809c78cd9b6219f85bd7d7e892aa" "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" "checksum pem 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39eb474073dfddbf7156515344266245d91ce698ddbf15e0498cef22b836f45a" +"checksum pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1581760c757a756a41f0ee3ff01256227bdf64cb752839779b95ffb01c59793" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" "checksum quote 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b71f9f575d55555aa9c06188be9d4e2bfc83ed02537948ac0d520c24d0419f1a" +"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" -"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" "checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" "checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" +"checksum rsa 0.2.0 (git+https://github.com/RustCrypto/RSA?rev=11500ed)" = "" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -1282,37 +1313,43 @@ dependencies = [ "checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" "checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" -"checksum signature 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "144b5d1138a4339c839603f15f69ffe3195e51b5caa92f815b47d4553db47337" +"checksum simple_asn1 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2b25ecba7165254f0c97d6c22a64b1122a03634b18d20a34daf21e18f892e618" "checksum skeptic 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c4474d6da9593171bcb086890fc344a3a12783cb24e5b141f8a5d0e43561f4b6" -"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" -"checksum spin 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbdb51a221842709c2dd65b62ad4b78289fc3e706a02c17a26104528b6aa7837" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" "checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" +"checksum subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" "checksum syn 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e13df71f29f9440b50261a5882c86eac334f1badb3134ec26f0de2f1418e44" "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" +"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f0570dc61221295909abdb95c739f2e74325e14293b2026b0a7e195091ec54ae" +"checksum thiserror-impl 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "227362df41d566be41a28f64401e07a043157c21c14b9785a0d8e256f940a8fd" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "af464bc7be7b785c7ac72e266a6b67c4c9070155606f51655a650a6686204e35" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum yasna 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a563d10ead87e2d798e357d44f40f495ad70bcee4d5c0d3f77a5b1b7376645d9" -"checksum zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e68403b858b6af538b11614e62dfe9ab2facba9f13a0cafb974855cfb495ec95" -"checksum zeroize_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3f07490820219949839d0027b965ffdd659d75be9220c00798762e36c6cd281" +"checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" +"checksum zeroize_derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" diff --git a/Cargo.toml b/Cargo.toml index d6ed6af..ce2b14b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,8 @@ bit_field = "0.10.0" bincode = "1.1.4" yasna = { version = "0.3", features = ["num-bigint"] } pem = "0.6" -rsa = { path = "../RSA" } +rand = "0.7" +rsa = { git = "https://github.com/RustCrypto/RSA", rev = "11500ed" } hex = "0.3" [features] diff --git a/src/format/npdm.rs b/src/format/npdm.rs index bfd1dcf..41b136c 100644 --- a/src/format/npdm.rs +++ b/src/format/npdm.rs @@ -255,7 +255,7 @@ impl NpdmJson { write_acid(&mut hash, self, &meta)?; let hash = hash.result(); println!("Signing over {:02x?}", hash); - let sig = pkey.sign(rsa::PaddingScheme::PSS, Some(&rsa::hash::Hashes::SHA2_256), &hash)?; + let sig = pkey.sign(rsa::PaddingScheme::new_pss::(rand::thread_rng()), &hash)?; assert_eq!(sig.len(), 0x100, "Signature of wrong length generated"); file.write_all(&sig)?;