methods.c 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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(DTLS1_3_VERSION, 0, SSL_OP_NO_DTLSv1_3,
  126. dtlsv1_3_method,
  127. ossl_statem_accept,
  128. ossl_statem_connect, DTLSv1_3_enc_data)
  129. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  130. DTLS_method,
  131. ossl_statem_accept,
  132. ossl_statem_connect, DTLSv1_2_enc_data)
  133. /*-
  134. * DTLS server methods
  135. */
  136. #ifndef OPENSSL_NO_DTLS1_METHOD
  137. IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  138. dtlsv1_server_method,
  139. ossl_statem_accept,
  140. ssl_undefined_function, DTLSv1_enc_data)
  141. #endif
  142. #ifndef OPENSSL_NO_DTLS1_2_METHOD
  143. IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
  144. dtlsv1_2_server_method,
  145. ossl_statem_accept,
  146. ssl_undefined_function, DTLSv1_2_enc_data)
  147. #endif
  148. IMPLEMENT_dtls1_meth_func(DTLS1_3_VERSION, 0, SSL_OP_NO_DTLSv1_3,
  149. dtlsv1_3_server_method,
  150. ossl_statem_accept,
  151. ssl_undefined_function, DTLSv1_3_enc_data)
  152. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  153. DTLS_server_method,
  154. ossl_statem_accept,
  155. ssl_undefined_function, DTLSv1_2_enc_data)
  156. /*-
  157. * DTLS client methods
  158. */
  159. #ifndef OPENSSL_NO_DTLS1_METHOD
  160. IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  161. dtlsv1_client_method,
  162. ssl_undefined_function,
  163. ossl_statem_connect, DTLSv1_enc_data)
  164. IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
  165. dtls_bad_ver_client_method,
  166. ssl_undefined_function,
  167. ossl_statem_connect, DTLSv1_enc_data)
  168. #endif
  169. #ifndef OPENSSL_NO_DTLS1_2_METHOD
  170. IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
  171. dtlsv1_2_client_method,
  172. ssl_undefined_function,
  173. ossl_statem_connect, DTLSv1_2_enc_data)
  174. #endif
  175. IMPLEMENT_dtls1_meth_func(DTLS1_3_VERSION, 0, SSL_OP_NO_DTLSv1_3,
  176. dtlsv1_3_client_method,
  177. ssl_undefined_function,
  178. ossl_statem_connect, DTLSv1_3_enc_data)
  179. IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
  180. DTLS_client_method,
  181. ssl_undefined_function,
  182. ossl_statem_connect, DTLSv1_2_enc_data)
  183. #ifndef OPENSSL_NO_DEPRECATED_1_1_0
  184. # ifndef OPENSSL_NO_TLS1_2_METHOD
  185. const SSL_METHOD *TLSv1_2_method(void)
  186. {
  187. return tlsv1_2_method();
  188. }
  189. const SSL_METHOD *TLSv1_2_server_method(void)
  190. {
  191. return tlsv1_2_server_method();
  192. }
  193. const SSL_METHOD *TLSv1_2_client_method(void)
  194. {
  195. return tlsv1_2_client_method();
  196. }
  197. # endif
  198. # ifndef OPENSSL_NO_TLS1_1_METHOD
  199. const SSL_METHOD *TLSv1_1_method(void)
  200. {
  201. return tlsv1_1_method();
  202. }
  203. const SSL_METHOD *TLSv1_1_server_method(void)
  204. {
  205. return tlsv1_1_server_method();
  206. }
  207. const SSL_METHOD *TLSv1_1_client_method(void)
  208. {
  209. return tlsv1_1_client_method();
  210. }
  211. # endif
  212. # ifndef OPENSSL_NO_TLS1_METHOD
  213. const SSL_METHOD *TLSv1_method(void)
  214. {
  215. return tlsv1_method();
  216. }
  217. const SSL_METHOD *TLSv1_server_method(void)
  218. {
  219. return tlsv1_server_method();
  220. }
  221. const SSL_METHOD *TLSv1_client_method(void)
  222. {
  223. return tlsv1_client_method();
  224. }
  225. # endif
  226. # ifndef OPENSSL_NO_SSL3_METHOD
  227. const SSL_METHOD *SSLv3_method(void)
  228. {
  229. return sslv3_method();
  230. }
  231. const SSL_METHOD *SSLv3_server_method(void)
  232. {
  233. return sslv3_server_method();
  234. }
  235. const SSL_METHOD *SSLv3_client_method(void)
  236. {
  237. return sslv3_client_method();
  238. }
  239. # endif
  240. # ifndef OPENSSL_NO_DTLS1_2_METHOD
  241. const SSL_METHOD *DTLSv1_2_method(void)
  242. {
  243. return dtlsv1_2_method();
  244. }
  245. const SSL_METHOD *DTLSv1_2_server_method(void)
  246. {
  247. return dtlsv1_2_server_method();
  248. }
  249. const SSL_METHOD *DTLSv1_2_client_method(void)
  250. {
  251. return dtlsv1_2_client_method();
  252. }
  253. # endif
  254. # ifndef OPENSSL_NO_DTLS1_METHOD
  255. const SSL_METHOD *DTLSv1_method(void)
  256. {
  257. return dtlsv1_method();
  258. }
  259. const SSL_METHOD *DTLSv1_server_method(void)
  260. {
  261. return dtlsv1_server_method();
  262. }
  263. const SSL_METHOD *DTLSv1_client_method(void)
  264. {
  265. return dtlsv1_client_method();
  266. }
  267. # endif
  268. #endif