Skip to content

Commit b5c603e

Browse files
committed
query_type range
1 parent 7168b5b commit b5c603e

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

test/fuzz_mongocrypt.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ enum {
4444
OP_DATAKEY = 4,
4545
OP_REWRAP_MANY_DATAKEY = 5,
4646
OP_EXPLICIT_ENCRYPT_EXPRESSION = 6,
47-
OP_DATAKEY_AWS = 7, /* exercises NEED_KMS → KMS response parser (HTTP chunked) */
47+
OP_DATAKEY_AWS = 7, /* exercises NEED_KMS → KMS response parser (HTTP chunked) */
4848
OP_DATAKEY_KMIP = 8, /* exercises NEED_KMS → KMIP response parser */
4949
OP_COUNT = 9,
5050
};
5151

52-
5352
/* Helper: consume bytes from the fuzz input. */
5453
static const uint8_t *fuzz_consume(const uint8_t **data, size_t *remaining, size_t n) {
5554
if (*remaining < n) {
@@ -221,8 +220,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
221220
/* Configure AWS KMS provider so OP_DATAKEY_AWS can reach NEED_KMS state
222221
* and exercise the KMS HTTP response parser with fuzz-controlled bytes. */
223222
mongocrypt_setopt_kms_provider_aws(crypt,
224-
"AKIAIOSFODNN7EXAMPLE", -1,
225-
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", -1);
223+
"AKIAIOSFODNN7EXAMPLE",
224+
-1,
225+
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
226+
-1);
226227

227228
/* Configure KMIP KMS provider so OP_DATAKEY_KMIP can reach NEED_KMS state
228229
* and exercise the KMIP response parser with fuzz-controlled bytes. */
@@ -318,7 +319,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
318319
mongocrypt_ctx_setopt_key_id(ctx, kid_bin);
319320
mongocrypt_binary_destroy(kid_bin);
320321
}
321-
mongocrypt_ctx_setopt_algorithm(ctx, "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", -1);
322+
mongocrypt_ctx_setopt_query_type(ctx, MONGOCRYPT_QUERY_TYPE_RANGE_STR, -1);
322323
if (input_bin) {
323324
init_ok = mongocrypt_ctx_explicit_encrypt_expression_init(ctx, input_bin);
324325
}
@@ -329,8 +330,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
329330
/* Create a datakey encrypted with AWS KMS. The context transitions
330331
* directly to NEED_KMS, so drive_ctx feeds fuzz bytes as the raw
331332
* HTTP response to the KMS response parser. */
332-
bson_t *kek = BCON_NEW("provider", "aws", "region", "us-east-1",
333-
"key", "arn:aws:kms:us-east-1:0:key/fuzz");
333+
bson_t *kek = BCON_NEW("provider", "aws", "region", "us-east-1", "key", "arn:aws:kms:us-east-1:0:key/fuzz");
334334
mongocrypt_binary_t *kek_bin =
335335
mongocrypt_binary_new_from_data((uint8_t *)bson_get_data(kek), (uint32_t)kek->len);
336336
if (kek_bin) {
@@ -375,4 +375,3 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
375375

376376
return 0;
377377
}
378-

0 commit comments

Comments
 (0)