diff --git a/oqs/src/kem.rs b/oqs/src/kem.rs index 43616691e8..903a7da5a9 100644 --- a/oqs/src/kem.rs +++ b/oqs/src/kem.rs @@ -217,7 +217,7 @@ impl Algorithm { /// This is the same as the `to_id`, but as a safe Rust string. pub fn name(&self) -> &'static str { // SAFETY: The id from ffi must be a proper null terminated C string - let id = unsafe { CStr::from_ptr(self.to_id()) }; + let id = unsafe { CStr::from_ptr(self.to_id() as *const _) }; id.to_str().expect("OQS algorithm names must be UTF-8") } } @@ -282,7 +282,7 @@ impl Kem { pub fn version(&self) -> &'static str { let kem = unsafe { self.kem.as_ref() }; // SAFETY: The alg_version from ffi must be a proper null terminated C string - let cstr = unsafe { CStr::from_ptr(kem.alg_version) }; + let cstr = unsafe { CStr::from_ptr(kem.alg_version as *const _) }; cstr.to_str() .expect("Algorithm version strings must be UTF-8") } diff --git a/oqs/src/sig.rs b/oqs/src/sig.rs index d7268de1d0..e308297409 100644 --- a/oqs/src/sig.rs +++ b/oqs/src/sig.rs @@ -259,7 +259,7 @@ impl Algorithm { /// This is the same as the `to_id`, but as a safe Rust string. pub fn name(&self) -> &'static str { // SAFETY: The id from ffi must be a proper null terminated C string - let id = unsafe { CStr::from_ptr(self.to_id()) }; + let id = unsafe { CStr::from_ptr(self.to_id() as *const _) }; id.to_str().expect("OQS algorithm names must be UTF-8") } } @@ -326,7 +326,7 @@ impl Sig { pub fn version(&self) -> &'static str { let sig = unsafe { self.sig.as_ref() }; // SAFETY: The alg_version from ffi must be a proper null terminated C string - let cstr = unsafe { CStr::from_ptr(sig.alg_version) }; + let cstr = unsafe { CStr::from_ptr(sig.alg_version as *const _) }; cstr.to_str() .expect("Algorithm version strings must be UTF-8") }