libmongocrypt-helper 1.13.2.0.1001 → 1.14.0.0.1001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +8 -0
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +5 -1
- data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +4 -1
- data/ext/libmongocrypt/libmongocrypt/Earthfile +18 -17
- data/ext/libmongocrypt/libmongocrypt/README.md +8 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +7 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CONTRIBUTING.md +34 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +6 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +18 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +9 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +14 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +6 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +8 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/libmongocrypt-version.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/{release.sh → scripts/release.sh} +9 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/python/{synchro.py → scripts/synchro.py} +16 -9
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.sh +8 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update-version.sh +27 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update_binding.py +78 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +15 -0
- data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +25 -18
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +39 -13
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +1 -1
- data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +2 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.c +5 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_azure_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +1 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +5 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -8
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.h +9 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response_parser.c +0 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.c +7 -3
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.h +2 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +8 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +5 -4
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_request.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response.c +3 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response_parser.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +39 -39
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +235 -65
- data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +1 -4
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +9 -11
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +1 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +10 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +167 -176
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +25 -26
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +2 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload-private.h +122 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload.c +477 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +1 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +28 -43
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +6 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +13 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +7 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c +4 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils-private.h +27 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils.c +48 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +15 -20
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +4 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +9 -18
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +4 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +5 -9
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +14 -19
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +2 -4
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +109 -119
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker-private.h +0 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker.c +4 -14
- data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets.c +3 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode-private.h +8 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode.c +78 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +34 -16
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +66 -74
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +12 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +2 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +65 -58
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +3 -3
- data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +4 -4
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +29 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +6 -3
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +48 -58
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +12 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +5 -13
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +19 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +9 -9
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +3 -4
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +285 -89
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +0 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +0 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +4 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -31
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +2 -0
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +3 -1
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/case-fold-map.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/diacritic-fold-map.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +0 -14
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +6 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +14 -6
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +14 -6
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +3 -3
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +11 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +9 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c +18 -29
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +2 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-text-payload.c +320 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +2 -17
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +8 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +6 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +29 -33
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +12 -20
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +5 -20
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-text-search-str-encode.c +147 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +35 -14
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +10 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +3 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +36 -24
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +13 -13
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +49 -55
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +64 -67
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +18 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +4 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +13 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +31 -13
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +35 -52
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +28 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +50 -91
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +7 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +3 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +527 -225
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +45 -56
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +12 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +11 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-unicode-fold.c +6 -2
- data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/util/util.h +7 -6
- data/lib/libmongocrypt_helper/version.rb +2 -2
- metadata +17 -13
- data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +0 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +0 -50
- data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +0 -14
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +0 -29
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +0 -29
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EqualityIndexedValueV2.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2RangeIndexedValueV2.json +0 -8
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/{build-manylinux-wheel.sh → scripts/build-manylinux-wheel.sh} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges.json → FLE2InsertUpdatePayload-RangeV1.json} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges-V2.json → FLE2InsertUpdatePayloadV2-RangeV1.json} +0 -0
@@ -24,38 +24,38 @@
|
|
24
24
|
#include "mongocrypt-util-private.h" // mc_bson_type_to_string
|
25
25
|
#include "mongocrypt.h"
|
26
26
|
|
27
|
-
#define CLIENT_ERR_PREFIXED_HELPER(Prefix, ErrorString, ...) CLIENT_ERR(Prefix ": " ErrorString, ##__VA_ARGS__)
|
28
|
-
#define CLIENT_ERR_PREFIXED(ErrorString, ...) CLIENT_ERR_PREFIXED_HELPER(ERROR_PREFIX, ErrorString, ##__VA_ARGS__)
|
29
|
-
|
30
27
|
// Common logic for testing field name, tracking duplication, and presence.
|
31
28
|
#define IF_FIELD(Name) \
|
32
29
|
if (0 == strcmp(field, #Name)) { \
|
33
30
|
if (has_##Name) { \
|
34
|
-
|
31
|
+
CLIENT_ERR(ERROR_PREFIX "Duplicate field '" #Name "' in placeholder bson"); \
|
35
32
|
goto fail; \
|
36
33
|
} \
|
37
|
-
has_##Name = true;
|
34
|
+
has_##Name = true; \
|
35
|
+
((void)0)
|
38
36
|
|
39
37
|
#define END_IF_FIELD \
|
40
38
|
continue; \
|
41
|
-
}
|
39
|
+
} \
|
40
|
+
else((void)0)
|
42
41
|
|
43
42
|
#define CHECK_HAS(Name) \
|
44
43
|
if (!has_##Name) { \
|
45
|
-
|
44
|
+
CLIENT_ERR(ERROR_PREFIX "Missing field '" #Name "' in placeholder"); \
|
46
45
|
goto fail; \
|
47
46
|
}
|
48
47
|
|
49
48
|
// Common logic for parsing int32 greater than zero
|
50
49
|
#define IF_FIELD_INT32_GT0_PARSE(Name, Dest, Iter) \
|
51
|
-
IF_FIELD(Name)
|
50
|
+
IF_FIELD(Name); \
|
51
|
+
{ \
|
52
52
|
if (!BSON_ITER_HOLDS_INT32(&Iter)) { \
|
53
|
-
|
53
|
+
CLIENT_ERR(ERROR_PREFIX "'" #Name "' must be an int32"); \
|
54
54
|
goto fail; \
|
55
55
|
} \
|
56
56
|
int32_t val = bson_iter_int32(&Iter); \
|
57
57
|
if (val <= 0) { \
|
58
|
-
|
58
|
+
CLIENT_ERR(ERROR_PREFIX "'" #Name "' must be greater than zero"); \
|
59
59
|
goto fail; \
|
60
60
|
} \
|
61
61
|
Dest = (uint32_t)val; \
|
@@ -66,7 +66,7 @@ void mc_FLE2EncryptionPlaceholder_init(mc_FLE2EncryptionPlaceholder_t *placehold
|
|
66
66
|
memset(placeholder, 0, sizeof(mc_FLE2EncryptionPlaceholder_t));
|
67
67
|
}
|
68
68
|
|
69
|
-
#define ERROR_PREFIX "Error parsing FLE2EncryptionPlaceholder"
|
69
|
+
#define ERROR_PREFIX "Error parsing FLE2EncryptionPlaceholder: "
|
70
70
|
|
71
71
|
bool mc_FLE2EncryptionPlaceholder_parse(mc_FLE2EncryptionPlaceholder_t *out,
|
72
72
|
const bson_t *in,
|
@@ -81,7 +81,7 @@ bool mc_FLE2EncryptionPlaceholder_parse(mc_FLE2EncryptionPlaceholder_t *out,
|
|
81
81
|
|
82
82
|
mc_FLE2EncryptionPlaceholder_init(out);
|
83
83
|
if (!bson_validate(in, BSON_VALIDATE_NONE, NULL) || !bson_iter_init(&iter, in)) {
|
84
|
-
|
84
|
+
CLIENT_ERR(ERROR_PREFIX "invalid BSON");
|
85
85
|
return false;
|
86
86
|
}
|
87
87
|
|
@@ -89,61 +89,65 @@ bool mc_FLE2EncryptionPlaceholder_parse(mc_FLE2EncryptionPlaceholder_t *out,
|
|
89
89
|
const char *field = bson_iter_key(&iter);
|
90
90
|
BSON_ASSERT(field);
|
91
91
|
|
92
|
-
IF_FIELD(t)
|
92
|
+
IF_FIELD(t);
|
93
|
+
{
|
93
94
|
int32_t type;
|
94
95
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
95
|
-
|
96
|
+
CLIENT_ERR(ERROR_PREFIX "invalid marking, 't' must be an int32");
|
96
97
|
goto fail;
|
97
98
|
}
|
98
99
|
type = bson_iter_int32(&iter);
|
99
100
|
if ((type != MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT) && (type != MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND)) {
|
100
|
-
|
101
|
+
CLIENT_ERR(ERROR_PREFIX "invalid placeholder type value: %d", type);
|
101
102
|
goto fail;
|
102
103
|
}
|
103
104
|
out->type = (mongocrypt_fle2_placeholder_type_t)type;
|
104
105
|
}
|
105
|
-
END_IF_FIELD
|
106
|
+
END_IF_FIELD;
|
106
107
|
|
107
|
-
IF_FIELD(a)
|
108
|
+
IF_FIELD(a);
|
109
|
+
{
|
108
110
|
int32_t algorithm;
|
109
111
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
110
|
-
|
112
|
+
CLIENT_ERR(ERROR_PREFIX "invalid marking, 'a' must be an int32");
|
111
113
|
goto fail;
|
112
114
|
}
|
113
115
|
algorithm = bson_iter_int32(&iter);
|
114
116
|
if (algorithm != MONGOCRYPT_FLE2_ALGORITHM_UNINDEXED && algorithm != MONGOCRYPT_FLE2_ALGORITHM_EQUALITY
|
115
117
|
&& algorithm != MONGOCRYPT_FLE2_ALGORITHM_RANGE && algorithm != MONGOCRYPT_FLE2_ALGORITHM_TEXT_SEARCH) {
|
116
|
-
|
118
|
+
CLIENT_ERR(ERROR_PREFIX "invalid algorithm value: %d", algorithm);
|
117
119
|
goto fail;
|
118
120
|
}
|
119
121
|
out->algorithm = (mongocrypt_fle2_encryption_algorithm_t)algorithm;
|
120
122
|
}
|
121
|
-
END_IF_FIELD
|
123
|
+
END_IF_FIELD;
|
122
124
|
|
123
|
-
IF_FIELD(ki)
|
125
|
+
IF_FIELD(ki);
|
126
|
+
{
|
124
127
|
if (!_mongocrypt_buffer_from_uuid_iter(&out->index_key_id, &iter)) {
|
125
|
-
|
128
|
+
CLIENT_ERR(ERROR_PREFIX "index key id must be a UUID");
|
126
129
|
goto fail;
|
127
130
|
}
|
128
131
|
}
|
129
|
-
END_IF_FIELD
|
132
|
+
END_IF_FIELD;
|
130
133
|
|
131
|
-
IF_FIELD(ku)
|
134
|
+
IF_FIELD(ku);
|
135
|
+
{
|
132
136
|
if (!_mongocrypt_buffer_from_uuid_iter(&out->user_key_id, &iter)) {
|
133
|
-
|
137
|
+
CLIENT_ERR(ERROR_PREFIX "user key id must be a UUID");
|
134
138
|
goto fail;
|
135
139
|
}
|
136
140
|
}
|
137
|
-
END_IF_FIELD
|
141
|
+
END_IF_FIELD;
|
138
142
|
|
139
|
-
IF_FIELD(v)
|
140
|
-
|
141
|
-
|
142
|
-
END_IF_FIELD
|
143
|
+
IF_FIELD(v);
|
144
|
+
memcpy(&out->v_iter, &iter, sizeof(bson_iter_t));
|
145
|
+
END_IF_FIELD;
|
143
146
|
|
144
|
-
IF_FIELD(cm)
|
147
|
+
IF_FIELD(cm);
|
148
|
+
{
|
145
149
|
if (!BSON_ITER_HOLDS_INT64(&iter)) {
|
146
|
-
|
150
|
+
CLIENT_ERR(ERROR_PREFIX "invalid marking, 'cm' must be an int64");
|
147
151
|
goto fail;
|
148
152
|
}
|
149
153
|
out->maxContentionFactor = bson_iter_int64(&iter);
|
@@ -151,11 +155,12 @@ bool mc_FLE2EncryptionPlaceholder_parse(mc_FLE2EncryptionPlaceholder_t *out,
|
|
151
155
|
goto fail;
|
152
156
|
}
|
153
157
|
}
|
154
|
-
END_IF_FIELD
|
158
|
+
END_IF_FIELD;
|
155
159
|
|
156
|
-
IF_FIELD(s)
|
160
|
+
IF_FIELD(s);
|
161
|
+
{
|
157
162
|
if (!BSON_ITER_HOLDS_INT64(&iter)) {
|
158
|
-
|
163
|
+
CLIENT_ERR(ERROR_PREFIX "invalid marking, 's' must be an int64");
|
159
164
|
goto fail;
|
160
165
|
}
|
161
166
|
out->sparsity = bson_iter_int64(&iter);
|
@@ -163,7 +168,7 @@ bool mc_FLE2EncryptionPlaceholder_parse(mc_FLE2EncryptionPlaceholder_t *out,
|
|
163
168
|
goto fail;
|
164
169
|
}
|
165
170
|
}
|
166
|
-
END_IF_FIELD
|
171
|
+
END_IF_FIELD;
|
167
172
|
}
|
168
173
|
|
169
174
|
CHECK_HAS(t)
|
@@ -191,42 +196,41 @@ void mc_FLE2EncryptionPlaceholder_cleanup(mc_FLE2EncryptionPlaceholder_t *placeh
|
|
191
196
|
}
|
192
197
|
|
193
198
|
#undef ERROR_PREFIX
|
194
|
-
#define ERROR_PREFIX "Error validating contention"
|
199
|
+
#define ERROR_PREFIX "Error validating contention: "
|
195
200
|
|
196
201
|
bool mc_validate_contention(int64_t contention, mongocrypt_status_t *status) {
|
197
202
|
if (contention < 0) {
|
198
|
-
|
203
|
+
CLIENT_ERR(ERROR_PREFIX "contention must be non-negative, got: %" PRId64, contention);
|
199
204
|
return false;
|
200
205
|
}
|
201
206
|
if (contention == INT64_MAX) {
|
202
|
-
|
207
|
+
CLIENT_ERR(ERROR_PREFIX "contention must be < INT64_MAX, got: %" PRId64, contention);
|
203
208
|
return false;
|
204
209
|
}
|
205
210
|
return true;
|
206
211
|
}
|
207
212
|
|
208
213
|
#undef ERROR_PREFIX
|
209
|
-
#define ERROR_PREFIX "Error validating sparsity"
|
214
|
+
#define ERROR_PREFIX "Error validating sparsity: "
|
210
215
|
|
211
216
|
bool mc_validate_sparsity(int64_t sparsity, mongocrypt_status_t *status) {
|
212
217
|
if (sparsity < 0) {
|
213
|
-
|
218
|
+
CLIENT_ERR(ERROR_PREFIX "sparsity must be non-negative, got: %" PRId64, sparsity);
|
214
219
|
return false;
|
215
220
|
}
|
216
221
|
// mc_getEdgesInt expects a size_t sparsity.
|
217
222
|
if ((uint64_t)sparsity >= SIZE_MAX) {
|
218
|
-
|
223
|
+
CLIENT_ERR(ERROR_PREFIX "sparsity must be < %zu, got: %" PRId64, SIZE_MAX, sparsity);
|
219
224
|
return false;
|
220
225
|
}
|
221
226
|
return true;
|
222
227
|
}
|
223
228
|
|
224
229
|
#undef ERROR_PREFIX
|
225
|
-
#define ERROR_PREFIX "Error parsing FLE2RangeFindSpecEdgesInfo"
|
230
|
+
#define ERROR_PREFIX "Error parsing FLE2RangeFindSpecEdgesInfo: "
|
226
231
|
|
227
232
|
static bool mc_FLE2RangeFindSpecEdgesInfo_parse(mc_FLE2RangeFindSpecEdgesInfo_t *out,
|
228
233
|
const bson_iter_t *in,
|
229
|
-
bool use_range_v2,
|
230
234
|
mongocrypt_status_t *status) {
|
231
235
|
bson_iter_t iter;
|
232
236
|
bool has_lowerBound = false, has_lbIncluded = false, has_upperBound = false, has_ubIncluded = false,
|
@@ -238,7 +242,7 @@ static bool mc_FLE2RangeFindSpecEdgesInfo_parse(mc_FLE2RangeFindSpecEdgesInfo_t
|
|
238
242
|
iter = *in;
|
239
243
|
|
240
244
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
241
|
-
|
245
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
242
246
|
return false;
|
243
247
|
}
|
244
248
|
bson_iter_recurse(&iter, &iter);
|
@@ -247,73 +251,73 @@ static bool mc_FLE2RangeFindSpecEdgesInfo_parse(mc_FLE2RangeFindSpecEdgesInfo_t
|
|
247
251
|
const char *field = bson_iter_key(&iter);
|
248
252
|
BSON_ASSERT(field);
|
249
253
|
|
250
|
-
IF_FIELD(lowerBound)
|
251
|
-
|
252
|
-
|
253
|
-
END_IF_FIELD
|
254
|
+
IF_FIELD(lowerBound);
|
255
|
+
out->lowerBound = iter;
|
256
|
+
END_IF_FIELD;
|
254
257
|
|
255
|
-
IF_FIELD(lbIncluded)
|
258
|
+
IF_FIELD(lbIncluded);
|
259
|
+
{
|
256
260
|
if (!BSON_ITER_HOLDS_BOOL(&iter)) {
|
257
|
-
|
261
|
+
CLIENT_ERR(ERROR_PREFIX "'lbIncluded' must be a bool");
|
258
262
|
goto fail;
|
259
263
|
}
|
260
264
|
out->lbIncluded = bson_iter_bool(&iter);
|
261
265
|
}
|
262
|
-
END_IF_FIELD
|
266
|
+
END_IF_FIELD;
|
263
267
|
|
264
|
-
IF_FIELD(upperBound)
|
265
|
-
|
266
|
-
|
267
|
-
END_IF_FIELD
|
268
|
+
IF_FIELD(upperBound);
|
269
|
+
out->upperBound = iter;
|
270
|
+
END_IF_FIELD;
|
268
271
|
|
269
|
-
IF_FIELD(ubIncluded)
|
272
|
+
IF_FIELD(ubIncluded);
|
273
|
+
{
|
270
274
|
if (!BSON_ITER_HOLDS_BOOL(&iter)) {
|
271
|
-
|
275
|
+
CLIENT_ERR(ERROR_PREFIX "'ubIncluded' must be a bool");
|
272
276
|
goto fail;
|
273
277
|
}
|
274
278
|
out->ubIncluded = bson_iter_bool(&iter);
|
275
279
|
}
|
276
|
-
END_IF_FIELD
|
280
|
+
END_IF_FIELD;
|
277
281
|
|
278
|
-
IF_FIELD(indexMin)
|
279
|
-
|
280
|
-
|
281
|
-
END_IF_FIELD
|
282
|
+
IF_FIELD(indexMin);
|
283
|
+
out->indexMin = iter;
|
284
|
+
END_IF_FIELD;
|
282
285
|
|
283
|
-
IF_FIELD(indexMax)
|
284
|
-
|
285
|
-
|
286
|
-
END_IF_FIELD
|
286
|
+
IF_FIELD(indexMax);
|
287
|
+
out->indexMax = iter;
|
288
|
+
END_IF_FIELD;
|
287
289
|
|
288
|
-
IF_FIELD(precision)
|
290
|
+
IF_FIELD(precision);
|
291
|
+
{
|
289
292
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
290
|
-
|
293
|
+
CLIENT_ERR(ERROR_PREFIX "'precision' must be an int32");
|
291
294
|
goto fail;
|
292
295
|
}
|
293
296
|
int32_t val = bson_iter_int32(&iter);
|
294
297
|
if (val < 0) {
|
295
|
-
|
298
|
+
CLIENT_ERR(ERROR_PREFIX "'precision' must be non-negative");
|
296
299
|
goto fail;
|
297
300
|
}
|
298
301
|
|
299
302
|
out->precision = OPT_I32(val);
|
300
303
|
}
|
301
|
-
END_IF_FIELD
|
304
|
+
END_IF_FIELD;
|
302
305
|
|
303
|
-
IF_FIELD(trimFactor)
|
306
|
+
IF_FIELD(trimFactor);
|
307
|
+
{
|
304
308
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
305
|
-
|
309
|
+
CLIENT_ERR(ERROR_PREFIX "'trimFactor' must be an int32");
|
306
310
|
goto fail;
|
307
311
|
}
|
308
312
|
int32_t val = bson_iter_int32(&iter);
|
309
313
|
if (val < 0) {
|
310
|
-
|
314
|
+
CLIENT_ERR(ERROR_PREFIX "'trimFactor' must be non-negative");
|
311
315
|
goto fail;
|
312
316
|
}
|
313
317
|
|
314
318
|
out->trimFactor = OPT_I32(val);
|
315
319
|
}
|
316
|
-
END_IF_FIELD
|
320
|
+
END_IF_FIELD;
|
317
321
|
}
|
318
322
|
|
319
323
|
CHECK_HAS(lowerBound)
|
@@ -325,11 +329,6 @@ static bool mc_FLE2RangeFindSpecEdgesInfo_parse(mc_FLE2RangeFindSpecEdgesInfo_t
|
|
325
329
|
// Do not error if precision is not present. Precision optional and only
|
326
330
|
// applies to double/decimal128.
|
327
331
|
|
328
|
-
if (!use_range_v2 && out->trimFactor.set) {
|
329
|
-
CLIENT_ERR_PREFIXED("'trimFactor' is not supported for QE range v1");
|
330
|
-
return false;
|
331
|
-
}
|
332
|
-
|
333
332
|
return true;
|
334
333
|
|
335
334
|
fail:
|
@@ -337,12 +336,9 @@ fail:
|
|
337
336
|
}
|
338
337
|
|
339
338
|
#undef ERROR_PREFIX
|
340
|
-
#define ERROR_PREFIX "Error parsing FLE2RangeFindSpec"
|
339
|
+
#define ERROR_PREFIX "Error parsing FLE2RangeFindSpec: "
|
341
340
|
|
342
|
-
bool mc_FLE2RangeFindSpec_parse(mc_FLE2RangeFindSpec_t *out,
|
343
|
-
const bson_iter_t *in,
|
344
|
-
bool use_range_v2,
|
345
|
-
mongocrypt_status_t *status) {
|
341
|
+
bool mc_FLE2RangeFindSpec_parse(mc_FLE2RangeFindSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
346
342
|
BSON_ASSERT_PARAM(out);
|
347
343
|
BSON_ASSERT_PARAM(in);
|
348
344
|
|
@@ -352,7 +348,7 @@ bool mc_FLE2RangeFindSpec_parse(mc_FLE2RangeFindSpec_t *out,
|
|
352
348
|
*out = (mc_FLE2RangeFindSpec_t){{{{0}}}};
|
353
349
|
|
354
350
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
355
|
-
|
351
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
356
352
|
return false;
|
357
353
|
}
|
358
354
|
bson_iter_recurse(&iter, &iter);
|
@@ -361,54 +357,58 @@ bool mc_FLE2RangeFindSpec_parse(mc_FLE2RangeFindSpec_t *out,
|
|
361
357
|
const char *field = bson_iter_key(&iter);
|
362
358
|
BSON_ASSERT(field);
|
363
359
|
|
364
|
-
IF_FIELD(edgesInfo)
|
365
|
-
|
360
|
+
IF_FIELD(edgesInfo);
|
361
|
+
{
|
362
|
+
if (!mc_FLE2RangeFindSpecEdgesInfo_parse(&out->edgesInfo.value, &iter, status)) {
|
366
363
|
goto fail;
|
367
364
|
}
|
368
365
|
out->edgesInfo.set = true;
|
369
366
|
}
|
370
|
-
END_IF_FIELD
|
367
|
+
END_IF_FIELD;
|
371
368
|
|
372
|
-
IF_FIELD(payloadId)
|
369
|
+
IF_FIELD(payloadId);
|
370
|
+
{
|
373
371
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
374
|
-
|
372
|
+
CLIENT_ERR(ERROR_PREFIX "'payloadId' must be an int32");
|
375
373
|
goto fail;
|
376
374
|
}
|
377
375
|
out->payloadId = bson_iter_int32(&iter);
|
378
376
|
}
|
379
|
-
END_IF_FIELD
|
377
|
+
END_IF_FIELD;
|
380
378
|
|
381
|
-
IF_FIELD(firstOperator)
|
379
|
+
IF_FIELD(firstOperator);
|
380
|
+
{
|
382
381
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
383
|
-
|
382
|
+
CLIENT_ERR(ERROR_PREFIX "'firstOperator' must be an int32");
|
384
383
|
goto fail;
|
385
384
|
}
|
386
385
|
const int32_t first_op = bson_iter_int32(&iter);
|
387
386
|
if (first_op < FLE2RangeOperator_min_val || first_op > FLE2RangeOperator_max_val) {
|
388
|
-
|
389
|
-
|
390
|
-
|
387
|
+
CLIENT_ERR(ERROR_PREFIX "'firstOperator' must be between %d and %d",
|
388
|
+
FLE2RangeOperator_min_val,
|
389
|
+
FLE2RangeOperator_max_val);
|
391
390
|
goto fail;
|
392
391
|
}
|
393
392
|
out->firstOperator = (mc_FLE2RangeOperator_t)first_op;
|
394
393
|
}
|
395
|
-
END_IF_FIELD
|
394
|
+
END_IF_FIELD;
|
396
395
|
|
397
|
-
IF_FIELD(secondOperator)
|
396
|
+
IF_FIELD(secondOperator);
|
397
|
+
{
|
398
398
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
399
|
-
|
399
|
+
CLIENT_ERR(ERROR_PREFIX "'secondOperator' must be an int32");
|
400
400
|
goto fail;
|
401
401
|
}
|
402
402
|
const int32_t second_op = bson_iter_int32(&iter);
|
403
403
|
if (second_op < FLE2RangeOperator_min_val || second_op > FLE2RangeOperator_max_val) {
|
404
|
-
|
405
|
-
|
406
|
-
|
404
|
+
CLIENT_ERR(ERROR_PREFIX "'secondOperator' must be between %d and %d",
|
405
|
+
FLE2RangeOperator_min_val,
|
406
|
+
FLE2RangeOperator_max_val);
|
407
407
|
goto fail;
|
408
408
|
}
|
409
409
|
out->secondOperator = (mc_FLE2RangeOperator_t)second_op;
|
410
410
|
}
|
411
|
-
END_IF_FIELD
|
411
|
+
END_IF_FIELD;
|
412
412
|
}
|
413
413
|
|
414
414
|
// edgesInfo is optional. Do not require it.
|
@@ -422,12 +422,9 @@ fail:
|
|
422
422
|
}
|
423
423
|
|
424
424
|
#undef ERROR_PREFIX
|
425
|
-
#define ERROR_PREFIX "Error parsing FLE2RangeInsertSpec"
|
425
|
+
#define ERROR_PREFIX "Error parsing FLE2RangeInsertSpec: "
|
426
426
|
|
427
|
-
bool mc_FLE2RangeInsertSpec_parse(mc_FLE2RangeInsertSpec_t *out,
|
428
|
-
const bson_iter_t *in,
|
429
|
-
bool use_range_v2,
|
430
|
-
mongocrypt_status_t *status) {
|
427
|
+
bool mc_FLE2RangeInsertSpec_parse(mc_FLE2RangeInsertSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
431
428
|
BSON_ASSERT_PARAM(out);
|
432
429
|
BSON_ASSERT_PARAM(in);
|
433
430
|
|
@@ -437,7 +434,7 @@ bool mc_FLE2RangeInsertSpec_parse(mc_FLE2RangeInsertSpec_t *out,
|
|
437
434
|
bool has_v = false, has_min = false, has_max = false, has_precision = false, has_trimFactor = false;
|
438
435
|
|
439
436
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
440
|
-
|
437
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
441
438
|
return false;
|
442
439
|
}
|
443
440
|
bson_iter_recurse(&iter, &iter);
|
@@ -446,48 +443,47 @@ bool mc_FLE2RangeInsertSpec_parse(mc_FLE2RangeInsertSpec_t *out,
|
|
446
443
|
const char *field = bson_iter_key(&iter);
|
447
444
|
BSON_ASSERT(field);
|
448
445
|
|
449
|
-
IF_FIELD(v)
|
450
|
-
|
451
|
-
|
452
|
-
END_IF_FIELD
|
446
|
+
IF_FIELD(v);
|
447
|
+
out->v = iter;
|
448
|
+
END_IF_FIELD;
|
453
449
|
|
454
|
-
IF_FIELD(min)
|
455
|
-
|
456
|
-
|
457
|
-
END_IF_FIELD
|
450
|
+
IF_FIELD(min);
|
451
|
+
out->min = iter;
|
452
|
+
END_IF_FIELD;
|
458
453
|
|
459
|
-
IF_FIELD(max)
|
460
|
-
|
461
|
-
|
462
|
-
END_IF_FIELD
|
454
|
+
IF_FIELD(max);
|
455
|
+
out->max = iter;
|
456
|
+
END_IF_FIELD;
|
463
457
|
|
464
|
-
IF_FIELD(precision)
|
458
|
+
IF_FIELD(precision);
|
459
|
+
{
|
465
460
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
466
|
-
|
461
|
+
CLIENT_ERR(ERROR_PREFIX "'precision' must be an int32");
|
467
462
|
goto fail;
|
468
463
|
}
|
469
464
|
int32_t val = bson_iter_int32(&iter);
|
470
465
|
if (val < 0) {
|
471
|
-
|
466
|
+
CLIENT_ERR(ERROR_PREFIX "'precision' must be non-negative");
|
472
467
|
goto fail;
|
473
468
|
}
|
474
469
|
out->precision = OPT_I32(val);
|
475
470
|
}
|
476
|
-
END_IF_FIELD
|
471
|
+
END_IF_FIELD;
|
477
472
|
|
478
|
-
IF_FIELD(trimFactor)
|
473
|
+
IF_FIELD(trimFactor);
|
474
|
+
{
|
479
475
|
if (!BSON_ITER_HOLDS_INT32(&iter)) {
|
480
|
-
|
476
|
+
CLIENT_ERR(ERROR_PREFIX "'trimFactor' must be an int32");
|
481
477
|
goto fail;
|
482
478
|
}
|
483
479
|
int32_t val = bson_iter_int32(&iter);
|
484
480
|
if (val < 0) {
|
485
|
-
|
481
|
+
CLIENT_ERR(ERROR_PREFIX "'trimFactor' must be non-negative");
|
486
482
|
goto fail;
|
487
483
|
}
|
488
484
|
out->trimFactor = OPT_I32(val);
|
489
485
|
}
|
490
|
-
END_IF_FIELD
|
486
|
+
END_IF_FIELD;
|
491
487
|
}
|
492
488
|
|
493
489
|
CHECK_HAS(v)
|
@@ -496,11 +492,6 @@ bool mc_FLE2RangeInsertSpec_parse(mc_FLE2RangeInsertSpec_t *out,
|
|
496
492
|
// Do not error if precision is not present. Precision optional and only
|
497
493
|
// applies to double/decimal128.
|
498
494
|
|
499
|
-
if (!use_range_v2 && out->trimFactor.set) {
|
500
|
-
CLIENT_ERR_PREFIXED("'trimFactor' is not supported for QE range v1");
|
501
|
-
return false;
|
502
|
-
}
|
503
|
-
|
504
495
|
return true;
|
505
496
|
|
506
497
|
fail:
|
@@ -509,11 +500,11 @@ fail:
|
|
509
500
|
|
510
501
|
#undef ERROR_PREFIX
|
511
502
|
|
512
|
-
#define ERROR_PREFIX "Error parsing FLE2SubstringInsertSpec"
|
503
|
+
#define ERROR_PREFIX "Error parsing FLE2SubstringInsertSpec: "
|
513
504
|
|
514
|
-
|
515
|
-
|
516
|
-
|
505
|
+
bool mc_FLE2SubstringInsertSpec_parse(mc_FLE2SubstringInsertSpec_t *out,
|
506
|
+
const bson_iter_t *in,
|
507
|
+
mongocrypt_status_t *status) {
|
517
508
|
bson_iter_t iter;
|
518
509
|
bool has_mlen = false, has_ub = false, has_lb = false;
|
519
510
|
BSON_ASSERT_PARAM(out);
|
@@ -522,7 +513,7 @@ static bool mc_FLE2SubstringInsertSpec_parse(mc_FLE2SubstringInsertSpec_t *out,
|
|
522
513
|
iter = *in;
|
523
514
|
|
524
515
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
525
|
-
|
516
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
526
517
|
return false;
|
527
518
|
}
|
528
519
|
bson_iter_recurse(&iter, &iter);
|
@@ -537,11 +528,11 @@ static bool mc_FLE2SubstringInsertSpec_parse(mc_FLE2SubstringInsertSpec_t *out,
|
|
537
528
|
CHECK_HAS(ub)
|
538
529
|
CHECK_HAS(lb)
|
539
530
|
if (out->ub < out->lb) {
|
540
|
-
|
531
|
+
CLIENT_ERR(ERROR_PREFIX "upper bound cannot be less than the lower bound");
|
541
532
|
goto fail;
|
542
533
|
}
|
543
534
|
if (out->mlen < out->ub) {
|
544
|
-
|
535
|
+
CLIENT_ERR(ERROR_PREFIX "maximum indexed length cannot be less than the upper bound");
|
545
536
|
goto fail;
|
546
537
|
}
|
547
538
|
return true;
|
@@ -551,10 +542,9 @@ fail:
|
|
551
542
|
|
552
543
|
#undef ERROR_PREFIX
|
553
544
|
|
554
|
-
#define ERROR_PREFIX "Error parsing FLE2SuffixInsertSpec"
|
545
|
+
#define ERROR_PREFIX "Error parsing FLE2SuffixInsertSpec: "
|
555
546
|
|
556
|
-
|
557
|
-
mc_FLE2SuffixInsertSpec_parse(mc_FLE2SuffixInsertSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
547
|
+
bool mc_FLE2SuffixInsertSpec_parse(mc_FLE2SuffixInsertSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
558
548
|
bson_iter_t iter;
|
559
549
|
bool has_ub = false, has_lb = false;
|
560
550
|
|
@@ -564,7 +554,7 @@ mc_FLE2SuffixInsertSpec_parse(mc_FLE2SuffixInsertSpec_t *out, const bson_iter_t
|
|
564
554
|
iter = *in;
|
565
555
|
|
566
556
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
567
|
-
|
557
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
568
558
|
return false;
|
569
559
|
}
|
570
560
|
bson_iter_recurse(&iter, &iter);
|
@@ -577,7 +567,7 @@ mc_FLE2SuffixInsertSpec_parse(mc_FLE2SuffixInsertSpec_t *out, const bson_iter_t
|
|
577
567
|
CHECK_HAS(ub)
|
578
568
|
CHECK_HAS(lb)
|
579
569
|
if (out->ub < out->lb) {
|
580
|
-
|
570
|
+
CLIENT_ERR(ERROR_PREFIX "upper bound cannot be less than the lower bound");
|
581
571
|
goto fail;
|
582
572
|
}
|
583
573
|
return true;
|
@@ -587,10 +577,9 @@ fail:
|
|
587
577
|
|
588
578
|
#undef ERROR_PREFIX
|
589
579
|
|
590
|
-
#define ERROR_PREFIX "Error parsing FLE2PrefixInsertSpec"
|
580
|
+
#define ERROR_PREFIX "Error parsing FLE2PrefixInsertSpec: "
|
591
581
|
|
592
|
-
|
593
|
-
mc_FLE2PrefixInsertSpec_parse(mc_FLE2PrefixInsertSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
582
|
+
bool mc_FLE2PrefixInsertSpec_parse(mc_FLE2PrefixInsertSpec_t *out, const bson_iter_t *in, mongocrypt_status_t *status) {
|
594
583
|
bson_iter_t iter;
|
595
584
|
bool has_ub = false, has_lb = false;
|
596
585
|
BSON_ASSERT_PARAM(out);
|
@@ -599,7 +588,7 @@ mc_FLE2PrefixInsertSpec_parse(mc_FLE2PrefixInsertSpec_t *out, const bson_iter_t
|
|
599
588
|
iter = *in;
|
600
589
|
|
601
590
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
602
|
-
|
591
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
603
592
|
return false;
|
604
593
|
}
|
605
594
|
bson_iter_recurse(&iter, &iter);
|
@@ -612,7 +601,7 @@ mc_FLE2PrefixInsertSpec_parse(mc_FLE2PrefixInsertSpec_t *out, const bson_iter_t
|
|
612
601
|
CHECK_HAS(ub)
|
613
602
|
CHECK_HAS(lb)
|
614
603
|
if (out->ub < out->lb) {
|
615
|
-
|
604
|
+
CLIENT_ERR(ERROR_PREFIX "upper bound cannot be less than the lower bound");
|
616
605
|
goto fail;
|
617
606
|
}
|
618
607
|
return true;
|
@@ -622,7 +611,7 @@ fail:
|
|
622
611
|
|
623
612
|
#undef ERROR_PREFIX
|
624
613
|
|
625
|
-
#define ERROR_PREFIX "Error parsing FLE2TextSearchInsertSpec"
|
614
|
+
#define ERROR_PREFIX "Error parsing FLE2TextSearchInsertSpec: "
|
626
615
|
|
627
616
|
bool mc_FLE2TextSearchInsertSpec_parse(mc_FLE2TextSearchInsertSpec_t *out,
|
628
617
|
const bson_iter_t *in,
|
@@ -637,7 +626,7 @@ bool mc_FLE2TextSearchInsertSpec_parse(mc_FLE2TextSearchInsertSpec_t *out,
|
|
637
626
|
bool has_substr = false, has_suffix = false, has_prefix = false;
|
638
627
|
|
639
628
|
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
|
640
|
-
|
629
|
+
CLIENT_ERR(ERROR_PREFIX "must be an iterator to a document");
|
641
630
|
return false;
|
642
631
|
}
|
643
632
|
bson_iter_recurse(&iter, &iter);
|
@@ -646,72 +635,74 @@ bool mc_FLE2TextSearchInsertSpec_parse(mc_FLE2TextSearchInsertSpec_t *out,
|
|
646
635
|
const char *field = bson_iter_key(&iter);
|
647
636
|
BSON_ASSERT(field);
|
648
637
|
|
649
|
-
IF_FIELD(v)
|
638
|
+
IF_FIELD(v);
|
639
|
+
{
|
650
640
|
out->v = bson_iter_utf8(&iter, &out->len);
|
651
641
|
if (!out->v) {
|
652
|
-
|
653
|
-
|
642
|
+
CLIENT_ERR(ERROR_PREFIX "unsupported BSON type: %s for text search",
|
643
|
+
mc_bson_type_to_string(bson_iter_type(&iter)));
|
654
644
|
goto fail;
|
655
645
|
}
|
656
646
|
out->v_iter = iter;
|
657
647
|
}
|
658
|
-
END_IF_FIELD
|
648
|
+
END_IF_FIELD;
|
659
649
|
|
660
|
-
IF_FIELD(casef)
|
650
|
+
IF_FIELD(casef);
|
651
|
+
{
|
661
652
|
if (!BSON_ITER_HOLDS_BOOL(&iter)) {
|
662
|
-
|
653
|
+
CLIENT_ERR(ERROR_PREFIX "'casef' must be a bool");
|
663
654
|
goto fail;
|
664
655
|
}
|
665
656
|
out->casef = bson_iter_bool(&iter);
|
666
657
|
}
|
667
|
-
END_IF_FIELD
|
658
|
+
END_IF_FIELD;
|
668
659
|
|
669
|
-
IF_FIELD(diacf)
|
660
|
+
IF_FIELD(diacf);
|
661
|
+
{
|
670
662
|
if (!BSON_ITER_HOLDS_BOOL(&iter)) {
|
671
|
-
|
663
|
+
CLIENT_ERR(ERROR_PREFIX "'diacf' must be a bool");
|
672
664
|
goto fail;
|
673
665
|
}
|
674
666
|
out->diacf = bson_iter_bool(&iter);
|
675
667
|
}
|
676
|
-
END_IF_FIELD
|
668
|
+
END_IF_FIELD;
|
677
669
|
|
678
|
-
IF_FIELD(substr)
|
670
|
+
IF_FIELD(substr);
|
671
|
+
{
|
679
672
|
if (!mc_FLE2SubstringInsertSpec_parse(&out->substr.value, &iter, status)) {
|
680
673
|
goto fail;
|
681
674
|
}
|
682
675
|
out->substr.set = true;
|
683
676
|
}
|
684
|
-
END_IF_FIELD
|
677
|
+
END_IF_FIELD;
|
685
678
|
|
686
|
-
IF_FIELD(suffix)
|
679
|
+
IF_FIELD(suffix);
|
680
|
+
{
|
687
681
|
if (!mc_FLE2SuffixInsertSpec_parse(&out->suffix.value, &iter, status)) {
|
688
682
|
goto fail;
|
689
683
|
}
|
690
684
|
out->suffix.set = true;
|
691
685
|
}
|
692
|
-
END_IF_FIELD
|
686
|
+
END_IF_FIELD;
|
693
687
|
|
694
|
-
IF_FIELD(prefix)
|
688
|
+
IF_FIELD(prefix);
|
689
|
+
{
|
695
690
|
if (!mc_FLE2PrefixInsertSpec_parse(&out->prefix.value, &iter, status)) {
|
696
691
|
goto fail;
|
697
692
|
}
|
698
693
|
out->prefix.set = true;
|
699
694
|
}
|
700
|
-
END_IF_FIELD
|
695
|
+
END_IF_FIELD;
|
701
696
|
}
|
702
697
|
|
703
698
|
CHECK_HAS(v)
|
704
699
|
CHECK_HAS(casef)
|
705
700
|
CHECK_HAS(diacf)
|
706
|
-
|
707
|
-
if (!(has_substr || has_suffix || has_prefix)) {
|
708
|
-
CLIENT_ERR_PREFIXED("Must have a substring, suffix, or prefix index specification");
|
709
|
-
goto fail;
|
710
|
-
}
|
701
|
+
|
711
702
|
return true;
|
712
703
|
|
713
704
|
fail:
|
714
705
|
return false;
|
715
706
|
}
|
716
707
|
|
717
|
-
#undef ERROR_PREFIX
|
708
|
+
#undef ERROR_PREFIX
|