blob: d53ff5abc6bbfc3ec4f516e229abcc2d3e6c510c [file] [log] [blame]
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TODO: Remove this after enabling the test.
#[allow(dead_code)]
#[cfg(test)]
mod tests {
use tipc::{Handle, TipcError};
use trusty_std::ffi::{CString, FallibleCString};
test::init!();
/// Port that handles secure world messages
const KM_SEC_TIPC_SRV_PORT: &str = "com.android.trusty.keymaster.secure";
// TODO: Removing tests for now until we have the Rust implementation as the default keymint;
// put them back once we finish switching to the Rust implementation.
// #[test]
fn test_access_policy_unauthorized() {
let port2 = CString::try_new(KM_SEC_TIPC_SRV_PORT).unwrap();
let err1 = Handle::connect(port2.as_c_str()).expect_err(
"An error is expected because the uuid of this test app is
not in the allowed uuid list of the keymint access policy.",
);
assert_eq!(err1, TipcError::SystemError(trusty_sys::Error::ChannelClosed));
}
}