1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* Copyright (c) 2018 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_
#define SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_
#include <openssl/ssl.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/engine.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
#include <vnet/tls/tls.h>
#define TLSO_CTRL_BYTES 1000
#define TLSO_MIN_ENQ_SPACE (1 << 16)
#define DTLSO_MAX_DGRAM 2000
#define ossl_check_err_is_fatal(_ssl, _rv) \
if (PREDICT_FALSE (_rv < 0 && SSL_get_error (_ssl, _rv) == SSL_ERROR_SSL)) \
return -1;
typedef struct tls_ctx_openssl_
{
tls_ctx_t ctx; /**< First */
u32 openssl_ctx_index;
SSL_CTX *client_ssl_ctx;
SSL *ssl;
u32 evt_index[SSL_ASYNC_EVT_MAX];
u32 total_async_write;
BIO *rbio;
BIO *wbio;
} openssl_ctx_t;
typedef struct tls_listen_ctx_opensl_
{
u32 openssl_lctx_index;
SSL_CTX *ssl_ctx;
SSL *ssl;
X509 *srvcert;
EVP_PKEY *pkey;
} openssl_listen_ctx_t;
typedef struct openssl_main_
{
openssl_ctx_t ***ctx_pool;
openssl_listen_ctx_t *lctx_pool;
u8 **rx_bufs;
u8 **tx_bufs;
/* API message ID base */
u16 msg_id_base;
X509_STORE *cert_store;
u8 *ciphers;
int engine_init;
int async;
u32 record_size;
u32 record_split_size;
u32 max_pipelines;
} openssl_main_t;
typedef int openssl_resume_handler (tls_ctx_t * ctx, session_t * tls_session);
tls_ctx_t *openssl_ctx_get_w_thread (u32 ctx_index, u8 thread_index);
int vpp_tls_async_init_events (tls_ctx_t *ctx, openssl_resume_handler *handler,
session_t *session);
int vpp_tls_async_update_event (tls_ctx_t *ctx, int eagain,
ssl_async_evt_type_t type);
int vpp_tls_async_enqueue_event (openssl_ctx_t *ctx, int evt_type,
transport_send_params_t *sp, int size);
int tls_async_openssl_callback (SSL * s, void *evt);
int openssl_evt_free (int event_idx, u8 thread_index);
void openssl_polling_start (ENGINE * engine);
int openssl_engine_register (char *engine, char *alg, int async);
void openssl_async_node_enable_disable (u8 is_en);
clib_error_t *tls_openssl_api_init (vlib_main_t * vm);
int tls_openssl_set_ciphers (char *ciphers);
int vpp_openssl_is_inflight (tls_ctx_t * ctx);
int openssl_read_from_ssl_into_fifo (svm_fifo_t *f, tls_ctx_t *ctx,
u32 max_len);
void openssl_handle_handshake_failure (tls_ctx_t *ctx);
void openssl_confirm_app_close (tls_ctx_t *ctx);
#endif /* SRC_PLUGINS_TLSOPENSSL_TLS_OPENSSL_H_ */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|