Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
altcp_tls.h
00001 /** 00002 * @file 00003 * Application layered TCP/TLS connection API (to be used from TCPIP thread) 00004 * 00005 * @defgroup altcp_tls TLS layer 00006 * @ingroup altcp 00007 * This file contains function prototypes for a TLS layer. 00008 * A port to ARM mbedtls is provided in the apps/ tree 00009 * (LWIP_ALTCP_TLS_MBEDTLS option). 00010 */ 00011 00012 /* 00013 * Copyright (c) 2017 Simon Goldschmidt 00014 * All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without modification, 00017 * are permitted provided that the following conditions are met: 00018 * 00019 * 1. Redistributions of source code must retain the above copyright notice, 00020 * this list of conditions and the following disclaimer. 00021 * 2. Redistributions in binary form must reproduce the above copyright notice, 00022 * this list of conditions and the following disclaimer in the documentation 00023 * and/or other materials provided with the distribution. 00024 * 3. The name of the author may not be used to endorse or promote products 00025 * derived from this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00028 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00029 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00030 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00031 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00032 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00035 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00036 * OF SUCH DAMAGE. 00037 * 00038 * This file is part of the lwIP TCP/IP stack. 00039 * 00040 * Author: Simon Goldschmidt <goldsimon@gmx.de> 00041 * 00042 */ 00043 #ifndef LWIP_HDR_ALTCP_TLS_H 00044 #define LWIP_HDR_ALTCP_TLS_H 00045 00046 #include "lwip/opt.h" 00047 00048 #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 00049 00050 #if LWIP_ALTCP_TLS 00051 00052 #include "lwip/altcp.h" 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00058 /** @ingroup altcp_tls 00059 * ALTCP_TLS configuration handle, content depends on port (e.g. mbedtls) 00060 */ 00061 struct altcp_tls_config; 00062 00063 /** @ingroup altcp_tls 00064 * Create an ALTCP_TLS server configuration handle 00065 */ 00066 struct altcp_tls_config *altcp_tls_create_config_server_privkey_cert(const u8_t *privkey, size_t privkey_len, 00067 const u8_t *privkey_pass, size_t privkey_pass_len, 00068 const u8_t *cert, size_t cert_len); 00069 00070 /** @ingroup altcp_tls 00071 * Create an ALTCP_TLS client configuration handle 00072 */ 00073 struct altcp_tls_config *altcp_tls_create_config_client(const u8_t *cert, size_t cert_len); 00074 00075 /** @ingroup altcp_tls 00076 * Create an ALTCP_TLS client configuration handle with two-way server/client authentication 00077 */ 00078 struct altcp_tls_config *altcp_tls_create_config_client_2wayauth(const u8_t *ca, size_t ca_len, const u8_t *privkey, size_t privkey_len, 00079 const u8_t *privkey_pass, size_t privkey_pass_len, 00080 const u8_t *cert, size_t cert_len); 00081 00082 /** @ingroup altcp_tls 00083 * Free an ALTCP_TLS configuration handle 00084 */ 00085 void altcp_tls_free_config(struct altcp_tls_config *conf); 00086 00087 /** @ingroup altcp_tls 00088 * Create new ALTCP_TLS layer wrapping an existing pcb as inner connection (e.g. TLS over TCP) 00089 */ 00090 struct altcp_pcb *altcp_tls_wrap(struct altcp_tls_config *config, struct altcp_pcb *inner_pcb); 00091 00092 /** @ingroup altcp_tls 00093 * Create new ALTCP_TLS pcb and its inner tcp pcb 00094 */ 00095 struct altcp_pcb *altcp_tls_new(struct altcp_tls_config *config, u8_t ip_type); 00096 00097 /** @ingroup altcp_tls 00098 * Create new ALTCP_TLS layer pcb and its inner tcp pcb. 00099 * Same as @ref altcp_tls_new but this allocator function fits to 00100 * @ref altcp_allocator_t / @ref altcp_new.\n 00101 'arg' must contain a struct altcp_tls_config *. 00102 */ 00103 struct altcp_pcb *altcp_tls_alloc(void *arg, u8_t ip_type); 00104 00105 /** @ingroup altcp_tls 00106 * Return pointer to internal TLS context so application can tweak it. 00107 * Real type depends on port (e.g. mbedtls) 00108 */ 00109 void *altcp_tls_context(struct altcp_pcb *conn); 00110 00111 #ifdef __cplusplus 00112 } 00113 #endif 00114 00115 #endif /* LWIP_ALTCP_TLS */ 00116 #endif /* LWIP_ALTCP */ 00117 #endif /* LWIP_HDR_ALTCP_TLS_H */
Generated on Tue Jul 12 2022 13:54:01 by
