Skip to content

Commit 5c474ff

Browse files
authored
fix error and comments for explicit encryption (#1033)
* remove out-dated error: `_fle2_finalize` is only called for auto-encryption, not explicit * clarify comments: `FLE2RangeFindSpec` and `FLE2RangeInsertSpec` are separately handled.
1 parent b308c67 commit 5c474ff

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/mongocrypt-ctx-encrypt.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,7 @@ static bool _fle2_finalize(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out) {
10961096

10971097
BSON_ASSERT(context_uses_fle2(ctx));
10981098
BSON_ASSERT(ctx->state == MONGOCRYPT_CTX_READY);
1099-
1100-
if (ectx->explicit) {
1101-
return _mongocrypt_ctx_fail_w_msg(ctx, "explicit encryption is not yet supported. See MONGOCRYPT-409.");
1102-
}
1099+
BSON_ASSERT(!ectx->explicit);
11031100

11041101
if (!_mongocrypt_buffer_to_bson(&ectx->original_cmd, &original_cmd_bson)) {
11051102
return _mongocrypt_ctx_fail_w_msg(ctx, "malformed bson in original_cmd");
@@ -1303,7 +1300,7 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
13031300

13041301
if (ctx->opts.rangeopts.set && ctx->opts.query_type.set) {
13051302
// RangeOpts with query type is a special case. The result contains two
1306-
// ciphertext values.
1303+
// ciphertext values of FLE2RangeFindSpec.
13071304
return FLE2RangeFindDriverSpec_to_ciphertexts(ctx, out);
13081305
}
13091306

@@ -1342,8 +1339,7 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
13421339

13431340
if (ctx->opts.rangeopts.set) {
13441341
// Process the RangeOpts and the input 'v' document into a new 'v'.
1345-
// The new 'v' document will be a FLE2RangeFindSpec or
1346-
// FLE2RangeInsertSpec.
1342+
// The new 'v' document will be a FLE2RangeInsertSpec.
13471343
bson_t old_v;
13481344

13491345
if (!_mongocrypt_buffer_to_bson(&ectx->original_cmd, &old_v)) {

0 commit comments

Comments
 (0)