Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25946ba2 authored by David Drysdale's avatar David Drysdale Committed by Automerger Merge Worker
Browse files

AuthGraph: reduce dependency on authgraph_core am: f2117ff7

parents 124c8c8d f2117ff7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ rust_binary {
        "libauthgraph_core",
        "libauthgraph_boringssl",
        "libauthgraph_hal",
        "libauthgraph_wire",
        "libbinder_rs",
        "liblibc",
        "liblog_rust",
+8 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ use android_hardware_security_authgraph::aidl::android::hardware::security::auth
};
use authgraph_boringssl as boring;
use authgraph_core::{key::MillisecondsSinceEpoch, keyexchange as ke, traits};
use authgraph_hal::{err_to_binder, Innto, TryInnto};
use authgraph_hal::{errcode_to_binder, Innto, TryInnto};
use log::{error, info};
use std::ffi::CString;
use std::sync::Mutex;
@@ -130,6 +130,13 @@ fn unsigned_pub_key(pub_key: &PubKey) -> binder::Result<&[u8]> {
    }
}

fn err_to_binder(err: authgraph_core::error::Error) -> binder::Status {
    if err.0 != authgraph_wire::ErrorCode::Ok && !err.1.is_empty() {
        error!("failure {:?} message: '{}'", err.0, err.1);
    }
    errcode_to_binder(err.0)
}

/// This nonsecure implementation of the AuthGraph HAL interface directly calls the AuthGraph
/// reference implementation library code; a real implementation requires the AuthGraph
/// code to run in a secure environment, not within Android.