From 7062633e8ebfc0544011116f4bd44c604b681c56 Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Thu, 11 Jul 2024 14:41:10 +0300 Subject: [PATCH] missing file --- mirrord/layer/src/tls.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mirrord/layer/src/tls.rs diff --git a/mirrord/layer/src/tls.rs b/mirrord/layer/src/tls.rs new file mode 100644 index 00000000000..6b77c17c82f --- /dev/null +++ b/mirrord/layer/src/tls.rs @@ -0,0 +1,24 @@ +use libc::c_void; +use mirrord_layer_macro::hook_guard_fn; + +use crate::{hooks::HookManager, replace}; + +// https://developer.apple.com/documentation/security/2980705-sectrustevaluatewitherror +#[hook_guard_fn] +pub(crate) unsafe extern "C" fn sec_trust_evaluate_with_error_detour( + trust: *const c_void, + error: *const c_void, +) -> bool { + tracing::trace!("sec_trust_evaluate_with_error_detour called"); + true +} + +pub(crate) unsafe fn enable_tls_hooks(hook_manager: &mut HookManager) { + replace!( + hook_manager, + "SecTrustEvaluateWithError", + sec_trust_evaluate_with_error_detour, + FnSec_trust_evaluate_with_error, + FN_SEC_TRUST_EVALUATE_WITH_ERROR + ); +}