diff options
author | Craig Tiller <ctiller@google.com> | 2016-01-06 13:55:14 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-01-06 13:55:14 -0800 |
commit | 791a49169ffe4da168fa140aa182b5f5088a39fa (patch) | |
tree | 42d0419837b568fa78ac40d8d9a1903221a150f9 /src/core/security | |
parent | e6d95c93a37329a2a43f62e03616c861af87f0ec (diff) | |
parent | 0850640213266afc64c1f6f7e10728037129f117 (diff) |
Merge github.com:grpc/grpc into clangfmt
Diffstat (limited to 'src/core/security')
-rw-r--r-- | src/core/security/base64.c | 13 | ||||
-rw-r--r-- | src/core/security/client_auth_filter.c | 2 | ||||
-rw-r--r-- | src/core/security/credentials.c | 2 | ||||
-rw-r--r-- | src/core/security/json_token.c | 6 | ||||
-rw-r--r-- | src/core/security/secure_endpoint.c | 22 |
5 files changed, 22 insertions, 23 deletions
diff --git a/src/core/security/base64.c b/src/core/security/base64.c index 5226d2c578..e68359602e 100644 --- a/src/core/security/base64.c +++ b/src/core/security/base64.c @@ -114,7 +114,7 @@ char *grpc_base64_encode(const void *vdata, size_t data_size, int url_safe, } GPR_ASSERT(current >= result); - GPR_ASSERT((gpr_uintptr)(current - result) < result_projected_size); + GPR_ASSERT((uintptr_t)(current - result) < result_projected_size); result[current - result] = '\0'; return result; } @@ -125,14 +125,14 @@ gpr_slice grpc_base64_decode(const char *b64, int url_safe) { static void decode_one_char(const unsigned char *codes, unsigned char *result, size_t *result_offset) { - gpr_uint32 packed = ((gpr_uint32)codes[0] << 2) | ((gpr_uint32)codes[1] >> 4); + uint32_t packed = ((uint32_t)codes[0] << 2) | ((uint32_t)codes[1] >> 4); result[(*result_offset)++] = (unsigned char)packed; } static void decode_two_chars(const unsigned char *codes, unsigned char *result, size_t *result_offset) { - gpr_uint32 packed = ((gpr_uint32)codes[0] << 10) | - ((gpr_uint32)codes[1] << 4) | ((gpr_uint32)codes[2] >> 2); + uint32_t packed = ((uint32_t)codes[0] << 10) | ((uint32_t)codes[1] << 4) | + ((uint32_t)codes[2] >> 2); result[(*result_offset)++] = (unsigned char)(packed >> 8); result[(*result_offset)++] = (unsigned char)(packed); } @@ -172,9 +172,8 @@ static int decode_group(const unsigned char *codes, size_t num_codes, decode_two_chars(codes, result, result_offset); } else { /* No padding. */ - gpr_uint32 packed = ((gpr_uint32)codes[0] << 18) | - ((gpr_uint32)codes[1] << 12) | - ((gpr_uint32)codes[2] << 6) | codes[3]; + uint32_t packed = ((uint32_t)codes[0] << 18) | ((uint32_t)codes[1] << 12) | + ((uint32_t)codes[2] << 6) | codes[3]; result[(*result_offset)++] = (unsigned char)(packed >> 16); result[(*result_offset)++] = (unsigned char)(packed >> 8); result[(*result_offset)++] = (unsigned char)(packed); diff --git a/src/core/security/client_auth_filter.c b/src/core/security/client_auth_filter.c index 795de0df7b..57b367d00f 100644 --- a/src/core/security/client_auth_filter.c +++ b/src/core/security/client_auth_filter.c @@ -60,7 +60,7 @@ typedef struct { progress */ grpc_pollset *pollset; grpc_transport_stream_op op; - gpr_uint8 security_context_set; + uint8_t security_context_set; grpc_linked_mdelem md_links[MAX_CREDENTIALS_METADATA_COUNT]; grpc_auth_metadata_context auth_md_context; } call_data; diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 3473d5c887..8b56c57645 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -180,7 +180,7 @@ void grpc_server_credentials_set_auth_metadata_processor( "grpc_server_credentials_set_auth_metadata_processor(" "creds=%p, " "processor=grpc_auth_metadata_processor { process: %p, state: %p })", - 3, (creds, (void *)(gpr_intptr)processor.process, processor.state)); + 3, (creds, (void *)(intptr_t)processor.process, processor.state)); if (creds == NULL) return; if (creds->processor.destroy != NULL && creds->processor.state != NULL) { creds->processor.destroy(creds->processor.state); diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index 92775d885d..4d4bc4baad 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -215,8 +215,8 @@ static char *encoded_jwt_claim(const grpc_auth_json_key *json_key, gpr_log(GPR_INFO, "Cropping token lifetime to maximum allowed value."); expiration = gpr_time_add(now, grpc_max_auth_token_lifetime); } - gpr_int64toa(now.tv_sec, now_str); - gpr_int64toa(expiration.tv_sec, expiration_str); + int64_ttoa(now.tv_sec, now_str); + int64_ttoa(expiration.tv_sec, expiration_str); child = create_child(NULL, json, "iss", json_key->client_email, GRPC_JSON_STRING); @@ -251,7 +251,7 @@ static char *dot_concat_and_free_strings(char *str1, char *str2) { memcpy(current, str2, str2_len); current += str2_len; GPR_ASSERT(current >= result); - GPR_ASSERT((gpr_uintptr)(current - result) == result_len); + GPR_ASSERT((uintptr_t)(current - result) == result_len); *current = '\0'; gpr_free(str1); gpr_free(str2); diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index fd50abb773..9b87e268c6 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -117,8 +117,8 @@ static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); } #endif -static void flush_read_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur, - gpr_uint8 **end) { +static void flush_read_staging_buffer(secure_endpoint *ep, uint8_t **cur, + uint8_t **end) { gpr_slice_buffer_add(ep->read_buffer, ep->read_staging_buffer); ep->read_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE); *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer); @@ -143,11 +143,11 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep, static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, int success) { unsigned i; - gpr_uint8 keep_looping = 0; + uint8_t keep_looping = 0; tsi_result result = TSI_OK; secure_endpoint *ep = (secure_endpoint *)user_data; - gpr_uint8 *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer); - gpr_uint8 *end = GPR_SLICE_END_PTR(ep->read_staging_buffer); + uint8_t *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer); + uint8_t *end = GPR_SLICE_END_PTR(ep->read_staging_buffer); if (!success) { gpr_slice_buffer_reset_and_unref(ep->read_buffer); @@ -158,7 +158,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, int success) { /* TODO(yangg) check error, maybe bail out early */ for (i = 0; i < ep->source_buffer.count; i++) { gpr_slice encrypted = ep->source_buffer.slices[i]; - gpr_uint8 *message_bytes = GPR_SLICE_START_PTR(encrypted); + uint8_t *message_bytes = GPR_SLICE_START_PTR(encrypted); size_t message_size = GPR_SLICE_LENGTH(encrypted); while (message_size > 0 || keep_looping) { @@ -234,8 +234,8 @@ static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep, &ep->on_read); } -static void flush_write_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur, - gpr_uint8 **end) { +static void flush_write_staging_buffer(secure_endpoint *ep, uint8_t **cur, + uint8_t **end) { gpr_slice_buffer_add(&ep->output_buffer, ep->write_staging_buffer); ep->write_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE); *cur = GPR_SLICE_START_PTR(ep->write_staging_buffer); @@ -247,8 +247,8 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep, unsigned i; tsi_result result = TSI_OK; secure_endpoint *ep = (secure_endpoint *)secure_ep; - gpr_uint8 *cur = GPR_SLICE_START_PTR(ep->write_staging_buffer); - gpr_uint8 *end = GPR_SLICE_END_PTR(ep->write_staging_buffer); + uint8_t *cur = GPR_SLICE_START_PTR(ep->write_staging_buffer); + uint8_t *end = GPR_SLICE_END_PTR(ep->write_staging_buffer); gpr_slice_buffer_reset_and_unref(&ep->output_buffer); @@ -263,7 +263,7 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep, for (i = 0; i < slices->count; i++) { gpr_slice plain = slices->slices[i]; - gpr_uint8 *message_bytes = GPR_SLICE_START_PTR(plain); + uint8_t *message_bytes = GPR_SLICE_START_PTR(plain); size_t message_size = GPR_SLICE_LENGTH(plain); while (message_size > 0) { size_t protected_buffer_size_to_send = (size_t)(end - cur); |