Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions oqs/src/kem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions oqs/src/sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
Expand Down
Loading