diff options
author | Andrew Walbran <qwandor@google.com> | 2023-07-14 14:50:38 +0100 |
---|---|---|
committer | Andrew Walbran <qwandor@google.com> | 2023-07-18 15:31:38 +0100 |
commit | 094a9c4e1709a1bb317f6d01a1bf7ebd15419eba (patch) | |
tree | e1d9024741984276b196e29ad1ffe6d6340e228f /keystore2/apc_compat | |
parent | b0a6a2adc19b94084fabf2d1f78f64ada86f9cb9 (diff) | |
download | security-094a9c4e1709a1bb317f6d01a1bf7ebd15419eba.tar.gz |
Add safety comments.
These will soon be required by a lint.
Bug: 290018030
Test: m libkeystore2_apc_compat-rust
Change-Id: Ic7e4e62e52d3361af9a275443bf097282a84f034
Diffstat (limited to 'keystore2/apc_compat')
-rw-r--r-- | keystore2/apc_compat/apc_compat.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/keystore2/apc_compat/apc_compat.rs b/keystore2/apc_compat/apc_compat.rs index 480f14dd..e97ac59a 100644 --- a/keystore2/apc_compat/apc_compat.rs +++ b/keystore2/apc_compat/apc_compat.rs @@ -53,7 +53,10 @@ use std::{ffi::CString, slice}; /// ``` pub struct ApcHal(ApcCompatServiceHandle); +// SAFETY: This is a wrapper around `ApcCompatSession`, which can be used from any thread. unsafe impl Send for ApcHal {} +// SAFETY: `ApcCompatSession` can be called simultaneously from different threads because AIDL and +// HIDL are thread-safe. unsafe impl Sync for ApcHal {} impl Drop for ApcHal { @@ -120,6 +123,7 @@ impl ApcHal { // `closeUserConfirmationService` when dropped. let handle = unsafe { tryGetUserConfirmationService() }; match handle { + // SAFETY: This is just a constant. h if h == unsafe { INVALID_SERVICE_HANDLE } => None, h => Some(Self(h)), } |