You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Refactor dtb in rust
This commit is contained in:
+10
-4
@@ -3,11 +3,14 @@
|
||||
|
||||
pub use base;
|
||||
use cpio::cpio_commands;
|
||||
use patch::{hexpatch, patch_encryption, patch_verity};
|
||||
use dtb::dtb_commands;
|
||||
use patch::hexpatch;
|
||||
use payload::extract_boot_from_payload;
|
||||
use sign::{get_sha, sha1_hash, sha256_hash, sign_boot_image, verify_boot_image, SHA};
|
||||
use std::env;
|
||||
|
||||
mod cpio;
|
||||
mod dtb;
|
||||
mod patch;
|
||||
mod payload;
|
||||
// Suppress warnings in generated code
|
||||
@@ -41,8 +44,6 @@ pub mod ffi {
|
||||
fn sha256_hash(data: &[u8], out: &mut [u8]);
|
||||
|
||||
fn hexpatch(file: &[u8], from: &[u8], to: &[u8]) -> bool;
|
||||
fn patch_encryption(buf: &mut [u8]) -> usize;
|
||||
fn patch_verity(buf: &mut [u8]) -> usize;
|
||||
}
|
||||
|
||||
#[namespace = "rust"]
|
||||
@@ -52,7 +53,6 @@ pub mod ffi {
|
||||
in_path: *const c_char,
|
||||
out_path: *const c_char,
|
||||
) -> bool;
|
||||
|
||||
unsafe fn cpio_commands(argc: i32, argv: *const *const c_char) -> bool;
|
||||
unsafe fn verify_boot_image(img: &BootImage, cert: *const c_char) -> bool;
|
||||
unsafe fn sign_boot_image(
|
||||
@@ -61,5 +61,11 @@ pub mod ffi {
|
||||
cert: *const c_char,
|
||||
key: *const c_char,
|
||||
) -> Vec<u8>;
|
||||
unsafe fn dtb_commands(argc: i32, argv: *const *const c_char) -> bool;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn check_env(env: &str) -> bool {
|
||||
env::var(env).map_or(false, |var| var == "true")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user