forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita40e7b7
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 parentac55abd commita40e7b7
File tree
8 files changed
+41
-7
lines changed- src
- backend/libpq
- include
- libpq
- interfaces/libpq
- tools/msvc
8 files changed
+41
-7
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12658 | 12658 |
| |
12659 | 12659 |
| |
12660 | 12660 |
| |
| 12661 | + | |
| 12662 | + | |
| 12663 | + | |
| 12664 | + | |
| 12665 | + | |
| 12666 | + | |
| 12667 | + | |
| 12668 | + | |
| 12669 | + | |
| 12670 | + | |
| 12671 | + | |
| 12672 | + | |
12661 | 12673 |
| |
12662 | 12674 |
| |
12663 | 12675 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1292 | 1292 |
| |
1293 | 1293 |
| |
1294 | 1294 |
| |
| 1295 | + | |
| 1296 | + | |
1295 | 1297 |
| |
1296 | 1298 |
| |
1297 | 1299 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1193 | 1193 |
| |
1194 | 1194 |
| |
1195 | 1195 |
| |
1196 |
| - | |
| 1196 | + | |
1197 | 1197 |
| |
1198 | 1198 |
| |
1199 | 1199 |
| |
| |||
1211 | 1211 |
| |
1212 | 1212 |
| |
1213 | 1213 |
| |
1214 |
| - | |
| 1214 | + | |
| 1215 | + | |
1215 | 1216 |
| |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1216 | 1220 |
| |
1217 | 1221 |
| |
| 1222 | + | |
1218 | 1223 |
| |
1219 | 1224 |
| |
1220 | 1225 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
285 |
| - | |
| 285 | + | |
286 | 286 |
| |
287 | 287 |
| |
288 | 288 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
733 | 733 |
| |
734 | 734 |
| |
735 | 735 |
| |
| 736 | + | |
| 737 | + | |
| 738 | + | |
736 | 739 |
| |
737 | 740 |
| |
738 | 741 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
369 | 369 |
| |
370 | 370 |
| |
371 | 371 |
| |
372 |
| - | |
| 372 | + | |
373 | 373 |
| |
374 | 374 |
| |
375 | 375 |
| |
| |||
389 | 389 |
| |
390 | 390 |
| |
391 | 391 |
| |
392 |
| - | |
| 392 | + | |
| 393 | + | |
393 | 394 |
| |
| 395 | + | |
| 396 | + | |
| 397 | + | |
394 | 398 |
| |
395 | 399 |
| |
| 400 | + | |
396 | 401 |
| |
397 | 402 |
| |
398 | 403 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
750 | 750 |
| |
751 | 751 |
| |
752 | 752 |
| |
753 |
| - | |
| 753 | + | |
754 | 754 |
| |
755 | 755 |
| |
756 | 756 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
256 |
| - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
257 | 264 |
| |
258 | 265 |
| |
259 | 266 |
| |
|
0 commit comments
Comments
(0)