aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc')
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc26
1 files changed, 17 insertions, 9 deletions
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);