diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/deprecated.diff | 40 | ||||
-rw-r--r-- | patches/remove-uint.diff | 21 | ||||
-rw-r--r-- | patches/series | 2 |
3 files changed, 63 insertions, 0 deletions
diff --git a/patches/deprecated.diff b/patches/deprecated.diff new file mode 100644 index 0000000..e13f90f --- /dev/null +++ b/patches/deprecated.diff @@ -0,0 +1,40 @@ +Add deprecated attribute to depracted functions + +bindgen does add the deprecated attribute to deprecated functions. This patch +manually adds the attributes libnitrokey’s deprecated functions. +Index: nitrokey-sys-rs/src/ffi.rs +=================================================================== +--- nitrokey-sys-rs.orig/src/ffi.rs ++++ nitrokey-sys-rs/src/ffi.rs +@@ -212,6 +212,7 @@ extern "C" { + #[doc = " deprecated in favor of NK_get_status_as_string."] + #[doc = " @return string representation of the status or an empty string"] + #[doc = " if the command failed"] ++ #[deprecated(since = "3.5.0", note="use `NK_get_status_as_string` instead")] + pub fn NK_status() -> *mut ::std::os::raw::c_char; + } + extern "C" { +@@ -498,6 +499,7 @@ extern "C" { + pub fn NK_totp_set_time_soft(time: u64) -> ::std::os::raw::c_int; + } + extern "C" { ++ #[deprecated(since = "3.4.0", note="use `NK_totp_set_time_soft` instead")] + pub fn NK_totp_get_time() -> ::std::os::raw::c_int; + } + extern "C" { +@@ -673,6 +675,7 @@ extern "C" { + #[doc = " Storage only"] + #[doc = " @param user_pin 20 characters User PIN"] + #[doc = " @return command processing error code"] ++ #[deprecated(since = "3.6.0", note = "use `set_unencrypted_read_only_admin` instead")] + pub fn NK_set_unencrypted_read_only( + user_pin: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +@@ -686,6 +689,7 @@ extern "C" { + #[doc = " Storage only"] + #[doc = " @param user_pin 20 characters User PIN"] + #[doc = " @return command processing error code"] ++ #[deprecated(since = "3.6.0", note = "use `set_unencrypted_read_write_admin` instead")] + pub fn NK_set_unencrypted_read_write( + user_pin: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; diff --git a/patches/remove-uint.diff b/patches/remove-uint.diff new file mode 100644 index 0000000..e4c24ba --- /dev/null +++ b/patches/remove-uint.diff @@ -0,0 +1,21 @@ +Remove uint type definitions + +While bindgen is able to replace the C uint types with the correct Rust types, +it still generates typedefs for __uint{8,16,32,64}_t [0]. We don’t need these +typedefs, so we remove them manually. + +[0] https://github.com/rust-lang/rust-bindgen/issues/1663 +Index: nitrokey-sys-rs/src/ffi.rs +=================================================================== +--- nitrokey-sys-rs.orig/src/ffi.rs ++++ nitrokey-sys-rs/src/ffi.rs +@@ -1,9 +1,5 @@ + /* automatically generated by rust-bindgen 0.55.1 */ + +-pub type __uint8_t = ::std::os::raw::c_uchar; +-pub type __uint16_t = ::std::os::raw::c_ushort; +-pub type __uint32_t = ::std::os::raw::c_uint; +-pub type __uint64_t = ::std::os::raw::c_ulong; + extern "C" { + pub static NK_PWS_SLOT_COUNT: u8; + } diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..1cbd24b --- /dev/null +++ b/patches/series @@ -0,0 +1,2 @@ +deprecated.diff +remove-uint.diff |