Line data Source code
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 : 27 : #define REPLY_MSG_ID_BASE om->msg_id_base 28 : #include <vlibapi/api_helper_macros.h> 29 : 30 : extern openssl_main_t openssl_main; 31 : 32 : /* API message handler */ 33 : static void 34 0 : vl_api_tls_openssl_set_engine_t_handler (vl_api_tls_openssl_set_engine_t * mp) 35 : { 36 : vl_api_tls_openssl_set_engine_reply_t *rmp; 37 0 : openssl_main_t *om = &openssl_main; 38 : char *engine, *alg; 39 : char *ciphers; 40 : int rv; 41 : 42 0 : ciphers = (char *) &mp->ciphers; 43 0 : ciphers[63] = '\0'; 44 0 : if (ciphers[0]) 45 0 : tls_openssl_set_ciphers (ciphers); 46 : 47 0 : engine = (char *) mp->engine; 48 0 : engine[63] = '\0'; 49 0 : alg = (char *) mp->algorithm; 50 0 : alg[63] = '\0'; 51 0 : rv = openssl_engine_register (engine, alg, mp->async_enable); 52 0 : om->async = mp->async_enable; 53 : 54 0 : REPLY_MACRO (VL_API_TLS_OPENSSL_SET_ENGINE_REPLY); 55 : } 56 : 57 : #include <tlsopenssl/tls_openssl.api.c> 58 : clib_error_t * 59 559 : tls_openssl_api_init (vlib_main_t * vm) 60 : { 61 559 : openssl_main_t *om = &openssl_main; 62 : 63 : /* Ask for a correctly-sized block of API message decode slots */ 64 559 : om->msg_id_base = setup_message_id_table (); 65 : 66 559 : return 0; 67 : } 68 : 69 : /* 70 : * fd.io coding-style-patch-verification: ON 71 : * 72 : * Local Variables: 73 : * eval: (c-set-style "gnu") 74 : * End: 75 : */