Skip to content

Commit

Permalink
Merge #82
Browse files Browse the repository at this point in the history
82: Silence unsafe FFI warnings r=jack-fortanix a=Goirad

The rust compiler is issuing false positive improper_ctypes warning, but
this is not an issue because only pointers are being passed to mbedtls,
and they are used completely opaquely.

Co-authored-by: Dario Gonzalez <[email protected]>
  • Loading branch information
bors[bot] and Goirad authored Nov 12, 2019
2 parents 71bad0c + 307d388 commit 13a1255
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mbedtls/src/threading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ pub static mut mbedtls_mutex_lock: unsafe extern "C" fn(mutex: *mut *mut StaticM
pub static mut mbedtls_mutex_unlock: unsafe extern "C" fn(mutex: *mut *mut StaticMutex) -> c_int =
StaticMutex::unlock;

// The nightly compiler complains that StaticMutex has no representation hint,
// but this is not an issue because this pointer is opaque to mbedtls
#[allow(improper_ctypes)]
impl StaticMutex {
unsafe extern "C" fn init(mutex: *mut *mut StaticMutex) {
if let Some(m) = mutex.as_mut() {
Expand Down

0 comments on commit 13a1255

Please sign in to comment.