18-dtls-renegotiate.cnf.in 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # -*- mode: perl; -*-
  2. # Copyright 2016-2024 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. ## Test Renegotiation
  9. use strict;
  10. use warnings;
  11. package ssltests;
  12. use OpenSSL::Test::Utils;
  13. our $fips_mode;
  14. our @tests = ();
  15. foreach my $sctp ("No", "Yes")
  16. {
  17. next if disabled("sctp") && $sctp eq "Yes";
  18. next if disabled("dtls1_2") && $fips_mode;
  19. my $suffix = ($sctp eq "No") ? "" : "-sctp";
  20. our @tests_basic = (
  21. {
  22. name => "renegotiate-client-no-resume".$suffix,
  23. server => {
  24. "MaxProtocol" => "DTLSv1.2",
  25. "CipherString" => 'DEFAULT:@SECLEVEL=0',
  26. "Options" => "NoResumptionOnRenegotiation"
  27. },
  28. client => {
  29. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  30. },
  31. test => {
  32. "Method" => "DTLS",
  33. "UseSCTP" => $sctp,
  34. "HandshakeMode" => "RenegotiateClient",
  35. "ResumptionExpected" => "No",
  36. "ExpectedResult" => "Success"
  37. }
  38. },
  39. {
  40. name => "renegotiate-client-resume".$suffix,
  41. server => {
  42. "MaxProtocol" => "DTLSv1.2",
  43. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  44. },
  45. client => {
  46. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  47. },
  48. test => {
  49. "Method" => "DTLS",
  50. "UseSCTP" => $sctp,
  51. "HandshakeMode" => "RenegotiateClient",
  52. "ResumptionExpected" => "Yes",
  53. "ExpectedResult" => "Success"
  54. }
  55. },
  56. # Note: Unlike the TLS tests, we will never do resumption with server
  57. # initiated reneg. This is because an OpenSSL DTLS client will always do a full
  58. # handshake (i.e. it doesn't supply a session id) when it receives a
  59. # HelloRequest. This is different to the OpenSSL TLS implementation where an
  60. # OpenSSL client will always try an abbreviated handshake (i.e. it will supply
  61. # the session id). This goes all the way to commit 48ae85b6f when abbreviated
  62. # handshake support was first added. Neither behaviour is wrong, but the
  63. # discrepancy is strange. TODO: Should we harmonise the TLS and DTLS behaviour,
  64. # and if so, what to?
  65. {
  66. name => "renegotiate-server-resume".$suffix,
  67. server => {
  68. "MaxProtocol" => "DTLSv1.2",
  69. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  70. },
  71. client => {
  72. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  73. },
  74. test => {
  75. "Method" => "DTLS",
  76. "UseSCTP" => $sctp,
  77. "HandshakeMode" => "RenegotiateServer",
  78. "ResumptionExpected" => "No",
  79. "ExpectedResult" => "Success"
  80. }
  81. },
  82. {
  83. name => "renegotiate-client-auth-require".$suffix,
  84. server => {
  85. "MaxProtocol" => "DTLSv1.2",
  86. "VerifyCAFile" => test_pem("root-cert.pem"),
  87. "VerifyMode" => "Require",
  88. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  89. },
  90. client => {
  91. "Certificate" => test_pem("ee-client-chain.pem"),
  92. "PrivateKey" => test_pem("ee-key.pem"),
  93. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  94. },
  95. test => {
  96. "Method" => "DTLS",
  97. "UseSCTP" => $sctp,
  98. "HandshakeMode" => "RenegotiateServer",
  99. "ResumptionExpected" => "No",
  100. "ExpectedResult" => "Success"
  101. }
  102. },
  103. {
  104. name => "renegotiate-client-auth-once".$suffix,
  105. server => {
  106. "MaxProtocol" => "DTLSv1.2",
  107. "VerifyCAFile" => test_pem("root-cert.pem"),
  108. "VerifyMode" => "Once",
  109. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  110. },
  111. client => {
  112. "Certificate" => test_pem("ee-client-chain.pem"),
  113. "PrivateKey" => test_pem("ee-key.pem"),
  114. "CipherString" => 'DEFAULT:@SECLEVEL=0'
  115. },
  116. test => {
  117. "Method" => "DTLS",
  118. "UseSCTP" => $sctp,
  119. "HandshakeMode" => "RenegotiateServer",
  120. "ResumptionExpected" => "No",
  121. "ExpectedResult" => "Success"
  122. }
  123. }
  124. );
  125. push @tests, @tests_basic;
  126. next if disabled("dtls1_2");
  127. our @tests_dtls1_2 = (
  128. {
  129. name => "renegotiate-aead-to-non-aead".$suffix,
  130. server => {
  131. "Options" => "NoResumptionOnRenegotiation"
  132. },
  133. client => {
  134. "MaxProtocol" => "DTLSv1.2",
  135. "CipherString" => "AES128-GCM-SHA256",
  136. extra => {
  137. "RenegotiateCiphers" => "AES128-SHA"
  138. }
  139. },
  140. test => {
  141. "Method" => "DTLS",
  142. "UseSCTP" => $sctp,
  143. "HandshakeMode" => "RenegotiateClient",
  144. "ResumptionExpected" => "No",
  145. "ExpectedResult" => "Success"
  146. }
  147. },
  148. {
  149. name => "renegotiate-non-aead-to-aead".$suffix,
  150. server => {
  151. "Options" => "NoResumptionOnRenegotiation"
  152. },
  153. client => {
  154. "MaxProtocol" => "DTLSv1.2",
  155. "CipherString" => "AES128-SHA",
  156. extra => {
  157. "RenegotiateCiphers" => "AES128-GCM-SHA256"
  158. }
  159. },
  160. test => {
  161. "Method" => "DTLS",
  162. "UseSCTP" => $sctp,
  163. "HandshakeMode" => "RenegotiateClient",
  164. "ResumptionExpected" => "No",
  165. "ExpectedResult" => "Success"
  166. }
  167. },
  168. {
  169. name => "renegotiate-non-aead-to-non-aead".$suffix,
  170. server => {
  171. "Options" => "NoResumptionOnRenegotiation"
  172. },
  173. client => {
  174. "MaxProtocol" => "DTLSv1.2",
  175. "CipherString" => "AES128-SHA",
  176. extra => {
  177. "RenegotiateCiphers" => "AES256-SHA"
  178. }
  179. },
  180. test => {
  181. "Method" => "DTLS",
  182. "UseSCTP" => $sctp,
  183. "HandshakeMode" => "RenegotiateClient",
  184. "ResumptionExpected" => "No",
  185. "ExpectedResult" => "Success"
  186. }
  187. },
  188. {
  189. name => "renegotiate-aead-to-aead".$suffix,
  190. server => {
  191. "Options" => "NoResumptionOnRenegotiation"
  192. },
  193. client => {
  194. "MaxProtocol" => "DTLSv1.2",
  195. "CipherString" => "AES128-GCM-SHA256",
  196. extra => {
  197. "RenegotiateCiphers" => "AES256-GCM-SHA384"
  198. }
  199. },
  200. test => {
  201. "Method" => "DTLS",
  202. "UseSCTP" => $sctp,
  203. "HandshakeMode" => "RenegotiateClient",
  204. "ResumptionExpected" => "No",
  205. "ExpectedResult" => "Success"
  206. }
  207. },
  208. );
  209. push @tests, @tests_dtls1_2;
  210. }