feat: updates

This commit is contained in:
2025-03-31 00:32:29 +08:00
parent 4dac890200
commit dc56f2df77
4 changed files with 11 additions and 9 deletions

View File

@@ -37,9 +37,7 @@ impl Command for CommandImpl {
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
let json_output = cmdutil::check_json_output(sub_arg_matches); let json_output = cmdutil::check_json_output(sub_arg_matches);
if !seutil::is_support_se() { seutil::check_se_supported()?;
return simple_error!("Secure Enclave is NOT supported.");
}
let key = sub_arg_matches.value_of("key").unwrap(); let key = sub_arg_matches.value_of("key").unwrap();
let epk = sub_arg_matches.value_of("epk").unwrap(); let epk = sub_arg_matches.value_of("epk").unwrap();

View File

@@ -41,9 +41,7 @@ impl Command for CommandImpl {
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
let json_output = cmdutil::check_json_output(sub_arg_matches); let json_output = cmdutil::check_json_output(sub_arg_matches);
if !seutil::is_support_se() { seutil::check_se_supported()?;
return simple_error!("Secure Enclave is NOT supported.");
}
let key = sub_arg_matches.value_of("key").unwrap(); let key = sub_arg_matches.value_of("key").unwrap();
let input_bytes = match sub_arg_matches.value_of("input") { let input_bytes = match sub_arg_matches.value_of("input") {
None => match sub_arg_matches.value_of("input-base64") { None => match sub_arg_matches.value_of("input-base64") {

View File

@@ -42,9 +42,7 @@ impl Command for CommandImpl {
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
let json_output = cmdutil::check_json_output(sub_arg_matches); let json_output = cmdutil::check_json_output(sub_arg_matches);
if !seutil::is_support_se() { seutil::check_se_supported()?;
return simple_error!("Secure Enclave is NOT supported.");
}
let ty = sub_arg_matches.value_of("type").unwrap(); let ty = sub_arg_matches.value_of("type").unwrap();
let host = sub_arg_matches.value_of("host").unwrap_or("macbook"); let host = sub_arg_matches.value_of("host").unwrap_or("macbook");

View File

@@ -10,6 +10,14 @@ pub fn is_support_se() -> bool {
}) })
} }
pub fn check_se_supported() -> XResult<()> {
if !is_support_se() {
simple_error!("Secure Enclave is NOT supported.")
} else {
Ok(())
}
}
pub fn generate_secure_enclave_p256_keypair( pub fn generate_secure_enclave_p256_keypair(
sign: bool, sign: bool,
require_bio: bool, require_bio: bool,