aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/handshake
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/handshake')
-rw-r--r--test/core/handshake/BUILD8
-rw-r--r--test/core/handshake/client_ssl.cc (renamed from test/core/handshake/client_ssl.c)16
-rw-r--r--test/core/handshake/server_ssl.cc (renamed from test/core/handshake/server_ssl.c)3
3 files changed, 14 insertions, 13 deletions
diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD
index 8e462cfc5b..aea4a27e99 100644
--- a/test/core/handshake/BUILD
+++ b/test/core/handshake/BUILD
@@ -20,8 +20,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_test(
name = "client_ssl",
- srcs = ["client_ssl.c"],
- language = "C",
+ srcs = ["client_ssl.cc"],
+ language = "C++",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",
@@ -37,8 +37,8 @@ grpc_cc_test(
grpc_cc_test(
name = "server_ssl",
- srcs = ["server_ssl.c"],
- language = "C",
+ srcs = ["server_ssl.cc"],
+ language = "C++",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",
diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.cc
index 6d4a14c1ea..b8cfd627a9 100644
--- a/test/core/handshake/client_ssl.c
+++ b/test/core/handshake/client_ssl.cc
@@ -230,8 +230,7 @@ static bool client_ssl_test(char* server_alpn_preferred) {
gpr_thd_options thdopt = gpr_thd_options_default();
gpr_thd_id thdid;
gpr_thd_options_set_joinable(&thdopt);
- server_args args = {.socket = server_socket,
- .alpn_preferred = server_alpn_preferred};
+ server_args args = {server_socket, server_alpn_preferred};
GPR_ASSERT(gpr_thd_new(&thdid, server_thread, &args, &thdopt));
// Load key pair and establish client SSL credentials.
@@ -253,9 +252,10 @@ static bool client_ssl_test(char* server_alpn_preferred) {
// lazy, this won't necessarily establish a connection yet.
char* target;
gpr_asprintf(&target, "127.0.0.1:%d", port);
- grpc_arg ssl_name_override = {GRPC_ARG_STRING,
- GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
- {"foo.test.google.fr"}};
+ grpc_arg ssl_name_override = {
+ GRPC_ARG_STRING,
+ const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
+ {const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args grpc_args;
grpc_args.num_args = 1;
grpc_args.args = &ssl_name_override;
@@ -305,14 +305,14 @@ static bool client_ssl_test(char* server_alpn_preferred) {
int main(int argc, char* argv[]) {
// Handshake succeeeds when the server has grpc-exp as the ALPN preference.
- GPR_ASSERT(client_ssl_test("grpc-exp"));
+ GPR_ASSERT(client_ssl_test(const_cast<char*>("grpc-exp")));
// Handshake succeeeds when the server has h2 as the ALPN preference. This
// covers legacy gRPC servers which don't support grpc-exp.
- GPR_ASSERT(client_ssl_test("h2"));
+ GPR_ASSERT(client_ssl_test(const_cast<char*>("h2")));
// Handshake fails when the server uses a fake protocol as its ALPN
// preference. This validates the client is correctly validating ALPN returns
// and sanity checks the client_ssl_test.
- GPR_ASSERT(!client_ssl_test("foo"));
+ GPR_ASSERT(!client_ssl_test(const_cast<char*>("foo")));
return 0;
}
diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.cc
index 84a1cf15aa..bb92c8435a 100644
--- a/test/core/handshake/server_ssl.c
+++ b/test/core/handshake/server_ssl.cc
@@ -175,7 +175,8 @@ static bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len,
for (unsigned int i = 0; i < alpn_list_len; ++i) {
alpn_protos_len += (unsigned int)strlen(alpn_list[i]);
}
- unsigned char* alpn_protos = gpr_malloc(alpn_protos_len);
+ unsigned char* alpn_protos =
+ static_cast<unsigned char*>(gpr_malloc(alpn_protos_len));
unsigned char* p = alpn_protos;
for (unsigned int i = 0; i < alpn_list_len; ++i) {
const uint8_t len = (uint8_t)strlen(alpn_list[i]);