libmongocrypt-helper 1.7.4.0.1002 → 1.11.0.0.1001
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +40 -5
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +29 -24
- data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
- data/ext/libmongocrypt/libmongocrypt/Earthfile +522 -0
- data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +25 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +35 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +22 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +22 -7
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +50 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/{python/test/data/fle2-find-range-explicit → java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2}/int32/rangeopts.json +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -771
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +86 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
- data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
- data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
- data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +232 -296
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -31
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -254
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
- data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements-test.txt +7 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
- data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +2 -10
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +14 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +991 -343
- data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
- data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +31 -6
- data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +20 -227
- data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -0
- data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
- data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
- data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
- data/ext/libmongocrypt/libmongocrypt/etc/c6-vault.repo +39 -0
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
- data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +15 -24
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
- data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
- data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
- data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
- data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
- data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -0
- data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
- data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
- data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
- data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
- data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
- data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
- data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
- 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 +17 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
- data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +381 -436
- data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +183 -248
- data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
- data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
- data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
- data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +21 -11
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +175 -99
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +69 -70
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +445 -439
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +103 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +28 -31
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +173 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +130 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +36 -44
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +382 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +454 -325
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +56 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +520 -580
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +47 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +67 -76
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +201 -190
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +55 -42
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +809 -558
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +177 -201
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +54 -53
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +188 -240
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +43 -35
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +484 -337
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +87 -65
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +153 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
- data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
- data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +461 -499
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +256 -334
- data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
- data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
- data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +1 -9
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +442 -565
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +104 -132
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -24
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +110 -93
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1145 -1567
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +510 -476
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2775 -2697
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +189 -184
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +990 -1139
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +23 -24
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +42 -44
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +292 -272
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +70 -110
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +1010 -1033
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +127 -120
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1692 -1611
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +31 -36
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1923 -1479
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +124 -107
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +925 -419
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +99 -122
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +98 -136
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +924 -1339
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +199 -313
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +83 -79
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +64 -73
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
- data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +60 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/README.md +17 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +25 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +25 -0
- data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +279 -323
- data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +60 -73
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +129 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +248 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +421 -388
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +974 -825
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +499 -481
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +312 -148
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +249 -213
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +632 -808
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +118 -37
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +410 -445
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +798 -812
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +142 -135
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +70 -71
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +870 -1045
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +5183 -4717
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +1093 -1178
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +348 -420
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +705 -368
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +1073 -690
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +381 -451
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +55 -67
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +7 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +879 -918
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +119 -169
- data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
- data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +512 -559
- data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +771 -882
- data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
- data/lib/libmongocrypt_helper/version.rb +2 -2
- metadata +245 -111
- checksums.yaml.gz.sig +0 -0
- data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -81
- data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
- data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
- data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
- data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -39
- data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -515
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -699
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -100
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -42
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -487
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -16051
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -81
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -929
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -953
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -701
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -284
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -59
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -29
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
- data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -84
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +0 -12
- data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
- data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
- data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
- data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
- data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
- data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
- data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
- data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +0 -359
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/key-filter.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/{java/mongocrypt/src/test/resources/fle2-find-range-explicit → python/test/data/fle2-find-rangePreview-explicit}/int32/rangeopts.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{test/data/fle2-find-range-explicit/int32-nominmax → bindings/python/test/data/fle2-find-rangePreview-explicit/int32}/value-to-encrypt.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -15,25 +15,23 @@
|
|
15
15
|
import os
|
16
16
|
import os.path
|
17
17
|
import sys
|
18
|
+
from pathlib import Path
|
18
19
|
|
19
20
|
import cffi
|
21
|
+
from packaging.version import Version
|
20
22
|
|
21
|
-
from pymongocrypt.compat import PY3
|
22
23
|
from pymongocrypt.version import _MIN_LIBMONGOCRYPT_VERSION
|
23
24
|
|
24
|
-
try:
|
25
|
-
from pkg_resources import parse_version as _parse_version
|
26
|
-
except ImportError:
|
27
|
-
from distutils.version import LooseVersion as _LooseVersion
|
28
25
|
|
29
|
-
|
30
|
-
|
26
|
+
def _parse_version(version):
|
27
|
+
return Version(version)
|
31
28
|
|
32
29
|
|
33
30
|
ffi = cffi.FFI()
|
34
31
|
|
35
32
|
# Generated with strip_header.py
|
36
|
-
ffi.cdef(
|
33
|
+
ffi.cdef(
|
34
|
+
"""/*
|
37
35
|
* Copyright 2019-present MongoDB, Inc.
|
38
36
|
*
|
39
37
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -65,8 +63,17 @@ ffi.cdef("""/*
|
|
65
63
|
* @param[out] len An optional length of the returned string. May be NULL.
|
66
64
|
* @returns a NULL terminated version string for libmongocrypt.
|
67
65
|
*/
|
68
|
-
const char *
|
69
|
-
|
66
|
+
const char *mongocrypt_version(uint32_t *len);
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Returns true if libmongocrypt was built with native crypto support.
|
70
|
+
*
|
71
|
+
* If libmongocrypt was not built with native crypto support, setting crypto
|
72
|
+
* hooks is required.
|
73
|
+
*
|
74
|
+
* @returns True if libmongocrypt was built with native crypto support.
|
75
|
+
*/
|
76
|
+
bool mongocrypt_is_crypto_available(void);
|
70
77
|
|
71
78
|
/**
|
72
79
|
* A non-owning view of a byte buffer.
|
@@ -89,8 +96,14 @@ mongocrypt_version (uint32_t *len);
|
|
89
96
|
* mongocrypt_ctx_mongo_op guarantees that the viewed data of
|
90
97
|
* mongocrypt_binary_t is valid until the parent ctx is destroyed with @ref
|
91
98
|
* mongocrypt_ctx_destroy.
|
99
|
+
*
|
100
|
+
* The `mongocrypt_binary_t` struct definition is public.
|
101
|
+
* Consumers may rely on the struct layout.
|
92
102
|
*/
|
93
|
-
typedef struct _mongocrypt_binary_t
|
103
|
+
typedef struct _mongocrypt_binary_t {
|
104
|
+
void *data;
|
105
|
+
uint32_t len;
|
106
|
+
} mongocrypt_binary_t;
|
94
107
|
|
95
108
|
/**
|
96
109
|
* Create a new non-owning view of a buffer (data + length).
|
@@ -99,8 +112,7 @@ typedef struct _mongocrypt_binary_t mongocrypt_binary_t;
|
|
99
112
|
*
|
100
113
|
* @returns A new mongocrypt_binary_t.
|
101
114
|
*/
|
102
|
-
mongocrypt_binary_t *
|
103
|
-
mongocrypt_binary_new (void);
|
115
|
+
mongocrypt_binary_t *mongocrypt_binary_new(void);
|
104
116
|
|
105
117
|
/**
|
106
118
|
* Create a new non-owning view of a buffer (data + length).
|
@@ -111,8 +123,7 @@ mongocrypt_binary_new (void);
|
|
111
123
|
*
|
112
124
|
* @returns A new @ref mongocrypt_binary_t.
|
113
125
|
*/
|
114
|
-
mongocrypt_binary_t *
|
115
|
-
mongocrypt_binary_new_from_data (uint8_t *data, uint32_t len);
|
126
|
+
mongocrypt_binary_t *mongocrypt_binary_new_from_data(uint8_t *data, uint32_t len);
|
116
127
|
|
117
128
|
/**
|
118
129
|
* Get a pointer to the viewed data.
|
@@ -121,8 +132,7 @@ mongocrypt_binary_new_from_data (uint8_t *data, uint32_t len);
|
|
121
132
|
*
|
122
133
|
* @returns A pointer to the viewed data.
|
123
134
|
*/
|
124
|
-
uint8_t *
|
125
|
-
mongocrypt_binary_data (const mongocrypt_binary_t *binary);
|
135
|
+
uint8_t *mongocrypt_binary_data(const mongocrypt_binary_t *binary);
|
126
136
|
|
127
137
|
/**
|
128
138
|
* Get the length of the viewed data.
|
@@ -131,8 +141,7 @@ mongocrypt_binary_data (const mongocrypt_binary_t *binary);
|
|
131
141
|
*
|
132
142
|
* @returns The length of the viewed data.
|
133
143
|
*/
|
134
|
-
uint32_t
|
135
|
-
mongocrypt_binary_len (const mongocrypt_binary_t *binary);
|
144
|
+
uint32_t mongocrypt_binary_len(const mongocrypt_binary_t *binary);
|
136
145
|
|
137
146
|
/**
|
138
147
|
* Free the @ref mongocrypt_binary_t.
|
@@ -141,8 +150,7 @@ mongocrypt_binary_len (const mongocrypt_binary_t *binary);
|
|
141
150
|
*
|
142
151
|
* @param[in] binary The mongocrypt_binary_t destroy.
|
143
152
|
*/
|
144
|
-
void
|
145
|
-
mongocrypt_binary_destroy (mongocrypt_binary_t *binary);
|
153
|
+
void mongocrypt_binary_destroy(mongocrypt_binary_t *binary);
|
146
154
|
|
147
155
|
/**
|
148
156
|
* Indicates success or contains error information.
|
@@ -158,10 +166,10 @@ typedef struct _mongocrypt_status_t mongocrypt_status_t;
|
|
158
166
|
* Indicates the type of error.
|
159
167
|
*/
|
160
168
|
typedef enum {
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
169
|
+
MONGOCRYPT_STATUS_OK = 0,
|
170
|
+
MONGOCRYPT_STATUS_ERROR_CLIENT = 1,
|
171
|
+
MONGOCRYPT_STATUS_ERROR_KMS = 2,
|
172
|
+
MONGOCRYPT_STATUS_ERROR_CRYPT_SHARED = 3,
|
165
173
|
} mongocrypt_status_type_t;
|
166
174
|
|
167
175
|
/**
|
@@ -173,8 +181,7 @@ typedef enum {
|
|
173
181
|
*
|
174
182
|
* @returns A new status object.
|
175
183
|
*/
|
176
|
-
mongocrypt_status_t *
|
177
|
-
mongocrypt_status_new (void);
|
184
|
+
mongocrypt_status_t *mongocrypt_status_new(void);
|
178
185
|
|
179
186
|
/**
|
180
187
|
* Set a status object with message, type, and code.
|
@@ -192,12 +199,11 @@ mongocrypt_status_new (void);
|
|
192
199
|
* to determine the string's length with strlen.
|
193
200
|
*
|
194
201
|
*/
|
195
|
-
void
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
int32_t message_len);
|
202
|
+
void mongocrypt_status_set(mongocrypt_status_t *status,
|
203
|
+
mongocrypt_status_type_t type,
|
204
|
+
uint32_t code,
|
205
|
+
const char *message,
|
206
|
+
int32_t message_len);
|
201
207
|
|
202
208
|
/**
|
203
209
|
* Indicates success or the type of error.
|
@@ -206,8 +212,7 @@ mongocrypt_status_set (mongocrypt_status_t *status,
|
|
206
212
|
*
|
207
213
|
* @returns A @ref mongocrypt_status_type_t.
|
208
214
|
*/
|
209
|
-
mongocrypt_status_type_t
|
210
|
-
mongocrypt_status_type (mongocrypt_status_t *status);
|
215
|
+
mongocrypt_status_type_t mongocrypt_status_type(mongocrypt_status_t *status);
|
211
216
|
|
212
217
|
/**
|
213
218
|
* Get an error code or 0.
|
@@ -216,8 +221,7 @@ mongocrypt_status_type (mongocrypt_status_t *status);
|
|
216
221
|
*
|
217
222
|
* @returns An error code.
|
218
223
|
*/
|
219
|
-
uint32_t
|
220
|
-
mongocrypt_status_code (mongocrypt_status_t *status);
|
224
|
+
uint32_t mongocrypt_status_code(mongocrypt_status_t *status);
|
221
225
|
|
222
226
|
/**
|
223
227
|
* Get the error message associated with a status or NULL.
|
@@ -228,8 +232,7 @@ mongocrypt_status_code (mongocrypt_status_t *status);
|
|
228
232
|
*
|
229
233
|
* @returns A NULL terminated error message or NULL.
|
230
234
|
*/
|
231
|
-
const char *
|
232
|
-
mongocrypt_status_message (mongocrypt_status_t *status, uint32_t *len);
|
235
|
+
const char *mongocrypt_status_message(mongocrypt_status_t *status, uint32_t *len);
|
233
236
|
|
234
237
|
/**
|
235
238
|
* Returns true if the status indicates success.
|
@@ -239,26 +242,24 @@ mongocrypt_status_message (mongocrypt_status_t *status, uint32_t *len);
|
|
239
242
|
* @returns A boolean indicating success. If false, an error status is set.
|
240
243
|
* Retrieve it with @ref mongocrypt_ctx_status
|
241
244
|
*/
|
242
|
-
bool
|
243
|
-
mongocrypt_status_ok (mongocrypt_status_t *status);
|
245
|
+
bool mongocrypt_status_ok(mongocrypt_status_t *status);
|
244
246
|
|
245
247
|
/**
|
246
248
|
* Free the memory for a status object.
|
247
249
|
*
|
248
250
|
* @param[in] status The status to destroy.
|
249
251
|
*/
|
250
|
-
void
|
251
|
-
mongocrypt_status_destroy (mongocrypt_status_t *status);
|
252
|
+
void mongocrypt_status_destroy(mongocrypt_status_t *status);
|
252
253
|
|
253
254
|
/**
|
254
255
|
* Indicates the type of log message.
|
255
256
|
*/
|
256
257
|
typedef enum {
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
258
|
+
MONGOCRYPT_LOG_LEVEL_FATAL = 0,
|
259
|
+
MONGOCRYPT_LOG_LEVEL_ERROR = 1,
|
260
|
+
MONGOCRYPT_LOG_LEVEL_WARNING = 2,
|
261
|
+
MONGOCRYPT_LOG_LEVEL_INFO = 3,
|
262
|
+
MONGOCRYPT_LOG_LEVEL_TRACE = 4
|
262
263
|
} mongocrypt_log_level_t;
|
263
264
|
|
264
265
|
/**
|
@@ -270,10 +271,7 @@ typedef enum {
|
|
270
271
|
* @param[in] ctx A context provided by the caller of @ref
|
271
272
|
* mongocrypt_setopt_log_handler.
|
272
273
|
*/
|
273
|
-
typedef void (*mongocrypt_log_fn_t)
|
274
|
-
const char *message,
|
275
|
-
uint32_t message_len,
|
276
|
-
void *ctx);
|
274
|
+
typedef void (*mongocrypt_log_fn_t)(mongocrypt_log_level_t level, const char *message, uint32_t message_len, void *ctx);
|
277
275
|
|
278
276
|
/**
|
279
277
|
* The top-level handle to libmongocrypt.
|
@@ -298,8 +296,7 @@ typedef struct _mongocrypt_t mongocrypt_t;
|
|
298
296
|
*
|
299
297
|
* @returns A new @ref mongocrypt_t object.
|
300
298
|
*/
|
301
|
-
mongocrypt_t *
|
302
|
-
mongocrypt_new (void);
|
299
|
+
mongocrypt_t *mongocrypt_new(void);
|
303
300
|
|
304
301
|
/**
|
305
302
|
* Set a handler on the @ref mongocrypt_t object to get called on every log
|
@@ -313,10 +310,7 @@ mongocrypt_new (void);
|
|
313
310
|
* @returns A boolean indicating success. If false, an error status is set.
|
314
311
|
* Retrieve it with @ref mongocrypt_ctx_status
|
315
312
|
*/
|
316
|
-
bool
|
317
|
-
mongocrypt_setopt_log_handler (mongocrypt_t *crypt,
|
318
|
-
mongocrypt_log_fn_t log_fn,
|
319
|
-
void *log_ctx);
|
313
|
+
bool mongocrypt_setopt_log_handler(mongocrypt_t *crypt, mongocrypt_log_fn_t log_fn, void *log_ctx);
|
320
314
|
|
321
315
|
/**
|
322
316
|
* Configure an AWS KMS provider on the @ref mongocrypt_t object.
|
@@ -339,12 +333,11 @@ mongocrypt_setopt_log_handler (mongocrypt_t *crypt,
|
|
339
333
|
* @returns A boolean indicating success. If false, an error status is set.
|
340
334
|
* Retrieve it with @ref mongocrypt_ctx_status
|
341
335
|
*/
|
342
|
-
bool
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
int32_t aws_secret_access_key_len);
|
336
|
+
bool mongocrypt_setopt_kms_provider_aws(mongocrypt_t *crypt,
|
337
|
+
const char *aws_access_key_id,
|
338
|
+
int32_t aws_access_key_id_len,
|
339
|
+
const char *aws_secret_access_key,
|
340
|
+
int32_t aws_secret_access_key_len);
|
348
341
|
|
349
342
|
/**
|
350
343
|
* Configure a local KMS provider on the @ref mongocrypt_t object.
|
@@ -360,9 +353,7 @@ mongocrypt_setopt_kms_provider_aws (mongocrypt_t *crypt,
|
|
360
353
|
* @returns A boolean indicating success. If false, an error status is set.
|
361
354
|
* Retrieve it with @ref mongocrypt_ctx_status
|
362
355
|
*/
|
363
|
-
bool
|
364
|
-
mongocrypt_setopt_kms_provider_local (mongocrypt_t *crypt,
|
365
|
-
mongocrypt_binary_t *key);
|
356
|
+
bool mongocrypt_setopt_kms_provider_local(mongocrypt_t *crypt, mongocrypt_binary_t *key);
|
366
357
|
|
367
358
|
/**
|
368
359
|
* Configure KMS providers with a BSON document.
|
@@ -375,9 +366,7 @@ mongocrypt_setopt_kms_provider_local (mongocrypt_t *crypt,
|
|
375
366
|
* @returns A boolean indicating success. If false, an error status is set.
|
376
367
|
* Retrieve it with @ref mongocrypt_ctx_status
|
377
368
|
*/
|
378
|
-
bool
|
379
|
-
mongocrypt_setopt_kms_providers (mongocrypt_t *crypt,
|
380
|
-
mongocrypt_binary_t *kms_providers);
|
369
|
+
bool mongocrypt_setopt_kms_providers(mongocrypt_t *crypt, mongocrypt_binary_t *kms_providers);
|
381
370
|
|
382
371
|
/**
|
383
372
|
* Set a local schema map for encryption.
|
@@ -391,9 +380,7 @@ mongocrypt_setopt_kms_providers (mongocrypt_t *crypt,
|
|
391
380
|
* @returns A boolean indicating success. If false, an error status is set.
|
392
381
|
* Retrieve it with @ref mongocrypt_status
|
393
382
|
*/
|
394
|
-
bool
|
395
|
-
mongocrypt_setopt_schema_map (mongocrypt_t *crypt,
|
396
|
-
mongocrypt_binary_t *schema_map);
|
383
|
+
bool mongocrypt_setopt_schema_map(mongocrypt_t *crypt, mongocrypt_binary_t *schema_map);
|
397
384
|
|
398
385
|
/**
|
399
386
|
* Set a local EncryptedFieldConfigMap for encryption.
|
@@ -407,9 +394,7 @@ mongocrypt_setopt_schema_map (mongocrypt_t *crypt,
|
|
407
394
|
* @returns A boolean indicating success. If false, an error status is set.
|
408
395
|
* Retrieve it with @ref mongocrypt_status
|
409
396
|
*/
|
410
|
-
bool
|
411
|
-
mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt,
|
412
|
-
mongocrypt_binary_t *efc_map);
|
397
|
+
bool mongocrypt_setopt_encrypted_field_config_map(mongocrypt_t *crypt, mongocrypt_binary_t *efc_map);
|
413
398
|
|
414
399
|
/**
|
415
400
|
* @brief Append an additional search directory to the search path for loading
|
@@ -439,9 +424,7 @@ mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt,
|
|
439
424
|
* @ref mongocrypt_setopt_set_crypt_shared_lib_path_override, then paths
|
440
425
|
* appended here will have no effect.
|
441
426
|
*/
|
442
|
-
void
|
443
|
-
mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt,
|
444
|
-
const char *path);
|
427
|
+
void mongocrypt_setopt_append_crypt_shared_lib_search_path(mongocrypt_t *crypt, const char *path);
|
445
428
|
|
446
429
|
/**
|
447
430
|
* @brief Set a single override path for loading the crypt_shared dynamic
|
@@ -466,9 +449,7 @@ mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt,
|
|
466
449
|
* initialize a valid crypt_shared library instance for the path specified, then
|
467
450
|
* the initialization of mongocrypt_t will fail with an error.
|
468
451
|
*/
|
469
|
-
void
|
470
|
-
mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt,
|
471
|
-
const char *path);
|
452
|
+
void mongocrypt_setopt_set_crypt_shared_lib_path_override(mongocrypt_t *crypt, const char *path);
|
472
453
|
|
473
454
|
/**
|
474
455
|
* @brief Opt-into handling the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state.
|
@@ -484,8 +465,18 @@ mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt,
|
|
484
465
|
*
|
485
466
|
* @param[in] crypt The @ref mongocrypt_t object to update
|
486
467
|
*/
|
487
|
-
void
|
488
|
-
|
468
|
+
void mongocrypt_setopt_use_need_kms_credentials_state(mongocrypt_t *crypt);
|
469
|
+
|
470
|
+
/**
|
471
|
+
* @brief Opt-into handling the MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB state.
|
472
|
+
*
|
473
|
+
* A context enters the MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB state when
|
474
|
+
* processing a `bulkWrite` command. The target database of the `bulkWrite` may differ from the command database
|
475
|
+
* ("admin").
|
476
|
+
*
|
477
|
+
* @param[in] crypt The @ref mongocrypt_t object to update
|
478
|
+
*/
|
479
|
+
void mongocrypt_setopt_use_need_mongo_collinfo_with_db_state(mongocrypt_t *crypt);
|
489
480
|
|
490
481
|
/**
|
491
482
|
* Initialize new @ref mongocrypt_t object.
|
@@ -500,8 +491,7 @@ mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t *crypt);
|
|
500
491
|
* set
|
501
492
|
* options are invalid.
|
502
493
|
*/
|
503
|
-
bool
|
504
|
-
mongocrypt_init (mongocrypt_t *crypt);
|
494
|
+
bool mongocrypt_init(mongocrypt_t *crypt);
|
505
495
|
|
506
496
|
/**
|
507
497
|
* Get the status associated with a @ref mongocrypt_t object.
|
@@ -512,16 +502,14 @@ mongocrypt_init (mongocrypt_t *crypt);
|
|
512
502
|
* @returns A boolean indicating success. If false, an error status is set.
|
513
503
|
* Retrieve it with @ref mongocrypt_ctx_status
|
514
504
|
*/
|
515
|
-
bool
|
516
|
-
mongocrypt_status (mongocrypt_t *crypt, mongocrypt_status_t *status);
|
505
|
+
bool mongocrypt_status(mongocrypt_t *crypt, mongocrypt_status_t *status);
|
517
506
|
|
518
507
|
/**
|
519
508
|
* Destroy the @ref mongocrypt_t object.
|
520
509
|
*
|
521
510
|
* @param[in] crypt The @ref mongocrypt_t object to destroy.
|
522
511
|
*/
|
523
|
-
void
|
524
|
-
mongocrypt_destroy (mongocrypt_t *crypt);
|
512
|
+
void mongocrypt_destroy(mongocrypt_t *crypt);
|
525
513
|
|
526
514
|
/**
|
527
515
|
* Obtain a nul-terminated version string of the loaded crypt_shared dynamic
|
@@ -541,15 +529,13 @@ mongocrypt_destroy (mongocrypt_t *crypt);
|
|
541
529
|
* @note For a numeric value that can be compared against, use
|
542
530
|
* @ref mongocrypt_crypt_shared_lib_version.
|
543
531
|
*/
|
544
|
-
const char *
|
545
|
-
mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt,
|
546
|
-
uint32_t *len);
|
532
|
+
const char *mongocrypt_crypt_shared_lib_version_string(const mongocrypt_t *crypt, uint32_t *len);
|
547
533
|
|
548
534
|
/**
|
549
535
|
* @brief Obtain a 64-bit constant encoding the version of the loaded
|
550
536
|
* crypt_shared library, if available.
|
551
537
|
*
|
552
|
-
* @param[in] crypt The mongocrypt_t object after a
|
538
|
+
* @param[in] crypt The mongocrypt_t object after a successful call to
|
553
539
|
* mongocrypt_init.
|
554
540
|
*
|
555
541
|
* @return A 64-bit encoded version number, with the version encoded as four
|
@@ -564,8 +550,7 @@ mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt,
|
|
564
550
|
*
|
565
551
|
* For example, version 6.2.1 would be encoded as: 0x0006'0002'0001'0000
|
566
552
|
*/
|
567
|
-
uint64_t
|
568
|
-
mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt);
|
553
|
+
uint64_t mongocrypt_crypt_shared_lib_version(const mongocrypt_t *crypt);
|
569
554
|
|
570
555
|
/**
|
571
556
|
* Manages the state machine for encryption or decryption.
|
@@ -581,8 +566,7 @@ typedef struct _mongocrypt_ctx_t mongocrypt_ctx_t;
|
|
581
566
|
* @param[in] crypt The @ref mongocrypt_t object.
|
582
567
|
* @returns A new context.
|
583
568
|
*/
|
584
|
-
mongocrypt_ctx_t *
|
585
|
-
mongocrypt_ctx_new (mongocrypt_t *crypt);
|
569
|
+
mongocrypt_ctx_t *mongocrypt_ctx_new(mongocrypt_t *crypt);
|
586
570
|
|
587
571
|
/**
|
588
572
|
* Get the status associated with a @ref mongocrypt_ctx_t object.
|
@@ -595,8 +579,7 @@ mongocrypt_ctx_new (mongocrypt_t *crypt);
|
|
595
579
|
*
|
596
580
|
* @see mongocrypt_status_ok
|
597
581
|
*/
|
598
|
-
bool
|
599
|
-
mongocrypt_ctx_status (mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
|
582
|
+
bool mongocrypt_ctx_status(mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
|
600
583
|
|
601
584
|
/**
|
602
585
|
* Set the key id to use for explicit encryption.
|
@@ -612,9 +595,7 @@ mongocrypt_ctx_status (mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
|
|
612
595
|
* @returns A boolean indicating success. If false, an error status is set.
|
613
596
|
* Retrieve it with @ref mongocrypt_ctx_status
|
614
597
|
*/
|
615
|
-
bool
|
616
|
-
mongocrypt_ctx_setopt_key_id (mongocrypt_ctx_t *ctx,
|
617
|
-
mongocrypt_binary_t *key_id);
|
598
|
+
bool mongocrypt_ctx_setopt_key_id(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_id);
|
618
599
|
|
619
600
|
/**
|
620
601
|
* Set the keyAltName to use for explicit encryption or
|
@@ -638,9 +619,7 @@ mongocrypt_ctx_setopt_key_id (mongocrypt_ctx_t *ctx,
|
|
638
619
|
* @returns A boolean indicating success. If false, an error status is set.
|
639
620
|
* Retrieve it with @ref mongocrypt_ctx_status
|
640
621
|
*/
|
641
|
-
bool
|
642
|
-
mongocrypt_ctx_setopt_key_alt_name (mongocrypt_ctx_t *ctx,
|
643
|
-
mongocrypt_binary_t *key_alt_name);
|
622
|
+
bool mongocrypt_ctx_setopt_key_alt_name(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_alt_name);
|
644
623
|
|
645
624
|
/**
|
646
625
|
* Set the keyMaterial to use for encrypting data.
|
@@ -657,9 +636,7 @@ mongocrypt_ctx_setopt_key_alt_name (mongocrypt_ctx_t *ctx,
|
|
657
636
|
* @returns A boolean indicating success. If false, an error status is set.
|
658
637
|
* Retrieve it with @ref mongocrypt_ctx_status
|
659
638
|
*/
|
660
|
-
bool
|
661
|
-
mongocrypt_ctx_setopt_key_material (mongocrypt_ctx_t *ctx,
|
662
|
-
mongocrypt_binary_t *key_material);
|
639
|
+
bool mongocrypt_ctx_setopt_key_material(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_material);
|
663
640
|
|
664
641
|
/**
|
665
642
|
* Set the algorithm used for encryption to either
|
@@ -681,18 +658,14 @@ mongocrypt_ctx_setopt_key_material (mongocrypt_ctx_t *ctx,
|
|
681
658
|
* @returns A boolean indicating success. If false, an error status is set.
|
682
659
|
* Retrieve it with @ref mongocrypt_ctx_status
|
683
660
|
*/
|
684
|
-
bool
|
685
|
-
mongocrypt_ctx_setopt_algorithm (mongocrypt_ctx_t *ctx,
|
686
|
-
const char *algorithm,
|
687
|
-
int len);
|
661
|
+
bool mongocrypt_ctx_setopt_algorithm(mongocrypt_ctx_t *ctx, const char *algorithm, int len);
|
688
662
|
|
689
663
|
/// String constant for setopt_algorithm "Deterministic" encryption
|
690
664
|
/// String constant for setopt_algorithm "Random" encryption
|
691
665
|
/// String constant for setopt_algorithm "Indexed" explicit encryption
|
692
666
|
/// String constant for setopt_algorithm "Unindexed" explicit encryption
|
693
|
-
|
694
|
-
|
695
|
-
/// for public use.
|
667
|
+
// DEPRECATED: support "RangePreview" has been removed in favor of "range".
|
668
|
+
// NOTE: "Range" is currently unstable API and subject to backwards breaking changes.
|
696
669
|
|
697
670
|
/**
|
698
671
|
* Identify the AWS KMS master key to use for creating a data key.
|
@@ -712,12 +685,11 @@ mongocrypt_ctx_setopt_algorithm (mongocrypt_ctx_t *ctx,
|
|
712
685
|
* @returns A boolean indicating success. If false, an error status is set.
|
713
686
|
* Retrieve it with @ref mongocrypt_ctx_status
|
714
687
|
*/
|
715
|
-
bool
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
int32_t cmk_len);
|
688
|
+
bool mongocrypt_ctx_setopt_masterkey_aws(mongocrypt_ctx_t *ctx,
|
689
|
+
const char *region,
|
690
|
+
int32_t region_len,
|
691
|
+
const char *cmk,
|
692
|
+
int32_t cmk_len);
|
721
693
|
|
722
694
|
/**
|
723
695
|
* Identify a custom AWS endpoint when creating a data key.
|
@@ -736,10 +708,7 @@ mongocrypt_ctx_setopt_masterkey_aws (mongocrypt_ctx_t *ctx,
|
|
736
708
|
* @returns A boolean indicating success. If false, an error status is set.
|
737
709
|
* Retrieve it with @ref mongocrypt_ctx_status
|
738
710
|
*/
|
739
|
-
bool
|
740
|
-
mongocrypt_ctx_setopt_masterkey_aws_endpoint (mongocrypt_ctx_t *ctx,
|
741
|
-
const char *endpoint,
|
742
|
-
int32_t endpoint_len);
|
711
|
+
bool mongocrypt_ctx_setopt_masterkey_aws_endpoint(mongocrypt_ctx_t *ctx, const char *endpoint, int32_t endpoint_len);
|
743
712
|
|
744
713
|
/**
|
745
714
|
* Set the master key to "local" for creating a data key.
|
@@ -751,8 +720,7 @@ mongocrypt_ctx_setopt_masterkey_aws_endpoint (mongocrypt_ctx_t *ctx,
|
|
751
720
|
* @returns A boolean indicating success. If false, an error status is set.
|
752
721
|
* Retrieve it with @ref mongocrypt_ctx_status
|
753
722
|
*/
|
754
|
-
bool
|
755
|
-
mongocrypt_ctx_setopt_masterkey_local (mongocrypt_ctx_t *ctx);
|
723
|
+
bool mongocrypt_ctx_setopt_masterkey_local(mongocrypt_ctx_t *ctx);
|
756
724
|
|
757
725
|
/**
|
758
726
|
* Set key encryption key document for creating a data key or for rewrapping
|
@@ -805,9 +773,7 @@ mongocrypt_ctx_setopt_masterkey_local (mongocrypt_ctx_t *ctx);
|
|
805
773
|
* @returns A boolean indicating success. If false, an error status is set.
|
806
774
|
* Retrieve it with @ref mongocrypt_ctx_status.
|
807
775
|
*/
|
808
|
-
bool
|
809
|
-
mongocrypt_ctx_setopt_key_encryption_key (mongocrypt_ctx_t *ctx,
|
810
|
-
mongocrypt_binary_t *bin);
|
776
|
+
bool mongocrypt_ctx_setopt_key_encryption_key(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *bin);
|
811
777
|
|
812
778
|
/**
|
813
779
|
* Initialize a context to create a data key.
|
@@ -823,8 +789,7 @@ mongocrypt_ctx_setopt_key_encryption_key (mongocrypt_ctx_t *ctx,
|
|
823
789
|
* @pre A master key option has been set, and an associated KMS provider
|
824
790
|
* has been set on the parent @ref mongocrypt_t.
|
825
791
|
*/
|
826
|
-
bool
|
827
|
-
mongocrypt_ctx_datakey_init (mongocrypt_ctx_t *ctx);
|
792
|
+
bool mongocrypt_ctx_datakey_init(mongocrypt_ctx_t *ctx);
|
828
793
|
|
829
794
|
/**
|
830
795
|
* Initialize a context for encryption.
|
@@ -840,11 +805,7 @@ mongocrypt_ctx_datakey_init (mongocrypt_ctx_t *ctx);
|
|
840
805
|
* @returns A boolean indicating success. If false, an error status is set.
|
841
806
|
* Retrieve it with @ref mongocrypt_ctx_status
|
842
807
|
*/
|
843
|
-
bool
|
844
|
-
mongocrypt_ctx_encrypt_init (mongocrypt_ctx_t *ctx,
|
845
|
-
const char *db,
|
846
|
-
int32_t db_len,
|
847
|
-
mongocrypt_binary_t *cmd);
|
808
|
+
bool mongocrypt_ctx_encrypt_init(mongocrypt_ctx_t *ctx, const char *db, int32_t db_len, mongocrypt_binary_t *cmd);
|
848
809
|
|
849
810
|
/**
|
850
811
|
* Explicit helper method to encrypt a single BSON object. Contexts
|
@@ -881,16 +842,14 @@ mongocrypt_ctx_encrypt_init (mongocrypt_ctx_t *ctx,
|
|
881
842
|
* @returns A boolean indicating success. If false, an error status is set.
|
882
843
|
* Retrieve it with @ref mongocrypt_ctx_status
|
883
844
|
*/
|
884
|
-
bool
|
885
|
-
mongocrypt_ctx_explicit_encrypt_init (mongocrypt_ctx_t *ctx,
|
886
|
-
mongocrypt_binary_t *msg);
|
845
|
+
bool mongocrypt_ctx_explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
|
887
846
|
|
888
847
|
/**
|
889
848
|
* Explicit helper method to encrypt a Match Expression or Aggregate Expression.
|
890
849
|
* Contexts created for explicit encryption will not go through mongocryptd.
|
891
|
-
* Requires query_type to be "
|
892
|
-
*
|
893
|
-
*
|
850
|
+
* Requires query_type to be "range".
|
851
|
+
*
|
852
|
+
* NOTE: "range" is currently unstable API and subject to backwards breaking changes.
|
894
853
|
*
|
895
854
|
* This method expects the passed-in BSON to be of the form:
|
896
855
|
* { "v" : FLE2RangeFindDriverSpec }
|
@@ -929,9 +888,7 @@ mongocrypt_ctx_explicit_encrypt_init (mongocrypt_ctx_t *ctx,
|
|
929
888
|
* @returns A boolean indicating success. If false, an error status is set.
|
930
889
|
* Retrieve it with @ref mongocrypt_ctx_status
|
931
890
|
*/
|
932
|
-
bool
|
933
|
-
mongocrypt_ctx_explicit_encrypt_expression_init (mongocrypt_ctx_t *ctx,
|
934
|
-
mongocrypt_binary_t *msg);
|
891
|
+
bool mongocrypt_ctx_explicit_encrypt_expression_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
|
935
892
|
|
936
893
|
/**
|
937
894
|
* Initialize a context for decryption.
|
@@ -946,8 +903,7 @@ mongocrypt_ctx_explicit_encrypt_expression_init (mongocrypt_ctx_t *ctx,
|
|
946
903
|
* @returns A boolean indicating success. If false, an error status is set.
|
947
904
|
* Retrieve it with @ref mongocrypt_ctx_status
|
948
905
|
*/
|
949
|
-
bool
|
950
|
-
mongocrypt_ctx_decrypt_init (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
|
906
|
+
bool mongocrypt_ctx_decrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
|
951
907
|
|
952
908
|
/**
|
953
909
|
* Explicit helper method to decrypt a single BSON object.
|
@@ -962,9 +918,7 @@ mongocrypt_ctx_decrypt_init (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
|
|
962
918
|
* is copied. It is valid to destroy @p msg with @ref mongocrypt_binary_destroy
|
963
919
|
* immediately after.
|
964
920
|
*/
|
965
|
-
bool
|
966
|
-
mongocrypt_ctx_explicit_decrypt_init (mongocrypt_ctx_t *ctx,
|
967
|
-
mongocrypt_binary_t *msg);
|
921
|
+
bool mongocrypt_ctx_explicit_decrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
|
968
922
|
|
969
923
|
/**
|
970
924
|
* @brief Initialize a context to rewrap datakeys.
|
@@ -978,9 +932,7 @@ mongocrypt_ctx_explicit_decrypt_init (mongocrypt_ctx_t *ctx,
|
|
978
932
|
* @return A boolean indicating success. If false, an error status is set.
|
979
933
|
* Retrieve it with @ref mongocrypt_ctx_status.
|
980
934
|
*/
|
981
|
-
bool
|
982
|
-
mongocrypt_ctx_rewrap_many_datakey_init (mongocrypt_ctx_t *ctx,
|
983
|
-
mongocrypt_binary_t *filter);
|
935
|
+
bool mongocrypt_ctx_rewrap_many_datakey_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *filter);
|
984
936
|
|
985
937
|
/**
|
986
938
|
* Indicates the state of the @ref mongocrypt_ctx_t. Each state requires
|
@@ -989,14 +941,15 @@ mongocrypt_ctx_rewrap_many_datakey_init (mongocrypt_ctx_t *ctx,
|
|
989
941
|
* for information on what to do for each state.
|
990
942
|
*/
|
991
943
|
typedef enum {
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
944
|
+
MONGOCRYPT_CTX_ERROR = 0,
|
945
|
+
MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1, /* run on main MongoClient */
|
946
|
+
MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB = 8, /* run on main MongoClient */
|
947
|
+
MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2, /* run on mongocryptd. */
|
948
|
+
MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3, /* run on key vault */
|
949
|
+
MONGOCRYPT_CTX_NEED_KMS = 4,
|
950
|
+
MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7, /* fetch/renew KMS credentials */
|
951
|
+
MONGOCRYPT_CTX_READY = 5, /* ready for encryption/decryption */
|
952
|
+
MONGOCRYPT_CTX_DONE = 6,
|
1000
953
|
} mongocrypt_ctx_state_t;
|
1001
954
|
|
1002
955
|
/**
|
@@ -1005,15 +958,14 @@ typedef enum {
|
|
1005
958
|
* @param[in] ctx The @ref mongocrypt_ctx_t object.
|
1006
959
|
* @returns A @ref mongocrypt_ctx_state_t.
|
1007
960
|
*/
|
1008
|
-
mongocrypt_ctx_state_t
|
1009
|
-
mongocrypt_ctx_state (mongocrypt_ctx_t *ctx);
|
961
|
+
mongocrypt_ctx_state_t mongocrypt_ctx_state(mongocrypt_ctx_t *ctx);
|
1010
962
|
|
1011
963
|
/**
|
1012
964
|
* Get BSON necessary to run the mongo operation when mongocrypt_ctx_t
|
1013
965
|
* is in MONGOCRYPT_CTX_NEED_MONGO_* states.
|
1014
966
|
*
|
1015
967
|
* @p op_bson is a BSON document to be used for the operation.
|
1016
|
-
* - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a listCollections filter.
|
968
|
+
* - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO(_WITH_DB) it is a listCollections filter.
|
1017
969
|
* - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a find filter.
|
1018
970
|
* - For MONGOCRYPT_CTX_NEED_MONGO_MARKINGS it is a command to send to
|
1019
971
|
* mongocryptd.
|
@@ -1028,8 +980,22 @@ mongocrypt_ctx_state (mongocrypt_ctx_t *ctx);
|
|
1028
980
|
* @returns A boolean indicating success. If false, an error status is set.
|
1029
981
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1030
982
|
*/
|
1031
|
-
bool
|
1032
|
-
|
983
|
+
bool mongocrypt_ctx_mongo_op(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
|
984
|
+
|
985
|
+
/**
|
986
|
+
* Get the database to run the mongo operation.
|
987
|
+
*
|
988
|
+
* Only applies when mongocrypt_ctx_t is in the state:
|
989
|
+
* MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB.
|
990
|
+
*
|
991
|
+
* The lifetime of the returned string is tied to the lifetime of @p ctx. It is
|
992
|
+
* valid until @ref mongocrypt_ctx_destroy is called.
|
993
|
+
*
|
994
|
+
* @param[in] ctx The @ref mongocrypt_ctx_t object.
|
995
|
+
* @returns A string or NULL. If NULL, an error status is set. Retrieve it with
|
996
|
+
* @ref mongocrypt_ctx_status
|
997
|
+
*/
|
998
|
+
const char *mongocrypt_ctx_mongo_db(mongocrypt_ctx_t *ctx);
|
1033
999
|
|
1034
1000
|
/**
|
1035
1001
|
* Feed a BSON reply or result when mongocrypt_ctx_t is in
|
@@ -1037,7 +1003,7 @@ mongocrypt_ctx_mongo_op (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
|
|
1037
1003
|
* depending on the operation.
|
1038
1004
|
*
|
1039
1005
|
* reply is a BSON document result being fed back for this operation.
|
1040
|
-
* - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a doc from a listCollections
|
1006
|
+
* - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO(_WITH_DB) it is a doc from a listCollections
|
1041
1007
|
* cursor. (Note, if listCollections returned no result, do not call this
|
1042
1008
|
* function.)
|
1043
1009
|
* - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a doc from a find cursor.
|
@@ -1053,8 +1019,7 @@ mongocrypt_ctx_mongo_op (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
|
|
1053
1019
|
* @returns A boolean indicating success. If false, an error status is set.
|
1054
1020
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1055
1021
|
*/
|
1056
|
-
bool
|
1057
|
-
mongocrypt_ctx_mongo_feed (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
|
1022
|
+
bool mongocrypt_ctx_mongo_feed(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
|
1058
1023
|
|
1059
1024
|
/**
|
1060
1025
|
* Call when done feeding the reply (or replies) back to the context.
|
@@ -1063,8 +1028,7 @@ mongocrypt_ctx_mongo_feed (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
|
|
1063
1028
|
* @returns A boolean indicating success. If false, an error status is set.
|
1064
1029
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1065
1030
|
*/
|
1066
|
-
bool
|
1067
|
-
mongocrypt_ctx_mongo_done (mongocrypt_ctx_t *ctx);
|
1031
|
+
bool mongocrypt_ctx_mongo_done(mongocrypt_ctx_t *ctx);
|
1068
1032
|
|
1069
1033
|
/**
|
1070
1034
|
* Manages a single KMS HTTP request/response.
|
@@ -1084,8 +1048,7 @@ typedef struct _mongocrypt_kms_ctx_t mongocrypt_kms_ctx_t;
|
|
1084
1048
|
* @param[in] ctx A @ref mongocrypt_ctx_t.
|
1085
1049
|
* @returns a new @ref mongocrypt_kms_ctx_t or NULL.
|
1086
1050
|
*/
|
1087
|
-
mongocrypt_kms_ctx_t *
|
1088
|
-
mongocrypt_ctx_next_kms_ctx (mongocrypt_ctx_t *ctx);
|
1051
|
+
mongocrypt_kms_ctx_t *mongocrypt_ctx_next_kms_ctx(mongocrypt_ctx_t *ctx);
|
1089
1052
|
|
1090
1053
|
/**
|
1091
1054
|
* Get the HTTP request message for a KMS handle.
|
@@ -1100,9 +1063,7 @@ mongocrypt_ctx_next_kms_ctx (mongocrypt_ctx_t *ctx);
|
|
1100
1063
|
* @returns A boolean indicating success. If false, an error status is set.
|
1101
1064
|
* Retrieve it with @ref mongocrypt_kms_ctx_status
|
1102
1065
|
*/
|
1103
|
-
bool
|
1104
|
-
mongocrypt_kms_ctx_message (mongocrypt_kms_ctx_t *kms,
|
1105
|
-
mongocrypt_binary_t *msg);
|
1066
|
+
bool mongocrypt_kms_ctx_message(mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *msg);
|
1106
1067
|
|
1107
1068
|
/**
|
1108
1069
|
* Get the hostname from which to connect over TLS.
|
@@ -1118,8 +1079,7 @@ mongocrypt_kms_ctx_message (mongocrypt_kms_ctx_t *kms,
|
|
1118
1079
|
* @returns A boolean indicating success. If false, an error status is set.
|
1119
1080
|
* Retrieve it with @ref mongocrypt_kms_ctx_status
|
1120
1081
|
*/
|
1121
|
-
bool
|
1122
|
-
mongocrypt_kms_ctx_endpoint (mongocrypt_kms_ctx_t *kms, const char **endpoint);
|
1082
|
+
bool mongocrypt_kms_ctx_endpoint(mongocrypt_kms_ctx_t *kms, const char **endpoint);
|
1123
1083
|
|
1124
1084
|
/**
|
1125
1085
|
* Indicates how many bytes to feed into @ref mongocrypt_kms_ctx_feed.
|
@@ -1127,8 +1087,7 @@ mongocrypt_kms_ctx_endpoint (mongocrypt_kms_ctx_t *kms, const char **endpoint);
|
|
1127
1087
|
* @param[in] kms The @ref mongocrypt_kms_ctx_t.
|
1128
1088
|
* @returns The number of requested bytes.
|
1129
1089
|
*/
|
1130
|
-
uint32_t
|
1131
|
-
mongocrypt_kms_ctx_bytes_needed (mongocrypt_kms_ctx_t *kms);
|
1090
|
+
uint32_t mongocrypt_kms_ctx_bytes_needed(mongocrypt_kms_ctx_t *kms);
|
1132
1091
|
|
1133
1092
|
/**
|
1134
1093
|
* Feed bytes from the HTTP response.
|
@@ -1142,8 +1101,7 @@ mongocrypt_kms_ctx_bytes_needed (mongocrypt_kms_ctx_t *kms);
|
|
1142
1101
|
* @returns A boolean indicating success. If false, an error status is set.
|
1143
1102
|
* Retrieve it with @ref mongocrypt_kms_ctx_status
|
1144
1103
|
*/
|
1145
|
-
bool
|
1146
|
-
mongocrypt_kms_ctx_feed (mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
|
1104
|
+
bool mongocrypt_kms_ctx_feed(mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
|
1147
1105
|
|
1148
1106
|
/**
|
1149
1107
|
* Get the status associated with a @ref mongocrypt_kms_ctx_t object.
|
@@ -1153,9 +1111,7 @@ mongocrypt_kms_ctx_feed (mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
|
|
1153
1111
|
*
|
1154
1112
|
* @returns A boolean indicating success. If false, an error status is set.
|
1155
1113
|
*/
|
1156
|
-
bool
|
1157
|
-
mongocrypt_kms_ctx_status (mongocrypt_kms_ctx_t *kms,
|
1158
|
-
mongocrypt_status_t *status);
|
1114
|
+
bool mongocrypt_kms_ctx_status(mongocrypt_kms_ctx_t *kms, mongocrypt_status_t *status);
|
1159
1115
|
|
1160
1116
|
/**
|
1161
1117
|
* Get the KMS provider identifier associated with this KMS request.
|
@@ -1172,8 +1128,7 @@ mongocrypt_kms_ctx_status (mongocrypt_kms_ctx_t *kms,
|
|
1172
1128
|
* @returns One of the NULL terminated static strings: "aws", "azure", "gcp", or
|
1173
1129
|
* "kmip".
|
1174
1130
|
*/
|
1175
|
-
const char *
|
1176
|
-
mongocrypt_kms_ctx_get_kms_provider (mongocrypt_kms_ctx_t *kms, uint32_t *len);
|
1131
|
+
const char *mongocrypt_kms_ctx_get_kms_provider(mongocrypt_kms_ctx_t *kms, uint32_t *len);
|
1177
1132
|
|
1178
1133
|
/**
|
1179
1134
|
* Call when done handling all KMS contexts.
|
@@ -1183,8 +1138,7 @@ mongocrypt_kms_ctx_get_kms_provider (mongocrypt_kms_ctx_t *kms, uint32_t *len);
|
|
1183
1138
|
* @returns A boolean indicating success. If false, an error status is set.
|
1184
1139
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1185
1140
|
*/
|
1186
|
-
bool
|
1187
|
-
mongocrypt_ctx_kms_done (mongocrypt_ctx_t *ctx);
|
1141
|
+
bool mongocrypt_ctx_kms_done(mongocrypt_ctx_t *ctx);
|
1188
1142
|
|
1189
1143
|
/**
|
1190
1144
|
* Call in response to the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state
|
@@ -1200,9 +1154,7 @@ mongocrypt_ctx_kms_done (mongocrypt_ctx_t *ctx);
|
|
1200
1154
|
* @returns A boolean indicating success. If false, an error status is set.
|
1201
1155
|
* Retrieve it with @ref mongocrypt_ctx_status.
|
1202
1156
|
*/
|
1203
|
-
bool
|
1204
|
-
mongocrypt_ctx_provide_kms_providers (
|
1205
|
-
mongocrypt_ctx_t *ctx, mongocrypt_binary_t *kms_providers_definition);
|
1157
|
+
bool mongocrypt_ctx_provide_kms_providers(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *kms_providers_definition);
|
1206
1158
|
|
1207
1159
|
/**
|
1208
1160
|
* Perform the final encryption or decryption.
|
@@ -1240,16 +1192,14 @@ mongocrypt_ctx_provide_kms_providers (
|
|
1240
1192
|
* @returns a bool indicating success. If false, an error status is set.
|
1241
1193
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1242
1194
|
*/
|
1243
|
-
bool
|
1244
|
-
mongocrypt_ctx_finalize (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out);
|
1195
|
+
bool mongocrypt_ctx_finalize(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out);
|
1245
1196
|
|
1246
1197
|
/**
|
1247
1198
|
* Destroy and free all memory associated with a @ref mongocrypt_ctx_t.
|
1248
1199
|
*
|
1249
1200
|
* @param[in] ctx A @ref mongocrypt_ctx_t.
|
1250
1201
|
*/
|
1251
|
-
void
|
1252
|
-
mongocrypt_ctx_destroy (mongocrypt_ctx_t *ctx);
|
1202
|
+
void mongocrypt_ctx_destroy(mongocrypt_ctx_t *ctx);
|
1253
1203
|
|
1254
1204
|
/**
|
1255
1205
|
* An crypto AES-256-CBC encrypt or decrypt function.
|
@@ -1266,15 +1216,15 @@ mongocrypt_ctx_destroy (mongocrypt_ctx_t *ctx);
|
|
1266
1216
|
* @param[out] status An optional status to pass error messages. See @ref
|
1267
1217
|
* mongocrypt_status_set.
|
1268
1218
|
* @returns A boolean indicating success. If returning false, set @p status
|
1269
|
-
* with a message
|
1219
|
+
* with a message indicating the error using @ref mongocrypt_status_set.
|
1270
1220
|
*/
|
1271
|
-
typedef bool (*mongocrypt_crypto_fn)
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1221
|
+
typedef bool (*mongocrypt_crypto_fn)(void *ctx,
|
1222
|
+
mongocrypt_binary_t *key,
|
1223
|
+
mongocrypt_binary_t *iv,
|
1224
|
+
mongocrypt_binary_t *in,
|
1225
|
+
mongocrypt_binary_t *out,
|
1226
|
+
uint32_t *bytes_written,
|
1227
|
+
mongocrypt_status_t *status);
|
1278
1228
|
|
1279
1229
|
/**
|
1280
1230
|
* A crypto signature or HMAC function.
|
@@ -1291,13 +1241,13 @@ typedef bool (*mongocrypt_crypto_fn) (void *ctx,
|
|
1291
1241
|
* @param[out] status An optional status to pass error messages. See @ref
|
1292
1242
|
* mongocrypt_status_set.
|
1293
1243
|
* @returns A boolean indicating success. If returning false, set @p status
|
1294
|
-
* with a message
|
1244
|
+
* with a message indicating the error using @ref mongocrypt_status_set.
|
1295
1245
|
*/
|
1296
|
-
typedef bool (*mongocrypt_hmac_fn)
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1246
|
+
typedef bool (*mongocrypt_hmac_fn)(void *ctx,
|
1247
|
+
mongocrypt_binary_t *key,
|
1248
|
+
mongocrypt_binary_t *in,
|
1249
|
+
mongocrypt_binary_t *out,
|
1250
|
+
mongocrypt_status_t *status);
|
1301
1251
|
|
1302
1252
|
/**
|
1303
1253
|
* A crypto hash (SHA-256) function.
|
@@ -1310,12 +1260,12 @@ typedef bool (*mongocrypt_hmac_fn) (void *ctx,
|
|
1310
1260
|
* @param[out] status An optional status to pass error messages. See @ref
|
1311
1261
|
* mongocrypt_status_set.
|
1312
1262
|
* @returns A boolean indicating success. If returning false, set @p status
|
1313
|
-
* with a message
|
1263
|
+
* with a message indicating the error using @ref mongocrypt_status_set.
|
1314
1264
|
*/
|
1315
|
-
typedef bool (*mongocrypt_hash_fn)
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1265
|
+
typedef bool (*mongocrypt_hash_fn)(void *ctx,
|
1266
|
+
mongocrypt_binary_t *in,
|
1267
|
+
mongocrypt_binary_t *out,
|
1268
|
+
mongocrypt_status_t *status);
|
1319
1269
|
|
1320
1270
|
/**
|
1321
1271
|
* A crypto secure random function.
|
@@ -1328,22 +1278,18 @@ typedef bool (*mongocrypt_hash_fn) (void *ctx,
|
|
1328
1278
|
* @param[out] status An optional status to pass error messages. See @ref
|
1329
1279
|
* mongocrypt_status_set.
|
1330
1280
|
* @returns A boolean indicating success. If returning false, set @p status
|
1331
|
-
* with a message
|
1281
|
+
* with a message indicating the error using @ref mongocrypt_status_set.
|
1332
1282
|
*/
|
1333
|
-
typedef bool (*mongocrypt_random_fn)
|
1334
|
-
mongocrypt_binary_t *out,
|
1335
|
-
uint32_t count,
|
1336
|
-
mongocrypt_status_t *status);
|
1283
|
+
typedef bool (*mongocrypt_random_fn)(void *ctx, mongocrypt_binary_t *out, uint32_t count, mongocrypt_status_t *status);
|
1337
1284
|
|
1338
|
-
bool
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
void *ctx);
|
1285
|
+
bool mongocrypt_setopt_crypto_hooks(mongocrypt_t *crypt,
|
1286
|
+
mongocrypt_crypto_fn aes_256_cbc_encrypt,
|
1287
|
+
mongocrypt_crypto_fn aes_256_cbc_decrypt,
|
1288
|
+
mongocrypt_random_fn random,
|
1289
|
+
mongocrypt_hmac_fn hmac_sha_512,
|
1290
|
+
mongocrypt_hmac_fn hmac_sha_256,
|
1291
|
+
mongocrypt_hash_fn sha_256,
|
1292
|
+
void *ctx);
|
1347
1293
|
|
1348
1294
|
/**
|
1349
1295
|
* Set a crypto hook for the AES256-CTR operations.
|
@@ -1353,18 +1299,16 @@ mongocrypt_setopt_crypto_hooks (mongocrypt_t *crypt,
|
|
1353
1299
|
* operation.
|
1354
1300
|
* @param[in] aes_256_ctr_decrypt The crypto callback function for decrypt
|
1355
1301
|
* operation.
|
1356
|
-
* @param[in] ctx
|
1357
|
-
* every invocation.
|
1302
|
+
* @param[in] ctx Unused.
|
1358
1303
|
* @pre @ref mongocrypt_init has not been called on @p crypt.
|
1359
1304
|
* @returns A boolean indicating success. If false, an error status is set.
|
1360
1305
|
* Retrieve it with @ref mongocrypt_status
|
1361
1306
|
*
|
1362
1307
|
*/
|
1363
|
-
bool
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
void *ctx);
|
1308
|
+
bool mongocrypt_setopt_aes_256_ctr(mongocrypt_t *crypt,
|
1309
|
+
mongocrypt_crypto_fn aes_256_ctr_encrypt,
|
1310
|
+
mongocrypt_crypto_fn aes_256_ctr_decrypt,
|
1311
|
+
void *ctx);
|
1368
1312
|
|
1369
1313
|
/**
|
1370
1314
|
* Set an AES256-ECB crypto hook for the AES256-CTR operations. If CTR hook was
|
@@ -1374,17 +1318,13 @@ mongocrypt_setopt_aes_256_ctr (mongocrypt_t *crypt,
|
|
1374
1318
|
* @param[in] crypt The @ref mongocrypt_t object.
|
1375
1319
|
* @param[in] aes_256_ecb_encrypt The crypto callback function for encrypt
|
1376
1320
|
* operation.
|
1377
|
-
* @param[in] ctx
|
1378
|
-
* every invocation.
|
1321
|
+
* @param[in] ctx Unused.
|
1379
1322
|
* @pre @ref mongocrypt_init has not been called on @p crypt.
|
1380
1323
|
* @returns A boolean indicating success. If false, an error status is set.
|
1381
1324
|
* Retrieve it with @ref mongocrypt_status
|
1382
1325
|
*
|
1383
1326
|
*/
|
1384
|
-
bool
|
1385
|
-
mongocrypt_setopt_aes_256_ecb (mongocrypt_t *crypt,
|
1386
|
-
mongocrypt_crypto_fn aes_256_ecb_encrypt,
|
1387
|
-
void *ctx);
|
1327
|
+
bool mongocrypt_setopt_aes_256_ecb(mongocrypt_t *crypt, mongocrypt_crypto_fn aes_256_ecb_encrypt, void *ctx);
|
1388
1328
|
|
1389
1329
|
/**
|
1390
1330
|
* Set a crypto hook for the RSASSA-PKCS1-v1_5 algorithm with a SHA-256 hash.
|
@@ -1403,11 +1343,9 @@ mongocrypt_setopt_aes_256_ecb (mongocrypt_t *crypt,
|
|
1403
1343
|
* Retrieve it with @ref mongocrypt_status
|
1404
1344
|
*
|
1405
1345
|
*/
|
1406
|
-
bool
|
1407
|
-
|
1408
|
-
|
1409
|
-
mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
|
1410
|
-
void *sign_ctx);
|
1346
|
+
bool mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5(mongocrypt_t *crypt,
|
1347
|
+
mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
|
1348
|
+
void *sign_ctx);
|
1411
1349
|
|
1412
1350
|
/**
|
1413
1351
|
* @brief Opt-into skipping query analysis.
|
@@ -1418,8 +1356,18 @@ mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5 (
|
|
1418
1356
|
*
|
1419
1357
|
* @param[in] crypt The @ref mongocrypt_t object to update
|
1420
1358
|
*/
|
1421
|
-
void
|
1422
|
-
|
1359
|
+
void mongocrypt_setopt_bypass_query_analysis(mongocrypt_t *crypt);
|
1360
|
+
|
1361
|
+
/**
|
1362
|
+
* DEPRECATED: Use of `mongocrypt_setopt_use_range_v2` is deprecated. Range V2 is always enabled.
|
1363
|
+
* NOTE: "range" is currently unstable API and subject to backwards breaking changes.
|
1364
|
+
*
|
1365
|
+
* @param[in] crypt The @ref mongocrypt_t object.
|
1366
|
+
*
|
1367
|
+
* @returns A boolean indicating success. If false, an error status is set.
|
1368
|
+
* Retrieve it with @ref mongocrypt_status
|
1369
|
+
*/
|
1370
|
+
bool mongocrypt_setopt_use_range_v2(mongocrypt_t *crypt);
|
1423
1371
|
|
1424
1372
|
/**
|
1425
1373
|
* Set the contention factor used for explicit encryption.
|
@@ -1431,9 +1379,7 @@ mongocrypt_setopt_bypass_query_analysis (mongocrypt_t *crypt);
|
|
1431
1379
|
* @returns A boolean indicating success. If false, an error status is set.
|
1432
1380
|
* Retrieve it with @ref mongocrypt_ctx_status.
|
1433
1381
|
*/
|
1434
|
-
bool
|
1435
|
-
mongocrypt_ctx_setopt_contention_factor (mongocrypt_ctx_t *ctx,
|
1436
|
-
int64_t contention_factor);
|
1382
|
+
bool mongocrypt_ctx_setopt_contention_factor(mongocrypt_ctx_t *ctx, int64_t contention_factor);
|
1437
1383
|
|
1438
1384
|
/**
|
1439
1385
|
* Set the index key id to use for explicit Queryable Encryption.
|
@@ -1450,9 +1396,7 @@ mongocrypt_ctx_setopt_contention_factor (mongocrypt_ctx_t *ctx,
|
|
1450
1396
|
* @returns A boolean indicating success. If false, an error status is set.
|
1451
1397
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1452
1398
|
*/
|
1453
|
-
bool
|
1454
|
-
mongocrypt_ctx_setopt_index_key_id (mongocrypt_ctx_t *ctx,
|
1455
|
-
mongocrypt_binary_t *key_id);
|
1399
|
+
bool mongocrypt_ctx_setopt_index_key_id(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_id);
|
1456
1400
|
|
1457
1401
|
/**
|
1458
1402
|
* Set the query type to use for explicit Queryable Encryption.
|
@@ -1464,22 +1408,19 @@ mongocrypt_ctx_setopt_index_key_id (mongocrypt_ctx_t *ctx,
|
|
1464
1408
|
* @returns A boolean indicating success. If false, an error status is set.
|
1465
1409
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1466
1410
|
*/
|
1467
|
-
bool
|
1468
|
-
mongocrypt_ctx_setopt_query_type (mongocrypt_ctx_t *ctx,
|
1469
|
-
const char *query_type,
|
1470
|
-
int len);
|
1411
|
+
bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_type, int len);
|
1471
1412
|
|
1472
1413
|
/**
|
1473
|
-
* Set options for explicit encryption with the "
|
1474
|
-
* NOTE:
|
1475
|
-
* public use.
|
1414
|
+
* Set options for explicit encryption with the "range" algorithm.
|
1415
|
+
* NOTE: "range" is currently unstable API and subject to backwards breaking changes.
|
1476
1416
|
*
|
1477
1417
|
* @p opts is a BSON document of the form:
|
1478
1418
|
* {
|
1479
1419
|
* "min": Optional<BSON value>,
|
1480
1420
|
* "max": Optional<BSON value>,
|
1481
1421
|
* "sparsity": Int64,
|
1482
|
-
* "precision": Optional<Int32
|
1422
|
+
* "precision": Optional<Int32>,
|
1423
|
+
* "trimFactor": Optional<Int32>
|
1483
1424
|
* }
|
1484
1425
|
*
|
1485
1426
|
* @param[in] ctx The @ref mongocrypt_ctx_t object.
|
@@ -1488,23 +1429,18 @@ mongocrypt_ctx_setopt_query_type (mongocrypt_ctx_t *ctx,
|
|
1488
1429
|
* @returns A boolean indicating success. If false, an error status is set.
|
1489
1430
|
* Retrieve it with @ref mongocrypt_ctx_status
|
1490
1431
|
*/
|
1491
|
-
bool
|
1492
|
-
mongocrypt_ctx_setopt_algorithm_range (mongocrypt_ctx_t *ctx,
|
1493
|
-
mongocrypt_binary_t *opts);
|
1432
|
+
bool mongocrypt_ctx_setopt_algorithm_range(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *opts);
|
1494
1433
|
|
1495
1434
|
/// String constants for setopt_query_type
|
1496
|
-
//
|
1497
|
-
|
1498
|
-
"""
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
def _to_string(cdata):
|
1506
|
-
"""Decode a cdata c-string to a Python str."""
|
1507
|
-
return ffi.string(cdata)
|
1435
|
+
// DEPRECATED: Support "rangePreview" has been removed in favor of "range".
|
1436
|
+
/// NOTE: "range" is currently unstable API and subject to backwards breaking changes.
|
1437
|
+
"""
|
1438
|
+
)
|
1439
|
+
|
1440
|
+
|
1441
|
+
def _to_string(cdata):
|
1442
|
+
"""Decode a cdata c-string to a Python str."""
|
1443
|
+
return ffi.string(cdata).decode()
|
1508
1444
|
|
1509
1445
|
|
1510
1446
|
def libmongocrypt_version():
|
@@ -1518,18 +1454,19 @@ def libmongocrypt_version():
|
|
1518
1454
|
# export PYMONGOCRYPT_LIB='/path/to/libmongocrypt.so'
|
1519
1455
|
# If the PYMONGOCRYPT_LIB is not set then load the embedded library and
|
1520
1456
|
# fallback to the relying on a system installed library.
|
1521
|
-
_base =
|
1522
|
-
if sys.platform ==
|
1523
|
-
_path =
|
1524
|
-
elif sys.platform ==
|
1525
|
-
_path =
|
1457
|
+
_base = Path(os.path.realpath(__file__)).parent
|
1458
|
+
if sys.platform == "win32":
|
1459
|
+
_path = Path(_base) / "mongocrypt.dll"
|
1460
|
+
elif sys.platform == "darwin":
|
1461
|
+
_path = Path(_base) / "libmongocrypt.dylib"
|
1526
1462
|
else:
|
1527
|
-
_path =
|
1463
|
+
_path = Path(_base) / "libmongocrypt.so"
|
1528
1464
|
|
1529
1465
|
|
1530
|
-
class _Library
|
1466
|
+
class _Library:
|
1531
1467
|
"""Helper class for delaying errors that would usually be raised at
|
1532
1468
|
import time until the library is actually used."""
|
1469
|
+
|
1533
1470
|
def __init__(self, error):
|
1534
1471
|
self._error = error
|
1535
1472
|
|
@@ -1537,25 +1474,24 @@ class _Library(object):
|
|
1537
1474
|
raise self._error
|
1538
1475
|
|
1539
1476
|
|
1540
|
-
_PYMONGOCRYPT_LIB = os.environ.get(
|
1477
|
+
_PYMONGOCRYPT_LIB = os.environ.get("PYMONGOCRYPT_LIB")
|
1541
1478
|
try:
|
1542
1479
|
if _PYMONGOCRYPT_LIB:
|
1543
1480
|
lib = ffi.dlopen(_PYMONGOCRYPT_LIB)
|
1544
1481
|
else:
|
1545
1482
|
try:
|
1546
|
-
lib = ffi.dlopen(_path)
|
1547
|
-
except OSError
|
1483
|
+
lib = ffi.dlopen(str(_path))
|
1484
|
+
except OSError:
|
1548
1485
|
# Fallback to libmongocrypt installed on the system.
|
1549
|
-
lib = ffi.dlopen(
|
1486
|
+
lib = ffi.dlopen("mongocrypt")
|
1550
1487
|
except OSError as exc:
|
1551
1488
|
# dlopen raises OSError when the library cannot be found.
|
1552
1489
|
# Delay the error until the library is actually used.
|
1553
1490
|
lib = _Library(exc)
|
1554
1491
|
else:
|
1555
|
-
|
1556
|
-
_limongocrypt_version
|
1557
|
-
if _limongocrypt_version < _parse_version(_MIN_LIBMONGOCRYPT_VERSION):
|
1492
|
+
_limongocrypt_version = Version(libmongocrypt_version())
|
1493
|
+
if _limongocrypt_version < Version(_MIN_LIBMONGOCRYPT_VERSION):
|
1558
1494
|
exc = RuntimeError(
|
1559
|
-
"Expected libmongocrypt version %s or greater, found
|
1560
|
-
|
1495
|
+
f"Expected libmongocrypt version %s or greater, found {_MIN_LIBMONGOCRYPT_VERSION, libmongocrypt_version()}"
|
1496
|
+
)
|
1561
1497
|
lib = _Library(exc)
|