This repository was archived by the owner on Nov 30, 2022. It is now read-only.
File tree 6 files changed +18
-18
lines changed
6 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl Default for HashEngine {
49
49
impl EngineTrait for HashEngine {
50
50
type MidState = [ u8 ; 20 ] ;
51
51
52
- #[ cfg( not( feature = "fuzztarget" ) ) ]
52
+ #[ cfg( not( fuzzing ) ) ]
53
53
fn midstate ( & self ) -> [ u8 ; 20 ] {
54
54
let mut ret = [ 0 ; 20 ] ;
55
55
for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
@@ -58,7 +58,7 @@ impl EngineTrait for HashEngine {
58
58
ret
59
59
}
60
60
61
- #[ cfg( feature = "fuzztarget" ) ]
61
+ #[ cfg( fuzzing ) ]
62
62
fn midstate ( & self ) -> [ u8 ; 20 ] {
63
63
let mut ret = [ 0 ; 20 ] ;
64
64
ret. copy_from_slice ( & self . buffer [ ..20 ] ) ;
@@ -97,7 +97,7 @@ impl HashTrait for Hash {
97
97
type Engine = HashEngine ;
98
98
type Inner = [ u8 ; 20 ] ;
99
99
100
- #[ cfg( not( feature = "fuzztarget" ) ) ]
100
+ #[ cfg( not( fuzzing ) ) ]
101
101
fn from_engine ( mut e : HashEngine ) -> Hash {
102
102
// pad buffer with a single 1-bit then all 0s, until there are exactly 8 bytes remaining
103
103
let data_len = e. length as u64 ;
@@ -117,7 +117,7 @@ impl HashTrait for Hash {
117
117
Hash ( e. midstate ( ) )
118
118
}
119
119
120
- #[ cfg( feature = "fuzztarget" ) ]
120
+ #[ cfg( fuzzing ) ]
121
121
fn from_engine ( e : HashEngine ) -> Hash {
122
122
let mut res = e. midstate ( ) ;
123
123
res[ 0 ] ^= ( e. length & 0xff ) as u8 ;
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ impl Default for HashEngine {
44
44
impl EngineTrait for HashEngine {
45
45
type MidState = [ u8 ; 20 ] ;
46
46
47
- #[ cfg( not( feature = "fuzztarget" ) ) ]
47
+ #[ cfg( not( fuzzing ) ) ]
48
48
fn midstate ( & self ) -> [ u8 ; 20 ] {
49
49
let mut ret = [ 0 ; 20 ] ;
50
50
for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
@@ -53,7 +53,7 @@ impl EngineTrait for HashEngine {
53
53
ret
54
54
}
55
55
56
- #[ cfg( feature = "fuzztarget" ) ]
56
+ #[ cfg( fuzzing ) ]
57
57
fn midstate ( & self ) -> [ u8 ; 20 ] {
58
58
let mut ret = [ 0 ; 20 ] ;
59
59
ret. copy_from_slice ( & self . buffer [ ..20 ] ) ;
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ impl Default for HashEngine {
45
45
impl EngineTrait for HashEngine {
46
46
type MidState = Midstate ;
47
47
48
- #[ cfg( not( feature = "fuzztarget" ) ) ]
48
+ #[ cfg( not( fuzzing ) ) ]
49
49
fn midstate ( & self ) -> Midstate {
50
50
let mut ret = [ 0 ; 32 ] ;
51
51
for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
@@ -54,7 +54,7 @@ impl EngineTrait for HashEngine {
54
54
Midstate ( ret)
55
55
}
56
56
57
- #[ cfg( feature = "fuzztarget" ) ]
57
+ #[ cfg( fuzzing ) ]
58
58
fn midstate ( & self ) -> Midstate {
59
59
let mut ret = [ 0 ; 32 ] ;
60
60
ret. copy_from_slice ( & self . buffer [ ..32 ] ) ;
@@ -93,7 +93,7 @@ impl HashTrait for Hash {
93
93
type Engine = HashEngine ;
94
94
type Inner = [ u8 ; 32 ] ;
95
95
96
- #[ cfg( not( feature = "fuzztarget" ) ) ]
96
+ #[ cfg( not( fuzzing ) ) ]
97
97
fn from_engine ( mut e : HashEngine ) -> Hash {
98
98
// pad buffer with a single 1-bit then all 0s, until there are exactly 8 bytes remaining
99
99
let data_len = e. length as u64 ;
@@ -113,7 +113,7 @@ impl HashTrait for Hash {
113
113
Hash ( e. midstate ( ) . into_inner ( ) )
114
114
}
115
115
116
- #[ cfg( feature = "fuzztarget" ) ]
116
+ #[ cfg( fuzzing ) ]
117
117
fn from_engine ( e : HashEngine ) -> Hash {
118
118
Hash ( e. midstate ( ) . into_inner ( ) )
119
119
}
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl Default for HashEngine {
52
52
impl EngineTrait for HashEngine {
53
53
type MidState = [ u8 ; 64 ] ;
54
54
55
- #[ cfg( not( feature = "fuzztarget" ) ) ]
55
+ #[ cfg( not( fuzzing ) ) ]
56
56
fn midstate ( & self ) -> [ u8 ; 64 ] {
57
57
let mut ret = [ 0 ; 64 ] ;
58
58
for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 8 ) ) {
@@ -61,7 +61,7 @@ impl EngineTrait for HashEngine {
61
61
ret
62
62
}
63
63
64
- #[ cfg( feature = "fuzztarget" ) ]
64
+ #[ cfg( fuzzing ) ]
65
65
fn midstate ( & self ) -> [ u8 ; 64 ] {
66
66
let mut ret = [ 0 ; 64 ] ;
67
67
ret. copy_from_slice ( & self . buffer [ ..64 ] ) ;
@@ -141,7 +141,7 @@ impl HashTrait for Hash {
141
141
type Engine = HashEngine ;
142
142
type Inner = [ u8 ; 64 ] ;
143
143
144
- #[ cfg( not( feature = "fuzztarget" ) ) ]
144
+ #[ cfg( not( fuzzing ) ) ]
145
145
fn from_engine ( mut e : HashEngine ) -> Hash {
146
146
// pad buffer with a single 1-bit then all 0s, until there are exactly 16 bytes remaining
147
147
let data_len = e. length as u64 ;
@@ -162,7 +162,7 @@ impl HashTrait for Hash {
162
162
Hash ( e. midstate ( ) )
163
163
}
164
164
165
- #[ cfg( feature = "fuzztarget" ) ]
165
+ #[ cfg( fuzzing ) ]
166
166
fn from_engine ( e : HashEngine ) -> Hash {
167
167
let mut hash = e. midstate ( ) ;
168
168
hash[ 0 ] ^= 0xff ; // Make this distinct from SHA-256
Original file line number Diff line number Diff line change @@ -260,12 +260,12 @@ impl HashTrait for Hash {
260
260
type Engine = HashEngine ;
261
261
type Inner = [ u8 ; 8 ] ;
262
262
263
- #[ cfg( not( feature = "fuzztarget" ) ) ]
263
+ #[ cfg( not( fuzzing ) ) ]
264
264
fn from_engine ( e : HashEngine ) -> Hash {
265
265
Hash :: from_u64 ( Hash :: from_engine_to_u64 ( e) )
266
266
}
267
267
268
- #[ cfg( feature = "fuzztarget" ) ]
268
+ #[ cfg( fuzzing ) ]
269
269
fn from_engine ( e : HashEngine ) -> Hash {
270
270
let state = e. midstate ( ) ;
271
271
Hash :: from_u64 ( state. v0 ^ state. v1 ^ state. v2 ^ state. v3 )
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ macro_rules! borrow_slice_impl(
117
117
118
118
macro_rules! engine_input_impl(
119
119
( ) => (
120
- #[ cfg( not( feature = "fuzztarget" ) ) ]
120
+ #[ cfg( not( fuzzing ) ) ]
121
121
fn input( & mut self , mut inp: & [ u8 ] ) {
122
122
while !inp. is_empty( ) {
123
123
let buf_idx = self . length % <Self as EngineTrait >:: BLOCK_SIZE ;
@@ -134,7 +134,7 @@ macro_rules! engine_input_impl(
134
134
}
135
135
}
136
136
137
- #[ cfg( feature = "fuzztarget" ) ]
137
+ #[ cfg( fuzzing ) ]
138
138
fn input( & mut self , inp: & [ u8 ] ) {
139
139
for c in inp {
140
140
self . buffer[ 0 ] ^= * c;
You can’t perform that action at this time.
0 commit comments