Skip to content

Commit

Permalink
fix: For Issue 672, Callback is unsound
Browse files Browse the repository at this point in the history
  • Loading branch information
gpeacock committed Nov 14, 2024
1 parent 5d279f6 commit dc7b2f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sdk/src/callback_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use crate::{
///
/// The callback should return a signature for the given data.
/// The callback should return an error if the data cannot be signed.
pub type CallbackFunc = dyn Fn(*const (), &[u8]) -> std::result::Result<Vec<u8>, Error>;
pub type CallbackFunc =
dyn Fn(*const (), &[u8]) -> std::result::Result<Vec<u8>, Error> + Send + Sync;

/// Defines a signer that uses a callback to sign data.
///
Expand Down Expand Up @@ -58,7 +59,7 @@ impl CallbackSigner {
/// Create a new callback signer.
pub fn new<F, T>(callback: F, alg: SigningAlg, certs: T) -> Self
where
F: Fn(*const (), &[u8]) -> std::result::Result<Vec<u8>, Error> + 'static,
F: Fn(*const (), &[u8]) -> std::result::Result<Vec<u8>, Error> + Send + Sync + 'static,
T: Into<Vec<u8>>,
{
let certs = certs.into();
Expand Down

0 comments on commit dc7b2f6

Please sign in to comment.