@@ -4308,7 +4308,7 @@ decryption_events_setup (void)
4308
4308
plaintext .value .v_utf8 .len = strlen (plaintext .value .v_utf8 .str );
4309
4309
4310
4310
mongoc_client_encryption_encrypt_opts_set_algorithm (
4311
- eOpts , MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM );
4311
+ eOpts , MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC );
4312
4312
mongoc_client_encryption_encrypt_opts_set_keyid (eOpts , & keyID );
4313
4313
4314
4314
ASSERT_OR_PRINT (
@@ -4323,10 +4323,10 @@ decryption_events_setup (void)
4323
4323
{
4324
4324
bson_value_copy (& def -> ciphertext , & def -> malformedCiphertext );
4325
4325
ASSERT (def -> ciphertext .value_type == BSON_TYPE_BINARY );
4326
- /* Set the last data byte to zero to make malformed. The last data byte is
4326
+ /* Change the last data byte to make malformed. The last data byte is
4327
4327
* part of the HMAC tag. */
4328
4328
def -> malformedCiphertext .value .v_binary
4329
- .data [def -> malformedCiphertext .value .v_binary .data_len - 1 ] = 0 ;
4329
+ .data [def -> malformedCiphertext .value .v_binary .data_len - 1 ]++ ;
4330
4330
}
4331
4331
4332
4332
/* Create a MongoClient with automatic decryption. */
@@ -4387,11 +4387,12 @@ decryption_events_fixture_destroy (decryption_events_fixture *def)
4387
4387
bson_free (def );
4388
4388
}
4389
4389
4390
+ /* Prose test 14: Case 1: Command Error */
4390
4391
/* test_decryption_events_command_error is a regression test for CDRIVER-4401.
4391
4392
* Send a command on an encrypted client resulting in a { 'ok': 0 } reply.
4392
4393
* Expect an error returned and a CommandFailed event to be emitted. */
4393
4394
static void
4394
- test_decryption_events_command_error (void * unused )
4395
+ test_decryption_events_case1 (void * unused )
4395
4396
{
4396
4397
bool got ;
4397
4398
bson_error_t error ;
@@ -4431,11 +4432,12 @@ test_decryption_events_command_error (void *unused)
4431
4432
decryption_events_fixture_destroy (def );
4432
4433
}
4433
4434
4435
+ /* Prose test 14: Case 2: Network Error */
4434
4436
/* test_decryption_events_network_error is a regression test for CDRIVER-4401.
4435
4437
* Send a command on an encrypted client resulting in a network error.
4436
4438
* Expect an error returned and a CommandFailed event to be emitted. */
4437
4439
static void
4438
- test_decryption_events_network_error (void * unused )
4440
+ test_decryption_events_case2 (void * unused )
4439
4441
4440
4442
{
4441
4443
bool got ;
@@ -4477,12 +4479,13 @@ test_decryption_events_network_error (void *unused)
4477
4479
decryption_events_fixture_destroy (def );
4478
4480
}
4479
4481
4482
+ /* Prose test 14: Case 3: Decrypt Error. */
4480
4483
/* test_decryption_events_decrypt_error is a regression test for CDRIVER-4401.
4481
4484
* Decrypt a reply with a malformed ciphertext.
4482
4485
* Expect an error returned and a CommandSucceeded event to be emitted with
4483
4486
* ciphertext. */
4484
4487
static void
4485
- test_decryption_events_decrypt_error (void * unused )
4488
+ test_decryption_events_case3 (void * unused )
4486
4489
{
4487
4490
bool got ;
4488
4491
bson_error_t error ;
@@ -4524,12 +4527,13 @@ test_decryption_events_decrypt_error (void *unused)
4524
4527
decryption_events_fixture_destroy (def );
4525
4528
}
4526
4529
4530
+ /* Prose test 14: Case 4: Decrypt Success. */
4527
4531
/* test_decryption_events_decrypt_success is a regression test for CDRIVER-4401.
4528
4532
* Decrypt a reply with a valid ciphertext.
4529
4533
* Expect a successful return and a CommandSucceeded event to be emitted with
4530
4534
* ciphertext. */
4531
4535
static void
4532
- test_decryption_events_decrypt_success (void * unused )
4536
+ test_decryption_events_case4 (void * unused )
4533
4537
{
4534
4538
bool got ;
4535
4539
bson_error_t error ;
@@ -4966,37 +4970,37 @@ test_client_side_encryption_install (TestSuite *suite)
4966
4970
test_framework_skip_if_single );
4967
4971
4968
4972
TestSuite_AddFull (suite ,
4969
- "/client_side_encryption/decryption_events/command_error " ,
4970
- test_decryption_events_command_error ,
4973
+ "/client_side_encryption/decryption_events/case1 " ,
4974
+ test_decryption_events_case1 ,
4971
4975
NULL /* dtor */ ,
4972
4976
NULL /* ctx */ ,
4973
4977
test_framework_skip_if_no_client_side_encryption ,
4974
4978
test_framework_skip_if_max_wire_version_less_than_8 );
4975
4979
4976
4980
TestSuite_AddFull (suite ,
4977
- "/client_side_encryption/decryption_events/network_error " ,
4978
- test_decryption_events_network_error ,
4981
+ "/client_side_encryption/decryption_events/case2 " ,
4982
+ test_decryption_events_case2 ,
4979
4983
NULL /* dtor */ ,
4980
4984
NULL /* ctx */ ,
4981
4985
test_framework_skip_if_no_client_side_encryption ,
4982
4986
test_framework_skip_if_max_wire_version_less_than_8 );
4983
4987
4984
4988
TestSuite_AddFull (suite ,
4985
- "/client_side_encryption/decryption_events/decrypt_error " ,
4986
- test_decryption_events_decrypt_error ,
4989
+ "/client_side_encryption/decryption_events/case3 " ,
4990
+ test_decryption_events_case3 ,
4987
4991
NULL /* dtor */ ,
4988
4992
NULL /* ctx */ ,
4989
4993
test_framework_skip_if_no_client_side_encryption ,
4990
4994
test_framework_skip_if_max_wire_version_less_than_8 );
4991
4995
4992
- TestSuite_AddFull (
4993
- suite ,
4994
- "/client_side_encryption/decryption_events/decrypt_success " ,
4995
- test_decryption_events_decrypt_success ,
4996
- NULL /* dtor */ ,
4997
- NULL /* ctx */ ,
4998
- test_framework_skip_if_no_client_side_encryption ,
4999
- test_framework_skip_if_max_wire_version_less_than_8 );
4996
+
4997
+ TestSuite_AddFull ( suite ,
4998
+ "/client_side_encryption/decryption_events/case4 " ,
4999
+ test_decryption_events_case4 ,
5000
+ NULL /* dtor */ ,
5001
+ NULL /* ctx */ ,
5002
+ test_framework_skip_if_no_client_side_encryption ,
5003
+ test_framework_skip_if_max_wire_version_less_than_8 );
5000
5004
5001
5005
TestSuite_AddFull (suite ,
5002
5006
"/client_side_encryption/qe_docs_example" ,
0 commit comments