2
0

methods.c 8.7 KB

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