option version = "2.0.0";
-define tls_openssl_set_engine {
+autoreply define tls_openssl_set_engine {
/* Client identifier, set from api_main.my_client_index */
u32 client_index;
u32 context;
/* if async is enabled */
- u32 async;
+ u32 async_enable;
/* engine name */
u8 engine[64];
/* cipher */
u8 ciphers[64];
};
-
-define tls_openssl_set_engine_reply {
- /* From the request */
- u32 context;
-
- /* Return value, zero means all OK */
- i32 retval;
-};
/* 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) \
#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);
#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;
/* 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);
return error;
}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
engine_alg = format (0, "ALL");
else
{
- for (int i = 0; i < strnlen ((char *) engine_alg, 64); i++)
+ for (int i = 0; i < strnlen ((char *) engine_alg, 63); i++)
engine_alg[i] = toupper (engine_alg[i]);
}
/* Construct the API message */
M (TLS_OPENSSL_SET_ENGINE, mp);
- mp->async = async;
+ mp->async_enable = async;
clib_memcpy_fast (mp->engine, engine_name,
- strnlen ((const char *) engine_name, 64));
+ strnlen ((const char *) engine_name, 63));
clib_memcpy_fast (mp->algorithm, engine_alg,
- strnlen ((const char *) engine_alg, 64));
+ strnlen ((const char *) engine_alg, 63));
if (ciphers)
clib_memcpy_fast (mp->ciphers, ciphers,
- strnlen ((const char *) ciphers, 64));
+ strnlen ((const char *) ciphers, 63));
/* send it... */
S (mp);