diff options
Diffstat (limited to 'src/core/tsi')
-rw-r--r-- | src/core/tsi/fake_transport_security.cc | 17 | ||||
-rw-r--r-- | src/core/tsi/transport_security.h | 2 | ||||
-rw-r--r-- | src/core/tsi/transport_security_grpc.cc | 27 | ||||
-rw-r--r-- | src/core/tsi/transport_security_grpc.h | 22 |
4 files changed, 28 insertions, 40 deletions
diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc index 349dcf5cb8..6ab7f8cc00 100644 --- a/src/core/tsi/fake_transport_security.cc +++ b/src/core/tsi/fake_transport_security.cc @@ -397,8 +397,7 @@ static const tsi_frame_protector_vtable frame_protector_vtable = { /* --- tsi_zero_copy_grpc_protector methods implementation. ---*/ static tsi_result fake_zero_copy_grpc_protector_protect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *unprotected_slices, + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices) { if (self == NULL || unprotected_slices == NULL || protected_slices == NULL) { return TSI_INVALID_ARGUMENT; @@ -421,8 +420,7 @@ static tsi_result fake_zero_copy_grpc_protector_protect( } static tsi_result fake_zero_copy_grpc_protector_unprotect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *protected_slices, + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices) { if (self == NULL || unprotected_slices == NULL || protected_slices == NULL) { return TSI_INVALID_ARGUMENT; @@ -450,18 +448,18 @@ static tsi_result fake_zero_copy_grpc_protector_unprotect( impl->parsed_frame_size - TSI_FAKE_FRAME_HEADER_SIZE, unprotected_slices); impl->parsed_frame_size = 0; - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &impl->header_sb); + grpc_slice_buffer_reset_and_unref_internal(&impl->header_sb); } return TSI_OK; } static void fake_zero_copy_grpc_protector_destroy( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self) { + tsi_zero_copy_grpc_protector *self) { if (self == NULL) return; tsi_fake_zero_copy_grpc_protector *impl = (tsi_fake_zero_copy_grpc_protector *)self; - grpc_slice_buffer_destroy_internal(exec_ctx, &impl->header_sb); - grpc_slice_buffer_destroy_internal(exec_ctx, &impl->protected_sb); + grpc_slice_buffer_destroy_internal(&impl->header_sb); + grpc_slice_buffer_destroy_internal(&impl->protected_sb); gpr_free(impl); } @@ -493,8 +491,7 @@ static tsi_result fake_handshaker_result_extract_peer( } static tsi_result fake_handshaker_result_create_zero_copy_grpc_protector( - void *exec_ctx, const tsi_handshaker_result *self, - size_t *max_output_protected_frame_size, + const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector) { *protector = tsi_create_fake_zero_copy_grpc_protector(max_output_protected_frame_size); diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index 3bba38149c..27f22c5203 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -94,7 +94,7 @@ struct tsi_handshaker { typedef struct { tsi_result (*extract_peer)(const tsi_handshaker_result *self, tsi_peer *peer); tsi_result (*create_zero_copy_grpc_protector)( - void *exec_ctx, const tsi_handshaker_result *self, + const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector); tsi_result (*create_frame_protector)(const tsi_handshaker_result *self, diff --git a/src/core/tsi/transport_security_grpc.cc b/src/core/tsi/transport_security_grpc.cc index affd995230..ee8df0c2f1 100644 --- a/src/core/tsi/transport_security_grpc.cc +++ b/src/core/tsi/transport_security_grpc.cc @@ -17,11 +17,11 @@ */ #include "src/core/tsi/transport_security_grpc.h" +#include "src/core/lib/iomgr/exec_ctx.h" /* This method creates a tsi_zero_copy_grpc_protector object. */ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector( - grpc_exec_ctx *exec_ctx, const tsi_handshaker_result *self, - size_t *max_output_protected_frame_size, + const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector) { if (exec_ctx == NULL || self == NULL || self->vtable == NULL || protector == NULL) { @@ -31,7 +31,7 @@ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector( return TSI_UNIMPLEMENTED; } return self->vtable->create_zero_copy_grpc_protector( - exec_ctx, self, max_output_protected_frame_size, protector); + self, max_output_protected_frame_size, protector); } /* --- tsi_zero_copy_grpc_protector common implementation. --- @@ -39,33 +39,28 @@ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector( Calls specific implementation after state/input validation. */ tsi_result tsi_zero_copy_grpc_protector_protect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *unprotected_slices, + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices) { - if (exec_ctx == NULL || self == NULL || self->vtable == NULL || + if (/*&exec_ctx == NULL || */ self == NULL || self->vtable == NULL || unprotected_slices == NULL || protected_slices == NULL) { return TSI_INVALID_ARGUMENT; } if (self->vtable->protect == NULL) return TSI_UNIMPLEMENTED; - return self->vtable->protect(exec_ctx, self, unprotected_slices, - protected_slices); + return self->vtable->protect(self, unprotected_slices, protected_slices); } tsi_result tsi_zero_copy_grpc_protector_unprotect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *protected_slices, + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices) { - if (exec_ctx == NULL || self == NULL || self->vtable == NULL || + if (/*&exec_ctx == NULL || self == NULL || */ self->vtable == NULL || protected_slices == NULL || unprotected_slices == NULL) { return TSI_INVALID_ARGUMENT; } if (self->vtable->unprotect == NULL) return TSI_UNIMPLEMENTED; - return self->vtable->unprotect(exec_ctx, self, protected_slices, - unprotected_slices); + return self->vtable->unprotect(self, protected_slices, unprotected_slices); } -void tsi_zero_copy_grpc_protector_destroy(grpc_exec_ctx *exec_ctx, - tsi_zero_copy_grpc_protector *self) { +void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self) { if (self == NULL) return; - self->vtable->destroy(exec_ctx, self); + self->vtable->destroy(self); } diff --git a/src/core/tsi/transport_security_grpc.h b/src/core/tsi/transport_security_grpc.h index ca6755c12f..5ab5297cc4 100644 --- a/src/core/tsi/transport_security_grpc.h +++ b/src/core/tsi/transport_security_grpc.h @@ -30,8 +30,7 @@ extern "C" { assuming there is no fatal error. The caller is responsible for destroying the protector. */ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector( - grpc_exec_ctx *exec_ctx, const tsi_handshaker_result *self, - size_t *max_output_protected_frame_size, + const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector); /* -- tsi_zero_copy_grpc_protector object -- */ @@ -43,8 +42,8 @@ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector( - This method returns TSI_OK in case of success or a specific error code in case of failure. */ tsi_result tsi_zero_copy_grpc_protector_protect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices); + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices, + grpc_slice_buffer *protected_slices); /* Outputs unprotected bytes. - protected_slices is the bytes of protected frames. @@ -53,24 +52,21 @@ tsi_result tsi_zero_copy_grpc_protector_protect( there is not enough data to output in which case unprotected_slices has 0 bytes. */ tsi_result tsi_zero_copy_grpc_protector_unprotect( - grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self, - grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices); + tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices, + grpc_slice_buffer *unprotected_slices); /* Destroys the tsi_zero_copy_grpc_protector object. */ -void tsi_zero_copy_grpc_protector_destroy(grpc_exec_ctx *exec_ctx, - tsi_zero_copy_grpc_protector *self); +void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self); /* Base for tsi_zero_copy_grpc_protector implementations. */ typedef struct { - tsi_result (*protect)(grpc_exec_ctx *exec_ctx, - tsi_zero_copy_grpc_protector *self, + tsi_result (*protect)(tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices); - tsi_result (*unprotect)(grpc_exec_ctx *exec_ctx, - tsi_zero_copy_grpc_protector *self, + tsi_result (*unprotect)(tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices); - void (*destroy)(grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self); + void (*destroy)(tsi_zero_copy_grpc_protector *self); } tsi_zero_copy_grpc_protector_vtable; struct tsi_zero_copy_grpc_protector { |