From 441c5d11d0a6521a4b59e9cf16358b382dc64330 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Mon, 15 Dec 2025 11:27:50 -0500 Subject: [PATCH] add repr(transparent) to Zeroizing This commit adds a repr(transparent) annotation to zeroize::Zeroizing, allowing it to be used safely for FFI in more contexts. See https://github.com/RustCrypto/utils/issues/1249 for more details. --- zeroize/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zeroize/src/lib.rs b/zeroize/src/lib.rs index 2c125168..fc8a1b84 100644 --- a/zeroize/src/lib.rs +++ b/zeroize/src/lib.rs @@ -619,7 +619,11 @@ impl Zeroize for CString { /// `Zeroizing` is a wrapper for any `Z: Zeroize` type which implements a /// `Drop` handler which zeroizes dropped values. +/// +/// Zeroizing is defined with `repr(transparent)`, which means it is +/// guaranteed to have the same physical representation as the underlying type. #[derive(Debug, Default, Eq, PartialEq)] +#[repr(transparent)] pub struct Zeroizing(Z); impl Zeroizing