diff options
Diffstat (limited to 'src/core/tsi/transport_security.cc')
-rw-r--r-- | src/core/tsi/transport_security.cc | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/core/tsi/transport_security.cc b/src/core/tsi/transport_security.cc index 21bd8eba78..78e7be249c 100644 --- a/src/core/tsi/transport_security.cc +++ b/src/core/tsi/transport_security.cc @@ -30,7 +30,7 @@ grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER(false, "tsi"); /* --- tsi_result common implementation. --- */ -const char *tsi_result_to_string(tsi_result result) { +const char* tsi_result_to_string(tsi_result result) { switch (result) { case TSI_OK: return "TSI_OK"; @@ -69,11 +69,11 @@ const char *tsi_result_to_string(tsi_result result) { Calls specific implementation after state/input validation. */ -tsi_result tsi_frame_protector_protect(tsi_frame_protector *self, - const unsigned char *unprotected_bytes, - size_t *unprotected_bytes_size, - unsigned char *protected_output_frames, - size_t *protected_output_frames_size) { +tsi_result tsi_frame_protector_protect(tsi_frame_protector* self, + const unsigned char* unprotected_bytes, + size_t* unprotected_bytes_size, + unsigned char* protected_output_frames, + size_t* protected_output_frames_size) { if (self == NULL || self->vtable == NULL || unprotected_bytes == NULL || unprotected_bytes_size == NULL || protected_output_frames == NULL || protected_output_frames_size == NULL) { @@ -86,8 +86,8 @@ tsi_result tsi_frame_protector_protect(tsi_frame_protector *self, } tsi_result tsi_frame_protector_protect_flush( - tsi_frame_protector *self, unsigned char *protected_output_frames, - size_t *protected_output_frames_size, size_t *still_pending_size) { + tsi_frame_protector* self, unsigned char* protected_output_frames, + size_t* protected_output_frames_size, size_t* still_pending_size) { if (self == NULL || self->vtable == NULL || protected_output_frames == NULL || protected_output_frames_size == NULL || still_pending_size == NULL) { return TSI_INVALID_ARGUMENT; @@ -99,9 +99,9 @@ tsi_result tsi_frame_protector_protect_flush( } tsi_result tsi_frame_protector_unprotect( - tsi_frame_protector *self, const unsigned char *protected_frames_bytes, - size_t *protected_frames_bytes_size, unsigned char *unprotected_bytes, - size_t *unprotected_bytes_size) { + tsi_frame_protector* self, const unsigned char* protected_frames_bytes, + size_t* protected_frames_bytes_size, unsigned char* unprotected_bytes, + size_t* unprotected_bytes_size) { if (self == NULL || self->vtable == NULL || protected_frames_bytes == NULL || protected_frames_bytes_size == NULL || unprotected_bytes == NULL || unprotected_bytes_size == NULL) { @@ -113,7 +113,7 @@ tsi_result tsi_frame_protector_unprotect( unprotected_bytes_size); } -void tsi_frame_protector_destroy(tsi_frame_protector *self) { +void tsi_frame_protector_destroy(tsi_frame_protector* self) { if (self == NULL) return; self->vtable->destroy(self); } @@ -122,9 +122,9 @@ void tsi_frame_protector_destroy(tsi_frame_protector *self) { Calls specific implementation after state/input validation. */ -tsi_result tsi_handshaker_get_bytes_to_send_to_peer(tsi_handshaker *self, - unsigned char *bytes, - size_t *bytes_size) { +tsi_result tsi_handshaker_get_bytes_to_send_to_peer(tsi_handshaker* self, + unsigned char* bytes, + size_t* bytes_size) { if (self == NULL || self->vtable == NULL || bytes == NULL || bytes_size == NULL) { return TSI_INVALID_ARGUMENT; @@ -134,9 +134,9 @@ tsi_result tsi_handshaker_get_bytes_to_send_to_peer(tsi_handshaker *self, return self->vtable->get_bytes_to_send_to_peer(self, bytes, bytes_size); } -tsi_result tsi_handshaker_process_bytes_from_peer(tsi_handshaker *self, - const unsigned char *bytes, - size_t *bytes_size) { +tsi_result tsi_handshaker_process_bytes_from_peer(tsi_handshaker* self, + const unsigned char* bytes, + size_t* bytes_size) { if (self == NULL || self->vtable == NULL || bytes == NULL || bytes_size == NULL) { return TSI_INVALID_ARGUMENT; @@ -146,14 +146,14 @@ tsi_result tsi_handshaker_process_bytes_from_peer(tsi_handshaker *self, return self->vtable->process_bytes_from_peer(self, bytes, bytes_size); } -tsi_result tsi_handshaker_get_result(tsi_handshaker *self) { +tsi_result tsi_handshaker_get_result(tsi_handshaker* self) { if (self == NULL || self->vtable == NULL) return TSI_INVALID_ARGUMENT; if (self->frame_protector_created) return TSI_FAILED_PRECONDITION; if (self->vtable->get_result == NULL) return TSI_UNIMPLEMENTED; return self->vtable->get_result(self); } -tsi_result tsi_handshaker_extract_peer(tsi_handshaker *self, tsi_peer *peer) { +tsi_result tsi_handshaker_extract_peer(tsi_handshaker* self, tsi_peer* peer) { if (self == NULL || self->vtable == NULL || peer == NULL) { return TSI_INVALID_ARGUMENT; } @@ -167,8 +167,8 @@ tsi_result tsi_handshaker_extract_peer(tsi_handshaker *self, tsi_peer *peer) { } tsi_result tsi_handshaker_create_frame_protector( - tsi_handshaker *self, size_t *max_protected_frame_size, - tsi_frame_protector **protector) { + tsi_handshaker* self, size_t* max_protected_frame_size, + tsi_frame_protector** protector) { tsi_result result; if (self == NULL || self->vtable == NULL || protector == NULL) { return TSI_INVALID_ARGUMENT; @@ -185,10 +185,10 @@ tsi_result tsi_handshaker_create_frame_protector( } tsi_result tsi_handshaker_next( - tsi_handshaker *self, const unsigned char *received_bytes, - size_t received_bytes_size, const unsigned char **bytes_to_send, - size_t *bytes_to_send_size, tsi_handshaker_result **handshaker_result, - tsi_handshaker_on_next_done_cb cb, void *user_data) { + tsi_handshaker* self, const unsigned char* received_bytes, + size_t received_bytes_size, const unsigned char** bytes_to_send, + size_t* bytes_to_send_size, tsi_handshaker_result** handshaker_result, + tsi_handshaker_on_next_done_cb cb, void* user_data) { if (self == NULL || self->vtable == NULL) return TSI_INVALID_ARGUMENT; if (self->handshaker_result_created) return TSI_FAILED_PRECONDITION; if (self->vtable->next == NULL) return TSI_UNIMPLEMENTED; @@ -197,15 +197,15 @@ tsi_result tsi_handshaker_next( handshaker_result, cb, user_data); } -void tsi_handshaker_destroy(tsi_handshaker *self) { +void tsi_handshaker_destroy(tsi_handshaker* self) { if (self == NULL) return; self->vtable->destroy(self); } /* --- tsi_handshaker_result implementation. --- */ -tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result *self, - tsi_peer *peer) { +tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result* self, + tsi_peer* peer) { if (self == NULL || self->vtable == NULL || peer == NULL) { return TSI_INVALID_ARGUMENT; } @@ -215,8 +215,8 @@ tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result *self, } tsi_result tsi_handshaker_result_create_frame_protector( - const tsi_handshaker_result *self, size_t *max_protected_frame_size, - tsi_frame_protector **protector) { + const tsi_handshaker_result* self, size_t* max_protected_frame_size, + tsi_frame_protector** protector) { if (self == NULL || self->vtable == NULL || protector == NULL) { return TSI_INVALID_ARGUMENT; } @@ -226,8 +226,8 @@ tsi_result tsi_handshaker_result_create_frame_protector( } tsi_result tsi_handshaker_result_get_unused_bytes( - const tsi_handshaker_result *self, const unsigned char **bytes, - size_t *bytes_size) { + const tsi_handshaker_result* self, const unsigned char** bytes, + size_t* bytes_size) { if (self == NULL || self->vtable == NULL || bytes == NULL || bytes_size == NULL) { return TSI_INVALID_ARGUMENT; @@ -236,7 +236,7 @@ tsi_result tsi_handshaker_result_get_unused_bytes( return self->vtable->get_unused_bytes(self, bytes, bytes_size); } -void tsi_handshaker_result_destroy(tsi_handshaker_result *self) { +void tsi_handshaker_result_destroy(tsi_handshaker_result* self) { if (self == NULL) return; self->vtable->destroy(self); } @@ -249,7 +249,7 @@ tsi_peer_property tsi_init_peer_property(void) { return property; } -static void tsi_peer_destroy_list_property(tsi_peer_property *children, +static void tsi_peer_destroy_list_property(tsi_peer_property* children, size_t child_count) { size_t i; for (i = 0; i < child_count; i++) { @@ -258,7 +258,7 @@ static void tsi_peer_destroy_list_property(tsi_peer_property *children, gpr_free(children); } -void tsi_peer_property_destruct(tsi_peer_property *property) { +void tsi_peer_property_destruct(tsi_peer_property* property) { if (property->name != NULL) { gpr_free(property->name); } @@ -268,7 +268,7 @@ void tsi_peer_property_destruct(tsi_peer_property *property) { *property = tsi_init_peer_property(); /* Reset everything to 0. */ } -void tsi_peer_destruct(tsi_peer *self) { +void tsi_peer_destruct(tsi_peer* self) { if (self == NULL) return; if (self->properties != NULL) { tsi_peer_destroy_list_property(self->properties, self->property_count); @@ -278,26 +278,26 @@ void tsi_peer_destruct(tsi_peer *self) { } tsi_result tsi_construct_allocated_string_peer_property( - const char *name, size_t value_length, tsi_peer_property *property) { + const char* name, size_t value_length, tsi_peer_property* property) { *property = tsi_init_peer_property(); if (name != NULL) property->name = gpr_strdup(name); if (value_length > 0) { - property->value.data = (char *)gpr_zalloc(value_length); + property->value.data = (char*)gpr_zalloc(value_length); property->value.length = value_length; } return TSI_OK; } tsi_result tsi_construct_string_peer_property_from_cstring( - const char *name, const char *value, tsi_peer_property *property) { + const char* name, const char* value, tsi_peer_property* property) { return tsi_construct_string_peer_property(name, value, strlen(value), property); } -tsi_result tsi_construct_string_peer_property(const char *name, - const char *value, +tsi_result tsi_construct_string_peer_property(const char* name, + const char* value, size_t value_length, - tsi_peer_property *property) { + tsi_peer_property* property) { tsi_result result = tsi_construct_allocated_string_peer_property( name, value_length, property); if (result != TSI_OK) return result; @@ -307,10 +307,10 @@ tsi_result tsi_construct_string_peer_property(const char *name, return TSI_OK; } -tsi_result tsi_construct_peer(size_t property_count, tsi_peer *peer) { +tsi_result tsi_construct_peer(size_t property_count, tsi_peer* peer) { memset(peer, 0, sizeof(tsi_peer)); if (property_count > 0) { - peer->properties = (tsi_peer_property *)gpr_zalloc( + peer->properties = (tsi_peer_property*)gpr_zalloc( property_count * sizeof(tsi_peer_property)); peer->property_count = property_count; } |