mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "AuthGraph VTS: detect additional errors" into main am: f4cb6de19c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2838658 Change-Id: I7c2bc33984ec60f6864461de36cae3ed885640d1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -50,6 +50,7 @@ cc_test {
|
|||||||
rust_test {
|
rust_test {
|
||||||
name: "VtsAidlAuthGraphRoleTest",
|
name: "VtsAidlAuthGraphRoleTest",
|
||||||
srcs: ["role_test.rs"],
|
srcs: ["role_test.rs"],
|
||||||
|
require_root: true,
|
||||||
test_suites: [
|
test_suites: [
|
||||||
"general-tests",
|
"general-tests",
|
||||||
"vts",
|
"vts",
|
||||||
|
|||||||
@@ -22,13 +22,18 @@ use authgraph_vts_test as vts;
|
|||||||
use android_hardware_security_authgraph::aidl::android::hardware::security::authgraph::{
|
use android_hardware_security_authgraph::aidl::android::hardware::security::authgraph::{
|
||||||
IAuthGraphKeyExchange::IAuthGraphKeyExchange,
|
IAuthGraphKeyExchange::IAuthGraphKeyExchange,
|
||||||
};
|
};
|
||||||
|
use binder::StatusCode;
|
||||||
|
|
||||||
const AUTH_GRAPH_NONSECURE: &str =
|
const AUTH_GRAPH_NONSECURE: &str =
|
||||||
"android.hardware.security.authgraph.IAuthGraphKeyExchange/nonsecure";
|
"android.hardware.security.authgraph.IAuthGraphKeyExchange/nonsecure";
|
||||||
|
|
||||||
/// Retrieve the /nonsecure instance of AuthGraph, which supports both sink and source roles.
|
/// Retrieve the /nonsecure instance of AuthGraph, which supports both sink and source roles.
|
||||||
fn get_nonsecure() -> Option<binder::Strong<dyn IAuthGraphKeyExchange>> {
|
fn get_nonsecure() -> Option<binder::Strong<dyn IAuthGraphKeyExchange>> {
|
||||||
binder::get_interface(AUTH_GRAPH_NONSECURE).ok()
|
match binder::get_interface(AUTH_GRAPH_NONSECURE) {
|
||||||
|
Ok(ag) => Some(ag),
|
||||||
|
Err(StatusCode::NAME_NOT_FOUND) => None,
|
||||||
|
Err(e) => panic!("failed to get AuthGraph/nonsecure: {e:?}"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Macro to require availability of a /nonsecure instance of AuthGraph.
|
/// Macro to require availability of a /nonsecure instance of AuthGraph.
|
||||||
|
|||||||
@@ -250,9 +250,13 @@ pub fn test_corrupt_key(
|
|||||||
&corrupt_key,
|
&corrupt_key,
|
||||||
);
|
);
|
||||||
|
|
||||||
let err = result.expect_err("expect failure with corrupt signature");
|
let err = result.expect_err("expect failure with corrupt key");
|
||||||
assert_eq!(
|
assert!(
|
||||||
err,
|
err == binder::Status::new_service_specific_error(Error::INVALID_KE_KEY.0, None)
|
||||||
binder::Status::new_service_specific_error(Error::INVALID_PRIV_KEY_ARC_IN_KEY.0, None)
|
|| err
|
||||||
|
== binder::Status::new_service_specific_error(
|
||||||
|
Error::INVALID_PRIV_KEY_ARC_IN_KEY.0,
|
||||||
|
None
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user