aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/security/credentials
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:34:04 -0800
committerGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:34:04 -0800
commit4d20a666850b732cf1562487fb5f46ab9654105f (patch)
tree9059162d0f125e02780f506c2476d5d9bbc0eb7d /src/core/lib/security/credentials
parentcddf6f838aa48c8d5c9f75cee5a8ed8abdcb25b9 (diff)
Run clang fmt
Diffstat (limited to 'src/core/lib/security/credentials')
-rw-r--r--src/core/lib/security/credentials/composite/composite_credentials.cc17
-rw-r--r--src/core/lib/security/credentials/credentials.cc7
-rw-r--r--src/core/lib/security/credentials/credentials_metadata.cc4
-rw-r--r--src/core/lib/security/credentials/fake/fake_credentials.cc19
-rw-r--r--src/core/lib/security/credentials/google_default/google_default_credentials.cc9
-rw-r--r--src/core/lib/security/credentials/iam/iam_credentials.cc6
-rw-r--r--src/core/lib/security/credentials/jwt/json_token.cc3
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_credentials.cc4
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.cc22
-rw-r--r--src/core/lib/security/credentials/oauth2/oauth2_credentials.cc29
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.cc16
-rw-r--r--src/core/lib/security/credentials/ssl/ssl_credentials.cc39
12 files changed, 101 insertions, 74 deletions
diff --git a/src/core/lib/security/credentials/composite/composite_credentials.cc b/src/core/lib/security/credentials/composite/composite_credentials.cc
index 248177a178..ea2c4e208f 100644
--- a/src/core/lib/security/credentials/composite/composite_credentials.cc
+++ b/src/core/lib/security/credentials/composite/composite_credentials.cc
@@ -40,7 +40,8 @@ typedef struct {
} grpc_composite_call_credentials_metadata_context;
static void composite_call_destruct(grpc_call_credentials* creds) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
for (size_t i = 0; i < c->inner.num_creds; i++) {
grpc_call_credentials_unref(c->inner.creds_array[i]);
}
@@ -75,10 +76,11 @@ static bool composite_call_get_request_metadata(
grpc_auth_metadata_context auth_md_context,
grpc_credentials_mdelem_array* md_array, grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
grpc_composite_call_credentials_metadata_context* ctx;
- ctx = static_cast<grpc_composite_call_credentials_metadata_context*>(gpr_zalloc(
- sizeof(grpc_composite_call_credentials_metadata_context)));
+ ctx = static_cast<grpc_composite_call_credentials_metadata_context*>(
+ gpr_zalloc(sizeof(grpc_composite_call_credentials_metadata_context)));
ctx->composite_creds = c;
ctx->pollent = pollent;
ctx->auth_md_context = auth_md_context;
@@ -106,7 +108,8 @@ static bool composite_call_get_request_metadata(
static void composite_call_cancel_get_request_metadata(
grpc_call_credentials* creds, grpc_credentials_mdelem_array* md_array,
grpc_error* error) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
for (size_t i = 0; i < c->inner.num_creds; ++i) {
grpc_call_credentials_cancel_get_request_metadata(
c->inner.creds_array[i], md_array, GRPC_ERROR_REF(error));
@@ -145,8 +148,8 @@ grpc_call_credentials* grpc_composite_call_credentials_create(
GPR_ASSERT(reserved == nullptr);
GPR_ASSERT(creds1 != nullptr);
GPR_ASSERT(creds2 != nullptr);
- c = static_cast<grpc_composite_call_credentials*>(gpr_zalloc(
- sizeof(grpc_composite_call_credentials)));
+ c = static_cast<grpc_composite_call_credentials*>(
+ gpr_zalloc(sizeof(grpc_composite_call_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE;
c->base.vtable = &composite_call_credentials_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/credentials.cc b/src/core/lib/security/credentials/credentials.cc
index c1ca881292..17f7de58be 100644
--- a/src/core/lib/security/credentials/credentials.cc
+++ b/src/core/lib/security/credentials/credentials.cc
@@ -40,8 +40,8 @@
grpc_credentials_metadata_request* grpc_credentials_metadata_request_create(
grpc_call_credentials* creds) {
grpc_credentials_metadata_request* r =
- static_cast<grpc_credentials_metadata_request*>(gpr_zalloc(
- sizeof(grpc_credentials_metadata_request)));
+ static_cast<grpc_credentials_metadata_request*>(
+ gpr_zalloc(sizeof(grpc_credentials_metadata_request)));
r->creds = grpc_call_credentials_ref(creds);
return r;
}
@@ -149,7 +149,8 @@ static void credentials_pointer_arg_destroy(void* p) {
}
static void* credentials_pointer_arg_copy(void* p) {
- return grpc_channel_credentials_ref(static_cast<grpc_channel_credentials*>(p));
+ return grpc_channel_credentials_ref(
+ static_cast<grpc_channel_credentials*>(p));
}
static int credentials_pointer_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
diff --git a/src/core/lib/security/credentials/credentials_metadata.cc b/src/core/lib/security/credentials/credentials_metadata.cc
index 76e856f48e..250e384155 100644
--- a/src/core/lib/security/credentials/credentials_metadata.cc
+++ b/src/core/lib/security/credentials/credentials_metadata.cc
@@ -33,8 +33,8 @@ static void mdelem_list_ensure_capacity(grpc_credentials_mdelem_array* list,
while (new_size < target_size) {
new_size *= 2;
}
- list->md =
- static_cast<grpc_mdelem*>(gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size));
+ list->md = static_cast<grpc_mdelem*>(
+ gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size));
}
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array* list,
diff --git a/src/core/lib/security/credentials/fake/fake_credentials.cc b/src/core/lib/security/credentials/fake/fake_credentials.cc
index b4f0dfdbdc..3b29db2efa 100644
--- a/src/core/lib/security/credentials/fake/fake_credentials.cc
+++ b/src/core/lib/security/credentials/fake/fake_credentials.cc
@@ -59,8 +59,8 @@ static grpc_server_credentials_vtable
grpc_channel_credentials* grpc_fake_transport_security_credentials_create(
void) {
- grpc_channel_credentials* c =
- static_cast<grpc_channel_credentials*>(gpr_zalloc(sizeof(grpc_channel_credentials)));
+ grpc_channel_credentials* c = static_cast<grpc_channel_credentials*>(
+ gpr_zalloc(sizeof(grpc_channel_credentials)));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
c->vtable = &fake_transport_security_credentials_vtable;
gpr_ref_init(&c->refcount, 1);
@@ -69,8 +69,8 @@ grpc_channel_credentials* grpc_fake_transport_security_credentials_create(
grpc_server_credentials* grpc_fake_transport_security_server_credentials_create(
void) {
- grpc_server_credentials* c =
- static_cast<grpc_server_credentials*>(gpr_malloc(sizeof(grpc_server_credentials)));
+ grpc_server_credentials* c = static_cast<grpc_server_credentials*>(
+ gpr_malloc(sizeof(grpc_server_credentials)));
memset(c, 0, sizeof(grpc_server_credentials));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
gpr_ref_init(&c->refcount, 1);
@@ -97,7 +97,8 @@ const char* grpc_fake_transport_get_expected_targets(
/* -- Metadata-only test credentials. -- */
static void md_only_test_destruct(grpc_call_credentials* creds) {
- grpc_md_only_test_credentials* c = reinterpret_cast<grpc_md_only_test_credentials*>(creds);
+ grpc_md_only_test_credentials* c =
+ reinterpret_cast<grpc_md_only_test_credentials*>(creds);
GRPC_MDELEM_UNREF(c->md);
}
@@ -105,7 +106,8 @@ static bool md_only_test_get_request_metadata(
grpc_call_credentials* creds, grpc_polling_entity* pollent,
grpc_auth_metadata_context context, grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata, grpc_error** error) {
- grpc_md_only_test_credentials* c = reinterpret_cast<grpc_md_only_test_credentials*>(creds);
+ grpc_md_only_test_credentials* c =
+ reinterpret_cast<grpc_md_only_test_credentials*>(creds);
grpc_credentials_mdelem_array_add(md_array, c->md);
if (c->is_async) {
GRPC_CLOSURE_SCHED(on_request_metadata, GRPC_ERROR_NONE);
@@ -126,8 +128,9 @@ static grpc_call_credentials_vtable md_only_test_vtable = {
grpc_call_credentials* grpc_md_only_test_credentials_create(
const char* md_key, const char* md_value, bool is_async) {
- grpc_md_only_test_credentials* c = static_cast<grpc_md_only_test_credentials*>(gpr_zalloc(
- sizeof(grpc_md_only_test_credentials)));
+ grpc_md_only_test_credentials* c =
+ static_cast<grpc_md_only_test_credentials*>(
+ gpr_zalloc(sizeof(grpc_md_only_test_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_OAUTH2;
c->base.vtable = &md_only_test_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.cc b/src/core/lib/security/credentials/google_default/google_default_credentials.cc
index dd7d52d750..65455f94b3 100644
--- a/src/core/lib/security/credentials/google_default/google_default_credentials.cc
+++ b/src/core/lib/security/credentials/google_default/google_default_credentials.cc
@@ -60,7 +60,8 @@ typedef struct {
static void on_compute_engine_detection_http_response(void* user_data,
grpc_error* error) {
- compute_engine_detector* detector = static_cast<compute_engine_detector*>(user_data);
+ compute_engine_detector* detector =
+ static_cast<compute_engine_detector*>(user_data);
if (error == GRPC_ERROR_NONE && detector->response.status == 200 &&
detector->response.hdr_count > 0) {
/* Internet providers can return a generic response to all requests, so
@@ -98,7 +99,8 @@ static int is_stack_running_on_compute_engine() {
on compute engine. */
grpc_millis max_detection_delay = GPR_MS_PER_SEC;
- grpc_pollset* pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
+ grpc_pollset* pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollset, &g_polling_mu);
detector.pollent = grpc_polling_entity_create_from_pollset(pollset);
detector.is_done = 0;
@@ -171,7 +173,8 @@ static grpc_error* create_default_creds_from_path(
goto end;
}
json = grpc_json_parse_string_with_len(
- reinterpret_cast<char*>GRPC_SLICE_START_PTR(creds_data), GRPC_SLICE_LENGTH(creds_data));
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(creds_data),
+ GRPC_SLICE_LENGTH(creds_data));
if (json == nullptr) {
error = grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to parse JSON"),
diff --git a/src/core/lib/security/credentials/iam/iam_credentials.cc b/src/core/lib/security/credentials/iam/iam_credentials.cc
index 20f4ff95f5..7f19fbc785 100644
--- a/src/core/lib/security/credentials/iam/iam_credentials.cc
+++ b/src/core/lib/security/credentials/iam/iam_credentials.cc
@@ -28,7 +28,8 @@
#include <grpc/support/sync.h>
static void iam_destruct(grpc_call_credentials* creds) {
- grpc_google_iam_credentials* c = reinterpret_cast<grpc_google_iam_credentials*>(creds);
+ grpc_google_iam_credentials* c =
+ reinterpret_cast<grpc_google_iam_credentials*>(creds);
grpc_credentials_mdelem_array_destroy(&c->md_array);
}
@@ -38,7 +39,8 @@ static bool iam_get_request_metadata(grpc_call_credentials* creds,
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_google_iam_credentials* c = reinterpret_cast<grpc_google_iam_credentials*>(creds);
+ grpc_google_iam_credentials* c =
+ reinterpret_cast<grpc_google_iam_credentials*>(creds);
grpc_credentials_mdelem_array_append(md_array, &c->md_array);
return true;
}
diff --git a/src/core/lib/security/credentials/jwt/json_token.cc b/src/core/lib/security/credentials/jwt/json_token.cc
index eae1be17fd..f7c9f57808 100644
--- a/src/core/lib/security/credentials/jwt/json_token.cc
+++ b/src/core/lib/security/credentials/jwt/json_token.cc
@@ -219,7 +219,8 @@ static char* dot_concat_and_free_strings(char* str1, char* str2) {
size_t str1_len = strlen(str1);
size_t str2_len = strlen(str2);
size_t result_len = str1_len + 1 /* dot */ + str2_len;
- char* result = static_cast<char*>(gpr_malloc(result_len + 1 /* NULL terminated */));
+ char* result =
+ static_cast<char*>(gpr_malloc(result_len + 1 /* NULL terminated */));
char* current = result;
memcpy(current, str1, str1_len);
current += str1_len;
diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.cc b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
index 44101acd78..05c08a68b0 100644
--- a/src/core/lib/security/credentials/jwt/jwt_credentials.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
@@ -123,8 +123,8 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
gpr_log(GPR_ERROR, "Invalid input for jwt credentials creation");
return nullptr;
}
- c = static_cast<grpc_service_account_jwt_access_credentials*>(gpr_zalloc(
- sizeof(grpc_service_account_jwt_access_credentials)));
+ c = static_cast<grpc_service_account_jwt_access_credentials*>(
+ gpr_zalloc(sizeof(grpc_service_account_jwt_access_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_JWT;
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &jwt_vtable;
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
index 3d7541f4c9..f5c1ada6ca 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
@@ -82,8 +82,9 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
gpr_log(GPR_ERROR, "Invalid base64.");
return nullptr;
}
- json = grpc_json_parse_string_with_len(reinterpret_cast<char*>GRPC_SLICE_START_PTR(*buffer),
- GRPC_SLICE_LENGTH(*buffer));
+ json = grpc_json_parse_string_with_len(
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(*buffer),
+ GRPC_SLICE_LENGTH(*buffer));
if (json == nullptr) {
grpc_slice_unref_internal(*buffer);
gpr_log(GPR_ERROR, "JSON parsing error.");
@@ -347,7 +348,8 @@ static verifier_cb_ctx* verifier_cb_ctx_create(
const char* signed_jwt, size_t signed_jwt_len, void* user_data,
grpc_jwt_verification_done_cb cb) {
grpc_core::ExecCtx exec_ctx;
- verifier_cb_ctx* ctx = static_cast<verifier_cb_ctx*>(gpr_zalloc(sizeof(verifier_cb_ctx)));
+ verifier_cb_ctx* ctx =
+ static_cast<verifier_cb_ctx*>(gpr_zalloc(sizeof(verifier_cb_ctx)));
ctx->verifier = verifier;
ctx->pollent = grpc_polling_entity_create_from_pollset(pollset);
ctx->header = header;
@@ -754,8 +756,8 @@ const char* grpc_jwt_issuer_email_domain(const char* issuer) {
if (dot == nullptr || dot == email_domain) return email_domain;
GPR_ASSERT(dot > email_domain);
/* There may be a subdomain, we just want the domain. */
- dot = static_cast<const char*>(gpr_memrchr((void*)email_domain, '.',
- static_cast<size_t>(dot - email_domain)));
+ dot = static_cast<const char*>(gpr_memrchr(
+ (void*)email_domain, '.', static_cast<size_t>(dot - email_domain)));
if (dot == nullptr) return email_domain;
return dot + 1;
}
@@ -861,7 +863,8 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
cb != nullptr);
dot = strchr(cur, '.');
if (dot == nullptr) goto error;
- json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur), &header_buffer);
+ json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur),
+ &header_buffer);
if (json == nullptr) goto error;
header = jose_header_from_json(json, header_buffer);
if (header == nullptr) goto error;
@@ -869,7 +872,8 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
cur = dot + 1;
dot = strchr(cur, '.');
if (dot == nullptr) goto error;
- json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur), &claims_buffer);
+ json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur),
+ &claims_buffer);
if (json == nullptr) goto error;
claims = grpc_jwt_claims_from_json(json, claims_buffer);
if (claims == nullptr) goto error;
@@ -898,8 +902,8 @@ grpc_jwt_verifier* grpc_jwt_verifier_create(
/* We know at least of one mapping. */
v->allocated_mappings = 1 + num_mappings;
- v->mappings = static_cast<email_key_mapping*>(gpr_malloc(v->allocated_mappings *
- sizeof(email_key_mapping)));
+ v->mappings = static_cast<email_key_mapping*>(
+ gpr_malloc(v->allocated_mappings * sizeof(email_key_mapping)));
verifier_put_mapping(v, GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN,
GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX);
/* User-Provided mappings. */
diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
index b4fb9a43e7..afae7d8f2f 100644
--- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
+++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
@@ -128,7 +128,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
}
if (response->body_length > 0) {
- null_terminated_body = static_cast<char*>(gpr_malloc(response->body_length + 1));
+ null_terminated_body =
+ static_cast<char*>(gpr_malloc(response->body_length + 1));
null_terminated_body[response->body_length] = '\0';
memcpy(null_terminated_body, response->body, response->body_length);
}
@@ -269,8 +270,8 @@ static bool oauth2_token_fetcher_get_request_metadata(
// Couldn't get the token from the cache.
// Add request to c->pending_requests and start a new fetch if needed.
grpc_oauth2_pending_get_request_metadata* pending_request =
- static_cast<grpc_oauth2_pending_get_request_metadata*>(gpr_malloc(
- sizeof(*pending_request)));
+ static_cast<grpc_oauth2_pending_get_request_metadata*>(
+ gpr_malloc(sizeof(*pending_request)));
pending_request->md_array = md_array;
pending_request->on_request_metadata = on_request_metadata;
pending_request->pollent = pollent;
@@ -371,8 +372,8 @@ static void compute_engine_fetch_oauth2(
grpc_call_credentials* grpc_google_compute_engine_credentials_create(
void* reserved) {
grpc_oauth2_token_fetcher_credentials* c =
- static_cast<grpc_oauth2_token_fetcher_credentials*>(gpr_malloc(
- sizeof(grpc_oauth2_token_fetcher_credentials)));
+ static_cast<grpc_oauth2_token_fetcher_credentials*>(
+ gpr_malloc(sizeof(grpc_oauth2_token_fetcher_credentials)));
GRPC_API_TRACE("grpc_compute_engine_credentials_create(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == nullptr);
@@ -401,7 +402,8 @@ static void refresh_token_fetch_oauth2(
grpc_httpcli_context* httpcli_context, grpc_polling_entity* pollent,
grpc_iomgr_cb_func response_cb, grpc_millis deadline) {
grpc_google_refresh_token_credentials* c =
- reinterpret_cast<grpc_google_refresh_token_credentials*>(metadata_req->creds);
+ reinterpret_cast<grpc_google_refresh_token_credentials*>(
+ metadata_req->creds);
grpc_http_header header = {(char*)"Content-Type",
(char*)"application/x-www-form-urlencoded"};
grpc_httpcli_request request;
@@ -437,8 +439,8 @@ grpc_refresh_token_credentials_create_from_auth_refresh_token(
gpr_log(GPR_ERROR, "Invalid input for refresh token credentials creation");
return nullptr;
}
- c = static_cast<grpc_google_refresh_token_credentials*>(gpr_zalloc(
- sizeof(grpc_google_refresh_token_credentials)));
+ c = static_cast<grpc_google_refresh_token_credentials*>(
+ gpr_zalloc(sizeof(grpc_google_refresh_token_credentials)));
init_oauth2_token_fetcher(&c->base, refresh_token_fetch_oauth2);
c->base.base.vtable = &refresh_token_vtable;
c->refresh_token = refresh_token;
@@ -478,7 +480,8 @@ grpc_call_credentials* grpc_google_refresh_token_credentials_create(
//
static void access_token_destruct(grpc_call_credentials* creds) {
- grpc_access_token_credentials* c = reinterpret_cast<grpc_access_token_credentials*>(creds);
+ grpc_access_token_credentials* c =
+ reinterpret_cast<grpc_access_token_credentials*>(creds);
GRPC_MDELEM_UNREF(c->access_token_md);
}
@@ -486,7 +489,8 @@ static bool access_token_get_request_metadata(
grpc_call_credentials* creds, grpc_polling_entity* pollent,
grpc_auth_metadata_context context, grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata, grpc_error** error) {
- grpc_access_token_credentials* c = reinterpret_cast<grpc_access_token_credentials*>(creds);
+ grpc_access_token_credentials* c =
+ reinterpret_cast<grpc_access_token_credentials*>(creds);
grpc_credentials_mdelem_array_add(md_array, c->access_token_md);
return true;
}
@@ -503,8 +507,9 @@ static grpc_call_credentials_vtable access_token_vtable = {
grpc_call_credentials* grpc_access_token_credentials_create(
const char* access_token, void* reserved) {
- grpc_access_token_credentials* c = static_cast<grpc_access_token_credentials*>(gpr_zalloc(
- sizeof(grpc_access_token_credentials)));
+ grpc_access_token_credentials* c =
+ static_cast<grpc_access_token_credentials*>(
+ gpr_zalloc(sizeof(grpc_access_token_credentials)));
GRPC_API_TRACE(
"grpc_access_token_credentials_create(access_token=<redacted>, "
"reserved=%p)",
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
index 89f94f9e6d..ddb86e153b 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
@@ -34,7 +34,8 @@
grpc_core::TraceFlag grpc_plugin_credentials_trace(false, "plugin_credentials");
static void plugin_destruct(grpc_call_credentials* creds) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
gpr_mu_destroy(&c->mu);
if (c->plugin.state != nullptr && c->plugin.destroy != nullptr) {
c->plugin.destroy(c->plugin.state);
@@ -147,13 +148,14 @@ static bool plugin_get_request_metadata(grpc_call_credentials* creds,
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
bool retval = true; // Synchronous return.
if (c->plugin.get_metadata != nullptr) {
// Create pending_request object.
grpc_plugin_credentials_pending_request* pending_request =
- static_cast<grpc_plugin_credentials_pending_request*>(gpr_zalloc(
- sizeof(*pending_request)));
+ static_cast<grpc_plugin_credentials_pending_request*>(
+ gpr_zalloc(sizeof(*pending_request)));
pending_request->creds = c;
pending_request->md_array = md_array;
pending_request->on_request_metadata = on_request_metadata;
@@ -225,7 +227,8 @@ static bool plugin_get_request_metadata(grpc_call_credentials* creds,
static void plugin_cancel_get_request_metadata(
grpc_call_credentials* creds, grpc_credentials_mdelem_array* md_array,
grpc_error* error) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
gpr_mu_lock(&c->mu);
for (grpc_plugin_credentials_pending_request* pending_request =
c->pending_requests;
@@ -252,7 +255,8 @@ static grpc_call_credentials_vtable plugin_vtable = {
grpc_call_credentials* grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin, void* reserved) {
- grpc_plugin_credentials* c = static_cast<grpc_plugin_credentials*>(gpr_zalloc(sizeof(*c)));
+ grpc_plugin_credentials* c =
+ static_cast<grpc_plugin_credentials*>(gpr_zalloc(sizeof(*c)));
GRPC_API_TRACE("grpc_metadata_credentials_create_from_plugin(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == nullptr);
diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.cc b/src/core/lib/security/credentials/ssl/ssl_credentials.cc
index 4237039274..a4fce25f3a 100644
--- a/src/core/lib/security/credentials/ssl/ssl_credentials.cc
+++ b/src/core/lib/security/credentials/ssl/ssl_credentials.cc
@@ -85,8 +85,8 @@ static void ssl_build_config(const char* pem_root_certs,
if (pem_key_cert_pair != nullptr) {
GPR_ASSERT(pem_key_cert_pair->private_key != nullptr);
GPR_ASSERT(pem_key_cert_pair->cert_chain != nullptr);
- config->pem_key_cert_pair = static_cast<tsi_ssl_pem_key_cert_pair*>(gpr_zalloc(
- sizeof(tsi_ssl_pem_key_cert_pair)));
+ config->pem_key_cert_pair = static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(sizeof(tsi_ssl_pem_key_cert_pair)));
config->pem_key_cert_pair->cert_chain =
gpr_strdup(pem_key_cert_pair->cert_chain);
config->pem_key_cert_pair->private_key =
@@ -97,8 +97,8 @@ static void ssl_build_config(const char* pem_root_certs,
grpc_channel_credentials* grpc_ssl_credentials_create(
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
void* reserved) {
- grpc_ssl_credentials* c =
- static_cast<grpc_ssl_credentials*>(gpr_zalloc(sizeof(grpc_ssl_credentials)));
+ grpc_ssl_credentials* c = static_cast<grpc_ssl_credentials*>(
+ gpr_zalloc(sizeof(grpc_ssl_credentials)));
GRPC_API_TRACE(
"grpc_ssl_credentials_create(pem_root_certs=%s, "
"pem_key_cert_pair=%p, "
@@ -123,7 +123,8 @@ struct grpc_ssl_server_credentials_options {
};
static void ssl_server_destruct(grpc_server_credentials* creds) {
- grpc_ssl_server_credentials* c = reinterpret_cast<grpc_ssl_server_credentials*>(creds);
+ grpc_ssl_server_credentials* c =
+ reinterpret_cast<grpc_ssl_server_credentials*>(creds);
grpc_tsi_ssl_pem_key_cert_pairs_destroy(c->config.pem_key_cert_pairs,
c->config.num_key_cert_pairs);
gpr_free(c->config.pem_root_certs);
@@ -143,8 +144,8 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs(
tsi_ssl_pem_key_cert_pair* tsi_pairs = nullptr;
if (num_key_cert_pairs > 0) {
GPR_ASSERT(pem_key_cert_pairs != nullptr);
- tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(gpr_zalloc(
- num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
+ tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
}
for (size_t i = 0; i < num_key_cert_pairs; i++) {
GPR_ASSERT(pem_key_cert_pairs[i].private_key != nullptr);
@@ -174,15 +175,15 @@ grpc_ssl_server_certificate_config* grpc_ssl_server_certificate_config_create(
const grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs,
size_t num_key_cert_pairs) {
grpc_ssl_server_certificate_config* config =
- static_cast<grpc_ssl_server_certificate_config*>(gpr_zalloc(
- sizeof(grpc_ssl_server_certificate_config)));
+ static_cast<grpc_ssl_server_certificate_config*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_certificate_config)));
if (pem_root_certs != nullptr) {
config->pem_root_certs = gpr_strdup(pem_root_certs);
}
if (num_key_cert_pairs > 0) {
GPR_ASSERT(pem_key_cert_pairs != nullptr);
- config->pem_key_cert_pairs = static_cast<grpc_ssl_pem_key_cert_pair*>(gpr_zalloc(
- num_key_cert_pairs * sizeof(grpc_ssl_pem_key_cert_pair)));
+ config->pem_key_cert_pairs = static_cast<grpc_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(num_key_cert_pairs * sizeof(grpc_ssl_pem_key_cert_pair)));
}
config->num_key_cert_pairs = num_key_cert_pairs;
for (size_t i = 0; i < num_key_cert_pairs; i++) {
@@ -217,8 +218,8 @@ grpc_ssl_server_credentials_create_options_using_config(
gpr_log(GPR_ERROR, "Certificate config must not be NULL.");
goto done;
}
- options = static_cast<grpc_ssl_server_credentials_options*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials_options)));
+ options = static_cast<grpc_ssl_server_credentials_options*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials_options)));
options->client_certificate_request = client_certificate_request;
options->certificate_config = config;
done:
@@ -235,14 +236,14 @@ grpc_ssl_server_credentials_create_options_using_config_fetcher(
}
grpc_ssl_server_certificate_config_fetcher* fetcher =
- static_cast<grpc_ssl_server_certificate_config_fetcher*>(gpr_zalloc(
- sizeof(grpc_ssl_server_certificate_config_fetcher)));
+ static_cast<grpc_ssl_server_certificate_config_fetcher*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_certificate_config_fetcher)));
fetcher->cb = cb;
fetcher->user_data = user_data;
grpc_ssl_server_credentials_options* options =
- static_cast<grpc_ssl_server_credentials_options*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials_options)));
+ static_cast<grpc_ssl_server_credentials_options*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials_options)));
options->client_certificate_request = client_certificate_request;
options->certificate_config_fetcher = fetcher;
@@ -307,8 +308,8 @@ grpc_server_credentials* grpc_ssl_server_credentials_create_with_options(
goto done;
}
- c = static_cast<grpc_ssl_server_credentials*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials)));
+ c = static_cast<grpc_ssl_server_credentials*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials)));
c->base.type = GRPC_CHANNEL_CREDENTIALS_TYPE_SSL;
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &ssl_server_vtable;