FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
tls_openssl_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Cisco 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 #include <vnet/vnet.h>
17 #include <vlibapi/api.h>
18 #include <vlibmemory/api.h>
19 #include <vpp/app/version.h>
20 #include <tlsopenssl/tls_openssl.h>
21 
22 /* define message IDs */
23 #include <tlsopenssl/tls_openssl.api_enum.h>
24 #include <tlsopenssl/tls_openssl.api_types.h>
25 
26 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
27 
28 #define REPLY_MSG_ID_BASE om->msg_id_base
30 
32 
33 /* API message handler */
34 static void
36 {
37  vl_api_tls_openssl_set_engine_reply_t *rmp;
39  char *engine, *alg;
40  char *ciphers;
41  int rv;
42 
43  ciphers = (char *) &mp->ciphers;
44  ciphers[63] = '\0';
45  if (ciphers[0])
46  tls_openssl_set_ciphers (ciphers);
47 
48  engine = (char *) mp->engine;
49  engine[63] = '\0';
50  alg = (char *) mp->algorithm;
51  alg[63] = '\0';
52  rv = openssl_engine_register (engine, alg, mp->async_enable);
53  om->async = mp->async_enable;
54 
55  REPLY_MACRO (VL_API_TLS_OPENSSL_SET_ENGINE_REPLY);
56 }
57 
58 #include <tlsopenssl/tls_openssl.api.c>
61 {
63 
64  /* Ask for a correctly-sized block of API message decode slots */
66 
67  return 0;
68 }
69 
70 /*
71  * fd.io coding-style-patch-verification: ON
72  *
73  * Local Variables:
74  * eval: (c-set-style "gnu")
75  * End:
76  */
vl_api_tls_openssl_set_engine_t::engine
u8 engine[64]
Definition: tls_openssl.api:16
api.h
openssl_main_::msg_id_base
u16 msg_id_base
Definition: tls_openssl.h:60
openssl_engine_register
int openssl_engine_register(char *engine_name, char *algorithm, int async)
Definition: tls_async.c:116
tls_openssl.h
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
api.h
tls_openssl_set_ciphers
int tls_openssl_set_ciphers(char *ciphers)
Definition: tls_openssl.c:1012
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
vl_api_tls_openssl_set_engine_t::algorithm
u8 algorithm[64]
Definition: tls_openssl.api:19
vl_api_tls_openssl_set_engine_t
Definition: tls_openssl.api:5
tls_openssl_api_init
clib_error_t * tls_openssl_api_init(vlib_main_t *vm)
Definition: tls_openssl_api.c:60
vl_api_tls_openssl_set_engine_t::async_enable
u32 async_enable
Definition: tls_openssl.api:13
api_helper_macros.h
openssl_main
openssl_main_t openssl_main
Definition: tls_openssl.c:33
vl_api_tls_openssl_set_engine_t_handler
static void vl_api_tls_openssl_set_engine_t_handler(vl_api_tls_openssl_set_engine_t *mp)
Definition: tls_openssl_api.c:35
openssl_main_::async
int async
Definition: tls_openssl.h:65
vlib_main_t
Definition: main.h:102
clib_error_t
Definition: clib_error.h:21
rv
int __clib_unused rv
Definition: application.c:491
vnet.h
vl_api_tls_openssl_set_engine_t::ciphers
u8 ciphers[64]
Definition: tls_openssl.api:22
openssl_main_
Definition: tls_openssl.h:51