Commit 10a7035
crypto: fix Node_SignFinal
PR #11705 switched Node away from using using OpenSSL's legacy EVP_Sign*
and EVP_Verify* APIs. Instead, it computes a hash normally via
EVP_Digest* and then uses EVP_PKEY_sign and EVP_PKEY_verify to verify
the hash directly. This change corrects two problems:
1. The documentation still recommends the signature algorithm EVP_MD
names of OpenSSL's legacy APIs. OpenSSL has since moved away from
thosee, which is why ECDSA was strangely inconsistent. (This is why
"ecdsa-with-SHA256" was missing.)
2. Node_SignFinal copied some code from EVP_SignFinal's internals. This
is problematic for OpenSSL 1.1.0 and is missing a critical check
that prevents pkey->pkey.ptr from being cast to the wrong type.
To resolve this, remove the non-EVP_PKEY_sign codepath. This codepath is
no longer necessary. PR #11705's verify half was already assuming all
EVP_PKEYs supported EVP_PKEY_sign and EVP_PKEY_verify. Also, in the
documentation, point users towards using hash function names which are
more consisent. This avoids an ECDSA special-case and some strangeness
around RSA-PSS ("RSA-SHA256" is the OpenSSL name of the
sha256WithRSAEncryption OID which is not used for RSA-PSS).
PR-URL: #15024
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>1 parent 9cebe82 commit 10a7035Copy full SHA for 10a7035
File tree
Expand file treeCollapse file tree
10 files changed
+110
-99
lines changedOpen diff view settings
Filter options
- benchmark/crypto
- doc/api
- src
- test
- fixtures/0-dns
- parallel
Expand file treeCollapse file tree
10 files changed
+110
-99
lines changedOpen diff view settings
Collapse file
benchmark/crypto/rsa-sign-verify-throughput.js
Copy file name to clipboardExpand all lines: benchmark/crypto/rsa-sign-verify-throughput.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | | - |
| 21 | + |
22 | 22 | |
23 | 23 | |
24 | 24 | |
|
Collapse file
+19-21Lines changed: 19 additions & 21 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
842 | 842 | |
843 | 843 | |
844 | 844 | |
845 | | - |
846 | | - |
| 845 | + |
| 846 | + |
| 847 | + |
847 | 848 | |
848 | 849 | |
849 | 850 | |
850 | 851 | |
851 | 852 | |
852 | | - |
| 853 | + |
853 | 854 | |
854 | 855 | |
855 | 856 | |
856 | 857 | |
857 | 858 | |
858 | 859 | |
859 | | - |
| 860 | + |
| 861 | + |
| 862 | + |
860 | 863 | |
861 | 864 | |
862 | 865 | |
863 | 866 | |
864 | 867 | |
865 | 868 | |
866 | | - |
| 869 | + |
867 | 870 | |
868 | 871 | |
869 | 872 | |
| ||
872 | 875 | |
873 | 876 | |
874 | 877 | |
875 | | - |
876 | | - |
877 | | - |
878 | | - |
| 878 | + |
| 879 | + |
| 880 | + |
| 881 | + |
879 | 882 | |
880 | | - |
| 883 | + |
881 | 884 | |
882 | 885 | |
883 | 886 | |
884 | | - |
| 887 | + |
885 | 888 | |
886 | 889 | |
887 | 890 | |
888 | | - |
889 | | - |
890 | | - |
891 | | - |
892 | | - |
893 | | - |
894 | | - |
895 | | - |
| 891 | + |
| 892 | + |
| 893 | + |
896 | 894 | |
897 | 895 | |
898 | 896 | |
| ||
965 | 963 | |
966 | 964 | |
967 | 965 | |
968 | | - |
| 966 | + |
969 | 967 | |
970 | 968 | |
971 | 969 | |
| ||
980 | 978 | |
981 | 979 | |
982 | 980 | |
983 | | - |
| 981 | + |
984 | 982 | |
985 | 983 | |
986 | 984 | |
|
Collapse file
+19-28Lines changed: 19 additions & 28 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3993 | 3993 | |
3994 | 3994 | |
3995 | 3995 | |
3996 | | - |
| 3996 | + |
| 3997 | + |
3997 | 3998 | |
3998 | 3999 | |
3999 | 4000 | |
| ||
4102 | 4103 | |
4103 | 4104 | |
4104 | 4105 | |
4105 | | - |
4106 | | - |
4107 | | - |
4108 | | - |
4109 | | - |
4110 | | - |
4111 | | - |
4112 | | - |
4113 | | - |
4114 | | - |
4115 | | - |
4116 | | - |
4117 | | - |
4118 | | - |
4119 | | - |
4120 | | - |
4121 | | - |
4122 | | - |
4123 | | - |
4124 | | - |
4125 | | - |
4126 | | - |
4127 | | - |
4128 | | - |
4129 | | - |
4130 | | - |
4131 | | - |
| 4106 | + |
| 4107 | + |
| 4108 | + |
| 4109 | + |
| 4110 | + |
| 4111 | + |
| 4112 | + |
| 4113 | + |
| 4114 | + |
| 4115 | + |
| 4116 | + |
| 4117 | + |
| 4118 | + |
| 4119 | + |
| 4120 | + |
| 4121 | + |
| 4122 | + |
4132 | 4123 | |
4133 | 4124 | |
4134 | 4125 | |
|
Collapse file
test/fixtures/0-dns/create-cert.js
Copy file name to clipboardExpand all lines: test/fixtures/0-dns/create-cert.js+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | | - |
| 11 | + |
12 | 12 | |
13 | 13 | |
14 | 14 | |
| ||
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | | - |
| 62 | + |
63 | 63 | |
64 | 64 | |
65 | 65 | |
|
Collapse file
test/parallel/test-crypto-binary-default.js
Copy file name to clipboardExpand all lines: test/parallel/test-crypto-binary-default.js+12-12Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | | - |
| 407 | + |
408 | 408 | |
409 | 409 | |
410 | | - |
| 410 | + |
411 | 411 | |
412 | 412 | |
413 | 413 | |
414 | 414 | |
415 | 415 | |
416 | | - |
| 416 | + |
417 | 417 | |
418 | 418 | |
419 | | - |
| 419 | + |
420 | 420 | |
421 | 421 | |
422 | 422 | |
423 | 423 | |
424 | 424 | |
425 | | - |
| 425 | + |
426 | 426 | |
427 | 427 | |
428 | | - |
| 428 | + |
429 | 429 | |
430 | 430 | |
431 | 431 | |
| ||
569 | 569 | |
570 | 570 | |
571 | 571 | |
572 | | - |
573 | | - |
| 572 | + |
| 573 | + |
574 | 574 | |
575 | 575 | |
576 | 576 | |
| ||
606 | 606 | |
607 | 607 | |
608 | 608 | |
609 | | - |
| 609 | + |
610 | 610 | |
611 | 611 | |
612 | 612 | |
613 | 613 | |
614 | 614 | |
615 | | - |
| 615 | + |
616 | 616 | |
617 | 617 | |
618 | 618 | |
| ||
631 | 631 | |
632 | 632 | |
633 | 633 | |
634 | | - |
| 634 | + |
635 | 635 | |
636 | 636 | |
637 | 637 | |
638 | | - |
| 638 | + |
639 | 639 | |
640 | 640 | |
641 | 641 | |
|
Collapse file
test/parallel/test-crypto-rsa-dsa.js
Copy file name to clipboardExpand all lines: test/parallel/test-crypto-rsa-dsa.js+34-12Lines changed: 34 additions & 12 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
132 | 132 | |
133 | 133 | |
134 | 134 | |
135 | | - |
136 | | - |
| 135 | + |
| 136 | + |
137 | 137 | |
138 | 138 | |
139 | 139 | |
| ||
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | | - |
| 155 | + |
156 | 156 | |
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | | - |
| 163 | + |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | | - |
| 167 | + |
168 | 168 | |
169 | 169 | |
170 | 170 | |
| ||
188 | 188 | |
189 | 189 | |
190 | 190 | |
191 | | - |
| 191 | + |
192 | 192 | |
193 | 193 | |
194 | 194 | |
195 | 195 | |
196 | 196 | |
197 | | - |
| 197 | + |
198 | 198 | |
199 | 199 | |
200 | 200 | |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
201 | 213 | |
202 | 214 | |
203 | 215 | |
| ||
209 | 221 | |
210 | 222 | |
211 | 223 | |
212 | | - |
| 224 | + |
213 | 225 | |
214 | 226 | |
215 | 227 | |
216 | | - |
| 228 | + |
217 | 229 | |
218 | 230 | |
219 | 231 | |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
220 | 242 | |
221 | 243 | |
222 | 244 | |
| ||
226 | 248 | |
227 | 249 | |
228 | 250 | |
229 | | - |
| 251 | + |
230 | 252 | |
231 | 253 | |
232 | 254 | |
| ||
236 | 258 | |
237 | 259 | |
238 | 260 | |
239 | | - |
| 261 | + |
240 | 262 | |
241 | 263 | |
242 | 264 | |
| ||
245 | 267 | |
246 | 268 | |
247 | 269 | |
248 | | - |
| 270 | + |
249 | 271 | |
250 | 272 | |
251 | 273 | |
|
0 commit comments