forked fromsybrenstuvel/python-rsa
- Notifications
You must be signed in to change notification settings - Fork0
Commitdae8ce0
committed
Use as many constant-time comparisons as practical in the`rsa.pkcs1.decrypt` function.`cleartext.index(b'\x00', 2)` will still be non-constant-time. Thealternative would be to iterate over all the data byte by byte inPython, which is several orders of magnitude slower. Given that aperfect constant-time implementation is very hard or even impossible todo in Python [1], I chose the more performant option here.[1]:https://securitypitfalls.wordpress.com/2018/08/03/constant-time-compare-in-python/
1 parent6f59ff0 commitdae8ce0
2 files changed
+13
-4
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 |
| |
4 | 9 |
| |
5 | 10 |
| |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
| |
35 | 36 |
| |
| |||
251 | 252 |
| |
252 | 253 |
| |
253 | 254 |
| |
254 |
| - | |
255 |
| - | |
| 255 | + | |
256 | 256 |
| |
257 | 257 |
| |
258 |
| - | |
259 |
| - | |
| 258 | + | |
260 | 259 |
| |
261 | 260 |
| |
262 | 261 |
| |
263 | 262 |
| |
264 | 263 |
| |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
265 | 269 |
| |
266 | 270 |
| |
267 | 271 |
| |
|
0 commit comments
Comments
(0)