aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD1
-rw-r--r--BUILDING.md4
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--build.yaml1
-rw-r--r--gRPC-C++.podspec2
-rw-r--r--gRPC-Core.podspec6
-rw-r--r--grpc.gemspec1
-rw-r--r--package.xml1
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc25
-rw-r--r--src/core/lib/channel/channel_stack.cc46
-rw-r--r--src/core/lib/gpr/alloc.h28
-rw-r--r--src/core/lib/gpr/arena.cc16
-rw-r--r--src/core/lib/security/transport/server_auth_filter.cc7
-rw-r--r--src/core/lib/surface/call.cc11
-rw-r--r--src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc3
-rw-r--r--src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc48
-rw-r--r--src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h4
-rw-r--r--src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc23
-rw-r--r--src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h9
-rw-r--r--src/cpp/README.md6
-rw-r--r--test/core/security/check_gcp_environment_linux_test.cc2
-rw-r--r--test/core/security/check_gcp_environment_windows_test.cc2
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc26
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc41
-rw-r--r--tools/doxygen/Doxyfile.c++.internal1
-rw-r--r--tools/doxygen/Doxyfile.core.internal1
-rw-r--r--tools/interop_matrix/client_matrix.py15
-rw-r--r--tools/run_tests/generated/sources_and_headers.json2
28 files changed, 242 insertions, 96 deletions
diff --git a/BUILD b/BUILD
index 012b96ff64..efb90b7ea1 100644
--- a/BUILD
+++ b/BUILD
@@ -540,6 +540,7 @@ grpc_cc_library(
"src/core/lib/profiling/stap_timers.cc",
],
hdrs = [
+ "src/core/lib/gpr/alloc.h",
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/host_port.h",
diff --git a/BUILDING.md b/BUILDING.md
index e1d63a7461..e408402a76 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -112,9 +112,11 @@ From the grpc repository root
## bazel
+See [Installing Bazel](https://docs.bazel.build/versions/master/install.html) for instructions how to install bazel on your system.
+
From the grpc repository root
```
-bazel build :all
+$ bazel build :all
```
## cmake: Windows, Using Visual Studio 2015 or 2017 (can only build with OPENSSL_NO_ASM).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index abd7a5eb78..e8582d9af5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -24,9 +24,9 @@ script that unifies the experience of building and testing gRPC in different
languages and on different platforms is provided.
To build gRPC in the language of choice (e.g. `c++`, `csharp`, `php`, `python`, `ruby`, ...)
-- Prepare you development environment based on language-specific instructions in `src/YOUR-LANGUAGE` directory.
+- Prepare your development environment based on language-specific instructions in `src/YOUR-LANGUAGE` directory.
- The language-specific instructions might involve installing C/C++ prerequisites listed in
- [Building gRPC C++: Prerequisites](BUILDING.md#pre-requisites) as gRPC implementations
+ [Building gRPC C++: Prerequisites](BUILDING.md#pre-requisites). This is because gRPC implementations
in this repository are using the native gRPC "core" library internally.
- Run
```
@@ -38,7 +38,7 @@ To build gRPC in the language of choice (e.g. `c++`, `csharp`, `php`, `python`,
```
You can also run `python tools/run_tests/run_tests.py --help` to discover useful command line flags supported. For more details,
-see [tools/run_tests](tools/run_tests) where you will also find guidance on how to run various other test suites (e.g. interop tests, benchmarks)
+see [tools/run_tests](tools/run_tests) where you will also find guidance on how to run various other test suites (e.g. interop tests, benchmarks).
## Generated project files
diff --git a/build.yaml b/build.yaml
index 77d0ca3267..b54a9c5d8d 100644
--- a/build.yaml
+++ b/build.yaml
@@ -173,6 +173,7 @@ filegroups:
- include/grpc/support/thd_id.h
- include/grpc/support/time.h
headers:
+ - src/core/lib/gpr/alloc.h
- src/core/lib/gpr/arena.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/host_port.h
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index f50da12d05..5407923c2c 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -213,6 +213,7 @@ Pod::Spec.new do |s|
'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc',
'src/cpp/codegen/codegen_init.cc',
+ 'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/host_port.h',
@@ -504,6 +505,7 @@ Pod::Spec.new do |s|
'src/cpp/server/health/health.pb.h',
'src/cpp/server/thread_pool_interface.h',
'src/cpp/thread_manager/thread_manager.h',
+ 'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/host_port.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 56fdfc3169..40e5323e7f 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -185,7 +185,8 @@ Pod::Spec.new do |s|
ss.dependency 'nanopb', '~> 0.3'
# To save you from scrolling, this is the last part of the podspec.
- ss.source_files = 'src/core/lib/gpr/arena.h',
+ ss.source_files = 'src/core/lib/gpr/alloc.h',
+ 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
@@ -805,7 +806,8 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/plugin_registry/grpc_plugin_registry.cc'
- ss.private_header_files = 'src/core/lib/gpr/arena.h',
+ ss.private_header_files = 'src/core/lib/gpr/alloc.h',
+ 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index 4e96ba3178..839875c742 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -82,6 +82,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
+ s.files += %w( src/core/lib/gpr/alloc.h )
s.files += %w( src/core/lib/gpr/arena.h )
s.files += %w( src/core/lib/gpr/env.h )
s.files += %w( src/core/lib/gpr/host_port.h )
diff --git a/package.xml b/package.xml
index 6e7894cabd..a986282512 100644
--- a/package.xml
+++ b/package.xml
@@ -87,6 +87,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_windows.h" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/gpr/alloc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/env.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/host_port.h" role="src" />
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index f010002ab9..8ab3fe40f5 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -38,6 +38,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/debug/stats.h"
+#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -140,9 +141,13 @@ struct grpc_subchannel_call {
grpc_closure* schedule_closure_after_destroy;
};
-#define SUBCHANNEL_CALL_TO_CALL_STACK(call) ((grpc_call_stack*)((call) + 1))
-#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \
- (((grpc_subchannel_call*)(callstack)) - 1)
+#define SUBCHANNEL_CALL_TO_CALL_STACK(call) \
+ (grpc_call_stack*)((char*)(call) + GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
+ sizeof(grpc_subchannel_call)))
+#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \
+ (grpc_subchannel_call*)(((char*)(call_stack)) - \
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
+ sizeof(grpc_subchannel_call)))
static void on_subchannel_connected(void* subchannel, grpc_error* error);
@@ -783,9 +788,17 @@ void ConnectedSubchannel::Ping(grpc_closure* on_initiate,
grpc_error* ConnectedSubchannel::CreateCall(const CallArgs& args,
grpc_subchannel_call** call) {
- *call = static_cast<grpc_subchannel_call*>(gpr_arena_alloc(
- args.arena, sizeof(grpc_subchannel_call) +
- channel_stack_->call_stack_size + args.parent_data_size));
+ size_t allocation_size =
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_subchannel_call));
+ if (args.parent_data_size > 0) {
+ allocation_size +=
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) +
+ args.parent_data_size;
+ } else {
+ allocation_size += channel_stack_->call_stack_size;
+ }
+ *call = static_cast<grpc_subchannel_call*>(
+ gpr_arena_alloc(args.arena, allocation_size));
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call);
RefCountedPtr<ConnectedSubchannel> connection =
Ref(DEBUG_LOCATION, "subchannel_call");
diff --git a/src/core/lib/channel/channel_stack.cc b/src/core/lib/channel/channel_stack.cc
index ef6482cb7f..056fcd93de 100644
--- a/src/core/lib/channel/channel_stack.cc
+++ b/src/core/lib/channel/channel_stack.cc
@@ -21,6 +21,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/gpr/alloc.h"
#include <stdlib.h>
#include <string.h>
@@ -43,16 +44,12 @@ grpc_core::TraceFlag grpc_trace_channel(false, "channel");
per-filter memory, aligned to GPR_MAX_ALIGNMENT
} */
-/* Given a size, round up to the next multiple of sizeof(void*) */
-#define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
- (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u))
-
size_t grpc_channel_stack_size(const grpc_channel_filter** filters,
size_t filter_count) {
/* always need the header, and size for the channel elements */
- size_t size =
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_channel_stack)) +
- ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_channel_element));
+ size_t size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_channel_stack)) +
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filter_count *
+ sizeof(grpc_channel_element));
size_t i;
GPR_ASSERT((GPR_MAX_ALIGNMENT & (GPR_MAX_ALIGNMENT - 1)) == 0 &&
@@ -60,19 +57,19 @@ size_t grpc_channel_stack_size(const grpc_channel_filter** filters,
/* add the size for each filter */
for (i = 0; i < filter_count; i++) {
- size += ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_channel_data);
+ size += GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_channel_data);
}
return size;
}
-#define CHANNEL_ELEMS_FROM_STACK(stk) \
- ((grpc_channel_element*)((char*)(stk) + ROUND_UP_TO_ALIGNMENT_SIZE( \
+#define CHANNEL_ELEMS_FROM_STACK(stk) \
+ ((grpc_channel_element*)((char*)(stk) + GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
sizeof(grpc_channel_stack))))
-#define CALL_ELEMS_FROM_STACK(stk) \
- ((grpc_call_element*)((char*)(stk) + \
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack))))
+#define CALL_ELEMS_FROM_STACK(stk) \
+ ((grpc_call_element*)((char*)(stk) + GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
+ sizeof(grpc_call_stack))))
grpc_channel_element* grpc_channel_stack_element(
grpc_channel_stack* channel_stack, size_t index) {
@@ -95,8 +92,8 @@ grpc_error* grpc_channel_stack_init(
const grpc_channel_args* channel_args, grpc_transport* optional_transport,
const char* name, grpc_channel_stack* stack) {
size_t call_size =
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)) +
- ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_call_element));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)) +
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_call_element));
grpc_channel_element* elems;
grpc_channel_element_args args;
char* user_data;
@@ -106,9 +103,9 @@ grpc_error* grpc_channel_stack_init(
GRPC_STREAM_REF_INIT(&stack->refcount, initial_refs, destroy, destroy_arg,
name);
elems = CHANNEL_ELEMS_FROM_STACK(stack);
- user_data =
- (reinterpret_cast<char*>(elems)) +
- ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_channel_element));
+ user_data = (reinterpret_cast<char*>(elems)) +
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filter_count *
+ sizeof(grpc_channel_element));
/* init per-filter data */
grpc_error* first_error = GRPC_ERROR_NONE;
@@ -128,8 +125,9 @@ grpc_error* grpc_channel_stack_init(
GRPC_ERROR_UNREF(error);
}
}
- user_data += ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_channel_data);
- call_size += ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_call_data);
+ user_data +=
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_channel_data);
+ call_size += GPR_ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_call_data);
}
GPR_ASSERT(user_data > (char*)stack);
@@ -166,7 +164,7 @@ grpc_error* grpc_call_stack_init(grpc_channel_stack* channel_stack,
destroy_arg, "CALL_STACK");
call_elems = CALL_ELEMS_FROM_STACK(elem_args->call_stack);
user_data = (reinterpret_cast<char*>(call_elems)) +
- ROUND_UP_TO_ALIGNMENT_SIZE(count * sizeof(grpc_call_element));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(count * sizeof(grpc_call_element));
/* init per-filter data */
grpc_error* first_error = GRPC_ERROR_NONE;
@@ -184,7 +182,7 @@ grpc_error* grpc_call_stack_init(grpc_channel_stack* channel_stack,
}
}
user_data +=
- ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
}
return first_error;
}
@@ -243,11 +241,11 @@ grpc_channel_stack* grpc_channel_stack_from_top_element(
grpc_channel_element* elem) {
return reinterpret_cast<grpc_channel_stack*>(
reinterpret_cast<char*>(elem) -
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_channel_stack)));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_channel_stack)));
}
grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem) {
return reinterpret_cast<grpc_call_stack*>(
reinterpret_cast<char*>(elem) -
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)));
}
diff --git a/src/core/lib/gpr/alloc.h b/src/core/lib/gpr/alloc.h
new file mode 100644
index 0000000000..762b51bf66
--- /dev/null
+++ b/src/core/lib/gpr/alloc.h
@@ -0,0 +1,28 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_GPR_ALLOC_H
+#define GRPC_CORE_LIB_GPR_ALLOC_H
+
+#include <grpc/support/port_platform.h>
+
+/// Given a size, round up to the next multiple of sizeof(void*).
+#define GPR_ROUND_UP_TO_ALIGNMENT_SIZE(x) \
+ (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u))
+
+#endif /* GRPC_CORE_LIB_GPR_ALLOC_H */
diff --git a/src/core/lib/gpr/arena.cc b/src/core/lib/gpr/arena.cc
index b02c5b9fb6..141de69426 100644
--- a/src/core/lib/gpr/arena.cc
+++ b/src/core/lib/gpr/arena.cc
@@ -26,6 +26,8 @@
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
+#include "src/core/lib/gpr/alloc.h"
+
// Uncomment this to use a simple arena that simply allocates the
// requested amount of memory for each call to gpr_arena_alloc(). This
// effectively eliminates the efficiency gain of using an arena, but it
@@ -74,8 +76,6 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
// arena API to C++, we should consider replacing gpr_arena_alloc() with a
// template that takes the type of the value being allocated, which
// would allow us to use the alignment actually needed by the caller.
-#define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
- (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u))
typedef struct zone {
size_t size_begin;
@@ -95,9 +95,9 @@ static void* zalloc_aligned(size_t size) {
}
gpr_arena* gpr_arena_create(size_t initial_size) {
- initial_size = ROUND_UP_TO_ALIGNMENT_SIZE(initial_size);
+ initial_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_size);
gpr_arena* a = static_cast<gpr_arena*>(zalloc_aligned(
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena)) + initial_size));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena)) + initial_size));
a->initial_zone.size_end = initial_size;
return a;
}
@@ -115,7 +115,7 @@ size_t gpr_arena_destroy(gpr_arena* arena) {
}
void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
- size = ROUND_UP_TO_ALIGNMENT_SIZE(size);
+ size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(size);
size_t start = static_cast<size_t>(
gpr_atm_no_barrier_fetch_add(&arena->size_so_far, size));
zone* z = &arena->initial_zone;
@@ -125,7 +125,7 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
size_t next_z_size =
static_cast<size_t>(gpr_atm_no_barrier_load(&arena->size_so_far));
next_z = static_cast<zone*>(zalloc_aligned(
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone)) + next_z_size));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone)) + next_z_size));
next_z->size_begin = z->size_end;
next_z->size_end = z->size_end + next_z_size;
if (!gpr_atm_rel_cas(&z->next_atm, static_cast<gpr_atm>(NULL),
@@ -143,9 +143,9 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
GPR_ASSERT(start + size <= z->size_end);
char* ptr = (z == &arena->initial_zone)
? reinterpret_cast<char*>(arena) +
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena))
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena))
: reinterpret_cast<char*>(z) +
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone));
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone));
return ptr + start - z->size_begin;
}
diff --git a/src/core/lib/security/transport/server_auth_filter.cc b/src/core/lib/security/transport/server_auth_filter.cc
index 0bf91d219e..2dbefdf131 100644
--- a/src/core/lib/security/transport/server_auth_filter.cc
+++ b/src/core/lib/security/transport/server_auth_filter.cc
@@ -44,7 +44,6 @@ struct call_data {
grpc_metadata_array md;
const grpc_metadata* consumed_md;
size_t num_consumed_md;
- grpc_auth_context* auth_context;
grpc_closure cancel_closure;
gpr_atm state; // async_state
};
@@ -178,7 +177,7 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
calld->md = metadata_batch_to_md_array(
batch->payload->recv_initial_metadata.recv_initial_metadata);
chand->creds->processor.process(
- chand->creds->processor.state, calld->auth_context,
+ chand->creds->processor.state, chand->auth_context,
calld->md.metadata, calld->md.count, on_md_processing_done, elem);
return;
}
@@ -215,8 +214,8 @@ static grpc_error* init_call_elem(grpc_call_element* elem,
// data and save it in the call context.
grpc_server_security_context* server_ctx =
grpc_server_security_context_create(args->arena);
- server_ctx->auth_context = grpc_auth_context_create(chand->auth_context);
- calld->auth_context = server_ctx->auth_context;
+ server_ctx->auth_context =
+ GRPC_AUTH_CONTEXT_REF(chand->auth_context, "server_auth_filter");
if (args->context[GRPC_CONTEXT_SECURITY].value != nullptr) {
args->context[GRPC_CONTEXT_SECURITY].destroy(
args->context[GRPC_CONTEXT_SECURITY].value);
diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc
index 3f26b05c34..88e015ce22 100644
--- a/src/core/lib/surface/call.cc
+++ b/src/core/lib/surface/call.cc
@@ -34,6 +34,7 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/compression/algorithm_metadata.h"
#include "src/core/lib/debug/stats.h"
+#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gpr/arena.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
@@ -271,16 +272,12 @@ struct grpc_call {
grpc_core::TraceFlag grpc_call_error_trace(false, "call_error");
grpc_core::TraceFlag grpc_compression_trace(false, "compression");
-/* Given a size, round up to the next multiple of sizeof(void*) */
-#define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
- (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u))
-
#define CALL_STACK_FROM_CALL(call) \
(grpc_call_stack*)((char*)(call) + \
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)))
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)))
#define CALL_FROM_CALL_STACK(call_stack) \
(grpc_call*)(((char*)(call_stack)) - \
- ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)))
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)))
#define CALL_ELEM_FROM_CALL(call, idx) \
grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx)
@@ -353,7 +350,7 @@ grpc_error* grpc_call_create(const grpc_call_create_args* args,
GRPC_STATS_INC_CALL_INITIAL_SIZE(initial_size);
gpr_arena* arena = gpr_arena_create(initial_size);
call = static_cast<grpc_call*>(
- gpr_arena_alloc(arena, ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)) +
+ gpr_arena_alloc(arena, GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call)) +
channel_stack->call_stack_size));
gpr_ref_init(&call->ext_ref, 1);
call->arena = arena;
diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
index 9676085380..06b999899a 100644
--- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
+++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
@@ -127,7 +127,8 @@ static tsi_result handshaker_result_create_zero_copy_grpc_protector(
tsi_result ok = alts_zero_copy_grpc_protector_create(
reinterpret_cast<const uint8_t*>(result->key_data),
kAltsAes128GcmRekeyKeyLength, /*is_rekey=*/true, result->is_client,
- /*is_integrity_only=*/false, max_output_protected_frame_size, protector);
+ /*is_integrity_only=*/false, /*enable_extra_copy=*/false,
+ max_output_protected_frame_size, protector);
if (ok != TSI_OK) {
gpr_log(GPR_ERROR, "Failed to create zero-copy grpc protector");
}
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc
index 7ba03eb7f0..54e59a60bc 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc
@@ -23,6 +23,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <string.h>
+
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h"
@@ -30,12 +32,49 @@
/* Main struct for alts_grpc_integrity_only_record_protocol. */
typedef struct alts_grpc_integrity_only_record_protocol {
alts_grpc_record_protocol base;
+ bool enable_extra_copy;
grpc_slice_buffer data_sb;
unsigned char* tag_buf;
} alts_grpc_integrity_only_record_protocol;
/* --- alts_grpc_record_protocol methods implementation. --- */
+static tsi_result alts_grpc_integrity_only_extra_copy_protect(
+ alts_grpc_record_protocol* rp, grpc_slice_buffer* unprotected_slices,
+ grpc_slice_buffer* protected_slices) {
+ /* Allocates memory for protected frame. */
+ size_t protected_frame_size =
+ unprotected_slices->length + rp->header_length + rp->tag_length;
+ grpc_slice protected_slice = GRPC_SLICE_MALLOC(protected_frame_size);
+ /* Calls alts_iovec_record_protocol protect. */
+ char* error_details = nullptr;
+ iovec_t header_iovec = {GRPC_SLICE_START_PTR(protected_slice),
+ rp->header_length};
+ iovec_t tag_iovec = {GRPC_SLICE_START_PTR(protected_slice) +
+ rp->header_length + unprotected_slices->length,
+ rp->tag_length};
+ alts_grpc_record_protocol_convert_slice_buffer_to_iovec(rp,
+ unprotected_slices);
+ grpc_status_code status = alts_iovec_record_protocol_integrity_only_protect(
+ rp->iovec_rp, rp->iovec_buf, unprotected_slices->count, header_iovec,
+ tag_iovec, &error_details);
+ if (status != GRPC_STATUS_OK) {
+ gpr_log(GPR_ERROR, "Failed to protect, %s", error_details);
+ gpr_free(error_details);
+ return TSI_INTERNAL_ERROR;
+ }
+ /* Copies data from unprotected_slices to protected_slice. */
+ uint8_t* data = GRPC_SLICE_START_PTR(protected_slice) + rp->header_length;
+ for (size_t i = 0; i < unprotected_slices->count; i++) {
+ memcpy(data, GRPC_SLICE_START_PTR(unprotected_slices->slices[i]),
+ GRPC_SLICE_LENGTH(unprotected_slices->slices[i]));
+ data += GRPC_SLICE_LENGTH(unprotected_slices->slices[i]);
+ }
+ grpc_slice_buffer_add(protected_slices, protected_slice);
+ grpc_slice_buffer_reset_and_unref_internal(unprotected_slices);
+ return TSI_OK;
+}
+
static tsi_result alts_grpc_integrity_only_protect(
alts_grpc_record_protocol* rp, grpc_slice_buffer* unprotected_slices,
grpc_slice_buffer* protected_slices) {
@@ -46,6 +85,12 @@ static tsi_result alts_grpc_integrity_only_protect(
"Invalid nullptr arguments to alts_grpc_record_protocol protect.");
return TSI_INVALID_ARGUMENT;
}
+ alts_grpc_integrity_only_record_protocol* integrity_only_record_protocol =
+ reinterpret_cast<alts_grpc_integrity_only_record_protocol*>(rp);
+ if (integrity_only_record_protocol->enable_extra_copy) {
+ return alts_grpc_integrity_only_extra_copy_protect(rp, unprotected_slices,
+ protected_slices);
+ }
/* Allocates memory for header and tag slices. */
grpc_slice header_slice = GRPC_SLICE_MALLOC(rp->header_length);
grpc_slice tag_slice = GRPC_SLICE_MALLOC(rp->tag_length);
@@ -152,7 +197,7 @@ static const alts_grpc_record_protocol_vtable
tsi_result alts_grpc_integrity_only_record_protocol_create(
gsec_aead_crypter* crypter, size_t overflow_size, bool is_client,
- bool is_protect, alts_grpc_record_protocol** rp) {
+ bool is_protect, bool enable_extra_copy, alts_grpc_record_protocol** rp) {
if (crypter == nullptr || rp == nullptr) {
gpr_log(GPR_ERROR,
"Invalid nullptr arguments to alts_grpc_record_protocol create.");
@@ -169,6 +214,7 @@ tsi_result alts_grpc_integrity_only_record_protocol_create(
gpr_free(impl);
return result;
}
+ impl->enable_extra_copy = enable_extra_copy;
/* Initializes slice buffer for data_sb. */
grpc_slice_buffer_init(&impl->data_sb);
/* Allocates tag buffer. */
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h
index 8d68b27e07..5456d34fad 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h
@@ -38,6 +38,8 @@
* be used at the client or server side.
* - is_protect: a flag indicating if the alts_grpc_record_protocol instance
* will be used for protect or unprotect.
+ *- enable_extra_copy: a flag indicating if the instance uses one-copy instead
+ * of zero-copy in the protect operation.
* - rp: an alts_grpc_record_protocol instance to be returned from
* the method.
*
@@ -46,7 +48,7 @@
*/
tsi_result alts_grpc_integrity_only_record_protocol_create(
gsec_aead_crypter* crypter, size_t overflow_size, bool is_client,
- bool is_protect, alts_grpc_record_protocol** rp);
+ bool is_protect, bool enable_extra_copy, alts_grpc_record_protocol** rp);
#endif /* GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_GRPC_INTEGRITY_ONLY_RECORD_PROTOCOL_H \
*/
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
index 608213745e..58aba9b747 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
@@ -110,7 +110,7 @@ static bool read_frame_size(const grpc_slice_buffer* sb,
*/
static tsi_result create_alts_grpc_record_protocol(
const uint8_t* key, size_t key_size, bool is_rekey, bool is_client,
- bool is_integrity_only, bool is_protect,
+ bool is_integrity_only, bool is_protect, bool enable_extra_copy,
alts_grpc_record_protocol** record_protocol) {
if (key == nullptr || record_protocol == nullptr) {
return TSI_INVALID_ARGUMENT;
@@ -130,13 +130,13 @@ static tsi_result create_alts_grpc_record_protocol(
: kAltsRecordProtocolFrameLimit;
/* Creates alts_grpc_record_protocol with AEAD crypter ownership transferred.
*/
- tsi_result result =
- is_integrity_only
- ? alts_grpc_integrity_only_record_protocol_create(
- crypter, overflow_limit, is_client, is_protect, record_protocol)
- : alts_grpc_privacy_integrity_record_protocol_create(
- crypter, overflow_limit, is_client, is_protect,
- record_protocol);
+ tsi_result result = is_integrity_only
+ ? alts_grpc_integrity_only_record_protocol_create(
+ crypter, overflow_limit, is_client, is_protect,
+ enable_extra_copy, record_protocol)
+ : alts_grpc_privacy_integrity_record_protocol_create(
+ crypter, overflow_limit, is_client, is_protect,
+ record_protocol);
if (result != TSI_OK) {
gsec_aead_crypter_destroy(crypter);
return result;
@@ -241,7 +241,8 @@ static const tsi_zero_copy_grpc_protector_vtable
tsi_result alts_zero_copy_grpc_protector_create(
const uint8_t* key, size_t key_size, bool is_rekey, bool is_client,
- bool is_integrity_only, size_t* max_protected_frame_size,
+ bool is_integrity_only, bool enable_extra_copy,
+ size_t* max_protected_frame_size,
tsi_zero_copy_grpc_protector** protector) {
if (grpc_core::ExecCtx::Get() == nullptr || key == nullptr ||
protector == nullptr) {
@@ -257,11 +258,11 @@ tsi_result alts_zero_copy_grpc_protector_create(
/* Creates alts_grpc_record_protocol objects. */
tsi_result status = create_alts_grpc_record_protocol(
key, key_size, is_rekey, is_client, is_integrity_only,
- /*is_protect=*/true, &impl->record_protocol);
+ /*is_protect=*/true, enable_extra_copy, &impl->record_protocol);
if (status == TSI_OK) {
status = create_alts_grpc_record_protocol(
key, key_size, is_rekey, is_client, is_integrity_only,
- /*is_protect=*/false, &impl->unrecord_protocol);
+ /*is_protect=*/false, enable_extra_copy, &impl->unrecord_protocol);
if (status == TSI_OK) {
/* Sets maximum frame size. */
size_t max_protected_frame_size_to_set = kDefaultFrameLength;
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h
index 71e953cfc1..515c27ea05 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h
@@ -35,6 +35,11 @@
* server side.
* - is_integrity_only: a flag indicating if the protector instance will be
* used for integrity-only or privacy-integrity mode.
+ * - enable_extra_copy: a flag indicating if the protector instance does one
+ * extra memory copy during the protect operation for integrity_only mode.
+ * For the unprotect operation, it is still zero-copy. If application intends
+ * to modify the data buffer after the protect operation, we can turn on this
+ * mode to avoid integrity check failure.
* - max_protected_frame_size: an in/out parameter indicating max frame size
* to be used by the protector. If it is nullptr, the default frame size will
* be used. Otherwise, the provided frame size will be adjusted (if not
@@ -45,8 +50,8 @@
*/
tsi_result alts_zero_copy_grpc_protector_create(
const uint8_t* key, size_t key_size, bool is_rekey, bool is_client,
- bool is_integrity_only, size_t* max_protected_frame_size,
- tsi_zero_copy_grpc_protector** protector);
+ bool is_integrity_only, bool enable_extra_copy,
+ size_t* max_protected_frame_size, tsi_zero_copy_grpc_protector** protector);
#endif /* GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_ZERO_COPY_GRPC_PROTECTOR_H \
*/
diff --git a/src/cpp/README.md b/src/cpp/README.md
index f16cab1f44..4ec9133c59 100644
--- a/src/cpp/README.md
+++ b/src/cpp/README.md
@@ -18,12 +18,16 @@ To add gRPC as a dependency in bazel:
2. Use the [http_archive](https://docs.bazel.build/versions/master/be/workspace.html#http_archive) bazel rule to include gRPC source
```
http_archive(
- name = "grpc",
+ name = "com_github_grpc_grpc",
urls = [
"https://github.com/grpc/grpc/archive/YOUR_GRPC_COMMIT_SHA.tar.gz",
],
strip_prefix = "grpc-YOUR_GRPC_COMMIT_SHA",
)
+
+ load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
+
+ grpc_deps()
```
NOTE: currently bazel is only supported for building gRPC on Linux.
diff --git a/test/core/security/check_gcp_environment_linux_test.cc b/test/core/security/check_gcp_environment_linux_test.cc
index 6c436a3945..3acd5b6ae4 100644
--- a/test/core/security/check_gcp_environment_linux_test.cc
+++ b/test/core/security/check_gcp_environment_linux_test.cc
@@ -16,6 +16,8 @@
*
*/
+#include <grpc/support/port_platform.h>
+
#include "src/core/lib/security/credentials/alts/check_gcp_environment.h"
#if GPR_LINUX
diff --git a/test/core/security/check_gcp_environment_windows_test.cc b/test/core/security/check_gcp_environment_windows_test.cc
index 46179b747d..2b9407e8ca 100644
--- a/test/core/security/check_gcp_environment_windows_test.cc
+++ b/test/core/security/check_gcp_environment_windows_test.cc
@@ -16,6 +16,8 @@
*
*/
+#include <grpc/support/port_platform.h>
+
#include "src/core/lib/security/credentials/alts/check_gcp_environment.h"
#ifdef GPR_WINDOWS
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
index b763f19d50..3ae64d6f20 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
@@ -109,7 +109,7 @@ static void alter_random_byte(grpc_slice_buffer* sb) {
}
static alts_grpc_record_protocol_test_fixture*
-test_fixture_integrity_only_create(bool rekey) {
+test_fixture_integrity_only_create(bool rekey, bool extra_copy) {
alts_grpc_record_protocol_test_fixture* fixture =
static_cast<alts_grpc_record_protocol_test_fixture*>(
gpr_zalloc(sizeof(alts_grpc_record_protocol_test_fixture)));
@@ -124,41 +124,46 @@ test_fixture_integrity_only_create(bool rekey) {
&crypter, nullptr) == GRPC_STATUS_OK);
GPR_ASSERT(alts_grpc_integrity_only_record_protocol_create(
crypter, 8, /*is_client=*/true, /*is_protect=*/true,
- &fixture->client_protect) == TSI_OK);
+ extra_copy, &fixture->client_protect) == TSI_OK);
/* Create client record protocol for unprotect. */
GPR_ASSERT(gsec_aes_gcm_aead_crypter_create(
key, key_length, kAesGcmNonceLength, kAesGcmTagLength, rekey,
&crypter, nullptr) == GRPC_STATUS_OK);
GPR_ASSERT(alts_grpc_integrity_only_record_protocol_create(
crypter, 8, /*is_client=*/true, /*is_protect=*/false,
- &fixture->client_unprotect) == TSI_OK);
+ extra_copy, &fixture->client_unprotect) == TSI_OK);
/* Create server record protocol for protect. */
GPR_ASSERT(gsec_aes_gcm_aead_crypter_create(
key, key_length, kAesGcmNonceLength, kAesGcmTagLength, rekey,
&crypter, nullptr) == GRPC_STATUS_OK);
GPR_ASSERT(alts_grpc_integrity_only_record_protocol_create(
crypter, 8, /*is_client=*/false, /*is_protect=*/true,
- &fixture->server_protect) == TSI_OK);
+ extra_copy, &fixture->server_protect) == TSI_OK);
/* Create server record protocol for unprotect. */
GPR_ASSERT(gsec_aes_gcm_aead_crypter_create(
key, key_length, kAesGcmNonceLength, kAesGcmTagLength, rekey,
&crypter, nullptr) == GRPC_STATUS_OK);
GPR_ASSERT(alts_grpc_integrity_only_record_protocol_create(
crypter, 8, /*is_client=*/false, /*is_protect=*/false,
- &fixture->server_unprotect) == TSI_OK);
+ extra_copy, &fixture->server_unprotect) == TSI_OK);
gpr_free(key);
return fixture;
}
static alts_grpc_record_protocol_test_fixture*
-test_fixture_integrity_only_no_rekey_create() {
- return test_fixture_integrity_only_create(false);
+test_fixture_integrity_only_no_rekey_no_extra_copy_create() {
+ return test_fixture_integrity_only_create(false, false);
}
static alts_grpc_record_protocol_test_fixture*
test_fixture_integrity_only_rekey_create() {
- return test_fixture_integrity_only_create(true);
+ return test_fixture_integrity_only_create(true, false);
+}
+
+static alts_grpc_record_protocol_test_fixture*
+test_fixture_integrity_only_extra_copy_create() {
+ return test_fixture_integrity_only_create(false, true);
}
static alts_grpc_record_protocol_test_fixture*
@@ -440,9 +445,12 @@ static void alts_grpc_record_protocol_tests(
}
int main(int argc, char** argv) {
- alts_grpc_record_protocol_tests(&test_fixture_integrity_only_no_rekey_create);
+ alts_grpc_record_protocol_tests(
+ &test_fixture_integrity_only_no_rekey_no_extra_copy_create);
alts_grpc_record_protocol_tests(&test_fixture_integrity_only_rekey_create);
alts_grpc_record_protocol_tests(
+ &test_fixture_integrity_only_extra_copy_create);
+ alts_grpc_record_protocol_tests(
&test_fixture_privacy_integrity_no_rekey_create);
alts_grpc_record_protocol_tests(&test_fixture_privacy_integrity_rekey_create);
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
index 32159e22f2..3ee8323a31 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
@@ -100,7 +100,8 @@ static bool are_slice_buffers_equal(grpc_slice_buffer* first,
static alts_zero_copy_grpc_protector_test_fixture*
alts_zero_copy_grpc_protector_test_fixture_create(bool rekey,
- bool integrity_only) {
+ bool integrity_only,
+ bool enable_extra_copy) {
alts_zero_copy_grpc_protector_test_fixture* fixture =
static_cast<alts_zero_copy_grpc_protector_test_fixture*>(
gpr_zalloc(sizeof(alts_zero_copy_grpc_protector_test_fixture)));
@@ -111,10 +112,12 @@ alts_zero_copy_grpc_protector_test_fixture_create(bool rekey,
gsec_test_random_array(&key, key_length);
GPR_ASSERT(alts_zero_copy_grpc_protector_create(
key, key_length, rekey, /*is_client=*/true, integrity_only,
- &max_protected_frame_size, &fixture->client) == TSI_OK);
+ enable_extra_copy, &max_protected_frame_size,
+ &fixture->client) == TSI_OK);
GPR_ASSERT(alts_zero_copy_grpc_protector_create(
key, key_length, rekey, /*is_client=*/false, integrity_only,
- &max_protected_frame_size, &fixture->server) == TSI_OK);
+ enable_extra_copy, &max_protected_frame_size,
+ &fixture->server) == TSI_OK);
gpr_free(key);
grpc_core::ExecCtx::Get()->Flush();
return fixture;
@@ -229,62 +232,70 @@ static void seal_unseal_large_buffer(tsi_zero_copy_grpc_protector* sender,
/* --- Test cases. --- */
-static void alts_zero_copy_protector_seal_unseal_small_buffer_tests() {
+static void alts_zero_copy_protector_seal_unseal_small_buffer_tests(
+ bool enable_extra_copy) {
alts_zero_copy_grpc_protector_test_fixture* fixture =
alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/false, /*integrity_only=*/true);
+ /*rekey=*/false, /*integrity_only=*/true, enable_extra_copy);
seal_unseal_small_buffer(fixture->client, fixture->server);
seal_unseal_small_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/false, /*integrity_only=*/false);
+ /*rekey=*/false, /*integrity_only=*/false, enable_extra_copy);
seal_unseal_small_buffer(fixture->client, fixture->server);
seal_unseal_small_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/true, /*integrity_only=*/true);
+ /*rekey=*/true, /*integrity_only=*/true, enable_extra_copy);
seal_unseal_small_buffer(fixture->client, fixture->server);
seal_unseal_small_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/true, /*integrity_only=*/false);
+ /*rekey=*/true, /*integrity_only=*/false, enable_extra_copy);
seal_unseal_small_buffer(fixture->client, fixture->server);
seal_unseal_small_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
}
-static void alts_zero_copy_protector_seal_unseal_large_buffer_tests() {
+static void alts_zero_copy_protector_seal_unseal_large_buffer_tests(
+ bool enable_extra_copy) {
alts_zero_copy_grpc_protector_test_fixture* fixture =
alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/false, /*integrity_only=*/true);
+ /*rekey=*/false, /*integrity_only=*/true, enable_extra_copy);
seal_unseal_large_buffer(fixture->client, fixture->server);
seal_unseal_large_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/false, /*integrity_only=*/false);
+ /*rekey=*/false, /*integrity_only=*/false, enable_extra_copy);
seal_unseal_large_buffer(fixture->client, fixture->server);
seal_unseal_large_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/true, /*integrity_only=*/true);
+ /*rekey=*/true, /*integrity_only=*/true, enable_extra_copy);
seal_unseal_large_buffer(fixture->client, fixture->server);
seal_unseal_large_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
fixture = alts_zero_copy_grpc_protector_test_fixture_create(
- /*rekey=*/true, /*integrity_only=*/false);
+ /*rekey=*/true, /*integrity_only=*/false, enable_extra_copy);
seal_unseal_large_buffer(fixture->client, fixture->server);
seal_unseal_large_buffer(fixture->server, fixture->client);
alts_zero_copy_grpc_protector_test_fixture_destroy(fixture);
}
int main(int argc, char** argv) {
- alts_zero_copy_protector_seal_unseal_small_buffer_tests();
- alts_zero_copy_protector_seal_unseal_large_buffer_tests();
+ alts_zero_copy_protector_seal_unseal_small_buffer_tests(
+ /*enable_extra_copy=*/false);
+ alts_zero_copy_protector_seal_unseal_small_buffer_tests(
+ /*enable_extra_copy=*/true);
+ alts_zero_copy_protector_seal_unseal_large_buffer_tests(
+ /*enable_extra_copy=*/false);
+ alts_zero_copy_protector_seal_unseal_large_buffer_tests(
+ /*enable_extra_copy=*/true);
return 0;
}
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index 78b0bb5969..c328387efa 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -1031,6 +1031,7 @@ src/core/lib/compression/stream_compression_identity.h \
src/core/lib/debug/stats.h \
src/core/lib/debug/stats_data.h \
src/core/lib/debug/trace.h \
+src/core/lib/gpr/alloc.h \
src/core/lib/gpr/arena.h \
src/core/lib/gpr/env.h \
src/core/lib/gpr/host_port.h \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index d466936719..e89fddd111 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -1075,6 +1075,7 @@ src/core/lib/debug/trace.cc \
src/core/lib/debug/trace.h \
src/core/lib/gpr/README.md \
src/core/lib/gpr/alloc.cc \
+src/core/lib/gpr/alloc.h \
src/core/lib/gpr/arena.cc \
src/core/lib/gpr/arena.h \
src/core/lib/gpr/atm.cc \
diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py
index 1a7c24f44b..cc4b5fcf74 100644
--- a/tools/interop_matrix/client_matrix.py
+++ b/tools/interop_matrix/client_matrix.py
@@ -93,6 +93,9 @@ LANG_RELEASE_MATRIX = {
{
'v1.12.0': None
},
+ {
+ 'v1.13.0': None
+ },
],
'go': [
{
@@ -213,6 +216,9 @@ LANG_RELEASE_MATRIX = {
{
'v1.12.0': None
},
+ {
+ 'v1.13.0': None
+ },
],
'node': [
{
@@ -289,6 +295,9 @@ LANG_RELEASE_MATRIX = {
{
'v1.12.0': None
},
+ {
+ 'v1.13.0': None
+ },
],
'php': [
{
@@ -327,6 +336,9 @@ LANG_RELEASE_MATRIX = {
{
'v1.12.0': None
},
+ {
+ 'v1.13.0': None
+ },
],
'csharp': [
{
@@ -370,6 +382,9 @@ LANG_RELEASE_MATRIX = {
{
'v1.12.0': None
},
+ {
+ 'v1.13.0': None
+ },
],
}
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index cb863e7d21..8199772d32 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -9185,6 +9185,7 @@
"include/grpc/support/sync_windows.h",
"include/grpc/support/thd_id.h",
"include/grpc/support/time.h",
+ "src/core/lib/gpr/alloc.h",
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/host_port.h",
@@ -9231,6 +9232,7 @@
"include/grpc/support/sync_windows.h",
"include/grpc/support/thd_id.h",
"include/grpc/support/time.h",
+ "src/core/lib/gpr/alloc.h",
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/host_port.h",