net: tls: Add TLS context allocation/deallocation

Add tls_context structure that stored data required by TLS socket
implementation. This structure is allocated from global pool during
socket creation and freed during socket closure.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2018-07-02 16:14:27 +02:00 committed by Anas Nashif
commit a7c698d936
4 changed files with 191 additions and 2 deletions

View file

@ -184,6 +184,8 @@ struct net_tcp;
struct net_conn_handle;
struct tls_context;
/**
* Note that we do not store the actual source IP address in the context
* because the address is already be set in the network interface struct.
@ -275,6 +277,11 @@ struct net_context {
struct k_fifo recv_q;
struct k_fifo accept_q;
};
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
/** TLS context information */
struct tls_context *tls;
#endif /* CONFIG_NET_SOCKETS_SOCKOPT_TLS */
#endif /* CONFIG_NET_SOCKETS */
};