2
0

methods.c 8.7 KB

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