Commit ed63126
authored
Add timing-resistant-secret-traits feature for PartialEq/Hash (#232)
Derived implementations of `PartialEq` and `Hash` are susceptible to timing side channels that make them unsuitable for secret types. This change introduces timing-safe implementations of `PartialEq` and `Hash` to all secret types that compare/hash, respectively, the SHA-256 hash of the secret rather than the secret itself. Because these implementations are significantly more computationally expensive than ordinary `PartialEq` and `Hash` implementations, they're behind a non-default `timing-resistant-secret-traits` feature flag.1 parent 8e66503 commit ed63126
2 files changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
| 153 | + | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| |||
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
173 | 191 | | |
174 | 192 | | |
175 | 193 | | |
| |||
0 commit comments