diff options
Diffstat (limited to 'src/core/lib/http/httpcli_security_connector.cc')
-rw-r--r-- | src/core/lib/http/httpcli_security_connector.cc | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc index d832dacb69..d029323eac 100644 --- a/src/core/lib/http/httpcli_security_connector.cc +++ b/src/core/lib/http/httpcli_security_connector.cc @@ -34,14 +34,14 @@ typedef struct { grpc_channel_security_connector base; - tsi_ssl_client_handshaker_factory *handshaker_factory; - char *secure_peer_name; + tsi_ssl_client_handshaker_factory* handshaker_factory; + char* secure_peer_name; } grpc_httpcli_ssl_channel_security_connector; -static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx, - grpc_security_connector *sc) { - grpc_httpcli_ssl_channel_security_connector *c = - (grpc_httpcli_ssl_channel_security_connector *)sc; +static void httpcli_ssl_destroy(grpc_exec_ctx* exec_ctx, + grpc_security_connector* sc) { + grpc_httpcli_ssl_channel_security_connector* c = + (grpc_httpcli_ssl_channel_security_connector*)sc; if (c->handshaker_factory != NULL) { tsi_ssl_client_handshaker_factory_unref(c->handshaker_factory); c->handshaker_factory = NULL; @@ -50,12 +50,12 @@ static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx, gpr_free(sc); } -static void httpcli_ssl_add_handshakers(grpc_exec_ctx *exec_ctx, - grpc_channel_security_connector *sc, - grpc_handshake_manager *handshake_mgr) { - grpc_httpcli_ssl_channel_security_connector *c = - (grpc_httpcli_ssl_channel_security_connector *)sc; - tsi_handshaker *handshaker = NULL; +static void httpcli_ssl_add_handshakers(grpc_exec_ctx* exec_ctx, + grpc_channel_security_connector* sc, + grpc_handshake_manager* handshake_mgr) { + grpc_httpcli_ssl_channel_security_connector* c = + (grpc_httpcli_ssl_channel_security_connector*)sc; + tsi_handshaker* handshaker = NULL; if (c->handshaker_factory != NULL) { tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker( c->handshaker_factory, c->secure_peer_name, &handshaker); @@ -70,18 +70,18 @@ static void httpcli_ssl_add_handshakers(grpc_exec_ctx *exec_ctx, exec_ctx, tsi_create_adapter_handshaker(handshaker), &sc->base)); } -static void httpcli_ssl_check_peer(grpc_exec_ctx *exec_ctx, - grpc_security_connector *sc, tsi_peer peer, - grpc_auth_context **auth_context, - grpc_closure *on_peer_checked) { - grpc_httpcli_ssl_channel_security_connector *c = - (grpc_httpcli_ssl_channel_security_connector *)sc; - grpc_error *error = GRPC_ERROR_NONE; +static void httpcli_ssl_check_peer(grpc_exec_ctx* exec_ctx, + grpc_security_connector* sc, tsi_peer peer, + grpc_auth_context** auth_context, + grpc_closure* on_peer_checked) { + grpc_httpcli_ssl_channel_security_connector* c = + (grpc_httpcli_ssl_channel_security_connector*)sc; + grpc_error* error = GRPC_ERROR_NONE; /* Check the peer name. */ if (c->secure_peer_name != NULL && !tsi_ssl_peer_matches_name(&peer, c->secure_peer_name)) { - char *msg; + char* msg; gpr_asprintf(&msg, "Peer name %s is not in peer certificate", c->secure_peer_name); error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); @@ -91,12 +91,12 @@ static void httpcli_ssl_check_peer(grpc_exec_ctx *exec_ctx, tsi_peer_destruct(&peer); } -static int httpcli_ssl_cmp(grpc_security_connector *sc1, - grpc_security_connector *sc2) { - grpc_httpcli_ssl_channel_security_connector *c1 = - (grpc_httpcli_ssl_channel_security_connector *)sc1; - grpc_httpcli_ssl_channel_security_connector *c2 = - (grpc_httpcli_ssl_channel_security_connector *)sc2; +static int httpcli_ssl_cmp(grpc_security_connector* sc1, + grpc_security_connector* sc2) { + grpc_httpcli_ssl_channel_security_connector* c1 = + (grpc_httpcli_ssl_channel_security_connector*)sc1; + grpc_httpcli_ssl_channel_security_connector* c2 = + (grpc_httpcli_ssl_channel_security_connector*)sc2; return strcmp(c1->secure_peer_name, c2->secure_peer_name); } @@ -104,10 +104,10 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = { httpcli_ssl_destroy, httpcli_ssl_check_peer, httpcli_ssl_cmp}; static grpc_security_status httpcli_ssl_channel_security_connector_create( - grpc_exec_ctx *exec_ctx, const char *pem_root_certs, - const char *secure_peer_name, grpc_channel_security_connector **sc) { + grpc_exec_ctx* exec_ctx, const char* pem_root_certs, + const char* secure_peer_name, grpc_channel_security_connector** sc) { tsi_result result = TSI_OK; - grpc_httpcli_ssl_channel_security_connector *c; + grpc_httpcli_ssl_channel_security_connector* c; if (secure_peer_name != NULL && pem_root_certs == NULL) { gpr_log(GPR_ERROR, @@ -115,7 +115,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create( return GRPC_SECURITY_ERROR; } - c = (grpc_httpcli_ssl_channel_security_connector *)gpr_zalloc( + c = (grpc_httpcli_ssl_channel_security_connector*)gpr_zalloc( sizeof(grpc_httpcli_ssl_channel_security_connector)); gpr_ref_init(&c->base.base.refcount, 1); @@ -135,7 +135,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create( // We don't actually need a channel credentials object in this case, // but we set it to a non-NULL address so that we don't trigger // assertions in grpc_channel_security_connector_cmp(). - c->base.channel_creds = (grpc_channel_credentials *)1; + c->base.channel_creds = (grpc_channel_credentials*)1; c->base.add_handshakers = httpcli_ssl_add_handshakers; *sc = &c->base; return GRPC_SECURITY_OK; @@ -144,17 +144,17 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create( /* handshaker */ typedef struct { - void (*func)(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *endpoint); - void *arg; - grpc_handshake_manager *handshake_mgr; + void (*func)(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* endpoint); + void* arg; + grpc_handshake_manager* handshake_mgr; } on_done_closure; -static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - grpc_handshaker_args *args = (grpc_handshaker_args *)arg; - on_done_closure *c = (on_done_closure *)args->user_data; +static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { + grpc_handshaker_args* args = (grpc_handshaker_args*)arg; + on_done_closure* c = (on_done_closure*)args->user_data; if (error != GRPC_ERROR_NONE) { - const char *msg = grpc_error_string(error); + const char* msg = grpc_error_string(error); gpr_log(GPR_ERROR, "Secure transport setup failed: %s", msg); c->func(exec_ctx, c->arg, NULL); @@ -168,13 +168,13 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, gpr_free(c); } -static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, - grpc_endpoint *tcp, const char *host, +static void ssl_handshake(grpc_exec_ctx* exec_ctx, void* arg, + grpc_endpoint* tcp, const char* host, grpc_millis deadline, - void (*on_done)(grpc_exec_ctx *exec_ctx, void *arg, - grpc_endpoint *endpoint)) { - on_done_closure *c = (on_done_closure *)gpr_malloc(sizeof(*c)); - const char *pem_root_certs = grpc_get_default_ssl_roots(); + void (*on_done)(grpc_exec_ctx* exec_ctx, void* arg, + grpc_endpoint* endpoint)) { + on_done_closure* c = (on_done_closure*)gpr_malloc(sizeof(*c)); + const char* pem_root_certs = grpc_get_default_ssl_roots(); if (pem_root_certs == NULL) { gpr_log(GPR_ERROR, "Could not get default pem root certs."); on_done(exec_ctx, arg, NULL); @@ -183,7 +183,7 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, } c->func = on_done; c->arg = arg; - grpc_channel_security_connector *sc = NULL; + grpc_channel_security_connector* sc = NULL; GPR_ASSERT(httpcli_ssl_channel_security_connector_create( exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK); grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base); |