aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-01-05 17:03:29 -0800
committerDave Barach <openvpp@barachs.net>2021-01-07 16:55:02 +0000
commita5a9efd4d1995ef6d46dfab4e5b8aba9c5d114ef (patch)
tree63db95ce5645cafed795284bd3138535f9605c65 /src/plugins/hs_apps/vcl
parente294de6f876587ddc34ab02771771aea60087adc (diff)
vcl session: switch to generic cert key apis
Remove the deprecated tls apis. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia1e12bd813671146f0aca22e83d04c23ac13e595
Diffstat (limited to 'src/plugins/hs_apps/vcl')
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_client.c28
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_server.c20
2 files changed, 40 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/vcl/vcl_test_client.c b/src/plugins/hs_apps/vcl/vcl_test_client.c
index 51544a7a445..0aff98ef1dd 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_client.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_client.c
@@ -51,6 +51,7 @@ typedef struct
vcl_test_t post_test;
uint8_t proto;
uint32_t n_workers;
+ uint32_t ckpair_index;
volatile int active_workers;
struct sockaddr_storage server_addr;
} vcl_test_client_main_t;
@@ -265,6 +266,13 @@ vtc_connect_test_sessions (vcl_test_client_worker_t * wrk)
return ts->fd;
}
+ if (vcm->proto == VPPCOM_PROTO_TLS)
+ {
+ uint32_t ckp_len = sizeof (vcm->ckpair_index);
+ vppcom_session_attr (ts->fd, VPPCOM_ATTR_SET_CKPAIR,
+ &vcm->ckpair_index, &ckp_len);
+ }
+
/* Connect is blocking */
rv = vppcom_session_connect (ts->fd, &vcm->server_endpt);
if (rv < 0)
@@ -1099,11 +1107,23 @@ main (int argc, char **argv)
if (vcm->proto == VPPCOM_PROTO_TLS || vcm->proto == VPPCOM_PROTO_QUIC)
{
+ vppcom_cert_key_pair_t ckpair;
+ uint32_t ckp_len;
+ int ckp_index;
+
vtinf ("Adding tls certs ...");
- vppcom_session_tls_add_cert (ctrl->fd, vcl_test_crt_rsa,
- vcl_test_crt_rsa_len);
- vppcom_session_tls_add_key (ctrl->fd, vcl_test_key_rsa,
- vcl_test_key_rsa_len);
+ ckpair.cert = vcl_test_crt_rsa;
+ ckpair.key = vcl_test_key_rsa;
+ ckpair.cert_len = vcl_test_crt_rsa_len;
+ ckpair.key_len = vcl_test_key_rsa_len;
+ ckp_index = vppcom_add_cert_key_pair (&ckpair);
+ if (ckp_index < 0)
+ vtfail ("vppcom_add_cert_key_pair()", ckp_index);
+
+ vcm->ckpair_index = ckp_index;
+ ckp_len = sizeof (ckp_index);
+ vppcom_session_attr (ctrl->fd, VPPCOM_ATTR_SET_CKPAIR, &ckp_index,
+ &ckp_len);
}
vtinf ("Connecting to server...");
diff --git a/src/plugins/hs_apps/vcl/vcl_test_server.c b/src/plugins/hs_apps/vcl/vcl_test_server.c
index 798fd72b481..a2a4d6ac3b0 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_server.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_server.c
@@ -553,10 +553,22 @@ vts_worker_init (vcl_test_server_worker_t * wrk)
if (vsm->cfg.proto == VPPCOM_PROTO_TLS
|| vsm->cfg.proto == VPPCOM_PROTO_QUIC)
{
- vppcom_session_tls_add_cert (wrk->listen_fd, vcl_test_crt_rsa,
- vcl_test_crt_rsa_len);
- vppcom_session_tls_add_key (wrk->listen_fd, vcl_test_key_rsa,
- vcl_test_key_rsa_len);
+ vppcom_cert_key_pair_t ckpair;
+ uint32_t ckp_len;
+ int ckp_index;
+
+ vtinf ("Adding tls certs ...");
+ ckpair.cert = vcl_test_crt_rsa;
+ ckpair.key = vcl_test_key_rsa;
+ ckpair.cert_len = vcl_test_crt_rsa_len;
+ ckpair.key_len = vcl_test_key_rsa_len;
+ ckp_index = vppcom_add_cert_key_pair (&ckpair);
+ if (ckp_index < 0)
+ vtfail ("vppcom_add_cert_key_pair()", ckp_index);
+
+ ckp_len = sizeof (ckp_index);
+ vppcom_session_attr (wrk->listen_fd, VPPCOM_ATTR_SET_CKPAIR, &ckp_index,
+ &ckp_len);
}
rv = vppcom_session_bind (wrk->listen_fd, &vsm->cfg.endpt);