1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include "private-lib-core.h" 16 17 #include "ssl_methods.h" 18 #include "ssl_pm.h" 19 20 /** 21 * TLS method function collection 22 */ 23 IMPLEMENT_TLS_METHOD_FUNC(TLS_method_func, 24 ssl_pm_new, ssl_pm_free, 25 ssl_pm_handshake, ssl_pm_shutdown, ssl_pm_clear, 26 ssl_pm_read, ssl_pm_send, ssl_pm_pending, 27 ssl_pm_set_fd, ssl_pm_get_fd, 28 ssl_pm_set_bufflen, 29 ssl_pm_get_verify_result, 30 ssl_pm_get_state); 31 32 /** 33 * TLS or SSL client method collection 34 */ 35 IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, 0, TLS_method_func, TLS_client_method); 36 37 IMPLEMENT_TLS_METHOD(TLS1_2_VERSION, 0, TLS_method_func, TLSv1_2_client_method); 38 39 #if 0 40 IMPLEMENT_TLS_METHOD(TLS1_1_VERSION, 0, TLS_method_func, TLSv1_1_client_method); 41 42 IMPLEMENT_TLS_METHOD(TLS1_VERSION, 0, TLS_method_func, TLSv1_client_method); 43 44 IMPLEMENT_SSL_METHOD(SSL3_VERSION, 0, TLS_method_func, SSLv3_client_method); 45 #endif 46 47 /** 48 * TLS or SSL server method collection 49 */ 50 IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, 1, TLS_method_func, TLS_server_method); 51 52 IMPLEMENT_TLS_METHOD(TLS1_2_VERSION, 1, TLS_method_func, TLSv1_2_server_method); 53 54 #if 0 55 IMPLEMENT_TLS_METHOD(TLS1_1_VERSION, 1, TLS_method_func, TLSv1_1_server_method); 56 57 IMPLEMENT_TLS_METHOD(TLS1_VERSION, 0, TLS_method_func, TLSv1_server_method); 58 59 IMPLEMENT_SSL_METHOD(SSL3_VERSION, 1, TLS_method_func, SSLv3_server_method); 60 #endif 61 62 /** 63 * TLS or SSL method collection 64 */ 65 IMPLEMENT_TLS_METHOD(TLS_ANY_VERSION, -1, TLS_method_func, TLS_method); 66 67 IMPLEMENT_SSL_METHOD(TLS1_2_VERSION, -1, TLS_method_func, TLSv1_2_method); 68 69 #if 0 70 IMPLEMENT_SSL_METHOD(TLS1_1_VERSION, -1, TLS_method_func, TLSv1_1_method); 71 72 IMPLEMENT_SSL_METHOD(TLS1_VERSION, -1, TLS_method_func, TLSv1_method); 73 74 IMPLEMENT_SSL_METHOD(SSL3_VERSION, -1, TLS_method_func, SSLv3_method); 75 #endif 76 77 /** 78 * @brief get X509 object method 79 */ 80 IMPLEMENT_X509_METHOD(X509_method, 81 x509_pm_new, x509_pm_free, 82 x509_pm_load, x509_pm_show_info); 83 84 /** 85 * @brief get private key object method 86 */ 87 IMPLEMENT_PKEY_METHOD(EVP_PKEY_method, 88 pkey_pm_new, pkey_pm_free, 89 pkey_pm_load); 90