20-cert-select.cnf.in 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. # -*- mode: perl; -*-
  2. ## SSL test configurations
  3. use strict;
  4. use warnings;
  5. package ssltests;
  6. use OpenSSL::Test::Utils;
  7. our $fips_mode;
  8. our $no_deflt_libctx;
  9. my $server;
  10. if ($fips_mode) {
  11. #TODO(3.0): No EdDSA support in FIPS mode at the moment
  12. $server = {
  13. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  14. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  15. "MaxProtocol" => "TLSv1.2"
  16. };
  17. } else {
  18. $server = {
  19. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  20. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  21. "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
  22. "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
  23. "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
  24. "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
  25. "MaxProtocol" => "TLSv1.2"
  26. };
  27. }
  28. my $server_pss = {
  29. "PSS.Certificate" => test_pem("server-pss-cert.pem"),
  30. "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
  31. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  32. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  33. "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
  34. "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
  35. "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
  36. "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
  37. "MaxProtocol" => "TLSv1.2"
  38. };
  39. my $server_pss_only = {
  40. "Certificate" => test_pem("server-pss-cert.pem"),
  41. "PrivateKey" => test_pem("server-pss-key.pem"),
  42. };
  43. my $server_pss_restrict_only = {
  44. "Certificate" => test_pem("server-pss-restrict-cert.pem"),
  45. "PrivateKey" => test_pem("server-pss-restrict-key.pem"),
  46. };
  47. my $server_rsa_all;
  48. if ($no_deflt_libctx) {
  49. $server_rsa_all = {
  50. "Certificate" => test_pem("servercert.pem"),
  51. "PrivateKey" => test_pem("serverkey.pem"),
  52. };
  53. } else {
  54. $server_rsa_all = {
  55. "PSS.Certificate" => test_pem("server-pss-cert.pem"),
  56. "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
  57. "Certificate" => test_pem("servercert.pem"),
  58. "PrivateKey" => test_pem("serverkey.pem"),
  59. };
  60. }
  61. our @tests = (
  62. {
  63. name => "ECDSA CipherString Selection",
  64. server => $server,
  65. client => {
  66. "CipherString" => "aECDSA",
  67. "MaxProtocol" => "TLSv1.2",
  68. "RequestCAFile" => test_pem("root-cert.pem"),
  69. },
  70. test => {
  71. "ExpectedServerCertType" =>, "P-256",
  72. "ExpectedServerSignType" =>, "EC",
  73. # Note: certificate_authorities not sent for TLS < 1.3
  74. "ExpectedServerCANames" =>, "empty",
  75. "ExpectedResult" => "Success"
  76. },
  77. },
  78. {
  79. name => "ECDSA CipherString Selection",
  80. server => {
  81. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  82. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  83. "MaxProtocol" => "TLSv1.2",
  84. #Deliberately set supported_groups to one not in the cert. This
  85. #should be tolerated
  86. "Groups" => "P-384"
  87. },
  88. client => {
  89. "CipherString" => "aECDSA",
  90. "MaxProtocol" => "TLSv1.2",
  91. "Groups" => "P-256:P-384",
  92. "RequestCAFile" => test_pem("root-cert.pem"),
  93. },
  94. test => {
  95. "ExpectedServerCertType" =>, "P-256",
  96. "ExpectedServerSignType" =>, "EC",
  97. # Note: certificate_authorities not sent for TLS < 1.3
  98. "ExpectedServerCANames" =>, "empty",
  99. "ExpectedResult" => "Success"
  100. },
  101. },
  102. {
  103. name => "ECDSA CipherString Selection",
  104. server => {
  105. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  106. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  107. "MaxProtocol" => "TLSv1.2",
  108. "Groups" => "P-256:P-384"
  109. },
  110. client => {
  111. "CipherString" => "aECDSA",
  112. "MaxProtocol" => "TLSv1.2",
  113. #Deliberately set groups to not include the certificate group. This
  114. #should fail
  115. "Groups" => "P-384",
  116. "RequestCAFile" => test_pem("root-cert.pem"),
  117. },
  118. test => {
  119. "ExpectedResult" => "ServerFail"
  120. },
  121. },
  122. {
  123. name => "RSA CipherString Selection",
  124. server => $server,
  125. client => {
  126. "CipherString" => "aRSA",
  127. "MaxProtocol" => "TLSv1.2",
  128. },
  129. test => {
  130. "ExpectedServerCertType" =>, "RSA",
  131. "ExpectedServerSignType" =>, "RSA-PSS",
  132. "ExpectedResult" => "Success"
  133. },
  134. },
  135. {
  136. name => "P-256 CipherString and Signature Algorithm Selection",
  137. server => $server,
  138. client => {
  139. "CipherString" => "aECDSA",
  140. "MaxProtocol" => "TLSv1.2",
  141. "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
  142. },
  143. test => {
  144. "ExpectedServerCertType" => "P-256",
  145. "ExpectedServerSignHash" => "SHA256",
  146. "ExpectedServerSignType" => "EC",
  147. "ExpectedResult" => "Success"
  148. },
  149. },
  150. {
  151. name => "ECDSA CipherString Selection, no ECDSA certificate",
  152. server => {
  153. "MaxProtocol" => "TLSv1.2"
  154. },
  155. client => {
  156. "CipherString" => "aECDSA",
  157. "MaxProtocol" => "TLSv1.2"
  158. },
  159. test => {
  160. "ExpectedResult" => "ServerFail"
  161. },
  162. },
  163. {
  164. name => "ECDSA Signature Algorithm Selection",
  165. server => $server,
  166. client => {
  167. "SignatureAlgorithms" => "ECDSA+SHA256",
  168. },
  169. test => {
  170. "ExpectedServerCertType" => "P-256",
  171. "ExpectedServerSignHash" => "SHA256",
  172. "ExpectedServerSignType" => "EC",
  173. "ExpectedResult" => "Success"
  174. },
  175. },
  176. {
  177. name => "ECDSA Signature Algorithm Selection SHA384",
  178. server => $server,
  179. client => {
  180. "SignatureAlgorithms" => "ECDSA+SHA384",
  181. },
  182. test => {
  183. "ExpectedServerCertType" => "P-256",
  184. "ExpectedServerSignHash" => "SHA384",
  185. "ExpectedServerSignType" => "EC",
  186. "ExpectedResult" => "Success"
  187. },
  188. },
  189. {
  190. name => "ECDSA Signature Algorithm Selection compressed point",
  191. server => {
  192. "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
  193. "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
  194. "MaxProtocol" => "TLSv1.2"
  195. },
  196. client => {
  197. "SignatureAlgorithms" => "ECDSA+SHA256",
  198. },
  199. test => {
  200. "ExpectedServerCertType" => "P-256",
  201. "ExpectedServerSignHash" => "SHA256",
  202. "ExpectedServerSignType" => "EC",
  203. "ExpectedResult" => "Success"
  204. },
  205. },
  206. {
  207. name => "ECDSA Signature Algorithm Selection, no ECDSA certificate",
  208. server => {
  209. "MaxProtocol" => "TLSv1.2"
  210. },
  211. client => {
  212. "SignatureAlgorithms" => "ECDSA+SHA256",
  213. },
  214. test => {
  215. "ExpectedResult" => "ServerFail"
  216. },
  217. },
  218. {
  219. name => "RSA Signature Algorithm Selection",
  220. server => $server,
  221. client => {
  222. "SignatureAlgorithms" => "RSA+SHA256",
  223. },
  224. test => {
  225. "ExpectedServerCertType" => "RSA",
  226. "ExpectedServerSignHash" => "SHA256",
  227. "ExpectedServerSignType" => "RSA",
  228. "ExpectedResult" => "Success"
  229. },
  230. },
  231. {
  232. name => "RSA-PSS Signature Algorithm Selection",
  233. server => $server,
  234. client => {
  235. "SignatureAlgorithms" => "RSA-PSS+SHA256",
  236. },
  237. test => {
  238. "ExpectedServerCertType" => "RSA",
  239. "ExpectedServerSignHash" => "SHA256",
  240. "ExpectedServerSignType" => "RSA-PSS",
  241. "ExpectedResult" => "Success"
  242. },
  243. },
  244. {
  245. name => "RSA key exchange with all RSA certificate types",
  246. server => $server_rsa_all,
  247. client => {
  248. "CipherString" => "kRSA",
  249. "MaxProtocol" => "TLSv1.2",
  250. },
  251. test => {
  252. "ExpectedServerCertType" =>, "RSA",
  253. "ExpectedResult" => "Success"
  254. },
  255. },
  256. {
  257. name => "Suite B P-256 Hash Algorithm Selection",
  258. server => {
  259. "ECDSA.Certificate" => test_pem("p256-server-cert.pem"),
  260. "ECDSA.PrivateKey" => test_pem("p256-server-key.pem"),
  261. "MaxProtocol" => "TLSv1.2",
  262. "CipherString" => "SUITEB128"
  263. },
  264. client => {
  265. "VerifyCAFile" => test_pem("p384-root.pem"),
  266. "SignatureAlgorithms" => "ECDSA+SHA384:ECDSA+SHA256"
  267. },
  268. test => {
  269. "ExpectedServerCertType" => "P-256",
  270. "ExpectedServerSignHash" => "SHA256",
  271. "ExpectedServerSignType" => "EC",
  272. "ExpectedResult" => "Success"
  273. },
  274. },
  275. {
  276. name => "Suite B P-384 Hash Algorithm Selection",
  277. server => {
  278. "ECDSA.Certificate" => test_pem("p384-server-cert.pem"),
  279. "ECDSA.PrivateKey" => test_pem("p384-server-key.pem"),
  280. "MaxProtocol" => "TLSv1.2",
  281. "CipherString" => "SUITEB128"
  282. },
  283. client => {
  284. "VerifyCAFile" => test_pem("p384-root.pem"),
  285. "SignatureAlgorithms" => "ECDSA+SHA256:ECDSA+SHA384"
  286. },
  287. test => {
  288. "ExpectedServerCertType" => "P-384",
  289. "ExpectedServerSignHash" => "SHA384",
  290. "ExpectedServerSignType" => "EC",
  291. "ExpectedResult" => "Success"
  292. },
  293. },
  294. );
  295. my @tests_non_fips = (
  296. {
  297. name => "ECDSA Signature Algorithm Selection SHA1",
  298. server => {
  299. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  300. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  301. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  302. "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
  303. "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
  304. "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
  305. "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
  306. "MaxProtocol" => "TLSv1.2"
  307. },
  308. client => {
  309. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  310. "SignatureAlgorithms" => "ECDSA+SHA1",
  311. },
  312. test => {
  313. "ExpectedServerCertType" => "P-256",
  314. "ExpectedServerSignHash" => "SHA1",
  315. "ExpectedServerSignType" => "EC",
  316. "ExpectedResult" => "Success"
  317. },
  318. },
  319. # TODO(3.0) No Ed25519/Ed448 in FIPS mode at the moment
  320. {
  321. name => "Ed25519 CipherString and Signature Algorithm Selection",
  322. server => $server,
  323. client => {
  324. "CipherString" => "aECDSA",
  325. "MaxProtocol" => "TLSv1.2",
  326. "SignatureAlgorithms" => "ed25519:ECDSA+SHA256",
  327. "RequestCAFile" => test_pem("root-cert.pem"),
  328. },
  329. test => {
  330. "ExpectedServerCertType" =>, "Ed25519",
  331. "ExpectedServerSignType" =>, "Ed25519",
  332. # Note: certificate_authorities not sent for TLS < 1.3
  333. "ExpectedServerCANames" =>, "empty",
  334. "ExpectedResult" => "Success"
  335. },
  336. },
  337. {
  338. name => "Ed448 CipherString and Signature Algorithm Selection",
  339. server => $server,
  340. client => {
  341. "CipherString" => "aECDSA",
  342. "MaxProtocol" => "TLSv1.2",
  343. "SignatureAlgorithms" => "ed448:ECDSA+SHA256",
  344. "RequestCAFile" => test_pem("root-ed448-cert.pem"),
  345. "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
  346. },
  347. test => {
  348. "ExpectedServerCertType" =>, "Ed448",
  349. "ExpectedServerSignType" =>, "Ed448",
  350. # Note: certificate_authorities not sent for TLS < 1.3
  351. "ExpectedServerCANames" =>, "empty",
  352. "ExpectedResult" => "Success"
  353. },
  354. },
  355. {
  356. name => "ECDSA with brainpool",
  357. server => {
  358. "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
  359. "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
  360. "Groups" => "brainpoolP256r1",
  361. },
  362. client => {
  363. #We don't restrict this to TLSv1.2, although use of brainpool
  364. #should force this anyway so that this should succeed
  365. "CipherString" => "aECDSA",
  366. "RequestCAFile" => test_pem("root-cert.pem"),
  367. "Groups" => "brainpoolP256r1",
  368. },
  369. test => {
  370. "ExpectedServerCertType" =>, "brainpoolP256r1",
  371. "ExpectedServerSignType" =>, "EC",
  372. # Note: certificate_authorities not sent for TLS < 1.3
  373. "ExpectedServerCANames" =>, "empty",
  374. "ExpectedResult" => "Success"
  375. },
  376. },
  377. {
  378. name => "Ed25519 CipherString and Curves Selection",
  379. server => $server,
  380. client => {
  381. "CipherString" => "aECDSA",
  382. "MaxProtocol" => "TLSv1.2",
  383. "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
  384. # Excluding P-256 from the supported curves list means server
  385. # certificate should be Ed25519 and not P-256
  386. "Curves" => "X25519"
  387. },
  388. test => {
  389. "ExpectedServerCertType" =>, "Ed25519",
  390. "ExpectedServerSignType" =>, "Ed25519",
  391. "ExpectedResult" => "Success"
  392. },
  393. },
  394. {
  395. name => "Ed448 CipherString and Curves Selection",
  396. server => $server,
  397. client => {
  398. "CipherString" => "aECDSA",
  399. "MaxProtocol" => "TLSv1.2",
  400. "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
  401. "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
  402. # Excluding P-256 from the supported curves list means server
  403. # certificate should be Ed25519 and not P-256
  404. "Curves" => "X448"
  405. },
  406. test => {
  407. "ExpectedServerCertType" =>, "Ed448",
  408. "ExpectedServerSignType" =>, "Ed448",
  409. "ExpectedResult" => "Success"
  410. },
  411. },
  412. {
  413. name => "TLS 1.2 Ed25519 Client Auth",
  414. server => {
  415. "VerifyCAFile" => test_pem("root-cert.pem"),
  416. "VerifyMode" => "Require"
  417. },
  418. client => {
  419. "Ed25519.Certificate" => test_pem("client-ed25519-cert.pem"),
  420. "Ed25519.PrivateKey" => test_pem("client-ed25519-key.pem"),
  421. "MinProtocol" => "TLSv1.2",
  422. "MaxProtocol" => "TLSv1.2"
  423. },
  424. test => {
  425. "ExpectedClientCertType" => "Ed25519",
  426. "ExpectedClientSignType" => "Ed25519",
  427. "ExpectedResult" => "Success"
  428. },
  429. },
  430. {
  431. name => "TLS 1.2 Ed448 Client Auth",
  432. server => {
  433. "VerifyCAFile" => test_pem("root-cert.pem"),
  434. "VerifyMode" => "Require"
  435. },
  436. client => {
  437. "Ed448.Certificate" => test_pem("client-ed448-cert.pem"),
  438. "Ed448.PrivateKey" => test_pem("client-ed448-key.pem"),
  439. "MinProtocol" => "TLSv1.2",
  440. "MaxProtocol" => "TLSv1.2"
  441. },
  442. test => {
  443. "ExpectedClientCertType" => "Ed448",
  444. "ExpectedClientSignType" => "Ed448",
  445. "ExpectedResult" => "Success"
  446. },
  447. },
  448. );
  449. my @tests_pss = (
  450. {
  451. name => "RSA-PSS Certificate CipherString Selection",
  452. server => $server_pss,
  453. client => {
  454. "CipherString" => "aRSA",
  455. "MaxProtocol" => "TLSv1.2",
  456. },
  457. test => {
  458. "ExpectedServerCertType" =>, "RSA-PSS",
  459. "ExpectedServerSignType" =>, "RSA-PSS",
  460. "ExpectedResult" => "Success"
  461. },
  462. },
  463. {
  464. name => "RSA-PSS Certificate Legacy Signature Algorithm Selection",
  465. server => $server_pss,
  466. client => {
  467. "SignatureAlgorithms" => "RSA-PSS+SHA256",
  468. },
  469. test => {
  470. "ExpectedServerCertType" => "RSA",
  471. "ExpectedServerSignHash" => "SHA256",
  472. "ExpectedServerSignType" => "RSA-PSS",
  473. "ExpectedResult" => "Success"
  474. },
  475. },
  476. {
  477. name => "RSA-PSS Certificate Unified Signature Algorithm Selection",
  478. server => $server_pss,
  479. client => {
  480. "SignatureAlgorithms" => "rsa_pss_pss_sha256",
  481. },
  482. test => {
  483. "ExpectedServerCertType" => "RSA-PSS",
  484. "ExpectedServerSignHash" => "SHA256",
  485. "ExpectedServerSignType" => "RSA-PSS",
  486. "ExpectedResult" => "Success"
  487. },
  488. },
  489. {
  490. name => "Only RSA-PSS Certificate",
  491. server => $server_pss_only,
  492. client => {},
  493. test => {
  494. "ExpectedServerCertType" => "RSA-PSS",
  495. "ExpectedServerSignHash" => "SHA256",
  496. "ExpectedServerSignType" => "RSA-PSS",
  497. "ExpectedResult" => "Success"
  498. },
  499. },
  500. {
  501. name => "Only RSA-PSS Certificate Valid Signature Algorithms",
  502. server => $server_pss_only,
  503. client => {
  504. "SignatureAlgorithms" => "rsa_pss_pss_sha512",
  505. },
  506. test => {
  507. "ExpectedServerCertType" => "RSA-PSS",
  508. "ExpectedServerSignHash" => "SHA512",
  509. "ExpectedServerSignType" => "RSA-PSS",
  510. "ExpectedResult" => "Success"
  511. },
  512. },
  513. {
  514. name => "RSA-PSS Certificate, no PSS signature algorithms",
  515. server => $server_pss_only,
  516. client => {
  517. "SignatureAlgorithms" => "RSA+SHA256",
  518. },
  519. test => {
  520. "ExpectedResult" => "ServerFail"
  521. },
  522. },
  523. {
  524. name => "Only RSA-PSS Restricted Certificate",
  525. server => $server_pss_restrict_only,
  526. client => {},
  527. test => {
  528. "ExpectedServerCertType" => "RSA-PSS",
  529. "ExpectedServerSignHash" => "SHA256",
  530. "ExpectedServerSignType" => "RSA-PSS",
  531. "ExpectedResult" => "Success"
  532. },
  533. },
  534. {
  535. name => "RSA-PSS Restricted Certificate Valid Signature Algorithms",
  536. server => $server_pss_restrict_only,
  537. client => {
  538. "SignatureAlgorithms" => "rsa_pss_pss_sha256:rsa_pss_pss_sha512",
  539. },
  540. test => {
  541. "ExpectedServerCertType" => "RSA-PSS",
  542. "ExpectedServerSignHash" => "SHA256",
  543. "ExpectedServerSignType" => "RSA-PSS",
  544. "ExpectedResult" => "Success"
  545. },
  546. },
  547. {
  548. name => "RSA-PSS Restricted Cert client prefers invalid Signature Algorithm",
  549. server => $server_pss_restrict_only,
  550. client => {
  551. "SignatureAlgorithms" => "rsa_pss_pss_sha512:rsa_pss_pss_sha256",
  552. },
  553. test => {
  554. "ExpectedServerCertType" => "RSA-PSS",
  555. "ExpectedServerSignHash" => "SHA256",
  556. "ExpectedServerSignType" => "RSA-PSS",
  557. "ExpectedResult" => "Success"
  558. },
  559. },
  560. {
  561. name => "RSA-PSS Restricted Certificate Invalid Signature Algorithms",
  562. server => $server_pss_restrict_only,
  563. client => {
  564. "SignatureAlgorithms" => "rsa_pss_pss_sha512",
  565. },
  566. test => {
  567. "ExpectedResult" => "ServerFail"
  568. },
  569. },
  570. {
  571. name => "RSA key exchange with only RSA-PSS certificate",
  572. server => $server_pss_only,
  573. client => {
  574. "CipherString" => "kRSA",
  575. "MaxProtocol" => "TLSv1.2",
  576. },
  577. test => {
  578. "ExpectedResult" => "ServerFail"
  579. },
  580. },
  581. );
  582. my @tests_tls_1_1 = (
  583. {
  584. name => "Only RSA-PSS Certificate, TLS v1.1",
  585. server => $server_pss_only,
  586. client => {
  587. "MaxProtocol" => "TLSv1.1",
  588. },
  589. test => {
  590. "ExpectedResult" => "ServerFail"
  591. },
  592. },
  593. );
  594. push @tests, @tests_non_fips unless $fips_mode;
  595. push @tests, @tests_pss;
  596. push @tests, @tests_tls_1_1 unless disabled("tls1_1") || $no_deflt_libctx;
  597. my $server_tls_1_3;
  598. if ($fips_mode) {
  599. $server_tls_1_3 = {
  600. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  601. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  602. "MinProtocol" => "TLSv1.3",
  603. "MaxProtocol" => "TLSv1.3"
  604. };
  605. } else {
  606. $server_tls_1_3 = {
  607. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  608. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  609. "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
  610. "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
  611. "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
  612. "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
  613. "MinProtocol" => "TLSv1.3",
  614. "MaxProtocol" => "TLSv1.3"
  615. };
  616. }
  617. my $client_tls_1_3 = {
  618. "RSA.Certificate" => test_pem("ee-client-chain.pem"),
  619. "RSA.PrivateKey" => test_pem("ee-key.pem"),
  620. "ECDSA.Certificate" => test_pem("ee-ecdsa-client-chain.pem"),
  621. "ECDSA.PrivateKey" => test_pem("ee-ecdsa-key.pem"),
  622. "MinProtocol" => "TLSv1.3",
  623. "MaxProtocol" => "TLSv1.3"
  624. };
  625. my @tests_tls_1_3 = (
  626. {
  627. name => "TLS 1.3 ECDSA Signature Algorithm Selection",
  628. server => $server_tls_1_3,
  629. client => {
  630. "SignatureAlgorithms" => "ECDSA+SHA256",
  631. },
  632. test => {
  633. "ExpectedServerCertType" => "P-256",
  634. "ExpectedServerSignHash" => "SHA256",
  635. "ExpectedServerSignType" => "EC",
  636. "ExpectedServerCANames" => "empty",
  637. "ExpectedResult" => "Success"
  638. },
  639. },
  640. {
  641. name => "TLS 1.3 ECDSA Signature Algorithm Selection compressed point",
  642. server => {
  643. "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
  644. "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
  645. "MinProtocol" => "TLSv1.3",
  646. "MaxProtocol" => "TLSv1.3"
  647. },
  648. client => {
  649. "SignatureAlgorithms" => "ECDSA+SHA256",
  650. },
  651. test => {
  652. "ExpectedServerCertType" => "P-256",
  653. "ExpectedServerSignHash" => "SHA256",
  654. "ExpectedServerSignType" => "EC",
  655. "ExpectedServerCANames" => "empty",
  656. "ExpectedResult" => "Success"
  657. },
  658. },
  659. {
  660. name => "TLS 1.3 ECDSA Signature Algorithm Selection SHA1",
  661. server => {
  662. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  663. "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
  664. "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
  665. "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
  666. "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
  667. "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
  668. "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
  669. "MinProtocol" => "TLSv1.3",
  670. "MaxProtocol" => "TLSv1.3"
  671. },
  672. client => {
  673. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  674. "SignatureAlgorithms" => "ECDSA+SHA1",
  675. },
  676. test => {
  677. "ExpectedResult" => "ServerFail"
  678. },
  679. },
  680. {
  681. name => "TLS 1.3 ECDSA Signature Algorithm Selection with PSS",
  682. server => $server_tls_1_3,
  683. client => {
  684. "SignatureAlgorithms" => "ECDSA+SHA256:RSA-PSS+SHA256",
  685. "RequestCAFile" => test_pem("root-cert.pem"),
  686. },
  687. test => {
  688. "ExpectedServerCertType" => "P-256",
  689. "ExpectedServerSignHash" => "SHA256",
  690. "ExpectedServerSignType" => "EC",
  691. "ExpectedServerCANames" => test_pem("root-cert.pem"),
  692. "ExpectedResult" => "Success"
  693. },
  694. },
  695. {
  696. name => "TLS 1.3 RSA Signature Algorithm Selection SHA384 with PSS",
  697. server => $server_tls_1_3,
  698. client => {
  699. "SignatureAlgorithms" => "ECDSA+SHA384:RSA-PSS+SHA384",
  700. },
  701. test => {
  702. "ExpectedServerCertType" => "RSA",
  703. "ExpectedServerSignHash" => "SHA384",
  704. "ExpectedServerSignType" => "RSA-PSS",
  705. "ExpectedResult" => "Success"
  706. },
  707. },
  708. {
  709. name => "TLS 1.3 ECDSA Signature Algorithm Selection, no ECDSA certificate",
  710. server => {
  711. "MinProtocol" => "TLSv1.3",
  712. "MaxProtocol" => "TLSv1.3"
  713. },
  714. client => {
  715. "SignatureAlgorithms" => "ECDSA+SHA256",
  716. },
  717. test => {
  718. "ExpectedResult" => "ServerFail"
  719. },
  720. },
  721. {
  722. name => "TLS 1.3 RSA Signature Algorithm Selection, no PSS",
  723. server => $server_tls_1_3,
  724. client => {
  725. "SignatureAlgorithms" => "RSA+SHA256",
  726. },
  727. test => {
  728. "ExpectedResult" => "ServerFail"
  729. },
  730. },
  731. {
  732. name => "TLS 1.3 RSA-PSS Signature Algorithm Selection",
  733. server => $server_tls_1_3,
  734. client => {
  735. "SignatureAlgorithms" => "RSA-PSS+SHA256",
  736. },
  737. test => {
  738. "ExpectedServerCertType" => "RSA",
  739. "ExpectedServerSignHash" => "SHA256",
  740. "ExpectedServerSignType" => "RSA-PSS",
  741. "ExpectedResult" => "Success"
  742. },
  743. },
  744. {
  745. name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection",
  746. server => {
  747. "ClientSignatureAlgorithms" => "PSS+SHA256",
  748. "VerifyCAFile" => test_pem("root-cert.pem"),
  749. "VerifyMode" => "Require"
  750. },
  751. client => $client_tls_1_3,
  752. test => {
  753. "ExpectedClientCertType" => "RSA",
  754. "ExpectedClientSignHash" => "SHA256",
  755. "ExpectedClientSignType" => "RSA-PSS",
  756. "ExpectedClientCANames" => "empty",
  757. "ExpectedResult" => "Success"
  758. },
  759. },
  760. {
  761. name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection non-empty CA Names",
  762. server => {
  763. "ClientSignatureAlgorithms" => "PSS+SHA256",
  764. "VerifyCAFile" => test_pem("root-cert.pem"),
  765. "RequestCAFile" => test_pem("root-cert.pem"),
  766. "VerifyMode" => "Require"
  767. },
  768. client => $client_tls_1_3,
  769. test => {
  770. "ExpectedClientCertType" => "RSA",
  771. "ExpectedClientSignHash" => "SHA256",
  772. "ExpectedClientSignType" => "RSA-PSS",
  773. "ExpectedClientCANames" => test_pem("root-cert.pem"),
  774. "ExpectedResult" => "Success"
  775. },
  776. },
  777. {
  778. name => "TLS 1.3 ECDSA Client Auth Signature Algorithm Selection",
  779. server => {
  780. "ClientSignatureAlgorithms" => "ECDSA+SHA256",
  781. "VerifyCAFile" => test_pem("root-cert.pem"),
  782. "VerifyMode" => "Require"
  783. },
  784. client => $client_tls_1_3,
  785. test => {
  786. "ExpectedClientCertType" => "P-256",
  787. "ExpectedClientSignHash" => "SHA256",
  788. "ExpectedClientSignType" => "EC",
  789. "ExpectedResult" => "Success"
  790. },
  791. },
  792. );
  793. my @tests_tls_1_3_non_fips = (
  794. {
  795. name => "TLS 1.3 Ed25519 Signature Algorithm Selection",
  796. server => $server_tls_1_3,
  797. client => {
  798. "SignatureAlgorithms" => "ed25519",
  799. },
  800. test => {
  801. "ExpectedServerCertType" => "Ed25519",
  802. "ExpectedServerSignType" => "Ed25519",
  803. "ExpectedResult" => "Success"
  804. },
  805. },
  806. {
  807. name => "TLS 1.3 Ed448 Signature Algorithm Selection",
  808. server => $server_tls_1_3,
  809. client => {
  810. "SignatureAlgorithms" => "ed448",
  811. "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
  812. },
  813. test => {
  814. "ExpectedServerCertType" => "Ed448",
  815. "ExpectedServerSignType" => "Ed448",
  816. "ExpectedResult" => "Success"
  817. },
  818. },
  819. {
  820. name => "TLS 1.3 Ed25519 CipherString and Groups Selection",
  821. server => $server_tls_1_3,
  822. client => {
  823. "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
  824. # Excluding P-256 from the supported groups list should
  825. # mean server still uses a P-256 certificate because supported
  826. # groups is not used in signature selection for TLS 1.3
  827. "Groups" => "X25519"
  828. },
  829. test => {
  830. "ExpectedServerCertType" =>, "P-256",
  831. "ExpectedServerSignType" =>, "EC",
  832. "ExpectedResult" => "Success"
  833. },
  834. },
  835. {
  836. name => "TLS 1.3 Ed448 CipherString and Groups Selection",
  837. server => $server_tls_1_3,
  838. client => {
  839. "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
  840. # Excluding P-256 from the supported groups list should
  841. # mean server still uses a P-256 certificate because supported
  842. # groups is not used in signature selection for TLS 1.3
  843. "Groups" => "X448"
  844. },
  845. test => {
  846. "ExpectedServerCertType" =>, "P-256",
  847. "ExpectedServerSignType" =>, "EC",
  848. "ExpectedResult" => "Success"
  849. },
  850. },
  851. {
  852. name => "TLS 1.3 Ed25519 Client Auth",
  853. server => {
  854. "VerifyCAFile" => test_pem("root-cert.pem"),
  855. "VerifyMode" => "Require"
  856. },
  857. client => {
  858. "EdDSA.Certificate" => test_pem("client-ed25519-cert.pem"),
  859. "EdDSA.PrivateKey" => test_pem("client-ed25519-key.pem"),
  860. "MinProtocol" => "TLSv1.3",
  861. "MaxProtocol" => "TLSv1.3"
  862. },
  863. test => {
  864. "ExpectedClientCertType" => "Ed25519",
  865. "ExpectedClientSignType" => "Ed25519",
  866. "ExpectedResult" => "Success"
  867. },
  868. },
  869. {
  870. name => "TLS 1.3 Ed448 Client Auth",
  871. server => {
  872. "VerifyCAFile" => test_pem("root-cert.pem"),
  873. "VerifyMode" => "Require"
  874. },
  875. client => {
  876. "EdDSA.Certificate" => test_pem("client-ed448-cert.pem"),
  877. "EdDSA.PrivateKey" => test_pem("client-ed448-key.pem"),
  878. "MinProtocol" => "TLSv1.3",
  879. "MaxProtocol" => "TLSv1.3"
  880. },
  881. test => {
  882. "ExpectedClientCertType" => "Ed448",
  883. "ExpectedClientSignType" => "Ed448",
  884. "ExpectedResult" => "Success"
  885. },
  886. },
  887. {
  888. name => "TLS 1.3 ECDSA with brainpool",
  889. server => {
  890. "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
  891. "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
  892. },
  893. client => {
  894. "RequestCAFile" => test_pem("root-cert.pem"),
  895. "MinProtocol" => "TLSv1.3",
  896. "MaxProtocol" => "TLSv1.3"
  897. },
  898. test => {
  899. "ExpectedResult" => "ServerFail"
  900. },
  901. },
  902. );
  903. push @tests, @tests_tls_1_3 unless disabled("tls1_3");
  904. push @tests, @tests_tls_1_3_non_fips unless disabled("tls1_3") || $fips_mode;
  905. my @tests_dsa_tls_1_2 = (
  906. {
  907. name => "TLS 1.2 DSA Certificate Test",
  908. server => {
  909. "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
  910. "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
  911. "DHParameters" => test_pem("dhp2048.pem"),
  912. "MinProtocol" => "TLSv1.2",
  913. "MaxProtocol" => "TLSv1.2",
  914. "CipherString" => "ALL",
  915. },
  916. client => {
  917. "SignatureAlgorithms" => "DSA+SHA256:DSA+SHA1",
  918. "CipherString" => "ALL",
  919. },
  920. test => {
  921. "ExpectedResult" => "Success"
  922. },
  923. },
  924. );
  925. my @tests_dsa_tls_1_3 = (
  926. {
  927. name => "TLS 1.3 Client Auth No TLS 1.3 Signature Algorithms",
  928. server => {
  929. "ClientSignatureAlgorithms" => "ECDSA+SHA1:DSA+SHA256:RSA+SHA256",
  930. "VerifyCAFile" => test_pem("root-cert.pem"),
  931. "VerifyMode" => "Request"
  932. },
  933. client => {},
  934. test => {
  935. "ExpectedResult" => "ServerFail"
  936. },
  937. },
  938. {
  939. name => "TLS 1.3 DSA Certificate Test",
  940. server => {
  941. "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
  942. "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
  943. "MinProtocol" => "TLSv1.3",
  944. "MaxProtocol" => "TLSv1.3",
  945. "CipherString" => "ALL",
  946. },
  947. client => {
  948. "SignatureAlgorithms" => "DSA+SHA1:DSA+SHA256:ECDSA+SHA256",
  949. "CipherString" => "ALL",
  950. },
  951. test => {
  952. "ExpectedResult" => "ServerFail"
  953. },
  954. },
  955. );
  956. if (!disabled("dsa")) {
  957. #TODO(3.0): Temporary workaround for DH issues in FIPS. Needs investigation
  958. push @tests, @tests_dsa_tls_1_2 unless disabled("dh") || $fips_mode;
  959. push @tests, @tests_dsa_tls_1_3 unless disabled("tls1_3");
  960. }