File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 13
13
// defined.
14
14
#![ allow( dead_code) ]
15
15
16
+ use core:: fmt:: Debug ;
17
+
16
18
use crate :: { InternalError , SignatureError } ;
17
19
18
20
use curve25519_dalek:: scalar:: { clamp_integer, Scalar } ;
19
21
22
+ use subtle:: { Choice , ConstantTimeEq } ;
20
23
#[ cfg( feature = "zeroize" ) ]
21
24
use zeroize:: { Zeroize , ZeroizeOnDrop } ;
22
25
@@ -41,6 +44,26 @@ pub struct ExpandedSecretKey {
41
44
pub hash_prefix : [ u8 ; 32 ] ,
42
45
}
43
46
47
+ impl Debug for ExpandedSecretKey {
48
+ fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
49
+ f. debug_struct ( "ExpandedSecretKey" ) . finish_non_exhaustive ( ) // avoids printing secrets
50
+ }
51
+ }
52
+
53
+ impl ConstantTimeEq for ExpandedSecretKey {
54
+ fn ct_eq ( & self , other : & Self ) -> Choice {
55
+ self . scalar . ct_eq ( & other. scalar ) & self . hash_prefix . ct_eq ( & other. hash_prefix )
56
+ }
57
+ }
58
+
59
+ impl PartialEq for ExpandedSecretKey {
60
+ fn eq ( & self , other : & Self ) -> bool {
61
+ self . ct_eq ( other) . into ( )
62
+ }
63
+ }
64
+
65
+ impl Eq for ExpandedSecretKey { }
66
+
44
67
#[ cfg( feature = "zeroize" ) ]
45
68
impl Drop for ExpandedSecretKey {
46
69
fn drop ( & mut self ) {
You can’t perform that action at this time.
0 commit comments