diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-11-06 14:12:23 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-11-07 17:29:31 +0000 |
commit | 7c40a3837a7a256cbb61dfad15be6e910058e4ba (patch) | |
tree | 3a92f319d58a44fc84926d0de14b4f7e436c487a /src/plugins/hs_apps/sapi/vpp_echo.c | |
parent | dcbbf2833d09ca6fc4f3df9bcac4ff2d1244c531 (diff) |
hsa: Add ckpair & crypto engine in vpp_echo
Type: feature
* vpp echo adds and dels a cert and key pair for each run
* it passes the crypto engine to be used (openssl, picotls, vpp, mbedtls)
Change-Id: Iaba1de2e6abb510e6c4edbe84b2324b2f4843f26
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo.c')
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c index 93291e7e7b6..143551f5848 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo.c +++ b/src/plugins/hs_apps/sapi/vpp_echo.c @@ -868,6 +868,7 @@ print_usage_and_exit (void) " tx-results-diff Tx results different to pass test\n" " json Output global stats in json\n" " log=N Set the log level to [0: no output, 1:errors, 2:log]\n" + " crypto [engine] Set the crypto engine [openssl, vpp, picotls, mbedtls]\n" "\n" " nclients N Open N clients sending data\n" " nthreads N Use N busy loop threads for data [in addition to main & msg queue]\n" @@ -970,11 +971,8 @@ echo_process_opts (int argc, char **argv) } else if (unformat (a, "nthreads %d", &em->n_rx_threads)) ; - else - if (unformat - (a, "crypto %U", echo_unformat_crypto_engine, - &em->crypto_ctx_engine)) - ; + else if (unformat (a, "crypto %U", echo_unformat_crypto_engine, &tmp)) + em->crypto_engine = tmp; else if (unformat (a, "appns %_%v%_", &em->appns_id)) ; else if (unformat (a, "all-scope")) @@ -1120,7 +1118,7 @@ main (int argc, char **argv) em->tx_buf_size = 1 << 20; em->data_source = ECHO_INVALID_DATA_SOURCE; em->uri = format (0, "%s%c", "tcp://0.0.0.0/1234", 0); - em->crypto_ctx_engine = CRYPTO_ENGINE_NONE; + em->crypto_engine = CRYPTO_ENGINE_NONE; echo_set_each_proto_defaults_before_opts (em); echo_process_opts (argc, argv); echo_process_uri (em); @@ -1184,14 +1182,14 @@ main (int argc, char **argv) goto exit_on_error; } - if (em->crypto_ctx_engine == CRYPTO_ENGINE_NONE) - /* when no crypto engine specified, dont expect crypto ctx */ + if (em->uri_elts.transport_proto != TRANSPORT_PROTO_QUIC + && em->uri_elts.transport_proto != TRANSPORT_PROTO_TLS) em->state = STATE_ATTACHED; else { ECHO_LOG (1, "Adding crypto context %U", echo_format_crypto_engine, - em->crypto_ctx_engine); - echo_send_add_crypto_ctx (em); + em->crypto_engine); + echo_send_add_cert_key (em); if (wait_for_state_change (em, STATE_ATTACHED, TIMEOUT)) { ECHO_FAIL (ECHO_FAIL_APP_ATTACH, @@ -1221,6 +1219,13 @@ main (int argc, char **argv) clients_run (em); echo_notify_event (em, ECHO_EVT_EXIT); echo_free_sessions (em); + echo_send_del_cert_key (em); + if (wait_for_state_change (em, STATE_CLEANED_CERT_KEY, TIMEOUT)) + { + ECHO_FAIL (ECHO_FAIL_DEL_CERT_KEY, "Couldn't cleanup cert and key"); + goto exit_on_error; + } + echo_send_detach (em); if (wait_for_state_change (em, STATE_DETACHED, TIMEOUT)) { |