diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ffi.rs | 607 | 
1 files changed, 558 insertions, 49 deletions
| @@ -1,11 +1,467 @@  /* automatically generated by rust-bindgen, manually modified */ +/// Use, if no supported device is connected +pub const NK_device_model_NK_DISCONNECTED: NK_device_model = 0;  /// Nitrokey Pro. -pub const NK_device_model_NK_PRO: NK_device_model = 0; +pub const NK_device_model_NK_PRO: NK_device_model = 1;  /// Nitrokey Storage. -pub const NK_device_model_NK_STORAGE: NK_device_model = 1; +pub const NK_device_model_NK_STORAGE: NK_device_model = 2;  /// The Nitrokey device models supported by the API.  pub type NK_device_model = u32; +/// Stores the status of a Storage device. +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct NK_storage_status { +    /// Indicates whether the unencrypted volume is read-only. +    pub unencrypted_volume_read_only: bool, +    /// Indicates whether the unencrypted volume is active. +    pub unencrypted_volume_active: bool, +    /// Indicates whether the encrypted volume is read-only. +    pub encrypted_volume_read_only: bool, +    /// Indicates whether the encrypted volume is active. +    pub encrypted_volume_active: bool, +    /// Indicates whether the hidden volume is read-only. +    pub hidden_volume_read_only: bool, +    /// Indicates whether the hidden volume is active. +    pub hidden_volume_active: bool, +    /// The major firmware version, e. g. 0 in v0.40. +    pub firmware_version_major: u8, +    /// The minor firmware version, e. g. 40 in v0.40. +    pub firmware_version_minor: u8, +    /// Indicates whether the firmware is locked. +    pub firmware_locked: bool, +    /// The serial number of the SD card in the Storage stick. +    pub serial_number_sd_card: u32, +    /// The serial number of the smart card in the Storage stick. +    pub serial_number_smart_card: u32, +    /// The number of remaining login attempts for the user PIN. +    pub user_retry_count: u8, +    /// The number of remaining login attempts for the admin PIN. +    pub admin_retry_count: u8, +    /// Indicates whether a new SD card was found. +    pub new_sd_card_found: bool, +    /// Indicates whether the SD card is filled with random characters. +    pub filled_with_random: bool, +    /// Indicates whether the stick has been initialized by generating +    /// the AES keys. +    pub stick_initialized: bool, +} +#[test] +fn bindgen_test_layout_NK_storage_status() { +    assert_eq!( +        ::std::mem::size_of::<NK_storage_status>(), +        28usize, +        concat!("Size of: ", stringify!(NK_storage_status)) +    ); +    assert_eq!( +        ::std::mem::align_of::<NK_storage_status>(), +        4usize, +        concat!("Alignment of ", stringify!(NK_storage_status)) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).unencrypted_volume_read_only as *const _ +                as usize +        }, +        0usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(unencrypted_volume_read_only) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).unencrypted_volume_active as *const _ +                as usize +        }, +        1usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(unencrypted_volume_active) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).encrypted_volume_read_only as *const _ +                as usize +        }, +        2usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(encrypted_volume_read_only) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).encrypted_volume_active as *const _ +                as usize +        }, +        3usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(encrypted_volume_active) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).hidden_volume_read_only as *const _ +                as usize +        }, +        4usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(hidden_volume_read_only) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).hidden_volume_active as *const _ as usize +        }, +        5usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(hidden_volume_active) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).firmware_version_major as *const _ +                as usize +        }, +        6usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(firmware_version_major) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).firmware_version_minor as *const _ +                as usize +        }, +        7usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(firmware_version_minor) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).firmware_locked as *const _ as usize +        }, +        8usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(firmware_locked) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).serial_number_sd_card as *const _ as usize +        }, +        12usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(serial_number_sd_card) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).serial_number_smart_card as *const _ +                as usize +        }, +        16usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(serial_number_smart_card) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).user_retry_count as *const _ as usize +        }, +        20usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(user_retry_count) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).admin_retry_count as *const _ as usize +        }, +        21usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(admin_retry_count) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).new_sd_card_found as *const _ as usize +        }, +        22usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(new_sd_card_found) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).filled_with_random as *const _ as usize +        }, +        23usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(filled_with_random) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_status>())).stick_initialized as *const _ as usize +        }, +        24usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_status), +            "::", +            stringify!(stick_initialized) +        ) +    ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct NK_storage_ProductionTest { +    pub FirmwareVersion_au8: [u8; 2usize], +    pub FirmwareVersionInternal_u8: u8, +    pub SD_Card_Size_u8: u8, +    pub CPU_CardID_u32: u32, +    pub SmartCardID_u32: u32, +    pub SD_CardID_u32: u32, +    pub SC_UserPwRetryCount: u8, +    pub SC_AdminPwRetryCount: u8, +    pub SD_Card_ManufacturingYear_u8: u8, +    pub SD_Card_ManufacturingMonth_u8: u8, +    pub SD_Card_OEM_u16: u16, +    pub SD_WriteSpeed_u16: u16, +    pub SD_Card_Manufacturer_u8: u8, +} +#[test] +fn bindgen_test_layout_NK_storage_ProductionTest() { +    assert_eq!( +        ::std::mem::size_of::<NK_storage_ProductionTest>(), +        28usize, +        concat!("Size of: ", stringify!(NK_storage_ProductionTest)) +    ); +    assert_eq!( +        ::std::mem::align_of::<NK_storage_ProductionTest>(), +        4usize, +        concat!("Alignment of ", stringify!(NK_storage_ProductionTest)) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).FirmwareVersion_au8 as *const _ +                as usize +        }, +        0usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(FirmwareVersion_au8) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).FirmwareVersionInternal_u8 +                as *const _ as usize +        }, +        2usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(FirmwareVersionInternal_u8) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_Card_Size_u8 as *const _ +                as usize +        }, +        3usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_Card_Size_u8) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).CPU_CardID_u32 as *const _ +                as usize +        }, +        4usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(CPU_CardID_u32) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SmartCardID_u32 as *const _ +                as usize +        }, +        8usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SmartCardID_u32) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_CardID_u32 as *const _ as usize +        }, +        12usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_CardID_u32) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SC_UserPwRetryCount as *const _ +                as usize +        }, +        16usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SC_UserPwRetryCount) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SC_AdminPwRetryCount as *const _ +                as usize +        }, +        17usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SC_AdminPwRetryCount) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_Card_ManufacturingYear_u8 +                as *const _ as usize +        }, +        18usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_Card_ManufacturingYear_u8) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_Card_ManufacturingMonth_u8 +                as *const _ as usize +        }, +        19usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_Card_ManufacturingMonth_u8) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_Card_OEM_u16 as *const _ +                as usize +        }, +        20usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_Card_OEM_u16) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_WriteSpeed_u16 as *const _ +                as usize +        }, +        22usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_WriteSpeed_u16) +        ) +    ); +    assert_eq!( +        unsafe { +            &(*(::std::ptr::null::<NK_storage_ProductionTest>())).SD_Card_Manufacturer_u8 +                as *const _ as usize +        }, +        24usize, +        concat!( +            "Offset of field: ", +            stringify!(NK_storage_ProductionTest), +            "::", +            stringify!(SD_Card_Manufacturer_u8) +        ) +    ); +} +extern "C" { +    pub fn NK_get_storage_production_info( +        out: *mut NK_storage_ProductionTest, +    ) -> ::std::os::raw::c_int; +}  extern "C" {      /// Set debug level of messages written on stderr      /// @param state state=True - most messages, state=False - only errors level @@ -17,6 +473,24 @@ extern "C" {      pub fn NK_set_debug_level(level: ::std::os::raw::c_int);  }  extern "C" { +    /// Get the major library version, e. g. the 3 in v3.2. +    /// @return the major library version +    pub fn NK_get_major_library_version() -> ::std::os::raw::c_uint; +} +extern "C" { +    /// Get the minor library version, e. g. the 2 in v3.2. +    /// @return the minor library version +    pub fn NK_get_minor_library_version() -> ::std::os::raw::c_uint; +} +extern "C" { +    /// Get the library version as a string.  This is the output of +    /// `git describe --always` at compile time, for example "v3.3" or +    /// "v3.3-19-gaee920b". +    /// The return value is a string literal and must not be freed. +    /// @return the library version as a string +    pub fn NK_get_library_version() -> *const ::std::os::raw::c_char; +} +extern "C" {      /// Connect to device of given model. Currently library can be connected only to one device at once.      /// @param device_model char 'S': Nitrokey Storage, 'P': Nitrokey Pro      /// @return 1 if connected, 0 if wrong model or cannot connect @@ -39,14 +513,21 @@ extern "C" {      pub fn NK_logout() -> ::std::os::raw::c_int;  }  extern "C" { +    /// Query the model of the connected device. +    /// Returns the model of the connected device or NK_DISCONNECTED. +    /// +    /// @return true if a device is connected and the out argument has been set +    pub fn NK_get_device_model() -> NK_device_model; +} +extern "C" {      /// Return the debug status string. Debug purposes.      /// @return command processing error code -    pub fn NK_status() -> *const ::std::os::raw::c_char; +    pub fn NK_status() -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Return the device's serial number string in hex.      /// @return string device's serial number in hex -    pub fn NK_device_serial_number() -> *const ::std::os::raw::c_char; +    pub fn NK_device_serial_number() -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get last command processing status. Useful for commands which returns the results of their own and could not return @@ -61,8 +542,8 @@ extern "C" {  }  extern "C" {      /// Authenticates the user on USER privilages with user_password and sets user's temporary password on device to user_temporary_password. -    /// @param user_password char[25](Pro) current user password -    /// @param user_temporary_password char[25](Pro) user temporary password to be set on device for further communication (authentication command) +    /// @param user_password char[25] current user password +    /// @param user_temporary_password char[25] user temporary password to be set on device for further communication (authentication command)      /// @return command processing error code      pub fn NK_user_authenticate(          user_password: *const ::std::os::raw::c_char, @@ -71,8 +552,8 @@ extern "C" {  }  extern "C" {      /// Authenticates the user on ADMIN privilages with admin_password and sets user's temporary password on device to admin_temporary_password. -    /// @param admin_password char[25](Pro) current administrator PIN -    /// @param admin_temporary_password char[25](Pro) admin temporary password to be set on device for further communication (authentication command) +    /// @param admin_password char[25] current administrator PIN +    /// @param admin_temporary_password char[25] admin temporary password to be set on device for further communication (authentication command)      /// @return command processing error code      pub fn NK_first_authenticate(          admin_password: *const ::std::os::raw::c_char, @@ -81,21 +562,21 @@ extern "C" {  }  extern "C" {      /// Execute a factory reset. -    /// @param admin_password char[20](Pro) current administrator PIN +    /// @param admin_password char[20] current administrator PIN      /// @return command processing error code      pub fn NK_factory_reset(admin_password: *const ::std::os::raw::c_char)          -> ::std::os::raw::c_int;  }  extern "C" {      /// Generates AES key on the device -    /// @param admin_password char[20](Pro) current administrator PIN +    /// @param admin_password char[20] current administrator PIN      /// @return command processing error code      pub fn NK_build_aes_key(admin_password: *const ::std::os::raw::c_char)          -> ::std::os::raw::c_int;  }  extern "C" {      /// Unlock user PIN locked after 3 incorrect codes tries. -    /// @param admin_password char[20](Pro) current administrator PIN +    /// @param admin_password char[20] current administrator PIN      /// @return command processing error code      pub fn NK_unlock_user_password(          admin_password: *const ::std::os::raw::c_char, @@ -135,13 +616,13 @@ extern "C" {  extern "C" {      /// Get name of given TOTP slot      /// @param slot_number TOTP slot number, slot_number<15 -    /// @return char[20](Pro) the name of the slot -    pub fn NK_get_totp_slot_name(slot_number: u8) -> *const ::std::os::raw::c_char; +    /// @return char[20] the name of the slot +    pub fn NK_get_totp_slot_name(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// @param slot_number HOTP slot number, slot_number<3 -    /// @return char[20](Pro) the name of the slot -    pub fn NK_get_hotp_slot_name(slot_number: u8) -> *const ::std::os::raw::c_char; +    /// @return char[20] the name of the slot +    pub fn NK_get_hotp_slot_name(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Erase HOTP slot data from the device @@ -165,15 +646,16 @@ extern "C" {  }  extern "C" {      /// Write HOTP slot data to the device -    /// @param slot_number HOTP slot number, slot_number<3 -    /// @param slot_name char[15](Pro) desired slot name -    /// @param secret char[20](Pro) 160-bit secret +    /// @param slot_number HOTP slot number, slot_number<3, 0-numbered +    /// @param slot_name char[15] desired slot name. C string (requires ending '\0'; 16 bytes). +    /// @param secret char[40] 160-bit or 320-bit (currently Pro v0.8 only) secret as a hex string. C string (requires ending '\0'; 41 bytes). +    /// See NitrokeyManager::is_320_OTP_secret_supported.      /// @param hotp_counter uint32_t starting value of HOTP counter      /// @param use_8_digits should returned codes be 6 (false) or 8 digits (true)      /// @param use_enter press ENTER key after sending OTP code using double-pressed scroll/num/capslock      /// @param use_tokenID @see token_ID      /// @param token_ID @see https://openauthentication.org/token-specs/, 'Class A' section -    /// @param temporary_password char[25](Pro) admin temporary password +    /// @param temporary_password char[25] admin temporary password      /// @return command processing error code      pub fn NK_write_hotp_slot(          slot_number: u8, @@ -189,15 +671,16 @@ extern "C" {  }  extern "C" {      /// Write TOTP slot data to the device -    /// @param slot_number TOTP slot number, slot_number<15 -    /// @param slot_name char[15](Pro) desired slot name -    /// @param secret char[20](Pro) 160-bit secret +    /// @param slot_number TOTP slot number, slot_number<15, 0-numbered +    /// @param slot_name char[15] desired slot name. C string (requires ending '\0'; 16 bytes). +    /// @param secret char[40] 160-bit or 320-bit (currently Pro v0.8 only) secret as a hex string. C string (requires ending '\0'; 41 bytes). +    /// See NitrokeyManager::is_320_OTP_secret_supported.      /// @param time_window uint16_t time window for this TOTP      /// @param use_8_digits should returned codes be 6 (false) or 8 digits (true)      /// @param use_enter press ENTER key after sending OTP code using double-pressed scroll/num/capslock      /// @param use_tokenID @see token_ID      /// @param token_ID @see https://openauthentication.org/token-specs/, 'Class A' section -    /// @param temporary_password char[20](Pro) admin temporary password +    /// @param temporary_password char[20] admin temporary password      /// @return command processing error code      pub fn NK_write_totp_slot(          slot_number: u8, @@ -215,40 +698,40 @@ extern "C" {      /// Get HOTP code from the device      /// @param slot_number HOTP slot number, slot_number<3      /// @return HOTP code -    pub fn NK_get_hotp_code(slot_number: u8) -> *const ::std::os::raw::c_char; +    pub fn NK_get_hotp_code(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get HOTP code from the device (PIN protected)      /// @param slot_number HOTP slot number, slot_number<3 -    /// @param user_temporary_password char[25](Pro) user temporary password if PIN protected OTP codes are enabled, +    /// @param user_temporary_password char[25] user temporary password if PIN protected OTP codes are enabled,      /// otherwise should be set to empty string - ''      /// @return HOTP code      pub fn NK_get_hotp_code_PIN(          slot_number: u8,          user_temporary_password: *const ::std::os::raw::c_char, -    ) -> *const ::std::os::raw::c_char; +    ) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get TOTP code from the device      /// @param slot_number TOTP slot number, slot_number<15 -    /// @param challenge TOTP challenge -    /// @param last_totp_time last time -    /// @param last_interval last interval +    /// @param challenge TOTP challenge -- unused +    /// @param last_totp_time last time -- unused +    /// @param last_interval last interval --unused      /// @return TOTP code      pub fn NK_get_totp_code(          slot_number: u8,          challenge: u64,          last_totp_time: u64,          last_interval: u8, -    ) -> *const ::std::os::raw::c_char; +    ) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get TOTP code from the device (PIN protected)      /// @param slot_number TOTP slot number, slot_number<15 -    /// @param challenge TOTP challenge -    /// @param last_totp_time last time -    /// @param last_interval last interval -    /// @param user_temporary_password char[25](Pro) user temporary password if PIN protected OTP codes are enabled, +    /// @param challenge TOTP challenge -- unused +    /// @param last_totp_time last time -- unused +    /// @param last_interval last interval -- unused +    /// @param user_temporary_password char[25] user temporary password if PIN protected OTP codes are enabled,      /// otherwise should be set to empty string - ''      /// @return TOTP code      pub fn NK_get_totp_code_PIN( @@ -257,7 +740,7 @@ extern "C" {          last_totp_time: u64,          last_interval: u8,          user_temporary_password: *const ::std::os::raw::c_char, -    ) -> *const ::std::os::raw::c_char; +    ) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Set time on the device (for TOTP requests) @@ -266,12 +749,23 @@ extern "C" {      pub fn NK_totp_set_time(time: u64) -> ::std::os::raw::c_int;  }  extern "C" { +    /// Set the device time used for TOTP to the given time.  Contrary to +    /// {@code set_time(uint64_t)}, this command fails if {@code old_time} +    /// > {@code time} or if {@code old_time} is zero (where {@code +    /// old_time} is the current time on the device). +    /// +    /// @param time new device time as Unix timestamp (seconds since +    /// 1970-01-01) +    /// @return command processing error code +    pub fn NK_totp_set_time_soft(time: u64) -> ::std::os::raw::c_int; +} +extern "C" {      pub fn NK_totp_get_time() -> ::std::os::raw::c_int;  }  extern "C" {      /// Change administrator PIN -    /// @param current_PIN char[25](Pro) current PIN -    /// @param new_PIN char[25](Pro) new PIN +    /// @param current_PIN char[25] current PIN +    /// @param new_PIN char[25] new PIN      /// @return command processing error code      pub fn NK_change_admin_PIN(          current_PIN: *const ::std::os::raw::c_char, @@ -280,8 +774,8 @@ extern "C" {  }  extern "C" {      /// Change user PIN -    /// @param current_PIN char[25](Pro) current PIN -    /// @param new_PIN char[25](Pro) new PIN +    /// @param current_PIN char[25] current PIN +    /// @param new_PIN char[25] new PIN      /// @return command processing error code      pub fn NK_change_user_PIN(          current_PIN: *const ::std::os::raw::c_char, @@ -300,7 +794,7 @@ extern "C" {  }  extern "C" {      /// Enable password safe access -    /// @param user_pin char[30](Pro) current user PIN +    /// @param user_pin char[30] current user PIN      /// @return command processing error code      pub fn NK_enable_password_safe(          user_pin: *const ::std::os::raw::c_char, @@ -315,26 +809,26 @@ extern "C" {      /// Get password safe slot name      /// @param slot_number password safe slot number, slot_number<16      /// @return slot name -    pub fn NK_get_password_safe_slot_name(slot_number: u8) -> *const ::std::os::raw::c_char; +    pub fn NK_get_password_safe_slot_name(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get password safe slot login      /// @param slot_number password safe slot number, slot_number<16      /// @return login from the PWS slot -    pub fn NK_get_password_safe_slot_login(slot_number: u8) -> *const ::std::os::raw::c_char; +    pub fn NK_get_password_safe_slot_login(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get the password safe slot password      /// @param slot_number password safe slot number, slot_number<16      /// @return password from the PWS slot -    pub fn NK_get_password_safe_slot_password(slot_number: u8) -> *const ::std::os::raw::c_char; +    pub fn NK_get_password_safe_slot_password(slot_number: u8) -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Write password safe data to the slot      /// @param slot_number password safe slot number, slot_number<16 -    /// @param slot_name char[11](Pro) name of the slot -    /// @param slot_login char[32](Pro) login string -    /// @param slot_password char[20](Pro) password string +    /// @param slot_name char[11] name of the slot +    /// @param slot_login char[32] login string +    /// @param slot_password char[20] password string      /// @return command processing error code      pub fn NK_write_password_safe_slot(          slot_number: u8, @@ -561,14 +1055,24 @@ extern "C" {      /// Get Storage stick status as string.      /// Storage only      /// @return string with devices attributes -    pub fn NK_get_status_storage_as_string() -> *const ::std::os::raw::c_char; +    pub fn NK_get_status_storage_as_string() -> *mut ::std::os::raw::c_char; +} +extern "C" { +    /// Get the Storage stick status and return the command processing +    /// error code.  If the code is zero, i. e. the command was successful, +    /// the storage status is written to the output pointer's target. +    /// The output pointer must not be null. +    /// +    /// @param out the output pointer for the storage status +    /// @return command processing error code +    pub fn NK_get_status_storage(out: *mut NK_storage_status) -> ::std::os::raw::c_int;  }  extern "C" {      /// Get SD card usage attributes as string.      /// Usable during hidden volumes creation.      /// Storage only      /// @return string with SD card usage attributes -    pub fn NK_get_SD_usage_data_as_string() -> *const ::std::os::raw::c_char; +    pub fn NK_get_SD_usage_data_as_string() -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Get progress value of current long operation. @@ -590,7 +1094,7 @@ extern "C" {      /// Storage only      /// @example Example of returned data: '00005d19:dacc2cb4_p_0001:0010:02;000037c7:4cf12445_p_0001:000f:02;0001:000c:02'      /// @return string delimited id's of connected devices -    pub fn NK_list_devices_by_cpuID() -> *const ::std::os::raw::c_char; +    pub fn NK_list_devices_by_cpuID() -> *mut ::std::os::raw::c_char;  }  extern "C" {      /// Connects to the device with given ID. ID's list could be created with NK_list_devices_by_cpuID. @@ -601,3 +1105,8 @@ extern "C" {      /// @return 1 on successful connection, 0 otherwise      pub fn NK_connect_with_ID(id: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;  } +extern "C" { +    /// Blink red and green LED alternatively and infinitely (until device is reconnected). +    /// @return command processing error code +    pub fn NK_wink() -> ::std::os::raw::c_int; +} | 
