From: Florin Coras Date: Mon, 21 Oct 2019 02:32:47 +0000 (-0700) Subject: session: support registration of custom crypto engines X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=79ba25d40248ceba3efb232952282678b5a7f910;p=vpp.git session: support registration of custom crypto engines Type: feature Change-Id: I888d415ff645b3827df7d4cfb0d3c5f4ac940617 Signed-off-by: Florin Coras --- diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 396470ae6f9..7cb888c2344 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -1630,6 +1630,7 @@ cert_key_pair_store_init (vlib_main_t * vm) { /* Add a certificate with index 0 to support legacy apis */ (void) app_cert_key_pair_alloc (); + app_main.last_crypto_engine = CRYPTO_ENGINE_LAST; return 0; } @@ -1651,6 +1652,18 @@ VLIB_CLI_COMMAND (show_certificate_command, static) = }; /* *INDENT-ON* */ +crypto_engine_type_t +app_crypto_engine_type_add (void) +{ + return (++app_main.last_crypto_engine); +} + +u8 +app_crypto_engine_n_types (void) +{ + return (app_main.last_crypto_engine + 1); +} + /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h index a853c3cb73a..08117b744f1 100644 --- a/src/vnet/session/application.h +++ b/src/vnet/session/application.h @@ -139,6 +139,11 @@ typedef struct app_main_ * Pool from which we allocate certificates (key, cert) */ app_cert_key_pair_t *cert_key_pair_store; + + /* + * Last registered crypto engine type + */ + crypto_engine_type_t last_crypto_engine; } app_main_t; typedef struct app_init_args_ @@ -291,6 +296,9 @@ int mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context, void mq_send_unlisten_reply (app_worker_t * app_wrk, session_handle_t sh, u32 context, int rv); +crypto_engine_type_t app_crypto_engine_type_add (void); +u8 app_crypto_engine_n_types (void); + #endif /* SRC_VNET_SESSION_APPLICATION_H_ */ /* diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 609a20a47f6..f73cd0abcbc 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -166,7 +166,7 @@ typedef enum crypto_engine_type_ CRYPTO_ENGINE_OPENSSL, CRYPTO_ENGINE_VPP, CRYPTO_ENGINE_PICOTLS, - CRYPTO_N_ENGINES + CRYPTO_ENGINE_LAST = CRYPTO_ENGINE_PICOTLS, } crypto_engine_type_t; typedef struct _vnet_app_add_cert_key_pair_args_