70-test_tls13kexmodes.t 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. #! /usr/bin/env perl
  2. # Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file srctop_dir bldtop_dir/;
  10. use OpenSSL::Test::Utils;
  11. use File::Temp qw(tempfile);
  12. use TLSProxy::Proxy;
  13. use checkhandshake qw(checkhandshake @handmessages @extensions);
  14. my $test_name = "test_tls13kexmodes";
  15. setup($test_name);
  16. plan skip_all => "TLSProxy isn't usable on $^O"
  17. if $^O =~ /^(VMS)$/;
  18. plan skip_all => "$test_name needs the dynamic engine feature enabled"
  19. if disabled("engine") || disabled("dynamic-engine");
  20. plan skip_all => "$test_name needs the sock feature enabled"
  21. if disabled("sock");
  22. plan skip_all => "$test_name needs TLSv1.3 enabled"
  23. if disabled("tls1_3") || (disabled("ec") && disabled("dh"));
  24. plan skip_all => "$test_name needs EC enabled"
  25. if disabled("ec");
  26. @handmessages = (
  27. [TLSProxy::Message::MT_CLIENT_HELLO,
  28. checkhandshake::ALL_HANDSHAKES],
  29. [TLSProxy::Message::MT_SERVER_HELLO,
  30. checkhandshake::HRR_HANDSHAKE | checkhandshake::HRR_RESUME_HANDSHAKE],
  31. [TLSProxy::Message::MT_CLIENT_HELLO,
  32. checkhandshake::HRR_HANDSHAKE | checkhandshake::HRR_RESUME_HANDSHAKE],
  33. [TLSProxy::Message::MT_SERVER_HELLO,
  34. checkhandshake::ALL_HANDSHAKES],
  35. [TLSProxy::Message::MT_ENCRYPTED_EXTENSIONS,
  36. checkhandshake::ALL_HANDSHAKES],
  37. [TLSProxy::Message::MT_CERTIFICATE_REQUEST,
  38. checkhandshake::CLIENT_AUTH_HANDSHAKE],
  39. [TLSProxy::Message::MT_CERTIFICATE,
  40. checkhandshake::ALL_HANDSHAKES & ~(checkhandshake::RESUME_HANDSHAKE | checkhandshake::HRR_RESUME_HANDSHAKE)],
  41. [TLSProxy::Message::MT_CERTIFICATE_VERIFY,
  42. checkhandshake::ALL_HANDSHAKES & ~(checkhandshake::RESUME_HANDSHAKE | checkhandshake::HRR_RESUME_HANDSHAKE)],
  43. [TLSProxy::Message::MT_FINISHED,
  44. checkhandshake::ALL_HANDSHAKES],
  45. [TLSProxy::Message::MT_CERTIFICATE,
  46. checkhandshake::CLIENT_AUTH_HANDSHAKE],
  47. [TLSProxy::Message::MT_CERTIFICATE_VERIFY,
  48. checkhandshake::CLIENT_AUTH_HANDSHAKE],
  49. [TLSProxy::Message::MT_FINISHED,
  50. checkhandshake::ALL_HANDSHAKES],
  51. [0, 0]
  52. );
  53. @extensions = (
  54. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SERVER_NAME,
  55. TLSProxy::Message::CLIENT,
  56. checkhandshake::SERVER_NAME_CLI_EXTENSION],
  57. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_STATUS_REQUEST,
  58. TLSProxy::Message::CLIENT,
  59. checkhandshake::STATUS_REQUEST_CLI_EXTENSION],
  60. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SUPPORTED_GROUPS,
  61. TLSProxy::Message::CLIENT,
  62. checkhandshake::DEFAULT_EXTENSIONS],
  63. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EC_POINT_FORMATS,
  64. TLSProxy::Message::CLIENT,
  65. checkhandshake::DEFAULT_EXTENSIONS],
  66. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SIG_ALGS,
  67. TLSProxy::Message::CLIENT,
  68. checkhandshake::DEFAULT_EXTENSIONS],
  69. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ALPN,
  70. TLSProxy::Message::CLIENT,
  71. checkhandshake::ALPN_CLI_EXTENSION],
  72. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SCT,
  73. TLSProxy::Message::CLIENT,
  74. checkhandshake::SCT_CLI_EXTENSION],
  75. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ENCRYPT_THEN_MAC,
  76. TLSProxy::Message::CLIENT,
  77. checkhandshake::DEFAULT_EXTENSIONS],
  78. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EXTENDED_MASTER_SECRET,
  79. TLSProxy::Message::CLIENT,
  80. checkhandshake::DEFAULT_EXTENSIONS],
  81. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SESSION_TICKET,
  82. TLSProxy::Message::CLIENT,
  83. checkhandshake::DEFAULT_EXTENSIONS],
  84. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_KEY_SHARE,
  85. TLSProxy::Message::CLIENT,
  86. checkhandshake::DEFAULT_EXTENSIONS],
  87. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SUPPORTED_VERSIONS,
  88. TLSProxy::Message::CLIENT,
  89. checkhandshake::DEFAULT_EXTENSIONS],
  90. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_PSK_KEX_MODES,
  91. TLSProxy::Message::CLIENT,
  92. checkhandshake::PSK_KEX_MODES_EXTENSION],
  93. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_PSK,
  94. TLSProxy::Message::CLIENT,
  95. checkhandshake::PSK_CLI_EXTENSION],
  96. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_RENEGOTIATE,
  97. TLSProxy::Message::CLIENT,
  98. checkhandshake::DEFAULT_EXTENSIONS],
  99. [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_SUPPORTED_VERSIONS,
  100. TLSProxy::Message::SERVER,
  101. checkhandshake::DEFAULT_EXTENSIONS],
  102. [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_KEY_SHARE,
  103. TLSProxy::Message::SERVER,
  104. checkhandshake::KEY_SHARE_HRR_EXTENSION],
  105. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SERVER_NAME,
  106. TLSProxy::Message::CLIENT,
  107. checkhandshake::SERVER_NAME_CLI_EXTENSION],
  108. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_STATUS_REQUEST,
  109. TLSProxy::Message::CLIENT,
  110. checkhandshake::STATUS_REQUEST_CLI_EXTENSION],
  111. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SUPPORTED_GROUPS,
  112. TLSProxy::Message::CLIENT,
  113. checkhandshake::DEFAULT_EXTENSIONS],
  114. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EC_POINT_FORMATS,
  115. TLSProxy::Message::CLIENT,
  116. checkhandshake::DEFAULT_EXTENSIONS],
  117. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SIG_ALGS,
  118. TLSProxy::Message::CLIENT,
  119. checkhandshake::DEFAULT_EXTENSIONS],
  120. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ALPN,
  121. TLSProxy::Message::CLIENT,
  122. checkhandshake::ALPN_CLI_EXTENSION],
  123. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SCT,
  124. TLSProxy::Message::CLIENT,
  125. checkhandshake::SCT_CLI_EXTENSION],
  126. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ENCRYPT_THEN_MAC,
  127. TLSProxy::Message::CLIENT,
  128. checkhandshake::DEFAULT_EXTENSIONS],
  129. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EXTENDED_MASTER_SECRET,
  130. TLSProxy::Message::CLIENT,
  131. checkhandshake::DEFAULT_EXTENSIONS],
  132. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SESSION_TICKET,
  133. TLSProxy::Message::CLIENT,
  134. checkhandshake::DEFAULT_EXTENSIONS],
  135. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_KEY_SHARE,
  136. TLSProxy::Message::CLIENT,
  137. checkhandshake::DEFAULT_EXTENSIONS],
  138. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SUPPORTED_VERSIONS,
  139. TLSProxy::Message::CLIENT,
  140. checkhandshake::DEFAULT_EXTENSIONS],
  141. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_PSK_KEX_MODES,
  142. TLSProxy::Message::CLIENT,
  143. checkhandshake::PSK_KEX_MODES_EXTENSION],
  144. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_PSK,
  145. TLSProxy::Message::CLIENT,
  146. checkhandshake::PSK_CLI_EXTENSION],
  147. [TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_RENEGOTIATE,
  148. TLSProxy::Message::CLIENT,
  149. checkhandshake::DEFAULT_EXTENSIONS],
  150. [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_SUPPORTED_VERSIONS,
  151. TLSProxy::Message::SERVER,
  152. checkhandshake::DEFAULT_EXTENSIONS],
  153. [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_KEY_SHARE,
  154. TLSProxy::Message::SERVER,
  155. checkhandshake::KEY_SHARE_SRV_EXTENSION],
  156. [TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_PSK,
  157. TLSProxy::Message::SERVER,
  158. checkhandshake::PSK_SRV_EXTENSION],
  159. [TLSProxy::Message::MT_CERTIFICATE, TLSProxy::Message::EXT_STATUS_REQUEST,
  160. TLSProxy::Message::SERVER,
  161. checkhandshake::STATUS_REQUEST_SRV_EXTENSION],
  162. [0,0,0,0]
  163. );
  164. use constant {
  165. DELETE_EXTENSION => 0,
  166. EMPTY_EXTENSION => 1,
  167. NON_DHE_KEX_MODE_ONLY => 2,
  168. DHE_KEX_MODE_ONLY => 3,
  169. UNKNOWN_KEX_MODES => 4,
  170. BOTH_KEX_MODES => 5
  171. };
  172. my $proxy = TLSProxy::Proxy->new(
  173. undef,
  174. cmdstr(app(["openssl"]), display => 1),
  175. srctop_file("apps", "server.pem"),
  176. (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
  177. );
  178. #Test 1: First get a session
  179. (undef, my $session) = tempfile();
  180. $proxy->clientflags("-no_rx_cert_comp -sess_out ".$session);
  181. $proxy->serverflags("-no_rx_cert_comp -servername localhost");
  182. $proxy->sessionfile($session);
  183. $proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
  184. plan tests => 13;
  185. ok(TLSProxy::Message->success(), "Initial connection");
  186. #Test 2: Attempt a resume with no kex modes extension. Should fail (server
  187. # MUST abort handshake with pre_shared key and no psk_kex_modes)
  188. $proxy->clear();
  189. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  190. my $testtype = DELETE_EXTENSION;
  191. $proxy->filter(\&modify_kex_modes_filter);
  192. $proxy->start();
  193. ok(TLSProxy::Message->fail(), "Resume with no kex modes");
  194. #Test 3: Attempt a resume with empty kex modes extension. Should fail (empty
  195. # extension is invalid)
  196. $proxy->clear();
  197. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  198. $testtype = EMPTY_EXTENSION;
  199. $proxy->start();
  200. ok(TLSProxy::Message->fail(), "Resume with empty kex modes");
  201. #Test 4: Attempt a resume with non-dhe kex mode only. Should resume without a
  202. # key_share
  203. $proxy->clear();
  204. $proxy->clientflags("-no_rx_cert_comp -allow_no_dhe_kex -sess_in ".$session);
  205. $proxy->serverflags("-no_rx_cert_comp -allow_no_dhe_kex");
  206. $testtype = NON_DHE_KEX_MODE_ONLY;
  207. $proxy->start();
  208. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  209. checkhandshake::DEFAULT_EXTENSIONS
  210. | checkhandshake::PSK_KEX_MODES_EXTENSION
  211. | checkhandshake::PSK_CLI_EXTENSION
  212. | checkhandshake::PSK_SRV_EXTENSION,
  213. "Resume with non-dhe kex mode");
  214. #Test 5: Attempt a resume with dhe kex mode only. Should resume with a key_share
  215. $proxy->clear();
  216. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  217. $testtype = DHE_KEX_MODE_ONLY;
  218. $proxy->start();
  219. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  220. checkhandshake::DEFAULT_EXTENSIONS
  221. | checkhandshake::PSK_KEX_MODES_EXTENSION
  222. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  223. | checkhandshake::PSK_CLI_EXTENSION
  224. | checkhandshake::PSK_SRV_EXTENSION,
  225. "Resume with non-dhe kex mode");
  226. #Test 6: Attempt a resume with only unrecognised kex modes. Should not resume
  227. # but rather fall back to full handshake
  228. $proxy->clear();
  229. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  230. $testtype = UNKNOWN_KEX_MODES;
  231. $proxy->start();
  232. checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
  233. checkhandshake::DEFAULT_EXTENSIONS
  234. | checkhandshake::PSK_KEX_MODES_EXTENSION
  235. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  236. | checkhandshake::PSK_CLI_EXTENSION,
  237. "Resume with unrecognized kex mode");
  238. #Test 7: Attempt a resume with both, non-dhe and dhe kex mode. Should resume with
  239. # a key_share, even though non-dhe is allowed, but not explicitly preferred.
  240. $proxy->clear();
  241. $proxy->clientflags("-no_rx_cert_comp -allow_no_dhe_kex -sess_in ".$session);
  242. $proxy->serverflags("-allow_no_dhe_kex");
  243. $testtype = BOTH_KEX_MODES;
  244. $proxy->start();
  245. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  246. checkhandshake::DEFAULT_EXTENSIONS
  247. | checkhandshake::PSK_KEX_MODES_EXTENSION
  248. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  249. | checkhandshake::PSK_CLI_EXTENSION
  250. | checkhandshake::PSK_SRV_EXTENSION,
  251. "Resume with both kex modes");
  252. #Test 8: Attempt a resume with both, non-dhe and dhe kex mode, but with server-side
  253. # preference for non-dhe. Should resume without a key_share.
  254. $proxy->clear();
  255. $proxy->clientflags("-no_rx_cert_comp -allow_no_dhe_kex -sess_in ".$session);
  256. $proxy->serverflags("-allow_no_dhe_kex -prefer_no_dhe_kex");
  257. $testtype = BOTH_KEX_MODES;
  258. $proxy->start();
  259. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  260. checkhandshake::DEFAULT_EXTENSIONS
  261. | checkhandshake::PSK_KEX_MODES_EXTENSION
  262. | checkhandshake::PSK_CLI_EXTENSION
  263. | checkhandshake::PSK_SRV_EXTENSION,
  264. "Resume with both kex modes, preference for non-dhe");
  265. #Test 9: Attempt a resume with both, non-dhe and dhe kex mode, with server-side
  266. # preference for non-dhe, but non-dhe not allowed. Should resume with a key_share.
  267. $proxy->clear();
  268. $proxy->clientflags("-no_rx_cert_comp -allow_no_dhe_kex -sess_in ".$session);
  269. $proxy->serverflags("-prefer_no_dhe_kex");
  270. $testtype = BOTH_KEX_MODES;
  271. $proxy->start();
  272. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  273. checkhandshake::DEFAULT_EXTENSIONS
  274. | checkhandshake::PSK_KEX_MODES_EXTENSION
  275. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  276. | checkhandshake::PSK_CLI_EXTENSION
  277. | checkhandshake::PSK_SRV_EXTENSION,
  278. "Resume with both kex modes, preference for but disabled non-dhe");
  279. #Test 10: Attempt a resume with both non-dhe and dhe kex mode, but unacceptable
  280. # initial key_share. Should resume with a key_share following an HRR
  281. $proxy->clear();
  282. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  283. $proxy->serverflags("-no_rx_cert_comp -curves P-384");
  284. $testtype = BOTH_KEX_MODES;
  285. $proxy->start();
  286. checkhandshake($proxy, checkhandshake::HRR_RESUME_HANDSHAKE,
  287. checkhandshake::DEFAULT_EXTENSIONS
  288. | checkhandshake::PSK_KEX_MODES_EXTENSION
  289. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  290. | checkhandshake::KEY_SHARE_HRR_EXTENSION
  291. | checkhandshake::PSK_CLI_EXTENSION
  292. | checkhandshake::PSK_SRV_EXTENSION,
  293. "Resume with both kex modes and HRR");
  294. #Test 11: Attempt a resume with dhe kex mode only and an unacceptable initial
  295. # key_share. Should resume with a key_share following an HRR
  296. $proxy->clear();
  297. $proxy->clientflags("-no_rx_cert_comp -sess_in ".$session);
  298. $proxy->serverflags("-no_rx_cert_comp -curves P-384");
  299. $testtype = DHE_KEX_MODE_ONLY;
  300. $proxy->start();
  301. checkhandshake($proxy, checkhandshake::HRR_RESUME_HANDSHAKE,
  302. checkhandshake::DEFAULT_EXTENSIONS
  303. | checkhandshake::PSK_KEX_MODES_EXTENSION
  304. | checkhandshake::KEY_SHARE_SRV_EXTENSION
  305. | checkhandshake::KEY_SHARE_HRR_EXTENSION
  306. | checkhandshake::PSK_CLI_EXTENSION
  307. | checkhandshake::PSK_SRV_EXTENSION,
  308. "Resume with dhe kex mode and HRR");
  309. #Test 12: Attempt a resume with both non-dhe and dhe kex mode, unacceptable
  310. # initial key_share and no overlapping groups. Should resume without a
  311. # key_share
  312. $proxy->clear();
  313. $proxy->clientflags("-no_rx_cert_comp -allow_no_dhe_kex -curves P-384 -sess_in ".$session);
  314. $proxy->serverflags("-no_rx_cert_comp -allow_no_dhe_kex -curves P-256");
  315. $testtype = BOTH_KEX_MODES;
  316. $proxy->start();
  317. checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
  318. checkhandshake::DEFAULT_EXTENSIONS
  319. | checkhandshake::PSK_KEX_MODES_EXTENSION
  320. | checkhandshake::PSK_CLI_EXTENSION
  321. | checkhandshake::PSK_SRV_EXTENSION,
  322. "Resume with both kex modes, no overlapping groups");
  323. #Test 13: Attempt a resume with dhe kex mode only, unacceptable
  324. # initial key_share and no overlapping groups. Should fail
  325. $proxy->clear();
  326. $proxy->clientflags("-no_rx_cert_comp -curves P-384 -sess_in ".$session);
  327. $proxy->serverflags("-no_rx_cert_comp -curves P-256");
  328. $testtype = DHE_KEX_MODE_ONLY;
  329. $proxy->start();
  330. ok(TLSProxy::Message->fail(), "Resume with dhe kex mode, no overlapping groups");
  331. unlink $session;
  332. sub modify_kex_modes_filter
  333. {
  334. my $proxy = shift;
  335. # We're only interested in the initial ClientHello
  336. return if ($proxy->flight != 0);
  337. foreach my $message (@{$proxy->message_list}) {
  338. if ($message->mt == TLSProxy::Message::MT_CLIENT_HELLO) {
  339. my $ext;
  340. if ($testtype == EMPTY_EXTENSION) {
  341. $ext = pack "C",
  342. 0x00; #List length
  343. } elsif ($testtype == NON_DHE_KEX_MODE_ONLY) {
  344. $ext = pack "C2",
  345. 0x01, #List length
  346. 0x00; #psk_ke
  347. } elsif ($testtype == DHE_KEX_MODE_ONLY) {
  348. $ext = pack "C2",
  349. 0x01, #List length
  350. 0x01; #psk_dhe_ke
  351. } elsif ($testtype == UNKNOWN_KEX_MODES) {
  352. $ext = pack "C3",
  353. 0x02, #List length
  354. 0xfe, #unknown
  355. 0xff; #unknown
  356. } elsif ($testtype == BOTH_KEX_MODES) {
  357. #We deliberately list psk_ke first...should still use psk_dhe_ke, except if the server is configured otherwise.
  358. $ext = pack "C3",
  359. 0x02, #List length
  360. 0x00, #psk_ke
  361. 0x01; #psk_dhe_ke
  362. }
  363. if ($testtype == DELETE_EXTENSION) {
  364. $message->delete_extension(
  365. TLSProxy::Message::EXT_PSK_KEX_MODES);
  366. } else {
  367. $message->set_extension(
  368. TLSProxy::Message::EXT_PSK_KEX_MODES, $ext);
  369. }
  370. $message->repack();
  371. }
  372. }
  373. }