Commit 1a461a0
committed
Merge dashpay#7127: feat: tidy-up mnemonic dialog by removing useless code and reducing exposure of sensitive data
b847bae fix: restore eager clearing of parsed words and improve secure memory handling (UdjinM6)
b8b0c1c fmt: fix formatting for mnemonicverificatinodialog (Konstantin Akimov)
1edec05 fix: add mnemonicverificationdialog to non-backported list (Konstantin Akimov)
f5d8b74 fix: avoid extra allocation of secured data in temporary std::string for mnemonic (Konstantin Akimov)
c7e3b46 refactor: SecureString already does zeroeing, remove duplicated code (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Firstly, current implementation of mnemonic dialog has zeroing of SecureString's objects with std::fill which is useless, and most likely even removed by optimizing compiler.
For reference, `SecureString`'s implementation of it, see [src/support/cleanse.cpp](https://github.com/dashpay/dash/blob/develop/src/support/cleanse.cpp) for details:
void deallocate(T* p, std::size_t n)
{
if (p != nullptr) {
memory_cleanse(p, sizeof(T) * n); // <- safe memory cleaning
}
LockedPoolManager::Instance().free(p);
}
Secondly, current implementation causes creating extra temporary object with sensitive data:
QString mnemonicStr = QString::fromStdString(std::string(m_mnemonic.begin(), m_mnemonic.end()));
This std::string object maybe omitted, see PR
## What was done?
This PR tidy-up a bit mnemonic dialog by fixing these issues and some minor improvements for formatting.
Though, using `memory_cleanse` should be considered to use for QStrings.
This PR conflicts to dashpay#7126 because the same function is changed; I will prefer dashpay#7126 to be merged first because 7126 is meant to be backported.
## How Has This Been Tested?
Tested as an extra changes to dashpay#7126 locally in the same branch, splitted to 2 PR after that.
## Breaking Changes
N/A
## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)
ACKs for top commit:
UdjinM6:
utACK b847bae
Tree-SHA512: c843a39b49f76c6647d004e1044fd4d24ecc4a82ccc311c50d4a88989bfcd62ac1cec09079c3ac40e5efd9e3790115625e65eedb10fc03bfd6475272cb0df72eFile tree
3 files changed
+16
-41
lines changed- src/qt
- test/util/data
3 files changed
+16
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| |||
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
282 | | - | |
| 279 | + | |
| 280 | + | |
283 | 281 | | |
284 | 282 | | |
285 | 283 | | |
286 | 284 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
291 | 288 | | |
292 | 289 | | |
293 | 290 | | |
| |||
310 | 307 | | |
311 | 308 | | |
312 | 309 | | |
313 | | - | |
314 | | - | |
| 310 | + | |
| 311 | + | |
315 | 312 | | |
316 | 313 | | |
317 | 314 | | |
| |||
361 | 358 | | |
362 | 359 | | |
363 | 360 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | 361 | | |
371 | 362 | | |
372 | 363 | | |
| |||
375 | 366 | | |
376 | 367 | | |
377 | 368 | | |
378 | | - | |
| 369 | + | |
379 | 370 | | |
380 | 371 | | |
381 | 372 | | |
382 | 373 | | |
383 | 374 | | |
384 | 375 | | |
385 | | - | |
| 376 | + | |
386 | 377 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
391 | 381 | | |
392 | 382 | | |
393 | 383 | | |
| |||
399 | 389 | | |
400 | 390 | | |
401 | 391 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | 392 | | |
414 | 393 | | |
415 | 394 | | |
416 | 395 | | |
417 | 396 | | |
418 | | - | |
| 397 | + | |
419 | 398 | | |
420 | 399 | | |
421 | 400 | | |
| |||
480 | 459 | | |
481 | 460 | | |
482 | 461 | | |
483 | | - | |
| 462 | + | |
484 | 463 | | |
485 | 464 | | |
486 | 465 | | |
| |||
494 | 473 | | |
495 | 474 | | |
496 | 475 | | |
497 | | - | |
498 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | | - | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
62 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
0 commit comments