methods.c 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. */
  9. #include <stdio.h>
  10. #include <openssl/objects.h>
  11. #include "ssl_locl.h"
  12. /*-
  13. * TLS/SSLv3 methods
  14. */
  15. IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  16. TLS_method,
  17. ossl_statem_accept,
  18. ossl_statem_connect, TLSv1_2_enc_data)
  19. #ifndef OPENSSL_NO_TLS1_3_METHOD
  20. IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
  21. tlsv1_3_method,
  22. ossl_statem_accept,
  23. ossl_statem_connect, TLSv1_3_enc_data)
  24. #endif
  25. #ifndef OPENSSL_NO_TLS1_2_METHOD
  26. IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
  27. tlsv1_2_method,
  28. ossl_statem_accept,
  29. ossl_statem_connect, TLSv1_2_enc_data)
  30. #endif
  31. #ifndef OPENSSL_NO_TLS1_1_METHOD
  32. IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
  33. tlsv1_1_method,
  34. ossl_statem_accept,
  35. ossl_statem_connect, TLSv1_1_enc_data)
  36. #endif
  37. #ifndef OPENSSL_NO_TLS1_METHOD
  38. IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
  39. tlsv1_method,
  40. ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
  41. #endif
  42. #ifndef OPENSSL_NO_SSL3_METHOD
  43. IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
  44. #endif
  45. /*-
  46. * TLS/SSLv3 server methods
  47. */
  48. IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  49. TLS_server_method,
  50. ossl_statem_accept,
  51. ssl_undefined_function, TLSv1_2_enc_data)
  52. #ifndef OPENSSL_NO_TLS1_3_METHOD
  53. IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
  54. tlsv1_3_server_method,
  55. ossl_statem_accept,
  56. ssl_undefined_function, TLSv1_3_enc_data)
  57. #endif
  58. #ifndef OPENSSL_NO_TLS1_2_METHOD
  59. IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
  60. tlsv1_2_server_method,
  61. ossl_statem_accept,
  62. ssl_undefined_function, TLSv1_2_enc_data)
  63. #endif
  64. #ifndef OPENSSL_NO_TLS1_1_METHOD
  65. IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
  66. tlsv1_1_server_method,
  67. ossl_statem_accept,
  68. ssl_undefined_function, TLSv1_1_enc_data)
  69. #endif
  70. #ifndef OPENSSL_NO_TLS1_METHOD
  71. IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
  72. tlsv1_server_method,
  73. ossl_statem_accept,
  74. ssl_undefined_function, TLSv1_enc_data)
  75. #endif
  76. #ifndef OPENSSL_NO_SSL3_METHOD
  77. IMPLEMENT_ssl3_meth_func(sslv3_server_method,
  78. ossl_statem_accept, ssl_undefined_function)
  79. #endif
  80. /*-
  81. * TLS/SSLv3 client methods
  82. */
  83. IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  84. TLS_client_method,
  85. ssl_undefined_function,
  86. ossl_statem_connect, TLSv1_2_enc_data)
  87. #ifndef OPENSSL_NO_TLS1_3_METHOD
  88. IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
  89. tlsv1_3_client_method,
  90. ssl_undefined_function,
  91. ossl_statem_connect, TLSv1_3_enc_data)
  92. #endif
  93. #ifndef OPENSSL_NO_TLS1_2_METHOD
  94. IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
  95. tlsv1_2_client_method,
  96. ssl_undefined_function,
  97. ossl_statem_connect, TLSv1_2_enc_data)
  98. #endif
  99. #ifndef OPENSSL_NO_TLS1_1_METHOD
  100. IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
  101. tlsv1_1_client_method,
  102. ssl_undefined_function,
  103. ossl_statem_connect, TLSv1_1_enc_data)
  104. #endif
  105. #ifndef OPENSSL_NO_TLS1_METHOD
  106. IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
  107. tlsv1_client_method,
  108. ssl_undefined_function,
  109. ossl_statem_connect, TLSv1_enc_data)
  110. #endif
  111. #ifndef OPENSSL_NO_SSL3_METHOD
  112. IMPLEMENT_ssl3_meth_func(sslv3_client_method,
  113. ssl_undefined_function, ossl_statem_connect)
  114. #endif
  115. /*-
  116. * DTLS methods
  117. */
  118. #ifndef OPENSSL_NO_DTLS1_METHOD
  119. IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  120. dtlsv1_method,
  121. ossl_statem_accept,
  122. ossl_statem_connect, DTLSv1_enc_data)
  123. #endif
  124. #ifndef OPENSSL_NO_DTLS1_2_METHOD
  125. IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
  126. dtlsv1_2_method,
  127. ossl_statem_accept,
  128. ossl_statem_connect, DTLSv1_2_enc_data)
  129. #endif
  130. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  131. DTLS_method,
  132. ossl_statem_accept,
  133. ossl_statem_connect, DTLSv1_2_enc_data)
  134. /*-
  135. * DTLS server methods
  136. */
  137. #ifndef OPENSSL_NO_DTLS1_METHOD
  138. IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  139. dtlsv1_server_method,
  140. ossl_statem_accept,
  141. ssl_undefined_function, DTLSv1_enc_data)
  142. #endif
  143. #ifndef OPENSSL_NO_DTLS1_2_METHOD
  144. IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
  145. dtlsv1_2_server_method,
  146. ossl_statem_accept,
  147. ssl_undefined_function, DTLSv1_2_enc_data)
  148. #endif
  149. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  150. DTLS_server_method,
  151. ossl_statem_accept,
  152. ssl_undefined_function, DTLSv1_2_enc_data)
  153. /*-
  154. * DTLS client methods
  155. */
  156. #ifndef OPENSSL_NO_DTLS1_METHOD
  157. IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  158. dtlsv1_client_method,
  159. ssl_undefined_function,
  160. ossl_statem_connect, DTLSv1_enc_data)
  161. IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  162. dtls_bad_ver_client_method,
  163. ssl_undefined_function,
  164. ossl_statem_connect, DTLSv1_enc_data)
  165. #endif
  166. #ifndef OPENSSL_NO_DTLS1_2_METHOD
  167. IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
  168. dtlsv1_2_client_method,
  169. ssl_undefined_function,
  170. ossl_statem_connect, DTLSv1_2_enc_data)
  171. #endif
  172. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  173. DTLS_client_method,
  174. ssl_undefined_function,
  175. ossl_statem_connect, DTLSv1_2_enc_data)
  176. #if OPENSSL_API_COMPAT < 0x10100000L
  177. # ifndef OPENSSL_NO_TLS1_2_METHOD
  178. const SSL_METHOD *TLSv1_2_method(void)
  179. {
  180. return tlsv1_2_method();
  181. }
  182. const SSL_METHOD *TLSv1_2_server_method(void)
  183. {
  184. return tlsv1_2_server_method();
  185. }
  186. const SSL_METHOD *TLSv1_2_client_method(void)
  187. {
  188. return tlsv1_2_client_method();
  189. }
  190. # endif
  191. # ifndef OPENSSL_NO_TLS1_1_METHOD
  192. const SSL_METHOD *TLSv1_1_method(void)
  193. {
  194. return tlsv1_1_method();
  195. }
  196. const SSL_METHOD *TLSv1_1_server_method(void)
  197. {
  198. return tlsv1_1_server_method();
  199. }
  200. const SSL_METHOD *TLSv1_1_client_method(void)
  201. {
  202. return tlsv1_1_client_method();
  203. }
  204. # endif
  205. # ifndef OPENSSL_NO_TLS1_METHOD
  206. const SSL_METHOD *TLSv1_method(void)
  207. {
  208. return tlsv1_method();
  209. }
  210. const SSL_METHOD *TLSv1_server_method(void)
  211. {
  212. return tlsv1_server_method();
  213. }
  214. const SSL_METHOD *TLSv1_client_method(void)
  215. {
  216. return tlsv1_client_method();
  217. }
  218. # endif
  219. # ifndef OPENSSL_NO_SSL3_METHOD
  220. const SSL_METHOD *SSLv3_method(void)
  221. {
  222. return sslv3_method();
  223. }
  224. const SSL_METHOD *SSLv3_server_method(void)
  225. {
  226. return sslv3_server_method();
  227. }
  228. const SSL_METHOD *SSLv3_client_method(void)
  229. {
  230. return sslv3_client_method();
  231. }
  232. # endif
  233. # ifndef OPENSSL_NO_DTLS1_2_METHOD
  234. const SSL_METHOD *DTLSv1_2_method(void)
  235. {
  236. return dtlsv1_2_method();
  237. }
  238. const SSL_METHOD *DTLSv1_2_server_method(void)
  239. {
  240. return dtlsv1_2_server_method();
  241. }
  242. const SSL_METHOD *DTLSv1_2_client_method(void)
  243. {
  244. return dtlsv1_2_client_method();
  245. }
  246. # endif
  247. # ifndef OPENSSL_NO_DTLS1_METHOD
  248. const SSL_METHOD *DTLSv1_method(void)
  249. {
  250. return dtlsv1_method();
  251. }
  252. const SSL_METHOD *DTLSv1_server_method(void)
  253. {
  254. return dtlsv1_server_method();
  255. }
  256. const SSL_METHOD *DTLSv1_client_method(void)
  257. {
  258. return dtlsv1_client_method();
  259. }
  260. # endif
  261. #endif