Skip to content

Commit

Permalink
fixup! Add context string signature APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 committed Dec 17, 2024
1 parent ac4728f commit cef666d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions oqs/src/sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! for the list of supported algorithms.
use alloc::vec::Vec;

use core::ptr::{NonNull, null};
use core::ptr::{null, NonNull};

#[cfg(not(feature = "std"))]
use cstr_core::CStr;
Expand Down Expand Up @@ -428,7 +428,11 @@ impl Sig {
// For algorithms without context string support, liboqs
// expects the context to be NULL. Converting an empty
// slice to a pointer doesn't actually do this.
let ctx_str_ptr = if ctx_str.len() != 0 { ctx_str.as_ptr() } else { null() };
let ctx_str_ptr = if ctx_str.len() != 0 {
ctx_str.as_ptr()
} else {
null()
};
let status = unsafe {
func(
sig.bytes.as_mut_ptr(),
Expand Down Expand Up @@ -496,7 +500,11 @@ impl Sig {
// For algorithms without context string support, liboqs
// expects the context to be NULL. Converting an empty
// slice to a pointer doesn't actually do this.
let ctx_str_ptr = if ctx_str.len() != 0 { ctx_str.as_ptr() } else { null() };
let ctx_str_ptr = if ctx_str.len() != 0 {
ctx_str.as_ptr()
} else {
null()
};
let status = unsafe {
func(
message.as_ptr(),
Expand Down

0 comments on commit cef666d

Please sign in to comment.