diff options
author | Ping Yu <ping.yu@intel.com> | 2019-08-22 13:43:00 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-09-02 18:24:41 +0000 |
commit | dd0cc9ec3df81485f19fc6b1126d0b4307bf9fa4 (patch) | |
tree | 7f374e3107370595168683b2b53e0fa4eedd34d7 /src/plugins/tlsopenssl/tls_openssl_api.c | |
parent | be2c2a82d817decc3b8e58239e8c6828f349b97b (diff) |
tls: some rework based on TLS openssl C API
Type: fix
Change-Id: I5d0ac1fe6a6770ab8b3a9c366d10387718391199
Signed-off-by: Ping Yu <ping.yu@intel.com>
Diffstat (limited to 'src/plugins/tlsopenssl/tls_openssl_api.c')
-rw-r--r-- | src/plugins/tlsopenssl/tls_openssl_api.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/plugins/tlsopenssl/tls_openssl_api.c b/src/plugins/tlsopenssl/tls_openssl_api.c index 9474aae2faf..99ef3fe27c3 100644 --- a/src/plugins/tlsopenssl/tls_openssl_api.c +++ b/src/plugins/tlsopenssl/tls_openssl_api.c @@ -55,32 +55,37 @@ extern openssl_main_t openssl_main; /* API message handler */ static void -vl_api_tls_openssl_set_engine_t_handler (vl_api_tls_openssl_set_engine_t *mp) +vl_api_tls_openssl_set_engine_t_handler (vl_api_tls_openssl_set_engine_t * mp) { vl_api_tls_openssl_set_engine_reply_t *rmp; openssl_main_t *om = &openssl_main; - char *engine, *alg, *ciphers; + char *engine, *alg; + char *ciphers; int rv; - engine = (char *)&mp->engine; - alg = (char *)&mp->algorithm; - ciphers = (char *)&mp->ciphers; - - if (mp->async) + if (mp->async_enable) { om->async = 1; openssl_async_node_enable_disable (1); } + ciphers = (char *) &mp->ciphers; + ciphers[63] = '\0'; if (ciphers[0]) tls_openssl_set_ciphers (ciphers); + + engine = (char *) mp->engine; + engine[63] = '\0'; + alg = (char *) mp->algorithm; + alg[63] = '\0'; rv = openssl_engine_register (engine, alg); REPLY_MACRO (VL_API_TLS_OPENSSL_SET_ENGINE_REPLY); } /* Set up the API message handling tables */ -static clib_error_t *tls_openssl_plugin_api_hookup (vlib_main_t *vm) +static clib_error_t * +tls_openssl_plugin_api_hookup (vlib_main_t * vm) { openssl_main_t *om = &openssl_main; #define _(N, n) \ @@ -98,7 +103,8 @@ static clib_error_t *tls_openssl_plugin_api_hookup (vlib_main_t *vm) #include <tlsopenssl/tls_openssl_all_api_h.h> #undef vl_msg_name_crc_list -static void setup_message_id_table (openssl_main_t *om, api_main_t *am) +static void +setup_message_id_table (openssl_main_t * om, api_main_t * am) { #define _(id, n, crc) \ vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + om->msg_id_base); @@ -106,7 +112,8 @@ static void setup_message_id_table (openssl_main_t *om, api_main_t *am) #undef _ } -clib_error_t *tls_openssl_api_init (vlib_main_t *vm) +clib_error_t * +tls_openssl_api_init (vlib_main_t * vm) { openssl_main_t *om = &openssl_main; clib_error_t *error = 0; @@ -116,7 +123,7 @@ clib_error_t *tls_openssl_api_init (vlib_main_t *vm) /* Ask for a correctly-sized block of API message decode slots */ om->msg_id_base = - vl_msg_api_get_msg_ids ((char *)name, VL_MSG_FIRST_AVAILABLE); + vl_msg_api_get_msg_ids ((char *) name, VL_MSG_FIRST_AVAILABLE); error = tls_openssl_plugin_api_hookup (vm); @@ -126,3 +133,11 @@ clib_error_t *tls_openssl_api_init (vlib_main_t *vm) return error; } + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ |