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.
Files changed (600) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +40 -5
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +29 -24
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
  5. data/ext/libmongocrypt/libmongocrypt/Earthfile +522 -0
  6. data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
  7. data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
  8. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +25 -6
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +35 -3
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
  15. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
  16. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
  17. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -1
  18. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
  19. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +22 -26
  22. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
  25. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
  27. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +22 -7
  28. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  29. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
  30. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
  31. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
  32. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
  33. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
  34. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
  35. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
  36. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
  37. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
  38. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
  39. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
  40. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +50 -6
  41. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  42. 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
  43. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -771
  44. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +86 -0
  45. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
  46. data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
  47. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
  48. data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
  50. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
  51. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
  52. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
  53. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
  54. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
  55. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
  56. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
  57. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +232 -296
  58. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -31
  59. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
  60. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
  61. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
  62. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
  63. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -254
  64. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
  65. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
  66. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
  67. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
  68. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
  69. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
  70. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
  71. data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
  72. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
  73. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements-test.txt +7 -0
  74. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
  75. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
  76. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
  77. data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
  78. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +2 -10
  79. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
  80. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
  81. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
  82. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
  83. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
  84. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  85. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +14 -0
  86. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
  87. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
  88. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
  89. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
  90. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
  91. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
  92. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
  93. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
  94. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
  95. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
  96. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
  97. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
  98. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +991 -343
  99. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
  100. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
  101. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +31 -6
  102. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +20 -227
  103. data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
  104. data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
  105. data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -0
  106. data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
  107. data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
  108. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
  109. data/ext/libmongocrypt/libmongocrypt/etc/c6-vault.repo +39 -0
  110. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
  111. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
  112. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
  113. data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +15 -24
  114. data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
  115. data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
  116. data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
  117. data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
  118. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
  119. data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
  120. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
  121. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
  122. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -0
  123. data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
  124. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
  125. data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
  126. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
  127. data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
  128. data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
  129. data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
  130. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
  131. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  132. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +17 -0
  133. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
  134. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
  135. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
  136. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
  137. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
  138. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
  139. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
  140. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
  141. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
  142. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
  143. data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +381 -436
  144. data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
  145. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +183 -248
  146. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
  147. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
  148. data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
  149. data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
  150. data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
  151. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
  152. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
  153. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +21 -11
  154. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +175 -99
  155. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
  156. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +69 -70
  157. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +445 -439
  158. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
  159. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
  160. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
  161. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
  162. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +103 -0
  163. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +28 -31
  164. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +173 -0
  165. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
  166. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +130 -0
  167. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +36 -44
  168. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +382 -0
  169. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
  170. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
  171. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
  172. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
  173. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +454 -325
  174. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
  175. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
  176. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
  177. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
  178. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
  179. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
  180. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
  181. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +56 -56
  182. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +520 -580
  183. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +47 -66
  184. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +67 -76
  185. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +201 -190
  186. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +55 -42
  187. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +809 -558
  188. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +177 -201
  189. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +54 -53
  190. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +188 -240
  191. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +43 -35
  192. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +484 -337
  193. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
  194. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
  195. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +87 -65
  196. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +153 -125
  197. data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
  198. data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
  199. data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
  200. data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
  201. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
  202. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +461 -499
  203. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +256 -334
  204. data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
  205. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
  206. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
  207. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
  208. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
  209. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
  210. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
  211. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +1 -9
  212. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
  213. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
  214. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +442 -565
  215. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
  216. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
  217. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
  218. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +104 -132
  219. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -24
  220. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +110 -93
  221. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
  222. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
  223. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
  224. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
  225. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
  226. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
  227. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1145 -1567
  228. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +510 -476
  229. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
  230. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2775 -2697
  231. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +189 -184
  232. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
  233. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +990 -1139
  234. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +23 -24
  235. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
  236. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
  237. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
  238. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +42 -44
  239. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +292 -272
  240. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +70 -110
  241. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +1010 -1033
  242. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
  243. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
  244. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +127 -120
  245. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1692 -1611
  246. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
  247. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
  248. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +31 -36
  249. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1923 -1479
  250. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
  251. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +124 -107
  252. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +925 -419
  253. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +99 -122
  254. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
  255. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
  256. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
  257. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
  258. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
  259. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +98 -136
  260. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +924 -1339
  261. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +199 -313
  262. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +83 -79
  263. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
  264. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +64 -73
  265. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
  266. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
  267. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
  268. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
  269. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
  270. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
  272. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
  273. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
  274. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
  276. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
  277. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
  278. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
  279. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
  280. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
  281. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
  282. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
  283. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
  284. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
  286. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
  287. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
  288. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
  289. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
  290. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
  291. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
  292. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
  293. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
  294. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
  295. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
  296. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
  297. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
  298. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
  300. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +60 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
  303. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +5 -5
  304. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
  306. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
  309. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
  310. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
  311. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
  312. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
  313. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
  314. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
  315. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
  316. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
  317. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
  318. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  319. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
  320. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
  321. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
  322. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
  323. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
  324. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
  325. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
  326. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
  327. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
  328. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
  329. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
  330. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
  331. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
  332. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
  333. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
  334. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
  335. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
  336. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
  337. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
  338. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
  339. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
  340. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
  341. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
  342. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
  343. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
  344. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
  345. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
  346. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
  347. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
  348. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
  349. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
  350. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
  351. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
  352. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
  353. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
  354. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
  355. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  356. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
  357. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
  358. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
  359. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
  360. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
  361. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
  362. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
  363. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
  364. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
  365. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
  366. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
  367. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
  368. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
  369. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
  370. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
  371. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
  372. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
  373. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
  374. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
  375. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
  376. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
  377. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
  378. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
  379. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
  380. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
  381. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
  382. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
  383. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
  384. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
  385. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
  386. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
  387. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
  388. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
  389. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
  390. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
  391. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
  392. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
  393. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
  394. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
  395. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
  396. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
  397. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
  398. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
  399. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
  400. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
  401. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
  402. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
  403. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
  404. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
  405. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
  406. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
  407. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
  408. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
  409. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
  410. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
  411. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
  412. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
  413. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
  414. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
  415. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
  416. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
  417. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
  418. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
  419. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
  420. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
  421. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
  422. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
  423. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
  424. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
  425. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
  426. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
  427. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
  428. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
  429. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
  430. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
  431. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
  432. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
  433. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
  434. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
  435. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
  436. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
  437. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/README.md +17 -0
  438. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
  439. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
  440. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
  441. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
  442. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
  443. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
  444. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
  445. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
  446. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
  447. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
  448. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +30 -0
  449. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +25 -0
  450. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +25 -0
  451. data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
  452. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +279 -323
  453. data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
  454. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
  455. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
  456. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +60 -73
  457. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
  458. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +129 -0
  459. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
  460. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
  461. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +248 -0
  462. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
  463. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
  464. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
  465. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
  466. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +421 -388
  467. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +974 -825
  468. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +499 -481
  469. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +312 -148
  470. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
  471. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +249 -213
  472. data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
  473. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +632 -808
  474. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -2
  475. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
  476. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
  477. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +118 -37
  478. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
  479. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
  480. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
  481. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +410 -445
  482. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +798 -812
  483. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +142 -135
  484. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +70 -71
  485. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
  486. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
  487. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +870 -1045
  488. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +5183 -4717
  489. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
  490. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +1093 -1178
  491. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +348 -420
  492. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
  493. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
  494. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
  495. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
  496. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
  497. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
  498. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +705 -368
  499. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
  500. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
  501. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
  502. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +1073 -690
  503. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
  504. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
  505. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +381 -451
  506. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +55 -67
  507. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +7 -10
  508. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +879 -918
  509. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +119 -169
  510. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
  511. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
  512. data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
  513. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +512 -559
  514. data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
  515. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +771 -882
  516. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
  517. data/lib/libmongocrypt_helper/version.rb +2 -2
  518. metadata +245 -111
  519. checksums.yaml.gz.sig +0 -0
  520. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
  521. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  522. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
  523. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -81
  524. data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
  525. data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
  526. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
  527. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -39
  528. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -515
  529. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
  530. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
  531. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -699
  532. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -100
  533. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
  534. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
  535. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -42
  536. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
  537. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -487
  538. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -16051
  539. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -81
  540. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -929
  541. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
  542. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -953
  543. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
  544. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -701
  545. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
  546. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -284
  547. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
  548. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
  549. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
  550. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
  551. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
  552. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
  553. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
  554. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
  555. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
  556. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
  557. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -59
  558. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -29
  559. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
  560. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
  561. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -84
  562. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  563. data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +0 -12
  564. data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
  565. data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
  566. data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
  567. data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
  568. data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
  569. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
  570. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
  571. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
  572. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
  573. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
  574. data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
  575. data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
  576. data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
  577. data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
  578. data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
  579. data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +0 -359
  580. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
  581. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
  582. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
  583. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
  584. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
  585. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
  586. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
  587. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
  588. data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
  589. data.tar.gz.sig +0 -0
  590. metadata.gz.sig +0 -0
  591. /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
  592. /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
  593. /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
  594. /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
  595. /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
  596. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
  597. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
  598. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
  599. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
  600. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -23,8 +23,8 @@
23
23
  * See all public API documentation in: @ref mongocrypt.h
24
24
  */
25
25
 
26
- #include "mongocrypt-export.h"
27
26
  #include "mongocrypt-compat.h"
27
+ #include "mongocrypt-export.h"
28
28
 
29
29
  /* clang-format off */
30
30
  #ifndef __has_include
@@ -46,9 +46,18 @@
46
46
  * @returns a NULL terminated version string for libmongocrypt.
47
47
  */
48
48
  MONGOCRYPT_EXPORT
49
- const char *
50
- mongocrypt_version (uint32_t *len);
49
+ const char *mongocrypt_version(uint32_t *len);
51
50
 
51
+ /**
52
+ * Returns true if libmongocrypt was built with native crypto support.
53
+ *
54
+ * If libmongocrypt was not built with native crypto support, setting crypto
55
+ * hooks is required.
56
+ *
57
+ * @returns True if libmongocrypt was built with native crypto support.
58
+ */
59
+ MONGOCRYPT_EXPORT
60
+ bool mongocrypt_is_crypto_available(void);
52
61
 
53
62
  /**
54
63
  * A non-owning view of a byte buffer.
@@ -71,9 +80,14 @@ mongocrypt_version (uint32_t *len);
71
80
  * mongocrypt_ctx_mongo_op guarantees that the viewed data of
72
81
  * mongocrypt_binary_t is valid until the parent ctx is destroyed with @ref
73
82
  * mongocrypt_ctx_destroy.
83
+ *
84
+ * The `mongocrypt_binary_t` struct definition is public.
85
+ * Consumers may rely on the struct layout.
74
86
  */
75
- typedef struct _mongocrypt_binary_t mongocrypt_binary_t;
76
-
87
+ typedef struct _mongocrypt_binary_t {
88
+ void *data;
89
+ uint32_t len;
90
+ } mongocrypt_binary_t;
77
91
 
78
92
  /**
79
93
  * Create a new non-owning view of a buffer (data + length).
@@ -83,9 +97,7 @@ typedef struct _mongocrypt_binary_t mongocrypt_binary_t;
83
97
  * @returns A new mongocrypt_binary_t.
84
98
  */
85
99
  MONGOCRYPT_EXPORT
86
- mongocrypt_binary_t *
87
- mongocrypt_binary_new (void);
88
-
100
+ mongocrypt_binary_t *mongocrypt_binary_new(void);
89
101
 
90
102
  /**
91
103
  * Create a new non-owning view of a buffer (data + length).
@@ -97,9 +109,7 @@ mongocrypt_binary_new (void);
97
109
  * @returns A new @ref mongocrypt_binary_t.
98
110
  */
99
111
  MONGOCRYPT_EXPORT
100
- mongocrypt_binary_t *
101
- mongocrypt_binary_new_from_data (uint8_t *data, uint32_t len);
102
-
112
+ mongocrypt_binary_t *mongocrypt_binary_new_from_data(uint8_t *data, uint32_t len);
103
113
 
104
114
  /**
105
115
  * Get a pointer to the viewed data.
@@ -109,9 +119,7 @@ mongocrypt_binary_new_from_data (uint8_t *data, uint32_t len);
109
119
  * @returns A pointer to the viewed data.
110
120
  */
111
121
  MONGOCRYPT_EXPORT
112
- uint8_t *
113
- mongocrypt_binary_data (const mongocrypt_binary_t *binary);
114
-
122
+ uint8_t *mongocrypt_binary_data(const mongocrypt_binary_t *binary);
115
123
 
116
124
  /**
117
125
  * Get the length of the viewed data.
@@ -121,9 +129,7 @@ mongocrypt_binary_data (const mongocrypt_binary_t *binary);
121
129
  * @returns The length of the viewed data.
122
130
  */
123
131
  MONGOCRYPT_EXPORT
124
- uint32_t
125
- mongocrypt_binary_len (const mongocrypt_binary_t *binary);
126
-
132
+ uint32_t mongocrypt_binary_len(const mongocrypt_binary_t *binary);
127
133
 
128
134
  /**
129
135
  * Free the @ref mongocrypt_binary_t.
@@ -133,9 +139,7 @@ mongocrypt_binary_len (const mongocrypt_binary_t *binary);
133
139
  * @param[in] binary The mongocrypt_binary_t destroy.
134
140
  */
135
141
  MONGOCRYPT_EXPORT
136
- void
137
- mongocrypt_binary_destroy (mongocrypt_binary_t *binary);
138
-
142
+ void mongocrypt_binary_destroy(mongocrypt_binary_t *binary);
139
143
 
140
144
  /**
141
145
  * Indicates success or contains error information.
@@ -151,13 +155,12 @@ typedef struct _mongocrypt_status_t mongocrypt_status_t;
151
155
  * Indicates the type of error.
152
156
  */
153
157
  typedef enum {
154
- MONGOCRYPT_STATUS_OK = 0,
155
- MONGOCRYPT_STATUS_ERROR_CLIENT = 1,
156
- MONGOCRYPT_STATUS_ERROR_KMS = 2,
157
- MONGOCRYPT_STATUS_ERROR_CRYPT_SHARED = 3,
158
+ MONGOCRYPT_STATUS_OK = 0,
159
+ MONGOCRYPT_STATUS_ERROR_CLIENT = 1,
160
+ MONGOCRYPT_STATUS_ERROR_KMS = 2,
161
+ MONGOCRYPT_STATUS_ERROR_CRYPT_SHARED = 3,
158
162
  } mongocrypt_status_type_t;
159
163
 
160
-
161
164
  /**
162
165
  * Create a new status object.
163
166
  *
@@ -168,9 +171,7 @@ typedef enum {
168
171
  * @returns A new status object.
169
172
  */
170
173
  MONGOCRYPT_EXPORT
171
- mongocrypt_status_t *
172
- mongocrypt_status_new (void);
173
-
174
+ mongocrypt_status_t *mongocrypt_status_new(void);
174
175
 
175
176
  /**
176
177
  * Set a status object with message, type, and code.
@@ -189,13 +190,11 @@ mongocrypt_status_new (void);
189
190
  *
190
191
  */
191
192
  MONGOCRYPT_EXPORT
192
- void
193
- mongocrypt_status_set (mongocrypt_status_t *status,
194
- mongocrypt_status_type_t type,
195
- uint32_t code,
196
- const char *message,
197
- int32_t message_len);
198
-
193
+ void mongocrypt_status_set(mongocrypt_status_t *status,
194
+ mongocrypt_status_type_t type,
195
+ uint32_t code,
196
+ const char *message,
197
+ int32_t message_len);
199
198
 
200
199
  /**
201
200
  * Indicates success or the type of error.
@@ -205,9 +204,7 @@ mongocrypt_status_set (mongocrypt_status_t *status,
205
204
  * @returns A @ref mongocrypt_status_type_t.
206
205
  */
207
206
  MONGOCRYPT_EXPORT
208
- mongocrypt_status_type_t
209
- mongocrypt_status_type (mongocrypt_status_t *status);
210
-
207
+ mongocrypt_status_type_t mongocrypt_status_type(mongocrypt_status_t *status);
211
208
 
212
209
  /**
213
210
  * Get an error code or 0.
@@ -217,9 +214,7 @@ mongocrypt_status_type (mongocrypt_status_t *status);
217
214
  * @returns An error code.
218
215
  */
219
216
  MONGOCRYPT_EXPORT
220
- uint32_t
221
- mongocrypt_status_code (mongocrypt_status_t *status);
222
-
217
+ uint32_t mongocrypt_status_code(mongocrypt_status_t *status);
223
218
 
224
219
  /**
225
220
  * Get the error message associated with a status or NULL.
@@ -231,9 +226,7 @@ mongocrypt_status_code (mongocrypt_status_t *status);
231
226
  * @returns A NULL terminated error message or NULL.
232
227
  */
233
228
  MONGOCRYPT_EXPORT
234
- const char *
235
- mongocrypt_status_message (mongocrypt_status_t *status, uint32_t *len);
236
-
229
+ const char *mongocrypt_status_message(mongocrypt_status_t *status, uint32_t *len);
237
230
 
238
231
  /**
239
232
  * Returns true if the status indicates success.
@@ -244,9 +237,7 @@ mongocrypt_status_message (mongocrypt_status_t *status, uint32_t *len);
244
237
  * Retrieve it with @ref mongocrypt_ctx_status
245
238
  */
246
239
  MONGOCRYPT_EXPORT
247
- bool
248
- mongocrypt_status_ok (mongocrypt_status_t *status);
249
-
240
+ bool mongocrypt_status_ok(mongocrypt_status_t *status);
250
241
 
251
242
  /**
252
243
  * Free the memory for a status object.
@@ -254,21 +245,19 @@ mongocrypt_status_ok (mongocrypt_status_t *status);
254
245
  * @param[in] status The status to destroy.
255
246
  */
256
247
  MONGOCRYPT_EXPORT
257
- void
258
- mongocrypt_status_destroy (mongocrypt_status_t *status);
248
+ void mongocrypt_status_destroy(mongocrypt_status_t *status);
259
249
 
260
250
  /**
261
251
  * Indicates the type of log message.
262
252
  */
263
253
  typedef enum {
264
- MONGOCRYPT_LOG_LEVEL_FATAL = 0,
265
- MONGOCRYPT_LOG_LEVEL_ERROR = 1,
266
- MONGOCRYPT_LOG_LEVEL_WARNING = 2,
267
- MONGOCRYPT_LOG_LEVEL_INFO = 3,
268
- MONGOCRYPT_LOG_LEVEL_TRACE = 4
254
+ MONGOCRYPT_LOG_LEVEL_FATAL = 0,
255
+ MONGOCRYPT_LOG_LEVEL_ERROR = 1,
256
+ MONGOCRYPT_LOG_LEVEL_WARNING = 2,
257
+ MONGOCRYPT_LOG_LEVEL_INFO = 3,
258
+ MONGOCRYPT_LOG_LEVEL_TRACE = 4
269
259
  } mongocrypt_log_level_t;
270
260
 
271
-
272
261
  /**
273
262
  * A log callback function. Set a custom log callback with @ref
274
263
  * mongocrypt_setopt_log_handler.
@@ -278,11 +267,7 @@ typedef enum {
278
267
  * @param[in] ctx A context provided by the caller of @ref
279
268
  * mongocrypt_setopt_log_handler.
280
269
  */
281
- typedef void (*mongocrypt_log_fn_t) (mongocrypt_log_level_t level,
282
- const char *message,
283
- uint32_t message_len,
284
- void *ctx);
285
-
270
+ typedef void (*mongocrypt_log_fn_t)(mongocrypt_log_level_t level, const char *message, uint32_t message_len, void *ctx);
286
271
 
287
272
  /**
288
273
  * The top-level handle to libmongocrypt.
@@ -298,7 +283,6 @@ typedef void (*mongocrypt_log_fn_t) (mongocrypt_log_level_t level,
298
283
  */
299
284
  typedef struct _mongocrypt_t mongocrypt_t;
300
285
 
301
-
302
286
  /**
303
287
  * Allocate a new @ref mongocrypt_t object.
304
288
  *
@@ -309,9 +293,7 @@ typedef struct _mongocrypt_t mongocrypt_t;
309
293
  * @returns A new @ref mongocrypt_t object.
310
294
  */
311
295
  MONGOCRYPT_EXPORT
312
- mongocrypt_t *
313
- mongocrypt_new (void);
314
-
296
+ mongocrypt_t *mongocrypt_new(void);
315
297
 
316
298
  /**
317
299
  * Set a handler on the @ref mongocrypt_t object to get called on every log
@@ -326,11 +308,7 @@ mongocrypt_new (void);
326
308
  * Retrieve it with @ref mongocrypt_ctx_status
327
309
  */
328
310
  MONGOCRYPT_EXPORT
329
- bool
330
- mongocrypt_setopt_log_handler (mongocrypt_t *crypt,
331
- mongocrypt_log_fn_t log_fn,
332
- void *log_ctx);
333
-
311
+ bool mongocrypt_setopt_log_handler(mongocrypt_t *crypt, mongocrypt_log_fn_t log_fn, void *log_ctx);
334
312
 
335
313
  /**
336
314
  * Configure an AWS KMS provider on the @ref mongocrypt_t object.
@@ -354,13 +332,11 @@ mongocrypt_setopt_log_handler (mongocrypt_t *crypt,
354
332
  * Retrieve it with @ref mongocrypt_ctx_status
355
333
  */
356
334
  MONGOCRYPT_EXPORT
357
- bool
358
- mongocrypt_setopt_kms_provider_aws (mongocrypt_t *crypt,
359
- const char *aws_access_key_id,
360
- int32_t aws_access_key_id_len,
361
- const char *aws_secret_access_key,
362
- int32_t aws_secret_access_key_len);
363
-
335
+ bool mongocrypt_setopt_kms_provider_aws(mongocrypt_t *crypt,
336
+ const char *aws_access_key_id,
337
+ int32_t aws_access_key_id_len,
338
+ const char *aws_secret_access_key,
339
+ int32_t aws_secret_access_key_len);
364
340
 
365
341
  /**
366
342
  * Configure a local KMS provider on the @ref mongocrypt_t object.
@@ -377,9 +353,7 @@ mongocrypt_setopt_kms_provider_aws (mongocrypt_t *crypt,
377
353
  * Retrieve it with @ref mongocrypt_ctx_status
378
354
  */
379
355
  MONGOCRYPT_EXPORT
380
- bool
381
- mongocrypt_setopt_kms_provider_local (mongocrypt_t *crypt,
382
- mongocrypt_binary_t *key);
356
+ bool mongocrypt_setopt_kms_provider_local(mongocrypt_t *crypt, mongocrypt_binary_t *key);
383
357
 
384
358
  /**
385
359
  * Configure KMS providers with a BSON document.
@@ -393,9 +367,7 @@ mongocrypt_setopt_kms_provider_local (mongocrypt_t *crypt,
393
367
  * Retrieve it with @ref mongocrypt_ctx_status
394
368
  */
395
369
  MONGOCRYPT_EXPORT
396
- bool
397
- mongocrypt_setopt_kms_providers (mongocrypt_t *crypt,
398
- mongocrypt_binary_t *kms_providers);
370
+ bool mongocrypt_setopt_kms_providers(mongocrypt_t *crypt, mongocrypt_binary_t *kms_providers);
399
371
 
400
372
  /**
401
373
  * Set a local schema map for encryption.
@@ -410,9 +382,7 @@ mongocrypt_setopt_kms_providers (mongocrypt_t *crypt,
410
382
  * Retrieve it with @ref mongocrypt_status
411
383
  */
412
384
  MONGOCRYPT_EXPORT
413
- bool
414
- mongocrypt_setopt_schema_map (mongocrypt_t *crypt,
415
- mongocrypt_binary_t *schema_map);
385
+ bool mongocrypt_setopt_schema_map(mongocrypt_t *crypt, mongocrypt_binary_t *schema_map);
416
386
 
417
387
  /**
418
388
  * Set a local EncryptedFieldConfigMap for encryption.
@@ -427,10 +397,7 @@ mongocrypt_setopt_schema_map (mongocrypt_t *crypt,
427
397
  * Retrieve it with @ref mongocrypt_status
428
398
  */
429
399
  MONGOCRYPT_EXPORT
430
- bool
431
- mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt,
432
- mongocrypt_binary_t *efc_map);
433
-
400
+ bool mongocrypt_setopt_encrypted_field_config_map(mongocrypt_t *crypt, mongocrypt_binary_t *efc_map);
434
401
 
435
402
  /**
436
403
  * @brief Append an additional search directory to the search path for loading
@@ -461,10 +428,7 @@ mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt,
461
428
  * appended here will have no effect.
462
429
  */
463
430
  MONGOCRYPT_EXPORT
464
- void
465
- mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt,
466
- const char *path);
467
-
431
+ void mongocrypt_setopt_append_crypt_shared_lib_search_path(mongocrypt_t *crypt, const char *path);
468
432
 
469
433
  /**
470
434
  * @brief Set a single override path for loading the crypt_shared dynamic
@@ -490,10 +454,7 @@ mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt,
490
454
  * the initialization of mongocrypt_t will fail with an error.
491
455
  */
492
456
  MONGOCRYPT_EXPORT
493
- void
494
- mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt,
495
- const char *path);
496
-
457
+ void mongocrypt_setopt_set_crypt_shared_lib_path_override(mongocrypt_t *crypt, const char *path);
497
458
 
498
459
  /**
499
460
  * @brief Opt-into handling the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state.
@@ -510,9 +471,19 @@ mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt,
510
471
  * @param[in] crypt The @ref mongocrypt_t object to update
511
472
  */
512
473
  MONGOCRYPT_EXPORT
513
- void
514
- mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t *crypt);
474
+ void mongocrypt_setopt_use_need_kms_credentials_state(mongocrypt_t *crypt);
515
475
 
476
+ /**
477
+ * @brief Opt-into handling the MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB state.
478
+ *
479
+ * A context enters the MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB state when
480
+ * processing a `bulkWrite` command. The target database of the `bulkWrite` may differ from the command database
481
+ * ("admin").
482
+ *
483
+ * @param[in] crypt The @ref mongocrypt_t object to update
484
+ */
485
+ MONGOCRYPT_EXPORT
486
+ void mongocrypt_setopt_use_need_mongo_collinfo_with_db_state(mongocrypt_t *crypt);
516
487
 
517
488
  /**
518
489
  * Initialize new @ref mongocrypt_t object.
@@ -528,9 +499,7 @@ mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t *crypt);
528
499
  * options are invalid.
529
500
  */
530
501
  MONGOCRYPT_EXPORT
531
- bool
532
- mongocrypt_init (mongocrypt_t *crypt);
533
-
502
+ bool mongocrypt_init(mongocrypt_t *crypt);
534
503
 
535
504
  /**
536
505
  * Get the status associated with a @ref mongocrypt_t object.
@@ -542,9 +511,7 @@ mongocrypt_init (mongocrypt_t *crypt);
542
511
  * Retrieve it with @ref mongocrypt_ctx_status
543
512
  */
544
513
  MONGOCRYPT_EXPORT
545
- bool
546
- mongocrypt_status (mongocrypt_t *crypt, mongocrypt_status_t *status);
547
-
514
+ bool mongocrypt_status(mongocrypt_t *crypt, mongocrypt_status_t *status);
548
515
 
549
516
  /**
550
517
  * Destroy the @ref mongocrypt_t object.
@@ -552,8 +519,7 @@ mongocrypt_status (mongocrypt_t *crypt, mongocrypt_status_t *status);
552
519
  * @param[in] crypt The @ref mongocrypt_t object to destroy.
553
520
  */
554
521
  MONGOCRYPT_EXPORT
555
- void
556
- mongocrypt_destroy (mongocrypt_t *crypt);
522
+ void mongocrypt_destroy(mongocrypt_t *crypt);
557
523
 
558
524
  /**
559
525
  * Obtain a nul-terminated version string of the loaded crypt_shared dynamic
@@ -574,10 +540,7 @@ mongocrypt_destroy (mongocrypt_t *crypt);
574
540
  * @ref mongocrypt_crypt_shared_lib_version.
575
541
  */
576
542
  MONGOCRYPT_EXPORT
577
- const char *
578
- mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt,
579
- uint32_t *len);
580
-
543
+ const char *mongocrypt_crypt_shared_lib_version_string(const mongocrypt_t *crypt, uint32_t *len);
581
544
 
582
545
  /**
583
546
  * @brief Obtain a 64-bit constant encoding the version of the loaded
@@ -599,16 +562,13 @@ mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt,
599
562
  * For example, version 6.2.1 would be encoded as: 0x0006'0002'0001'0000
600
563
  */
601
564
  MONGOCRYPT_EXPORT
602
- uint64_t
603
- mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt);
604
-
565
+ uint64_t mongocrypt_crypt_shared_lib_version(const mongocrypt_t *crypt);
605
566
 
606
567
  /**
607
568
  * Manages the state machine for encryption or decryption.
608
569
  */
609
570
  typedef struct _mongocrypt_ctx_t mongocrypt_ctx_t;
610
571
 
611
-
612
572
  /**
613
573
  * Create a new uninitialized @ref mongocrypt_ctx_t.
614
574
  *
@@ -619,9 +579,7 @@ typedef struct _mongocrypt_ctx_t mongocrypt_ctx_t;
619
579
  * @returns A new context.
620
580
  */
621
581
  MONGOCRYPT_EXPORT
622
- mongocrypt_ctx_t *
623
- mongocrypt_ctx_new (mongocrypt_t *crypt);
624
-
582
+ mongocrypt_ctx_t *mongocrypt_ctx_new(mongocrypt_t *crypt);
625
583
 
626
584
  /**
627
585
  * Get the status associated with a @ref mongocrypt_ctx_t object.
@@ -635,9 +593,7 @@ mongocrypt_ctx_new (mongocrypt_t *crypt);
635
593
  * @see mongocrypt_status_ok
636
594
  */
637
595
  MONGOCRYPT_EXPORT
638
- bool
639
- mongocrypt_ctx_status (mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
640
-
596
+ bool mongocrypt_ctx_status(mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
641
597
 
642
598
  /**
643
599
  * Set the key id to use for explicit encryption.
@@ -654,9 +610,7 @@ mongocrypt_ctx_status (mongocrypt_ctx_t *ctx, mongocrypt_status_t *status);
654
610
  * Retrieve it with @ref mongocrypt_ctx_status
655
611
  */
656
612
  MONGOCRYPT_EXPORT
657
- bool
658
- mongocrypt_ctx_setopt_key_id (mongocrypt_ctx_t *ctx,
659
- mongocrypt_binary_t *key_id);
613
+ bool mongocrypt_ctx_setopt_key_id(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_id);
660
614
 
661
615
  /**
662
616
  * Set the keyAltName to use for explicit encryption or
@@ -681,9 +635,7 @@ mongocrypt_ctx_setopt_key_id (mongocrypt_ctx_t *ctx,
681
635
  * Retrieve it with @ref mongocrypt_ctx_status
682
636
  */
683
637
  MONGOCRYPT_EXPORT
684
- bool
685
- mongocrypt_ctx_setopt_key_alt_name (mongocrypt_ctx_t *ctx,
686
- mongocrypt_binary_t *key_alt_name);
638
+ bool mongocrypt_ctx_setopt_key_alt_name(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_alt_name);
687
639
 
688
640
  /**
689
641
  * Set the keyMaterial to use for encrypting data.
@@ -701,9 +653,7 @@ mongocrypt_ctx_setopt_key_alt_name (mongocrypt_ctx_t *ctx,
701
653
  * Retrieve it with @ref mongocrypt_ctx_status
702
654
  */
703
655
  MONGOCRYPT_EXPORT
704
- bool
705
- mongocrypt_ctx_setopt_key_material (mongocrypt_ctx_t *ctx,
706
- mongocrypt_binary_t *key_material);
656
+ bool mongocrypt_ctx_setopt_key_material(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_material);
707
657
 
708
658
  /**
709
659
  * Set the algorithm used for encryption to either
@@ -726,25 +676,19 @@ mongocrypt_ctx_setopt_key_material (mongocrypt_ctx_t *ctx,
726
676
  * Retrieve it with @ref mongocrypt_ctx_status
727
677
  */
728
678
  MONGOCRYPT_EXPORT
729
- bool
730
- mongocrypt_ctx_setopt_algorithm (mongocrypt_ctx_t *ctx,
731
- const char *algorithm,
732
- int len);
679
+ bool mongocrypt_ctx_setopt_algorithm(mongocrypt_ctx_t *ctx, const char *algorithm, int len);
733
680
 
734
681
  /// String constant for setopt_algorithm "Deterministic" encryption
735
- #define MONGOCRYPT_ALGORITHM_DETERMINISTIC_STR \
736
- "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
682
+ #define MONGOCRYPT_ALGORITHM_DETERMINISTIC_STR "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
737
683
  /// String constant for setopt_algorithm "Random" encryption
738
684
  #define MONGOCRYPT_ALGORITHM_RANDOM_STR "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
739
685
  /// String constant for setopt_algorithm "Indexed" explicit encryption
740
686
  #define MONGOCRYPT_ALGORITHM_INDEXED_STR "Indexed"
741
687
  /// String constant for setopt_algorithm "Unindexed" explicit encryption
742
688
  #define MONGOCRYPT_ALGORITHM_UNINDEXED_STR "Unindexed"
743
- /// String constant for setopt_algorithm "rangePreview" explicit encryption
744
- /// NOTE: The RangePreview algorithm is experimental only. It is not intended
745
- /// for public use.
746
- #define MONGOCRYPT_ALGORITHM_RANGEPREVIEW_STR "RangePreview"
747
-
689
+ // DEPRECATED: support "RangePreview" has been removed in favor of "range".
690
+ #define MONGOCRYPT_ALGORITHM_RANGEPREVIEW_DEPRECATED_STR "RangePreview"
691
+ #define MONGOCRYPT_ALGORITHM_RANGE_STR "Range"
748
692
 
749
693
  /**
750
694
  * Identify the AWS KMS master key to use for creating a data key.
@@ -765,13 +709,11 @@ mongocrypt_ctx_setopt_algorithm (mongocrypt_ctx_t *ctx,
765
709
  * Retrieve it with @ref mongocrypt_ctx_status
766
710
  */
767
711
  MONGOCRYPT_EXPORT
768
- bool
769
- mongocrypt_ctx_setopt_masterkey_aws (mongocrypt_ctx_t *ctx,
770
- const char *region,
771
- int32_t region_len,
772
- const char *cmk,
773
- int32_t cmk_len);
774
-
712
+ bool mongocrypt_ctx_setopt_masterkey_aws(mongocrypt_ctx_t *ctx,
713
+ const char *region,
714
+ int32_t region_len,
715
+ const char *cmk,
716
+ int32_t cmk_len);
775
717
 
776
718
  /**
777
719
  * Identify a custom AWS endpoint when creating a data key.
@@ -791,10 +733,7 @@ mongocrypt_ctx_setopt_masterkey_aws (mongocrypt_ctx_t *ctx,
791
733
  * Retrieve it with @ref mongocrypt_ctx_status
792
734
  */
793
735
  MONGOCRYPT_EXPORT
794
- bool
795
- mongocrypt_ctx_setopt_masterkey_aws_endpoint (mongocrypt_ctx_t *ctx,
796
- const char *endpoint,
797
- int32_t endpoint_len);
736
+ bool mongocrypt_ctx_setopt_masterkey_aws_endpoint(mongocrypt_ctx_t *ctx, const char *endpoint, int32_t endpoint_len);
798
737
 
799
738
  /**
800
739
  * Set the master key to "local" for creating a data key.
@@ -807,8 +746,7 @@ mongocrypt_ctx_setopt_masterkey_aws_endpoint (mongocrypt_ctx_t *ctx,
807
746
  * Retrieve it with @ref mongocrypt_ctx_status
808
747
  */
809
748
  MONGOCRYPT_EXPORT
810
- bool
811
- mongocrypt_ctx_setopt_masterkey_local (mongocrypt_ctx_t *ctx);
749
+ bool mongocrypt_ctx_setopt_masterkey_local(mongocrypt_ctx_t *ctx);
812
750
 
813
751
  /**
814
752
  * Set key encryption key document for creating a data key or for rewrapping
@@ -862,10 +800,7 @@ mongocrypt_ctx_setopt_masterkey_local (mongocrypt_ctx_t *ctx);
862
800
  * Retrieve it with @ref mongocrypt_ctx_status.
863
801
  */
864
802
  MONGOCRYPT_EXPORT
865
- bool
866
- mongocrypt_ctx_setopt_key_encryption_key (mongocrypt_ctx_t *ctx,
867
- mongocrypt_binary_t *bin);
868
-
803
+ bool mongocrypt_ctx_setopt_key_encryption_key(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *bin);
869
804
 
870
805
  /**
871
806
  * Initialize a context to create a data key.
@@ -882,8 +817,7 @@ mongocrypt_ctx_setopt_key_encryption_key (mongocrypt_ctx_t *ctx,
882
817
  * has been set on the parent @ref mongocrypt_t.
883
818
  */
884
819
  MONGOCRYPT_EXPORT
885
- bool
886
- mongocrypt_ctx_datakey_init (mongocrypt_ctx_t *ctx);
820
+ bool mongocrypt_ctx_datakey_init(mongocrypt_ctx_t *ctx);
887
821
 
888
822
  /**
889
823
  * Initialize a context for encryption.
@@ -900,11 +834,7 @@ mongocrypt_ctx_datakey_init (mongocrypt_ctx_t *ctx);
900
834
  * Retrieve it with @ref mongocrypt_ctx_status
901
835
  */
902
836
  MONGOCRYPT_EXPORT
903
- bool
904
- mongocrypt_ctx_encrypt_init (mongocrypt_ctx_t *ctx,
905
- const char *db,
906
- int32_t db_len,
907
- mongocrypt_binary_t *cmd);
837
+ bool mongocrypt_ctx_encrypt_init(mongocrypt_ctx_t *ctx, const char *db, int32_t db_len, mongocrypt_binary_t *cmd);
908
838
 
909
839
  /**
910
840
  * Explicit helper method to encrypt a single BSON object. Contexts
@@ -942,16 +872,12 @@ mongocrypt_ctx_encrypt_init (mongocrypt_ctx_t *ctx,
942
872
  * Retrieve it with @ref mongocrypt_ctx_status
943
873
  */
944
874
  MONGOCRYPT_EXPORT
945
- bool
946
- mongocrypt_ctx_explicit_encrypt_init (mongocrypt_ctx_t *ctx,
947
- mongocrypt_binary_t *msg);
875
+ bool mongocrypt_ctx_explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
948
876
 
949
877
  /**
950
878
  * Explicit helper method to encrypt a Match Expression or Aggregate Expression.
951
879
  * Contexts created for explicit encryption will not go through mongocryptd.
952
- * Requires query_type to be "rangePreview".
953
- * NOTE: The RangePreview algorithm is experimental only. It is not intended for
954
- * public use.
880
+ * Requires query_type to be "range".
955
881
  *
956
882
  * This method expects the passed-in BSON to be of the form:
957
883
  * { "v" : FLE2RangeFindDriverSpec }
@@ -991,10 +917,7 @@ mongocrypt_ctx_explicit_encrypt_init (mongocrypt_ctx_t *ctx,
991
917
  * Retrieve it with @ref mongocrypt_ctx_status
992
918
  */
993
919
  MONGOCRYPT_EXPORT
994
- bool
995
- mongocrypt_ctx_explicit_encrypt_expression_init (mongocrypt_ctx_t *ctx,
996
- mongocrypt_binary_t *msg);
997
-
920
+ bool mongocrypt_ctx_explicit_encrypt_expression_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
998
921
 
999
922
  /**
1000
923
  * Initialize a context for decryption.
@@ -1010,9 +933,7 @@ mongocrypt_ctx_explicit_encrypt_expression_init (mongocrypt_ctx_t *ctx,
1010
933
  * Retrieve it with @ref mongocrypt_ctx_status
1011
934
  */
1012
935
  MONGOCRYPT_EXPORT
1013
- bool
1014
- mongocrypt_ctx_decrypt_init (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
1015
-
936
+ bool mongocrypt_ctx_decrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
1016
937
 
1017
938
  /**
1018
939
  * Explicit helper method to decrypt a single BSON object.
@@ -1028,10 +949,7 @@ mongocrypt_ctx_decrypt_init (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *doc);
1028
949
  * immediately after.
1029
950
  */
1030
951
  MONGOCRYPT_EXPORT
1031
- bool
1032
- mongocrypt_ctx_explicit_decrypt_init (mongocrypt_ctx_t *ctx,
1033
- mongocrypt_binary_t *msg);
1034
-
952
+ bool mongocrypt_ctx_explicit_decrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *msg);
1035
953
 
1036
954
  /**
1037
955
  * @brief Initialize a context to rewrap datakeys.
@@ -1046,10 +964,7 @@ mongocrypt_ctx_explicit_decrypt_init (mongocrypt_ctx_t *ctx,
1046
964
  * Retrieve it with @ref mongocrypt_ctx_status.
1047
965
  */
1048
966
  MONGOCRYPT_EXPORT
1049
- bool
1050
- mongocrypt_ctx_rewrap_many_datakey_init (mongocrypt_ctx_t *ctx,
1051
- mongocrypt_binary_t *filter);
1052
-
967
+ bool mongocrypt_ctx_rewrap_many_datakey_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *filter);
1053
968
 
1054
969
  /**
1055
970
  * Indicates the state of the @ref mongocrypt_ctx_t. Each state requires
@@ -1058,17 +973,17 @@ mongocrypt_ctx_rewrap_many_datakey_init (mongocrypt_ctx_t *ctx,
1058
973
  * for information on what to do for each state.
1059
974
  */
1060
975
  typedef enum {
1061
- MONGOCRYPT_CTX_ERROR = 0,
1062
- MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1, /* run on main MongoClient */
1063
- MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2, /* run on mongocryptd. */
1064
- MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3, /* run on key vault */
1065
- MONGOCRYPT_CTX_NEED_KMS = 4,
1066
- MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7, /* fetch/renew KMS credentials */
1067
- MONGOCRYPT_CTX_READY = 5, /* ready for encryption/decryption */
1068
- MONGOCRYPT_CTX_DONE = 6,
976
+ MONGOCRYPT_CTX_ERROR = 0,
977
+ MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1, /* run on main MongoClient */
978
+ MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB = 8, /* run on main MongoClient */
979
+ MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2, /* run on mongocryptd. */
980
+ MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3, /* run on key vault */
981
+ MONGOCRYPT_CTX_NEED_KMS = 4,
982
+ MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7, /* fetch/renew KMS credentials */
983
+ MONGOCRYPT_CTX_READY = 5, /* ready for encryption/decryption */
984
+ MONGOCRYPT_CTX_DONE = 6,
1069
985
  } mongocrypt_ctx_state_t;
1070
986
 
1071
-
1072
987
  /**
1073
988
  * Get the current state of a context.
1074
989
  *
@@ -1076,16 +991,14 @@ typedef enum {
1076
991
  * @returns A @ref mongocrypt_ctx_state_t.
1077
992
  */
1078
993
  MONGOCRYPT_EXPORT
1079
- mongocrypt_ctx_state_t
1080
- mongocrypt_ctx_state (mongocrypt_ctx_t *ctx);
1081
-
994
+ mongocrypt_ctx_state_t mongocrypt_ctx_state(mongocrypt_ctx_t *ctx);
1082
995
 
1083
996
  /**
1084
997
  * Get BSON necessary to run the mongo operation when mongocrypt_ctx_t
1085
998
  * is in MONGOCRYPT_CTX_NEED_MONGO_* states.
1086
999
  *
1087
1000
  * @p op_bson is a BSON document to be used for the operation.
1088
- * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a listCollections filter.
1001
+ * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO(_WITH_DB) it is a listCollections filter.
1089
1002
  * - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a find filter.
1090
1003
  * - For MONGOCRYPT_CTX_NEED_MONGO_MARKINGS it is a command to send to
1091
1004
  * mongocryptd.
@@ -1101,9 +1014,23 @@ mongocrypt_ctx_state (mongocrypt_ctx_t *ctx);
1101
1014
  * Retrieve it with @ref mongocrypt_ctx_status
1102
1015
  */
1103
1016
  MONGOCRYPT_EXPORT
1104
- bool
1105
- mongocrypt_ctx_mongo_op (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
1017
+ bool mongocrypt_ctx_mongo_op(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
1106
1018
 
1019
+ /**
1020
+ * Get the database to run the mongo operation.
1021
+ *
1022
+ * Only applies when mongocrypt_ctx_t is in the state:
1023
+ * MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB.
1024
+ *
1025
+ * The lifetime of the returned string is tied to the lifetime of @p ctx. It is
1026
+ * valid until @ref mongocrypt_ctx_destroy is called.
1027
+ *
1028
+ * @param[in] ctx The @ref mongocrypt_ctx_t object.
1029
+ * @returns A string or NULL. If NULL, an error status is set. Retrieve it with
1030
+ * @ref mongocrypt_ctx_status
1031
+ */
1032
+ MONGOCRYPT_EXPORT
1033
+ const char *mongocrypt_ctx_mongo_db(mongocrypt_ctx_t *ctx);
1107
1034
 
1108
1035
  /**
1109
1036
  * Feed a BSON reply or result when mongocrypt_ctx_t is in
@@ -1111,7 +1038,7 @@ mongocrypt_ctx_mongo_op (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
1111
1038
  * depending on the operation.
1112
1039
  *
1113
1040
  * reply is a BSON document result being fed back for this operation.
1114
- * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a doc from a listCollections
1041
+ * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO(_WITH_DB) it is a doc from a listCollections
1115
1042
  * cursor. (Note, if listCollections returned no result, do not call this
1116
1043
  * function.)
1117
1044
  * - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a doc from a find cursor.
@@ -1128,9 +1055,7 @@ mongocrypt_ctx_mongo_op (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *op_bson);
1128
1055
  * Retrieve it with @ref mongocrypt_ctx_status
1129
1056
  */
1130
1057
  MONGOCRYPT_EXPORT
1131
- bool
1132
- mongocrypt_ctx_mongo_feed (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
1133
-
1058
+ bool mongocrypt_ctx_mongo_feed(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
1134
1059
 
1135
1060
  /**
1136
1061
  * Call when done feeding the reply (or replies) back to the context.
@@ -1140,16 +1065,13 @@ mongocrypt_ctx_mongo_feed (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *reply);
1140
1065
  * Retrieve it with @ref mongocrypt_ctx_status
1141
1066
  */
1142
1067
  MONGOCRYPT_EXPORT
1143
- bool
1144
- mongocrypt_ctx_mongo_done (mongocrypt_ctx_t *ctx);
1145
-
1068
+ bool mongocrypt_ctx_mongo_done(mongocrypt_ctx_t *ctx);
1146
1069
 
1147
1070
  /**
1148
1071
  * Manages a single KMS HTTP request/response.
1149
1072
  */
1150
1073
  typedef struct _mongocrypt_kms_ctx_t mongocrypt_kms_ctx_t;
1151
1074
 
1152
-
1153
1075
  /**
1154
1076
  * Get the next KMS handle.
1155
1077
  *
@@ -1164,9 +1086,7 @@ typedef struct _mongocrypt_kms_ctx_t mongocrypt_kms_ctx_t;
1164
1086
  * @returns a new @ref mongocrypt_kms_ctx_t or NULL.
1165
1087
  */
1166
1088
  MONGOCRYPT_EXPORT
1167
- mongocrypt_kms_ctx_t *
1168
- mongocrypt_ctx_next_kms_ctx (mongocrypt_ctx_t *ctx);
1169
-
1089
+ mongocrypt_kms_ctx_t *mongocrypt_ctx_next_kms_ctx(mongocrypt_ctx_t *ctx);
1170
1090
 
1171
1091
  /**
1172
1092
  * Get the HTTP request message for a KMS handle.
@@ -1182,10 +1102,7 @@ mongocrypt_ctx_next_kms_ctx (mongocrypt_ctx_t *ctx);
1182
1102
  * Retrieve it with @ref mongocrypt_kms_ctx_status
1183
1103
  */
1184
1104
  MONGOCRYPT_EXPORT
1185
- bool
1186
- mongocrypt_kms_ctx_message (mongocrypt_kms_ctx_t *kms,
1187
- mongocrypt_binary_t *msg);
1188
-
1105
+ bool mongocrypt_kms_ctx_message(mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *msg);
1189
1106
 
1190
1107
  /**
1191
1108
  * Get the hostname from which to connect over TLS.
@@ -1202,9 +1119,7 @@ mongocrypt_kms_ctx_message (mongocrypt_kms_ctx_t *kms,
1202
1119
  * Retrieve it with @ref mongocrypt_kms_ctx_status
1203
1120
  */
1204
1121
  MONGOCRYPT_EXPORT
1205
- bool
1206
- mongocrypt_kms_ctx_endpoint (mongocrypt_kms_ctx_t *kms, const char **endpoint);
1207
-
1122
+ bool mongocrypt_kms_ctx_endpoint(mongocrypt_kms_ctx_t *kms, const char **endpoint);
1208
1123
 
1209
1124
  /**
1210
1125
  * Indicates how many bytes to feed into @ref mongocrypt_kms_ctx_feed.
@@ -1213,9 +1128,7 @@ mongocrypt_kms_ctx_endpoint (mongocrypt_kms_ctx_t *kms, const char **endpoint);
1213
1128
  * @returns The number of requested bytes.
1214
1129
  */
1215
1130
  MONGOCRYPT_EXPORT
1216
- uint32_t
1217
- mongocrypt_kms_ctx_bytes_needed (mongocrypt_kms_ctx_t *kms);
1218
-
1131
+ uint32_t mongocrypt_kms_ctx_bytes_needed(mongocrypt_kms_ctx_t *kms);
1219
1132
 
1220
1133
  /**
1221
1134
  * Feed bytes from the HTTP response.
@@ -1230,9 +1143,7 @@ mongocrypt_kms_ctx_bytes_needed (mongocrypt_kms_ctx_t *kms);
1230
1143
  * Retrieve it with @ref mongocrypt_kms_ctx_status
1231
1144
  */
1232
1145
  MONGOCRYPT_EXPORT
1233
- bool
1234
- mongocrypt_kms_ctx_feed (mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
1235
-
1146
+ bool mongocrypt_kms_ctx_feed(mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
1236
1147
 
1237
1148
  /**
1238
1149
  * Get the status associated with a @ref mongocrypt_kms_ctx_t object.
@@ -1243,9 +1154,7 @@ mongocrypt_kms_ctx_feed (mongocrypt_kms_ctx_t *kms, mongocrypt_binary_t *bytes);
1243
1154
  * @returns A boolean indicating success. If false, an error status is set.
1244
1155
  */
1245
1156
  MONGOCRYPT_EXPORT
1246
- bool
1247
- mongocrypt_kms_ctx_status (mongocrypt_kms_ctx_t *kms,
1248
- mongocrypt_status_t *status);
1157
+ bool mongocrypt_kms_ctx_status(mongocrypt_kms_ctx_t *kms, mongocrypt_status_t *status);
1249
1158
 
1250
1159
  /**
1251
1160
  * Get the KMS provider identifier associated with this KMS request.
@@ -1263,9 +1172,7 @@ mongocrypt_kms_ctx_status (mongocrypt_kms_ctx_t *kms,
1263
1172
  * "kmip".
1264
1173
  */
1265
1174
  MONGOCRYPT_EXPORT
1266
- const char *
1267
- mongocrypt_kms_ctx_get_kms_provider (mongocrypt_kms_ctx_t *kms, uint32_t *len);
1268
-
1175
+ const char *mongocrypt_kms_ctx_get_kms_provider(mongocrypt_kms_ctx_t *kms, uint32_t *len);
1269
1176
 
1270
1177
  /**
1271
1178
  * Call when done handling all KMS contexts.
@@ -1276,9 +1183,7 @@ mongocrypt_kms_ctx_get_kms_provider (mongocrypt_kms_ctx_t *kms, uint32_t *len);
1276
1183
  * Retrieve it with @ref mongocrypt_ctx_status
1277
1184
  */
1278
1185
  MONGOCRYPT_EXPORT
1279
- bool
1280
- mongocrypt_ctx_kms_done (mongocrypt_ctx_t *ctx);
1281
-
1186
+ bool mongocrypt_ctx_kms_done(mongocrypt_ctx_t *ctx);
1282
1187
 
1283
1188
  /**
1284
1189
  * Call in response to the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state
@@ -1295,9 +1200,7 @@ mongocrypt_ctx_kms_done (mongocrypt_ctx_t *ctx);
1295
1200
  * Retrieve it with @ref mongocrypt_ctx_status.
1296
1201
  */
1297
1202
  MONGOCRYPT_EXPORT
1298
- bool
1299
- mongocrypt_ctx_provide_kms_providers (
1300
- mongocrypt_ctx_t *ctx, mongocrypt_binary_t *kms_providers_definition);
1203
+ bool mongocrypt_ctx_provide_kms_providers(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *kms_providers_definition);
1301
1204
 
1302
1205
  /**
1303
1206
  * Perform the final encryption or decryption.
@@ -1336,9 +1239,7 @@ mongocrypt_ctx_provide_kms_providers (
1336
1239
  * Retrieve it with @ref mongocrypt_ctx_status
1337
1240
  */
1338
1241
  MONGOCRYPT_EXPORT
1339
- bool
1340
- mongocrypt_ctx_finalize (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out);
1341
-
1242
+ bool mongocrypt_ctx_finalize(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out);
1342
1243
 
1343
1244
  /**
1344
1245
  * Destroy and free all memory associated with a @ref mongocrypt_ctx_t.
@@ -1346,8 +1247,7 @@ mongocrypt_ctx_finalize (mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out);
1346
1247
  * @param[in] ctx A @ref mongocrypt_ctx_t.
1347
1248
  */
1348
1249
  MONGOCRYPT_EXPORT
1349
- void
1350
- mongocrypt_ctx_destroy (mongocrypt_ctx_t *ctx);
1250
+ void mongocrypt_ctx_destroy(mongocrypt_ctx_t *ctx);
1351
1251
 
1352
1252
  /**
1353
1253
  * An crypto AES-256-CBC encrypt or decrypt function.
@@ -1366,13 +1266,13 @@ mongocrypt_ctx_destroy (mongocrypt_ctx_t *ctx);
1366
1266
  * @returns A boolean indicating success. If returning false, set @p status
1367
1267
  * with a message indiciating the error using @ref mongocrypt_status_set.
1368
1268
  */
1369
- typedef bool (*mongocrypt_crypto_fn) (void *ctx,
1370
- mongocrypt_binary_t *key,
1371
- mongocrypt_binary_t *iv,
1372
- mongocrypt_binary_t *in,
1373
- mongocrypt_binary_t *out,
1374
- uint32_t *bytes_written,
1375
- mongocrypt_status_t *status);
1269
+ typedef bool (*mongocrypt_crypto_fn)(void *ctx,
1270
+ mongocrypt_binary_t *key,
1271
+ mongocrypt_binary_t *iv,
1272
+ mongocrypt_binary_t *in,
1273
+ mongocrypt_binary_t *out,
1274
+ uint32_t *bytes_written,
1275
+ mongocrypt_status_t *status);
1376
1276
 
1377
1277
  /**
1378
1278
  * A crypto signature or HMAC function.
@@ -1391,12 +1291,11 @@ typedef bool (*mongocrypt_crypto_fn) (void *ctx,
1391
1291
  * @returns A boolean indicating success. If returning false, set @p status
1392
1292
  * with a message indiciating the error using @ref mongocrypt_status_set.
1393
1293
  */
1394
- typedef bool (*mongocrypt_hmac_fn) (void *ctx,
1395
- mongocrypt_binary_t *key,
1396
- mongocrypt_binary_t *in,
1397
- mongocrypt_binary_t *out,
1398
- mongocrypt_status_t *status);
1399
-
1294
+ typedef bool (*mongocrypt_hmac_fn)(void *ctx,
1295
+ mongocrypt_binary_t *key,
1296
+ mongocrypt_binary_t *in,
1297
+ mongocrypt_binary_t *out,
1298
+ mongocrypt_status_t *status);
1400
1299
 
1401
1300
  /**
1402
1301
  * A crypto hash (SHA-256) function.
@@ -1411,10 +1310,10 @@ typedef bool (*mongocrypt_hmac_fn) (void *ctx,
1411
1310
  * @returns A boolean indicating success. If returning false, set @p status
1412
1311
  * with a message indiciating the error using @ref mongocrypt_status_set.
1413
1312
  */
1414
- typedef bool (*mongocrypt_hash_fn) (void *ctx,
1415
- mongocrypt_binary_t *in,
1416
- mongocrypt_binary_t *out,
1417
- mongocrypt_status_t *status);
1313
+ typedef bool (*mongocrypt_hash_fn)(void *ctx,
1314
+ mongocrypt_binary_t *in,
1315
+ mongocrypt_binary_t *out,
1316
+ mongocrypt_status_t *status);
1418
1317
 
1419
1318
  /**
1420
1319
  * A crypto secure random function.
@@ -1429,21 +1328,17 @@ typedef bool (*mongocrypt_hash_fn) (void *ctx,
1429
1328
  * @returns A boolean indicating success. If returning false, set @p status
1430
1329
  * with a message indiciating the error using @ref mongocrypt_status_set.
1431
1330
  */
1432
- typedef bool (*mongocrypt_random_fn) (void *ctx,
1433
- mongocrypt_binary_t *out,
1434
- uint32_t count,
1435
- mongocrypt_status_t *status);
1331
+ typedef bool (*mongocrypt_random_fn)(void *ctx, mongocrypt_binary_t *out, uint32_t count, mongocrypt_status_t *status);
1436
1332
 
1437
1333
  MONGOCRYPT_EXPORT
1438
- bool
1439
- mongocrypt_setopt_crypto_hooks (mongocrypt_t *crypt,
1440
- mongocrypt_crypto_fn aes_256_cbc_encrypt,
1441
- mongocrypt_crypto_fn aes_256_cbc_decrypt,
1442
- mongocrypt_random_fn random,
1443
- mongocrypt_hmac_fn hmac_sha_512,
1444
- mongocrypt_hmac_fn hmac_sha_256,
1445
- mongocrypt_hash_fn sha_256,
1446
- void *ctx);
1334
+ bool mongocrypt_setopt_crypto_hooks(mongocrypt_t *crypt,
1335
+ mongocrypt_crypto_fn aes_256_cbc_encrypt,
1336
+ mongocrypt_crypto_fn aes_256_cbc_decrypt,
1337
+ mongocrypt_random_fn random,
1338
+ mongocrypt_hmac_fn hmac_sha_512,
1339
+ mongocrypt_hmac_fn hmac_sha_256,
1340
+ mongocrypt_hash_fn sha_256,
1341
+ void *ctx);
1447
1342
 
1448
1343
  /**
1449
1344
  * Set a crypto hook for the AES256-CTR operations.
@@ -1453,19 +1348,17 @@ mongocrypt_setopt_crypto_hooks (mongocrypt_t *crypt,
1453
1348
  * operation.
1454
1349
  * @param[in] aes_256_ctr_decrypt The crypto callback function for decrypt
1455
1350
  * operation.
1456
- * @param[in] ctx A context passed as an argument to the crypto callback
1457
- * every invocation.
1351
+ * @param[in] ctx Unused.
1458
1352
  * @pre @ref mongocrypt_init has not been called on @p crypt.
1459
1353
  * @returns A boolean indicating success. If false, an error status is set.
1460
1354
  * Retrieve it with @ref mongocrypt_status
1461
1355
  *
1462
1356
  */
1463
1357
  MONGOCRYPT_EXPORT
1464
- bool
1465
- mongocrypt_setopt_aes_256_ctr (mongocrypt_t *crypt,
1466
- mongocrypt_crypto_fn aes_256_ctr_encrypt,
1467
- mongocrypt_crypto_fn aes_256_ctr_decrypt,
1468
- void *ctx);
1358
+ bool mongocrypt_setopt_aes_256_ctr(mongocrypt_t *crypt,
1359
+ mongocrypt_crypto_fn aes_256_ctr_encrypt,
1360
+ mongocrypt_crypto_fn aes_256_ctr_decrypt,
1361
+ void *ctx);
1469
1362
 
1470
1363
  /**
1471
1364
  * Set an AES256-ECB crypto hook for the AES256-CTR operations. If CTR hook was
@@ -1475,18 +1368,14 @@ mongocrypt_setopt_aes_256_ctr (mongocrypt_t *crypt,
1475
1368
  * @param[in] crypt The @ref mongocrypt_t object.
1476
1369
  * @param[in] aes_256_ecb_encrypt The crypto callback function for encrypt
1477
1370
  * operation.
1478
- * @param[in] ctx A context passed as an argument to the crypto callback
1479
- * every invocation.
1371
+ * @param[in] ctx Unused.
1480
1372
  * @pre @ref mongocrypt_init has not been called on @p crypt.
1481
1373
  * @returns A boolean indicating success. If false, an error status is set.
1482
1374
  * Retrieve it with @ref mongocrypt_status
1483
1375
  *
1484
1376
  */
1485
1377
  MONGOCRYPT_EXPORT
1486
- bool
1487
- mongocrypt_setopt_aes_256_ecb (mongocrypt_t *crypt,
1488
- mongocrypt_crypto_fn aes_256_ecb_encrypt,
1489
- void *ctx);
1378
+ bool mongocrypt_setopt_aes_256_ecb(mongocrypt_t *crypt, mongocrypt_crypto_fn aes_256_ecb_encrypt, void *ctx);
1490
1379
 
1491
1380
  /**
1492
1381
  * Set a crypto hook for the RSASSA-PKCS1-v1_5 algorithm with a SHA-256 hash.
@@ -1506,11 +1395,9 @@ mongocrypt_setopt_aes_256_ecb (mongocrypt_t *crypt,
1506
1395
  *
1507
1396
  */
1508
1397
  MONGOCRYPT_EXPORT
1509
- bool
1510
- mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5 (
1511
- mongocrypt_t *crypt,
1512
- mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
1513
- void *sign_ctx);
1398
+ bool mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5(mongocrypt_t *crypt,
1399
+ mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
1400
+ void *sign_ctx);
1514
1401
 
1515
1402
  /**
1516
1403
  * @brief Opt-into skipping query analysis.
@@ -1522,8 +1409,18 @@ mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5 (
1522
1409
  * @param[in] crypt The @ref mongocrypt_t object to update
1523
1410
  */
1524
1411
  MONGOCRYPT_EXPORT
1525
- void
1526
- mongocrypt_setopt_bypass_query_analysis (mongocrypt_t *crypt);
1412
+ void mongocrypt_setopt_bypass_query_analysis(mongocrypt_t *crypt);
1413
+
1414
+ /**
1415
+ * DEPRECATED: Use of `mongocrypt_setopt_use_range_v2` is deprecated. Range V2 is always enabled.
1416
+ *
1417
+ * @param[in] crypt The @ref mongocrypt_t object.
1418
+ *
1419
+ * @returns A boolean indicating success. If false, an error status is set.
1420
+ * Retrieve it with @ref mongocrypt_status
1421
+ */
1422
+ MONGOCRYPT_EXPORT
1423
+ bool mongocrypt_setopt_use_range_v2(mongocrypt_t *crypt);
1527
1424
 
1528
1425
  /**
1529
1426
  * Set the contention factor used for explicit encryption.
@@ -1536,9 +1433,7 @@ mongocrypt_setopt_bypass_query_analysis (mongocrypt_t *crypt);
1536
1433
  * Retrieve it with @ref mongocrypt_ctx_status.
1537
1434
  */
1538
1435
  MONGOCRYPT_EXPORT
1539
- bool
1540
- mongocrypt_ctx_setopt_contention_factor (mongocrypt_ctx_t *ctx,
1541
- int64_t contention_factor);
1436
+ bool mongocrypt_ctx_setopt_contention_factor(mongocrypt_ctx_t *ctx, int64_t contention_factor);
1542
1437
 
1543
1438
  /**
1544
1439
  * Set the index key id to use for explicit Queryable Encryption.
@@ -1556,10 +1451,7 @@ mongocrypt_ctx_setopt_contention_factor (mongocrypt_ctx_t *ctx,
1556
1451
  * Retrieve it with @ref mongocrypt_ctx_status
1557
1452
  */
1558
1453
  MONGOCRYPT_EXPORT
1559
- bool
1560
- mongocrypt_ctx_setopt_index_key_id (mongocrypt_ctx_t *ctx,
1561
- mongocrypt_binary_t *key_id);
1562
-
1454
+ bool mongocrypt_ctx_setopt_index_key_id(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *key_id);
1563
1455
 
1564
1456
  /**
1565
1457
  * Set the query type to use for explicit Queryable Encryption.
@@ -1572,22 +1464,18 @@ mongocrypt_ctx_setopt_index_key_id (mongocrypt_ctx_t *ctx,
1572
1464
  * Retrieve it with @ref mongocrypt_ctx_status
1573
1465
  */
1574
1466
  MONGOCRYPT_EXPORT
1575
- bool
1576
- mongocrypt_ctx_setopt_query_type (mongocrypt_ctx_t *ctx,
1577
- const char *query_type,
1578
- int len);
1467
+ bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_type, int len);
1579
1468
 
1580
1469
  /**
1581
- * Set options for explicit encryption with the "rangePreview" algorithm.
1582
- * NOTE: The RangePreview algorithm is experimental only. It is not intended for
1583
- * public use.
1470
+ * Set options for explicit encryption with the "range" algorithm.
1584
1471
  *
1585
1472
  * @p opts is a BSON document of the form:
1586
1473
  * {
1587
1474
  * "min": Optional<BSON value>,
1588
1475
  * "max": Optional<BSON value>,
1589
1476
  * "sparsity": Int64,
1590
- * "precision": Optional<Int32>
1477
+ * "precision": Optional<Int32>,
1478
+ * "trimFactor": Optional<Int32>
1591
1479
  * }
1592
1480
  *
1593
1481
  * @param[in] ctx The @ref mongocrypt_ctx_t object.
@@ -1597,14 +1485,12 @@ mongocrypt_ctx_setopt_query_type (mongocrypt_ctx_t *ctx,
1597
1485
  * Retrieve it with @ref mongocrypt_ctx_status
1598
1486
  */
1599
1487
  MONGOCRYPT_EXPORT
1600
- bool
1601
- mongocrypt_ctx_setopt_algorithm_range (mongocrypt_ctx_t *ctx,
1602
- mongocrypt_binary_t *opts);
1488
+ bool mongocrypt_ctx_setopt_algorithm_range(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *opts);
1603
1489
 
1604
1490
  /// String constants for setopt_query_type
1605
1491
  #define MONGOCRYPT_QUERY_TYPE_EQUALITY_STR "equality"
1606
- // NOTE: The RangePreview algorithm is experimental only. It is not intended for
1607
- // public use.
1608
- #define MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_STR "rangePreview"
1492
+ // DEPRECATED: Support "rangePreview" has been removed in favor of "range".
1493
+ #define MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED_STR "rangePreview"
1494
+ #define MONGOCRYPT_QUERY_TYPE_RANGE_STR "range"
1609
1495
 
1610
1496
  #endif /* MONGOCRYPT_H */