#[no_mangle]
pub unsafe extern "C" fn crosvm_client_security_key_attach(
    socket_path: *const c_char,
    hidraw_path: *const c_char,
    out_port: *mut u8
) -> bool
Expand description

Attaches a u2f security key to crosvm instance whose control socket is listening on socket_path.

The function returns the amount of entries written.

§Arguments

  • socket_path - Path to the crosvm control socket
  • hidraw_path - Path to the hidraw device of the security key (like /dev/hidraw0)
  • out_port - (optional) internal port will be written here if provided.

The function returns true on success or false if an error occurred.

§Safety

Function is unsafe due to raw pointer usage. Trivial !raw_pointer.is_null() checks prevent some unsafe behavior, but the caller should ensure no null pointers are passed into the function.

The safety requirements for socket_path and hidraw_path are the same as the ones from CStr::from_ptr(). out_port should be a non-null pointer that points to a writable 1byte region.