Commit 53cf996
crypto: implement basic secure heap support
Adds two new command line arguments:
* `--secure-heap=n`, which causes node.js to initialize
an openssl secure heap of `n` bytes on openssl initialization.
* `--secure-heap-min=n`, which specifies the minimum allocation
from the secure heap.
* A new method `crypto.secureHeapUsed()` that returns details
about the total and used secure heap allocation.
The secure heap is an openssl feature that allows certain kinds
of potentially sensitive information (such as private key
BigNums) to be allocated from a dedicated memory area that is
protected against pointer over- and underruns.
The secure heap is a fixed size, so it's important that users
pick a large enough size to cover the crypto operations they
intend to utilize.
The secure heap is disabled by default.
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: #36779
Refs: #36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de>1 parent 42aca13 commit 53cf996Copy full SHA for 53cf996
File tree
Expand file treeCollapse file tree
10 files changed
+211
-2
lines changedOpen diff view settings
Filter options
- doc
- api
- lib
- internal/crypto
- src
- crypto
- test/parallel
Expand file treeCollapse file tree
10 files changed
+211
-2
lines changedOpen diff view settings
Collapse file
+37Lines changed: 37 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
848 | 848 | |
849 | 849 | |
850 | 850 | |
| 851 | + |
| 852 | + |
| 853 | + |
| 854 | + |
| 855 | + |
| 856 | + |
| 857 | + |
| 858 | + |
| 859 | + |
| 860 | + |
| 861 | + |
| 862 | + |
| 863 | + |
| 864 | + |
| 865 | + |
| 866 | + |
| 867 | + |
| 868 | + |
| 869 | + |
| 870 | + |
| 871 | + |
| 872 | + |
| 873 | + |
| 874 | + |
| 875 | + |
| 876 | + |
| 877 | + |
| 878 | + |
| 879 | + |
| 880 | + |
| 881 | + |
| 882 | + |
| 883 | + |
| 884 | + |
851 | 885 | |
852 | 886 | |
853 | 887 | |
| ||
1361 | 1395 | |
1362 | 1396 | |
1363 | 1397 | |
| 1398 | + |
| 1399 | + |
1364 | 1400 | |
1365 | 1401 | |
1366 | 1402 | |
| ||
1659 | 1695 | |
1660 | 1696 | |
1661 | 1697 | |
| 1698 | + |
1662 | 1699 | |
1663 | 1700 | |
1664 | 1701 | |
|
Collapse file
+15Lines changed: 15 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3545 | 3545 | |
3546 | 3546 | |
3547 | 3547 | |
| 3548 | + |
| 3549 | + |
| 3550 | + |
| 3551 | + |
| 3552 | + |
| 3553 | + |
| 3554 | + |
| 3555 | + |
| 3556 | + |
| 3557 | + |
| 3558 | + |
| 3559 | + |
| 3560 | + |
| 3561 | + |
| 3562 | + |
3548 | 3563 | |
3549 | 3564 | |
3550 | 3565 | |
|
Collapse file
+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
359 | 359 | |
360 | 360 | |
361 | 361 | |
| 362 | + |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | + |
| 367 | + |
| 368 | + |
362 | 369 | |
363 | 370 | |
364 | 371 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
118 | 118 | |
119 | 119 | |
120 | 120 | |
| 121 | + |
121 | 122 | |
122 | 123 | |
123 | 124 | |
| ||
230 | 231 | |
231 | 232 | |
232 | 233 | |
| 234 | + |
233 | 235 | |
234 | 236 | |
235 | 237 | |
|
Collapse file
lib/internal/crypto/util.js
Copy file name to clipboardExpand all lines: lib/internal/crypto/util.js+16Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
| 7 | + |
7 | 8 | |
8 | 9 | |
9 | 10 | |
| ||
15 | 16 | |
16 | 17 | |
17 | 18 | |
| 19 | + |
18 | 20 | |
19 | 21 | |
| 22 | + |
| 23 | + |
20 | 24 | |
21 | 25 | |
22 | 26 | |
| ||
371 | 375 | |
372 | 376 | |
373 | 377 | |
| 378 | + |
| 379 | + |
| 380 | + |
| 381 | + |
| 382 | + |
| 383 | + |
| 384 | + |
| 385 | + |
| 386 | + |
| 387 | + |
| 388 | + |
374 | 389 | |
375 | 390 | |
376 | 391 | |
| ||
402 | 417 | |
403 | 418 | |
404 | 419 | |
| 420 | + |
405 | 421 | |
Collapse file
+28Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
| 21 | + |
21 | 22 | |
22 | 23 | |
23 | 24 | |
| ||
113 | 114 | |
114 | 115 | |
115 | 116 | |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
116 | 136 | |
117 | 137 | |
118 | 138 | |
| ||
617 | 637 | |
618 | 638 | |
619 | 639 | |
| 640 | + |
| 641 | + |
| 642 | + |
| 643 | + |
| 644 | + |
| 645 | + |
| 646 | + |
620 | 647 | |
621 | 648 | |
622 | 649 | |
| ||
634 | 661 | |
635 | 662 | |
636 | 663 | |
| 664 | + |
637 | 665 | |
638 | 666 | |
639 | 667 | |
|
Collapse file
+24Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
| 10 | + |
| 11 | + |
10 | 12 | |
11 | 13 | |
12 | 14 | |
| ||
64 | 66 | |
65 | 67 | |
66 | 68 | |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
67 | 83 | |
68 | 84 | |
69 | 85 | |
| ||
760 | 776 | |
761 | 777 | |
762 | 778 | |
| 779 | + |
| 780 | + |
| 781 | + |
| 782 | + |
| 783 | + |
| 784 | + |
| 785 | + |
| 786 | + |
763 | 787 | |
764 | 788 | |
765 | 789 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
236 | 236 | |
237 | 237 | |
238 | 238 | |
| 239 | + |
| 240 | + |
239 | 241 | |
240 | 242 | |
241 | 243 | |
|
Collapse file
test/parallel/test-crypto-secure-heap.js
Copy file name to clipboard+72Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
Collapse file
test/parallel/test-process-env-allowed-flags-are-documented.js
Copy file name to clipboardExpand all lines: test/parallel/test-process-env-allowed-flags-are-documented.js+8-2Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | | - |
47 | | - |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
48 | 54 | |
49 | 55 | |
50 | 56 | |
|
0 commit comments