forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9244c11
committed
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
OpenSSL 1.1.1 and newer versions have added support for RSA-PSScertificates, which requires the use of a specific routine in OpenSSL todetermine which hash function to use when compiling it when usingchannel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is theoriginal routine the channel binding code has relied on, is not able todetermine which hash algorithm to use for such certificates. However,X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. Thiscommit switches the channel binding logic to rely onX509_get_signature_info() over X509_get_signature_nid(), which would bethe choice when building with 1.1.1 or newer.The error could have been triggered on the client or the server, hencelibpq and the backend need to have their related code paths patched.Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0or older leads to a failure due to an unsupported algorithm.The discovery of relying on X509_get_signature_info() comes from Jacob,the tests have been written by Heikki (with few tweaks from me), while Ihave bundled the whole together while adding the bits needed for MSVCand meson.This issue exists since channel binding exists, so backpatch all the waydown. Some tests are added in 15~, triggered if compiling with OpenSSL1.1.1 or newer, where the certificate and key files can easily begenerated for RSA-PSS.Reported-by: Gunnar "Nick" BluthAuthor: Jacob Champion, Heikki LinnakangasDiscussion:https://postgr.es/m/17760-b6c61e752ec07060@postgresql.orgBackpatch-through: 111 parent87f21d2 commit9244c11
File tree
15 files changed
+148
-11
lines changed- src
- backend/libpq
- include
- libpq
- interfaces/libpq
- test/ssl
- conf
- ssl
- t
- tools/msvc
15 files changed
+148
-11
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13013 | 13013 |
| |
13014 | 13014 |
| |
13015 | 13015 |
| |
| 13016 | + | |
| 13017 | + | |
| 13018 | + | |
| 13019 | + | |
| 13020 | + | |
| 13021 | + | |
| 13022 | + | |
| 13023 | + | |
| 13024 | + | |
| 13025 | + | |
| 13026 | + | |
| 13027 | + | |
13016 | 13028 |
| |
13017 | 13029 |
| |
13018 | 13030 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1385 | 1385 |
| |
1386 | 1386 |
| |
1387 | 1387 |
| |
| 1388 | + | |
| 1389 | + | |
1388 | 1390 |
| |
1389 | 1391 |
| |
1390 | 1392 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1223 | 1223 |
| |
1224 | 1224 |
| |
1225 | 1225 |
| |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1226 | 1229 |
| |
1227 | 1230 |
| |
1228 | 1231 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1429 | 1429 |
| |
1430 | 1430 |
| |
1431 | 1431 |
| |
1432 |
| - | |
| 1432 | + | |
1433 | 1433 |
| |
1434 | 1434 |
| |
1435 | 1435 |
| |
| |||
1447 | 1447 |
| |
1448 | 1448 |
| |
1449 | 1449 |
| |
1450 |
| - | |
| 1450 | + | |
| 1451 | + | |
1451 | 1452 |
| |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
1452 | 1456 |
| |
1453 | 1457 |
| |
| 1458 | + | |
1454 | 1459 |
| |
1455 | 1460 |
| |
1456 | 1461 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
308 | 308 |
| |
309 | 309 |
| |
310 | 310 |
| |
311 |
| - | |
| 311 | + | |
312 | 312 |
| |
313 | 313 |
| |
314 | 314 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
523 | 523 |
| |
524 | 524 |
| |
525 | 525 |
| |
| 526 | + | |
| 527 | + | |
| 528 | + | |
526 | 529 |
| |
527 | 530 |
| |
528 | 531 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
364 | 364 |
| |
365 | 365 |
| |
366 | 366 |
| |
367 |
| - | |
| 367 | + | |
368 | 368 |
| |
369 | 369 |
| |
370 | 370 |
| |
| |||
384 | 384 |
| |
385 | 385 |
| |
386 | 386 |
| |
387 |
| - | |
| 387 | + | |
| 388 | + | |
388 | 389 |
| |
| 390 | + | |
| 391 | + | |
| 392 | + | |
389 | 393 |
| |
390 | 394 |
| |
| 395 | + | |
391 | 396 |
| |
392 | 397 |
| |
393 | 398 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
806 | 806 |
| |
807 | 807 |
| |
808 | 808 |
| |
809 |
| - | |
| 809 | + | |
810 | 810 |
| |
811 | 811 |
| |
812 | 812 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
| 95 | + | |
95 | 96 |
| |
96 | 97 |
| |
97 | 98 |
| |
|
Lines changed: 14 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 | + |
Lines changed: 21 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 | + |
Lines changed: 28 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 | + |
Lines changed: 22 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
41 |
| - | |
| 40 | + | |
| 41 | + | |
42 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 |
| |
44 | 47 |
| |
45 | 48 |
| |
46 |
| - | |
| 49 | + | |
| 50 | + | |
47 | 51 |
| |
48 | 52 |
| |
49 | 53 |
| |
| |||
66 | 70 |
| |
67 | 71 |
| |
68 | 72 |
| |
69 |
| - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
70 | 80 |
| |
71 | 81 |
| |
72 | 82 |
| |
| |||
86 | 96 |
| |
87 | 97 |
| |
88 | 98 |
| |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
89 | 103 |
| |
90 | 104 |
| |
91 | 105 |
| |
| |||
96 | 110 |
| |
97 | 111 |
| |
98 | 112 |
| |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
99 | 117 |
| |
100 | 118 |
| |
101 | 119 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 |
| |
50 | 54 |
| |
51 | 55 |
| |
| |||
136 | 140 |
| |
137 | 141 |
| |
138 | 142 |
| |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
139 | 156 |
|
Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
371 | 371 |
| |
372 | 372 |
| |
373 | 373 |
| |
| 374 | + | |
374 | 375 |
| |
375 | 376 |
| |
376 | 377 |
| |
| |||
489 | 490 |
| |
490 | 491 |
| |
491 | 492 |
| |
492 |
| - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
493 | 501 |
| |
494 | 502 |
| |
495 | 503 |
| |
|
0 commit comments
Comments
(0)