Commit dd42214
crypto: unify validation of checkPrime checks
Previously, the JS layer would validate that the value of the 'checks'
option was an unsigned 32-bit integer, otherwise throwing an appropriate
error but with a slightly misleading error message. Then the C++ layer
would validate that the value was an unsigned 31-bit integer, otherwise
throwing an appropriate error, but with a different (and even less
helpful) error message.
Instead, make the JS layer aware of the 31-bit restriction so that no
validation in C++ is necessary and so that the error message always
matches the exact requirement.
PR-URL: #47165
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>1 parent 0dc4971 commit dd42214Copy full SHA for dd42214
File tree
Expand file treeCollapse file tree
3 files changed
+19
-14
lines changedOpen diff view settings
Filter options
- lib/internal/crypto
- src/crypto
- test/parallel
Expand file treeCollapse file tree
3 files changed
+19
-14
lines changedOpen diff view settings
Collapse file
lib/internal/crypto/random.js
Copy file name to clipboardExpand all lines: lib/internal/crypto/random.js+4-3Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | | - |
56 | 55 | |
57 | 56 | |
58 | 57 | |
| ||
563 | 562 | |
564 | 563 | |
565 | 564 | |
566 | | - |
| 565 | + |
| 566 | + |
567 | 567 | |
568 | 568 | |
569 | 569 | |
| ||
591 | 591 | |
592 | 592 | |
593 | 593 | |
594 | | - |
| 594 | + |
| 595 | + |
595 | 596 | |
596 | 597 | |
597 | 598 | |
|
Collapse file
src/crypto/crypto_random.cc
Copy file name to clipboardExpand all lines: src/crypto/crypto_random.cc+4-11Lines changed: 4 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
15 | 15 | |
16 | 16 | |
17 | 17 | |
| 18 | + |
18 | 19 | |
19 | 20 | |
20 | 21 | |
| ||
185 | 186 | |
186 | 187 | |
187 | 188 | |
188 | | - |
189 | | - |
190 | 189 | |
191 | 190 | |
192 | 191 | |
| ||
195 | 194 | |
196 | 195 | |
197 | 196 | |
198 | | - |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
| 197 | + |
| 198 | + |
| 199 | + |
207 | 200 | |
208 | 201 | |
209 | 202 | |
|
Collapse file
test/parallel/test-crypto-prime.js
Copy file name to clipboardExpand all lines: test/parallel/test-crypto-prime.js+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
240 | 240 | |
241 | 241 | |
242 | 242 | |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
243 | 254 | |
244 | 255 | |
245 | 256 | |
|
0 commit comments