Commit 56f343e
committed
Allow RSA client certs on ECDHE-ECDSA mutual auth
The TLS 1.2 server derived the single advertised ClientCertificateType
and the signature_algorithms list in its CertificateRequest from the
negotiated cipher suite's own signature algorithm. On an ECDHE-ECDSA
suite only ecdsa_sign was offered (and only ECDSA sig algs), so RSA
clients could not authenticate even though the server could happily
verify an RSA certificate. The same was true in reverse for an RSA
server: the CertificateRequest only advertised rsa_sign.
Refactor SendCertificateRequest to advertise certificate_types and
signature_algorithms covering both sig families when both are compiled
in. Three static helpers in internal.c keep the logic in one place
without mutating ssl->suites:
GetServerCertReqCertTypes - certificate_types to emit
GetServerCertReqHashSigAlgo - signature_algorithms to emit
InServerCertReqHashSigAlgo - membership check used for verification
The advertised lists are written to stack buffers in the caller. To
keep DoCertificateVerify in agreement with what we actually sent, the
SupportedHashSigAlgo call site there is replaced with
InServerCertReqHashSigAlgo, which rebuilds the same list locally and
looks up the client's chosen algo.
Replace the magic certTypes buffer size with a new
MAX_CERT_REQ_CERT_TYPE_CNT constant declared next to
ClientCertificateType.
Add two end-to-end mutual-auth tests covering both directions:
test_tls12_ecdhe_ecdsa_rsa_client_cert - ECDSA server, RSA client
test_tls12_ecdhe_rsa_ecdsa_client_cert - RSA server, ECDSA client
Update test_certreq_sighash_algos to permit RSA / RSA-PSS sig algs in
the ECDHE-ECDSA CertificateRequest; the previous assertion locked in
the ECDSA-only behaviour that this change corrects.
TLS 1.3 is unaffected: RFC 8446 removed certificate_types from
CertificateRequest, and TLS 1.3 cipher suites do not bind a signature
algorithm, so the server's hashSigAlgo already covers both sig
families when either has been compiled in.1 parent 7467ce2 commit 56f343e
6 files changed
Lines changed: 281 additions & 71 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25818 | 25818 | | |
25819 | 25819 | | |
25820 | 25820 | | |
| 25821 | + | |
| 25822 | + | |
| 25823 | + | |
| 25824 | + | |
| 25825 | + | |
| 25826 | + | |
| 25827 | + | |
| 25828 | + | |
| 25829 | + | |
| 25830 | + | |
| 25831 | + | |
| 25832 | + | |
| 25833 | + | |
| 25834 | + | |
| 25835 | + | |
| 25836 | + | |
| 25837 | + | |
| 25838 | + | |
| 25839 | + | |
| 25840 | + | |
| 25841 | + | |
| 25842 | + | |
| 25843 | + | |
| 25844 | + | |
| 25845 | + | |
| 25846 | + | |
| 25847 | + | |
| 25848 | + | |
| 25849 | + | |
| 25850 | + | |
| 25851 | + | |
| 25852 | + | |
| 25853 | + | |
| 25854 | + | |
| 25855 | + | |
| 25856 | + | |
| 25857 | + | |
| 25858 | + | |
| 25859 | + | |
| 25860 | + | |
| 25861 | + | |
| 25862 | + | |
| 25863 | + | |
| 25864 | + | |
| 25865 | + | |
| 25866 | + | |
| 25867 | + | |
| 25868 | + | |
| 25869 | + | |
| 25870 | + | |
| 25871 | + | |
| 25872 | + | |
| 25873 | + | |
| 25874 | + | |
| 25875 | + | |
| 25876 | + | |
| 25877 | + | |
| 25878 | + | |
| 25879 | + | |
| 25880 | + | |
| 25881 | + | |
| 25882 | + | |
| 25883 | + | |
| 25884 | + | |
| 25885 | + | |
| 25886 | + | |
| 25887 | + | |
| 25888 | + | |
| 25889 | + | |
| 25890 | + | |
| 25891 | + | |
| 25892 | + | |
| 25893 | + | |
| 25894 | + | |
| 25895 | + | |
| 25896 | + | |
| 25897 | + | |
| 25898 | + | |
| 25899 | + | |
| 25900 | + | |
| 25901 | + | |
| 25902 | + | |
| 25903 | + | |
| 25904 | + | |
| 25905 | + | |
| 25906 | + | |
| 25907 | + | |
| 25908 | + | |
| 25909 | + | |
| 25910 | + | |
| 25911 | + | |
| 25912 | + | |
| 25913 | + | |
| 25914 | + | |
| 25915 | + | |
| 25916 | + | |
| 25917 | + | |
| 25918 | + | |
| 25919 | + | |
| 25920 | + | |
| 25921 | + | |
| 25922 | + | |
| 25923 | + | |
| 25924 | + | |
| 25925 | + | |
| 25926 | + | |
| 25927 | + | |
| 25928 | + | |
| 25929 | + | |
| 25930 | + | |
| 25931 | + | |
| 25932 | + | |
| 25933 | + | |
| 25934 | + | |
| 25935 | + | |
| 25936 | + | |
| 25937 | + | |
| 25938 | + | |
| 25939 | + | |
| 25940 | + | |
| 25941 | + | |
| 25942 | + | |
| 25943 | + | |
25821 | 25944 | | |
25822 | 25945 | | |
25823 | 25946 | | |
| |||
25829 | 25952 | | |
25830 | 25953 | | |
25831 | 25954 | | |
25832 | | - | |
25833 | | - | |
25834 | | - | |
25835 | | - | |
| 25955 | + | |
| 25956 | + | |
| 25957 | + | |
| 25958 | + | |
| 25959 | + | |
| 25960 | + | |
25836 | 25961 | | |
25837 | 25962 | | |
25838 | 25963 | | |
25839 | 25964 | | |
| 25965 | + | |
| 25966 | + | |
| 25967 | + | |
| 25968 | + | |
| 25969 | + | |
| 25970 | + | |
25840 | 25971 | | |
25841 | | - | |
| 25972 | + | |
25842 | 25973 | | |
25843 | 25974 | | |
25844 | 25975 | | |
| |||
25891 | 26022 | | |
25892 | 26023 | | |
25893 | 26024 | | |
25894 | | - | |
25895 | | - | |
25896 | | - | |
25897 | | - | |
25898 | | - | |
25899 | | - | |
25900 | | - | |
25901 | | - | |
25902 | | - | |
25903 | | - | |
25904 | | - | |
25905 | | - | |
25906 | | - | |
25907 | | - | |
25908 | | - | |
25909 | | - | |
25910 | | - | |
25911 | | - | |
25912 | | - | |
25913 | | - | |
25914 | | - | |
25915 | | - | |
25916 | | - | |
25917 | | - | |
25918 | | - | |
25919 | | - | |
25920 | | - | |
25921 | | - | |
25922 | | - | |
| 26025 | + | |
| 26026 | + | |
25923 | 26027 | | |
25924 | 26028 | | |
25925 | 26029 | | |
25926 | | - | |
| 26030 | + | |
25927 | 26031 | | |
25928 | 26032 | | |
25929 | | - | |
25930 | | - | |
| 26033 | + | |
| 26034 | + | |
25931 | 26035 | | |
25932 | 26036 | | |
25933 | 26037 | | |
| |||
38949 | 39053 | | |
38950 | 39054 | | |
38951 | 39055 | | |
38952 | | - | |
38953 | | - | |
38954 | | - | |
| 39056 | + | |
| 39057 | + | |
| 39058 | + | |
38955 | 39059 | | |
38956 | 39060 | | |
38957 | 39061 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35648 | 35648 | | |
35649 | 35649 | | |
35650 | 35650 | | |
35651 | | - | |
35652 | | - | |
| 35651 | + | |
| 35652 | + | |
| 35653 | + | |
35653 | 35654 | | |
35654 | 35655 | | |
35655 | 35656 | | |
| |||
35710 | 35711 | | |
35711 | 35712 | | |
35712 | 35713 | | |
35713 | | - | |
35714 | | - | |
35715 | | - | |
35716 | | - | |
35717 | | - | |
35718 | | - | |
35719 | | - | |
35720 | | - | |
35721 | | - | |
35722 | | - | |
35723 | | - | |
| 35714 | + | |
| 35715 | + | |
| 35716 | + | |
| 35717 | + | |
| 35718 | + | |
| 35719 | + | |
| 35720 | + | |
| 35721 | + | |
| 35722 | + | |
| 35723 | + | |
| 35724 | + | |
| 35725 | + | |
| 35726 | + | |
| 35727 | + | |
| 35728 | + | |
| 35729 | + | |
| 35730 | + | |
| 35731 | + | |
35724 | 35732 | | |
35725 | 35733 | | |
35726 | 35734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
0 commit comments