diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
commit | 1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch) | |
tree | 7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/zeroize/src/x86.rs | |
parent | 5ecd8cf2cba827454317368b68571df0d13d7842 (diff) | |
download | fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip |
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/zeroize/src/x86.rs')
-rw-r--r-- | vendor/zeroize/src/x86.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/zeroize/src/x86.rs b/vendor/zeroize/src/x86.rs new file mode 100644 index 0000000..5e4bfcb --- /dev/null +++ b/vendor/zeroize/src/x86.rs @@ -0,0 +1,26 @@ +//! [`Zeroize`] impls for x86 SIMD registers + +use crate::{atomic_fence, volatile_write, Zeroize}; + +#[cfg(target_arch = "x86")] +use core::arch::x86::*; + +#[cfg(target_arch = "x86_64")] +use core::arch::x86_64::*; + +macro_rules! impl_zeroize_for_simd_register { + ($($type:ty),* $(,)?) => { + $( + #[cfg_attr(docsrs, doc(cfg(any(target_arch = "x86", target_arch = "x86_64"))))] + impl Zeroize for $type { + #[inline] + fn zeroize(&mut self) { + volatile_write(self, unsafe { core::mem::zeroed() }); + atomic_fence(); + } + } + )* + }; +} + +impl_zeroize_for_simd_register!(__m128, __m128d, __m128i, __m256, __m256d, __m256i); |