@@ -4,7 +4,6 @@ use std::{
44 str:: FromStr ,
55} ;
66
7- use subtle:: ConstantTimeEq ;
87use zeroize:: Zeroize ;
98
109use crate :: secure_utils:: memlock;
@@ -18,7 +17,7 @@ use crate::secure_utils::memlock;
1817/// - Automatic `madvise(MADV_NOCORE/MADV_DONTDUMP)` to protect against leaking into core dumps (FreeBSD, DragonflyBSD, Linux)
1918///
2019/// Comparisons using the `PartialEq` implementation are undefined behavior (and most likely wrong) if `T` has any padding bytes.
21- #[ derive( Eq , PartialOrd , Ord , Hash ) ]
20+ #[ derive( Eq , PartialEq , PartialOrd , Ord , Hash ) ]
2221pub struct SecureArray < T , const LENGTH : usize >
2322where
2423 T : Copy + Zeroize ,
@@ -57,29 +56,6 @@ impl<T: Copy + Zeroize, const LENGTH: usize> Clone for SecureArray<T, LENGTH> {
5756 }
5857}
5958
60- impl < T , const LENGTH : usize > PartialEq for SecureArray < T , LENGTH >
61- where
62- T : Copy + Zeroize ,
63- {
64- fn eq ( & self , other : & Self ) -> bool {
65- let self_bytes = unsafe {
66- std:: slice:: from_raw_parts (
67- self . content . as_ptr ( ) as * const T as * const u8 ,
68- LENGTH * std:: mem:: size_of :: < T > ( ) ,
69- )
70- } ;
71-
72- let other_bytes = unsafe {
73- std:: slice:: from_raw_parts (
74- other. content . as_ptr ( ) as * const T as * const u8 ,
75- LENGTH * std:: mem:: size_of :: < T > ( ) ,
76- )
77- } ;
78-
79- self_bytes. ct_eq ( other_bytes) . into ( )
80- }
81- }
82-
8359// Creation
8460impl < T , const LENGTH : usize > From < [ T ; LENGTH ] > for SecureArray < T , LENGTH >
8561where
0 commit comments