FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
tls_openssl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Intel and/or its affiliates.
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 
16 #ifndef SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_
17 #define SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_
18 
19 #include <openssl/ssl.h>
20 #include <openssl/conf.h>
21 #include <openssl/err.h>
22 #include <openssl/engine.h>
23 #include <vnet/plugin/plugin.h>
24 #include <vpp/app/version.h>
25 #include <vnet/tls/tls.h>
26 
27 #define TLSO_CTRL_BYTES 1000
28 #define TLSO_MIN_ENQ_SPACE (1 << 16)
29 
30 #define DTLSO_MAX_DGRAM 2000
31 
32 typedef struct tls_ctx_openssl_
33 {
34  tls_ctx_t ctx; /**< First */
36  SSL_CTX *ssl_ctx;
37  SSL *ssl;
38  BIO *rbio;
39  BIO *wbio;
41 
42 typedef struct tls_listen_ctx_opensl_
43 {
45  SSL_CTX *ssl_ctx;
46  SSL *ssl;
47  X509 *srvcert;
48  EVP_PKEY *pkey;
50 
51 typedef struct openssl_main_
52 {
55 
58 
59  /* API message ID base */
61 
62  X509_STORE *cert_store;
65  int async;
67 
68 typedef int openssl_resume_handler (tls_ctx_t * ctx, session_t * tls_session);
69 
72  openssl_resume_handler * handler,
73  session_t * session);
74 int vpp_tls_async_update_event (tls_ctx_t * ctx, int eagain);
75 int tls_async_openssl_callback (SSL * s, void *evt);
77 void openssl_polling_start (ENGINE * engine);
78 int openssl_engine_register (char *engine, char *alg, int async);
81 int tls_openssl_set_ciphers (char *ciphers);
83 
84 #endif /* SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_ */
85 
86 /*
87  * fd.io coding-style-patch-verification: ON
88  *
89  * Local Variables:
90  * eval: (c-set-style "gnu")
91  * End:
92  */
openssl_engine_register
int openssl_engine_register(char *engine, char *alg, int async)
Definition: tls_async.c:116
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:495
tls_async_openssl_callback
int tls_async_openssl_callback(SSL *s, void *evt)
Definition: tls_async.c:243
openssl_ctx_t
struct tls_ctx_openssl_ openssl_ctx_t
openssl_main_::rx_bufs
u8 ** rx_bufs
Definition: tls_openssl.h:56
openssl_main_::msg_id_base
u16 msg_id_base
Definition: tls_openssl.h:60
openssl_listen_ctx_t
struct tls_listen_ctx_opensl_ openssl_listen_ctx_t
tls_listen_ctx_opensl_::ssl
SSL * ssl
Definition: tls_openssl.h:46
session_
Definition: session_types.h:175
openssl_main_::tx_bufs
u8 ** tx_bufs
Definition: tls_openssl.h:57
openssl_main_::engine_init
int engine_init
Definition: tls_openssl.h:64
u16
unsigned short u16
Definition: types.h:57
vpp_openssl_is_inflight
int vpp_openssl_is_inflight(tls_ctx_t *ctx)
Definition: tls_async.c:306
tls_listen_ctx_opensl_::openssl_lctx_index
u32 openssl_lctx_index
Definition: tls_openssl.h:44
tls_ctx_openssl_::wbio
BIO * wbio
Definition: tls_openssl.h:39
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
tls_openssl_set_ciphers
int tls_openssl_set_ciphers(char *ciphers)
Definition: tls_openssl.c:1012
openssl_main_::ctx_pool
openssl_ctx_t *** ctx_pool
Definition: tls_openssl.h:53
tls_listen_ctx_opensl_
Definition: tls_openssl.h:42
openssl_main_::ciphers
u8 * ciphers
Definition: tls_openssl.h:63
openssl_evt_free
int openssl_evt_free(int event_idx, u8 thread_index)
Definition: tls_async.c:212
tls_ctx_openssl_::openssl_ctx_index
u32 openssl_ctx_index
Definition: tls_openssl.h:35
tls_ctx_openssl_::ctx
tls_ctx_t ctx
First.
Definition: tls_openssl.h:34
tls_ctx_
Definition: tls.h:59
openssl_main_::cert_store
X509_STORE * cert_store
Definition: tls_openssl.h:62
tls_ctx_openssl_::rbio
BIO * rbio
Definition: tls_openssl.h:38
tls_ctx_openssl_::ssl
SSL * ssl
Definition: tls_openssl.h:37
vpp_tls_async_init_event
int vpp_tls_async_init_event(tls_ctx_t *ctx, openssl_resume_handler *handler, session_t *session)
Definition: tls_async.c:280
tls_listen_ctx_opensl_::srvcert
X509 * srvcert
Definition: tls_openssl.h:47
openssl_main_::lctx_pool
openssl_listen_ctx_t * lctx_pool
Definition: tls_openssl.h:54
tls_listen_ctx_opensl_::pkey
EVP_PKEY * pkey
Definition: tls_openssl.h:48
tls_ctx_openssl_
Definition: tls_openssl.h:32
openssl_polling_start
void openssl_polling_start(ENGINE *engine)
plugin.h
event_idx
#define event_idx
Definition: tls_async.c:41
u32
unsigned int u32
Definition: types.h:88
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
openssl_main_::async
int async
Definition: tls_openssl.h:65
openssl_ctx_get_w_thread
tls_ctx_t * openssl_ctx_get_w_thread(u32 ctx_index, u8 thread_index)
Definition: tls_openssl.c:126
vlib_main_t
Definition: main.h:102
tls.h
tls_openssl_api_init
clib_error_t * tls_openssl_api_init(vlib_main_t *vm)
Definition: tls_openssl_api.c:60
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
tls_listen_ctx_opensl_::ssl_ctx
SSL_CTX * ssl_ctx
Definition: tls_openssl.h:45
tls_ctx_openssl_::ssl_ctx
SSL_CTX * ssl_ctx
Definition: tls_openssl.h:36
openssl_main_
Definition: tls_openssl.h:51
openssl_resume_handler
int openssl_resume_handler(tls_ctx_t *ctx, session_t *tls_session)
Definition: tls_openssl.h:68
vpp_tls_async_update_event
int vpp_tls_async_update_event(tls_ctx_t *ctx, int eagain)
Definition: tls_async.c:319
openssl_async_node_enable_disable
void openssl_async_node_enable_disable(u8 is_en)
Definition: tls_async.c:412
openssl_main_t
struct openssl_main_ openssl_main_t