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
@@ -16,594 +16,612 @@
16
16
 
17
17
  #include "test-mongocrypt.h"
18
18
 
19
+ #include "mc-array-private.h"
19
20
  #include "mc-check-conversions-private.h"
20
21
  #include "mc-optional-private.h"
22
+ #include "mc-range-encoding-private.h"
21
23
  #include "mc-range-mincover-private.h"
22
- #include "mc-array-private.h"
23
-
24
24
 
25
25
  enum {
26
- /// Why this number? The Decimal128 tests generate thousands of test strings,
27
- /// but we can't set this arbitrarily high, since we'll bump up on stack
28
- /// overflow on MSVC. This is large enough to capture all strings in all
29
- /// Decimal128 tests without overflowing the stack.
30
- MAX_MINCOVER_STRINGS = 4500
26
+ /// Why this number? The Decimal128 tests generate thousands of test strings,
27
+ /// but we can't set this arbitrarily high, since we'll bump up on stack
28
+ /// overflow on MSVC. This is large enough to capture all strings in all
29
+ /// Decimal128 tests without overflowing the stack.
30
+ MAX_MINCOVER_STRINGS = 4500
31
31
  };
32
32
 
33
33
  typedef struct {
34
- int32_t lowerBound;
35
- bool includeLowerBound;
36
- int32_t upperBound;
37
- bool includeUpperBound;
38
- mc_optional_int32_t min;
39
- mc_optional_int32_t max;
40
- size_t sparsity;
41
- const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
42
- const char *expectError;
34
+ int32_t lowerBound;
35
+ bool includeLowerBound;
36
+ int32_t upperBound;
37
+ bool includeUpperBound;
38
+ mc_optional_int32_t min;
39
+ mc_optional_int32_t max;
40
+ size_t sparsity;
41
+ uint32_t trimFactor;
42
+ const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
43
+ const char *expectError;
43
44
  } Int32Test;
44
45
 
45
46
  typedef struct {
46
- int64_t lowerBound;
47
- bool includeLowerBound;
48
- int64_t upperBound;
49
- bool includeUpperBound;
50
- mc_optional_int64_t min;
51
- mc_optional_int64_t max;
52
- size_t sparsity;
53
- const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
54
- const char *expectError;
47
+ int64_t lowerBound;
48
+ bool includeLowerBound;
49
+ int64_t upperBound;
50
+ bool includeUpperBound;
51
+ mc_optional_int64_t min;
52
+ mc_optional_int64_t max;
53
+ size_t sparsity;
54
+ const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
55
+ const char *expectError;
55
56
  } Int64Test;
56
57
 
57
58
  typedef struct {
58
- double lowerBound;
59
- bool includeLowerBound;
60
- double upperBound;
61
- bool includeUpperBound;
62
- size_t sparsity;
63
- mc_optional_double_t min;
64
- mc_optional_double_t max;
65
- mc_optional_uint32_t precision;
66
- const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
67
- const char *expectError;
59
+ double lowerBound;
60
+ bool includeLowerBound;
61
+ double upperBound;
62
+ bool includeUpperBound;
63
+ size_t sparsity;
64
+ mc_optional_double_t min;
65
+ mc_optional_double_t max;
66
+ mc_optional_int32_t precision;
67
+ const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
68
+ const char *expectError;
68
69
  } DoubleTest;
69
70
 
70
71
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
71
72
  typedef struct {
72
- mc_dec128 lowerBound;
73
- bool includeLowerBound;
74
- mc_dec128 upperBound;
75
- bool includeUpperBound;
76
- size_t sparsity;
77
- mc_optional_dec128_t min;
78
- mc_optional_dec128_t max;
79
- mc_optional_uint32_t precision;
80
- const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
81
- const char *expectError;
73
+ mc_dec128 lowerBound;
74
+ bool includeLowerBound;
75
+ mc_dec128 upperBound;
76
+ bool includeUpperBound;
77
+ size_t sparsity;
78
+ mc_optional_dec128_t min;
79
+ mc_optional_dec128_t max;
80
+ mc_optional_int32_t precision;
81
+ const char *expectMincoverStrings[MAX_MINCOVER_STRINGS];
82
+ const char *expectError;
82
83
  } Decimal128Test;
83
84
  #endif
84
85
 
85
86
  typedef struct _test_getMincover_args {
86
- mc_mincover_t *(*getMincover) (void *tests,
87
- size_t idx,
88
- mongocrypt_status_t *status);
89
- const char *(*expectError) (void *tests, size_t idx);
90
- const char *const *(*expectMincoverStrings) (void *tests, size_t idx);
91
- void (*dump) (void *tests, size_t idx, mc_mincover_t *got);
87
+ mc_mincover_t *(*getMincover)(void *tests, size_t idx, mongocrypt_status_t *status);
88
+ const char *(*expectError)(void *tests, size_t idx);
89
+ const char *const *(*expectMincoverStrings)(void *tests, size_t idx);
90
+ void (*dump)(void *tests, size_t idx, mc_mincover_t *got);
92
91
  } _test_getMincover_args;
93
92
 
94
- static mc_mincover_t *
95
- _test_getMincover32 (void *tests, size_t idx, mongocrypt_status_t *status)
96
- {
97
- BSON_ASSERT_PARAM (tests);
98
-
99
- Int32Test *test = (Int32Test *) tests + idx;
100
-
101
- return mc_getMincoverInt32 (
102
- (mc_getMincoverInt32_args_t){.lowerBound = test->lowerBound,
103
- .includeLowerBound = test->includeLowerBound,
104
- .upperBound = test->upperBound,
105
- .includeUpperBound = test->includeUpperBound,
106
- .min = test->min,
107
- .max = test->max,
108
- .sparsity = test->sparsity},
109
- status);
93
+ static mc_mincover_t *_test_getMincover32(void *tests, size_t idx, mongocrypt_status_t *status) {
94
+ BSON_ASSERT_PARAM(tests);
95
+
96
+ Int32Test *test = (Int32Test *)tests + idx;
97
+
98
+ const bool use_range_v2 = true;
99
+ return mc_getMincoverInt32((mc_getMincoverInt32_args_t){.lowerBound = test->lowerBound,
100
+ .includeLowerBound = test->includeLowerBound,
101
+ .upperBound = test->upperBound,
102
+ .includeUpperBound = test->includeUpperBound,
103
+ .min = test->min,
104
+ .max = test->max,
105
+ .sparsity = test->sparsity,
106
+ .trimFactor = OPT_I32(test->trimFactor)},
107
+ status,
108
+ use_range_v2);
110
109
  }
111
110
 
112
- static mc_mincover_t *
113
- _test_getMincover64 (void *tests, size_t idx, mongocrypt_status_t *status)
114
- {
115
- BSON_ASSERT_PARAM (tests);
116
-
117
- Int64Test *const test = (Int64Test *) tests + idx;
118
-
119
- return mc_getMincoverInt64 (
120
- (mc_getMincoverInt64_args_t){.lowerBound = test->lowerBound,
121
- .includeLowerBound = test->includeLowerBound,
122
- .upperBound = test->upperBound,
123
- .includeUpperBound = test->includeUpperBound,
124
- .min = test->min,
125
- .max = test->max,
126
- .sparsity = test->sparsity},
127
- status);
111
+ static mc_mincover_t *_test_getMincover64(void *tests, size_t idx, mongocrypt_status_t *status) {
112
+ BSON_ASSERT_PARAM(tests);
113
+
114
+ const bool use_range_v2 = true;
115
+ const uint32_t trimFactor = 0; // At present, all test cases expect trimFactor=0.
116
+ Int64Test *const test = (Int64Test *)tests + idx;
117
+
118
+ return mc_getMincoverInt64((mc_getMincoverInt64_args_t){.lowerBound = test->lowerBound,
119
+ .includeLowerBound = test->includeLowerBound,
120
+ .upperBound = test->upperBound,
121
+ .includeUpperBound = test->includeUpperBound,
122
+ .min = test->min,
123
+ .max = test->max,
124
+ .sparsity = test->sparsity,
125
+ .trimFactor = OPT_I32(trimFactor)},
126
+ status,
127
+ use_range_v2);
128
128
  }
129
129
 
130
- static mc_mincover_t *
131
- _test_getMincoverDouble_helper (void *tests,
132
- size_t idx,
133
- mongocrypt_status_t *status)
134
- {
135
- BSON_ASSERT_PARAM (tests);
136
-
137
- DoubleTest *const test = (DoubleTest *) tests + idx;
138
-
139
- return mc_getMincoverDouble (
140
- (mc_getMincoverDouble_args_t){
141
- .lowerBound = test->lowerBound,
142
- .includeLowerBound = test->includeLowerBound,
143
- .upperBound = test->upperBound,
144
- .includeUpperBound = test->includeUpperBound,
145
- .sparsity = test->sparsity,
146
- .min = test->precision.set ? test->min : (mc_optional_double_t){0},
147
- .max = test->precision.set ? test->max : (mc_optional_double_t){0},
148
- .precision = test->precision},
149
- status);
130
+ static mc_mincover_t *_test_getMincoverDouble_helper(void *tests, size_t idx, mongocrypt_status_t *status) {
131
+ BSON_ASSERT_PARAM(tests);
132
+
133
+ const bool use_range_v2 = true;
134
+ const uint32_t trimFactor = 0; // At present, all test cases expect trimFactor=0.
135
+ DoubleTest *const test = (DoubleTest *)tests + idx;
136
+
137
+ return mc_getMincoverDouble(
138
+ (mc_getMincoverDouble_args_t){.lowerBound = test->lowerBound,
139
+ .includeLowerBound = test->includeLowerBound,
140
+ .upperBound = test->upperBound,
141
+ .includeUpperBound = test->includeUpperBound,
142
+ .sparsity = test->sparsity,
143
+ .min = test->precision.set ? test->min : (mc_optional_double_t){0},
144
+ .max = test->precision.set ? test->max : (mc_optional_double_t){0},
145
+ .precision = test->precision,
146
+ .trimFactor = OPT_I32(trimFactor)},
147
+ status,
148
+ use_range_v2);
150
149
  }
151
150
 
152
151
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
153
- static mc_mincover_t *
154
- _test_getMincoverDecimal128_helper (void *tests,
155
- size_t idx,
156
- mongocrypt_status_t *status)
157
- {
158
- BSON_ASSERT_PARAM (tests);
159
-
160
- Decimal128Test *const test = (Decimal128Test *) tests + idx;
161
-
162
- return mc_getMincoverDecimal128 (
163
- (mc_getMincoverDecimal128_args_t){
164
- .lowerBound = test->lowerBound,
165
- .includeLowerBound = test->includeLowerBound,
166
- .upperBound = test->upperBound,
167
- .includeUpperBound = test->includeUpperBound,
168
- .sparsity = test->sparsity,
169
- .min = test->precision.set ? test->min : (mc_optional_dec128_t){0},
170
- .max = test->precision.set ? test->max : (mc_optional_dec128_t){0},
171
- .precision = test->precision},
172
- status);
152
+ static mc_mincover_t *_test_getMincoverDecimal128_helper(void *tests, size_t idx, mongocrypt_status_t *status) {
153
+ BSON_ASSERT_PARAM(tests);
154
+
155
+ Decimal128Test *const test = (Decimal128Test *)tests + idx;
156
+
157
+ const bool use_range_v2 = true;
158
+ const uint32_t trimFactor = 0; // At present, all test cases expect trimFactor=0.
159
+ return mc_getMincoverDecimal128(
160
+ (mc_getMincoverDecimal128_args_t){.lowerBound = test->lowerBound,
161
+ .includeLowerBound = test->includeLowerBound,
162
+ .upperBound = test->upperBound,
163
+ .includeUpperBound = test->includeUpperBound,
164
+ .sparsity = test->sparsity,
165
+ .min = test->precision.set ? test->min : (mc_optional_dec128_t){0},
166
+ .max = test->precision.set ? test->max : (mc_optional_dec128_t){0},
167
+ .precision = test->precision,
168
+ .trimFactor = OPT_I32(trimFactor)},
169
+ status,
170
+ use_range_v2);
173
171
  }
174
172
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
175
173
 
176
- static const char *
177
- _test_expectError32 (void *tests, size_t idx)
178
- {
179
- BSON_ASSERT_PARAM (tests);
180
- return ((Int32Test *) tests + idx)->expectError;
174
+ static const char *_test_expectError32(void *tests, size_t idx) {
175
+ BSON_ASSERT_PARAM(tests);
176
+ return ((Int32Test *)tests + idx)->expectError;
181
177
  }
182
178
 
183
- static const char *
184
- _test_expectError64 (void *tests, size_t idx)
185
- {
186
- BSON_ASSERT_PARAM (tests);
187
- return ((Int64Test *) tests + idx)->expectError;
179
+ static const char *_test_expectError64(void *tests, size_t idx) {
180
+ BSON_ASSERT_PARAM(tests);
181
+ return ((Int64Test *)tests + idx)->expectError;
188
182
  }
189
183
 
190
- static const char *
191
- _test_expectErrorDouble (void *tests, size_t idx)
192
- {
193
- BSON_ASSERT_PARAM (tests);
194
- return ((DoubleTest *) tests + idx)->expectError;
184
+ static const char *_test_expectErrorDouble(void *tests, size_t idx) {
185
+ BSON_ASSERT_PARAM(tests);
186
+ DoubleTest *test = ((DoubleTest *)tests + idx);
187
+ if (test->min.set && test->max.set && test->precision.set) {
188
+ // Expect an error for tests including an invalid min/max/precision.
189
+ uint32_t ignored;
190
+ mongocrypt_status_t *const status = mongocrypt_status_new();
191
+ if (!mc_canUsePrecisionModeDouble(test->min.value, test->max.value, test->precision.value, &ignored, status)) {
192
+ if (!mongocrypt_status_ok(status)) {
193
+ return mongocrypt_status_message(status, NULL);
194
+ }
195
+
196
+ return "The domain of double values specified by the min, max, and precision cannot be represented in "
197
+ "fewer than 64 bits";
198
+ }
199
+ mongocrypt_status_destroy(status);
200
+ }
201
+ return test->expectError;
195
202
  }
196
203
 
197
204
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
198
- static const char *
199
- _test_expectErrorDecimal128 (void *tests, size_t idx)
200
- {
201
- BSON_ASSERT_PARAM (tests);
202
- return ((Decimal128Test *) tests + idx)->expectError;
205
+ static const char *_test_expectErrorDecimal128(void *tests, size_t idx) {
206
+ BSON_ASSERT_PARAM(tests);
207
+ Decimal128Test *test = ((Decimal128Test *)tests + idx);
208
+ if (test->min.set && test->max.set && test->precision.set) {
209
+ // Expect an error for tests including an invalid min/max/precision.
210
+ uint32_t ignored;
211
+ mongocrypt_status_t *const status = mongocrypt_status_new();
212
+ if (!mc_canUsePrecisionModeDecimal(test->min.value, test->max.value, test->precision.value, &ignored, status)) {
213
+ if (!mongocrypt_status_ok(status)) {
214
+ return mongocrypt_status_message(status, NULL);
215
+ }
216
+
217
+ return "The domain of decimal values specified by the min, max, and precision cannot be represented in "
218
+ "fewer than 128 bits";
219
+ }
220
+ }
221
+ return test->expectError;
203
222
  }
204
223
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
205
224
 
206
- static const char *const *
207
- _test_expectMincover32 (void *tests, size_t idx)
208
- {
209
- BSON_ASSERT_PARAM (tests);
210
- return ((Int32Test *) tests + idx)->expectMincoverStrings;
225
+ static const char *const *_test_expectMincover32(void *tests, size_t idx) {
226
+ BSON_ASSERT_PARAM(tests);
227
+ return ((Int32Test *)tests + idx)->expectMincoverStrings;
211
228
  }
212
229
 
213
- static const char *const *
214
- _test_expectMincover64 (void *tests, size_t idx)
215
- {
216
- BSON_ASSERT_PARAM (tests);
217
- return ((Int64Test *) tests + idx)->expectMincoverStrings;
230
+ static const char *const *_test_expectMincover64(void *tests, size_t idx) {
231
+ BSON_ASSERT_PARAM(tests);
232
+ return ((Int64Test *)tests + idx)->expectMincoverStrings;
218
233
  }
219
234
 
220
- static const char *const *
221
- _test_expectMincoverDouble (void *tests, size_t idx)
222
- {
223
- BSON_ASSERT_PARAM (tests);
224
- return ((DoubleTest *) tests + idx)->expectMincoverStrings;
235
+ static const char *const *_test_expectMincoverDouble(void *tests, size_t idx) {
236
+ BSON_ASSERT_PARAM(tests);
237
+ return ((DoubleTest *)tests + idx)->expectMincoverStrings;
225
238
  }
226
239
 
227
240
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
228
- static const char *const *
229
- _test_expectMincoverDecimal128 (void *tests, size_t idx)
230
- {
231
- BSON_ASSERT_PARAM (tests);
232
- return ((Decimal128Test *) tests + idx)->expectMincoverStrings;
241
+ static const char *const *_test_expectMincoverDecimal128(void *tests, size_t idx) {
242
+ BSON_ASSERT_PARAM(tests);
243
+ return ((Decimal128Test *)tests + idx)->expectMincoverStrings;
233
244
  }
234
245
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
235
246
 
236
- static void
237
- _test_dump_32 (void *tests, size_t idx, mc_mincover_t *got)
238
- {
239
- BSON_ASSERT_PARAM (tests);
240
- Int32Test *const test = (Int32Test *) tests + idx;
241
- fflush (stdout); // Avoid incomplete stdout output from prior tests on error
242
- fprintf (stderr,
247
+ static void _test_dump_32(void *tests, size_t idx, mc_mincover_t *got) {
248
+ BSON_ASSERT_PARAM(tests);
249
+ Int32Test *const test = (Int32Test *)tests + idx;
250
+ fflush(stdout); // Avoid incomplete stdout output from prior tests on error
251
+ fprintf(stderr,
243
252
  "testcase: lowerBound=%" PRId32 " (%s) upperBound=%" PRId32 " (%s)",
244
253
  test->lowerBound,
245
254
  test->includeLowerBound ? "inclusive" : "exclusive",
246
255
  test->upperBound,
247
256
  test->includeUpperBound ? "inclusive" : "exclusive");
248
- if (test->min.set) {
249
- fprintf (stderr, " min=%" PRId32, test->min.value);
250
- }
251
- if (test->max.set) {
252
- fprintf (stderr, " max=%" PRId32, test->max.value);
253
- }
254
- fprintf (stderr, " sparsity=%zu\n", test->sparsity);
255
- fprintf (stderr, "mincover expected ... begin\n");
256
- for (const char **p = test->expectMincoverStrings; *p; ++p) {
257
- fprintf (stderr, " %s\n", *p);
258
- }
259
- fprintf (stderr, "mincover expected ... end\n");
260
- fprintf (stderr, "mincover got ... begin\n");
261
- for (size_t i = 0; i < mc_mincover_len (got); i++) {
262
- fprintf (stderr, " %s\n", mc_mincover_get (got, i));
263
- }
264
- fprintf (stderr, "mincover got ... end\n");
257
+ if (test->min.set) {
258
+ fprintf(stderr, " min=%" PRId32, test->min.value);
259
+ }
260
+ if (test->max.set) {
261
+ fprintf(stderr, " max=%" PRId32, test->max.value);
262
+ }
263
+ fprintf(stderr, " sparsity=%zu\n", test->sparsity);
264
+ fprintf(stderr, "mincover expected ... begin\n");
265
+ for (const char **p = test->expectMincoverStrings; *p; ++p) {
266
+ fprintf(stderr, " %s\n", *p);
267
+ }
268
+ fprintf(stderr, "mincover expected ... end\n");
269
+ fprintf(stderr, "mincover got ... begin\n");
270
+ for (size_t i = 0; i < mc_mincover_len(got); i++) {
271
+ fprintf(stderr, " %s\n", mc_mincover_get(got, i));
272
+ }
273
+ fprintf(stderr, "mincover got ... end\n");
265
274
  }
266
275
 
267
- static void
268
- _test_dump_64 (void *tests, size_t idx, mc_mincover_t *got)
269
- {
270
- BSON_ASSERT_PARAM (tests);
271
- Int64Test *const test = (Int64Test *) tests + idx;
272
- fflush (stdout); // Avoid incomplete stdout output from prior tests on error
273
- fprintf (stderr,
276
+ static void _test_dump_64(void *tests, size_t idx, mc_mincover_t *got) {
277
+ BSON_ASSERT_PARAM(tests);
278
+ Int64Test *const test = (Int64Test *)tests + idx;
279
+ fflush(stdout); // Avoid incomplete stdout output from prior tests on error
280
+ fprintf(stderr,
274
281
  "testcase: lowerBound=%" PRId64 " (%s) upperBound=%" PRId64 " (%s)",
275
282
  test->lowerBound,
276
283
  test->includeLowerBound ? "inclusive" : "exclusive",
277
284
  test->upperBound,
278
285
  test->includeUpperBound ? "inclusive" : "exclusive");
279
- if (test->min.set) {
280
- fprintf (stderr, " min=%" PRId64, test->min.value);
281
- }
282
- if (test->max.set) {
283
- fprintf (stderr, " max=%" PRId64, test->max.value);
284
- }
285
- fprintf (stderr, " sparsity=%zu\n", test->sparsity);
286
- fprintf (stderr, "mincover expected ... begin\n");
287
- for (const char **p = test->expectMincoverStrings; *p; ++p) {
288
- fprintf (stderr, " %s\n", *p);
289
- }
290
- fprintf (stderr, "mincover expected ... end\n");
291
- fprintf (stderr, "mincover got ... begin\n");
292
- for (size_t i = 0; i < mc_mincover_len (got); i++) {
293
- fprintf (stderr, " %s\n", mc_mincover_get (got, i));
294
- }
295
- fprintf (stderr, "mincover got ... end\n");
286
+ if (test->min.set) {
287
+ fprintf(stderr, " min=%" PRId64, test->min.value);
288
+ }
289
+ if (test->max.set) {
290
+ fprintf(stderr, " max=%" PRId64, test->max.value);
291
+ }
292
+ fprintf(stderr, " sparsity=%zu\n", test->sparsity);
293
+ fprintf(stderr, "mincover expected ... begin\n");
294
+ for (const char **p = test->expectMincoverStrings; *p; ++p) {
295
+ fprintf(stderr, " %s\n", *p);
296
+ }
297
+ fprintf(stderr, "mincover expected ... end\n");
298
+ fprintf(stderr, "mincover got ... begin\n");
299
+ for (size_t i = 0; i < mc_mincover_len(got); i++) {
300
+ fprintf(stderr, " %s\n", mc_mincover_get(got, i));
301
+ }
302
+ fprintf(stderr, "mincover got ... end\n");
296
303
  }
297
304
 
298
- static void
299
- _test_dump_Double (void *tests, size_t idx, mc_mincover_t *got)
300
- {
301
- BSON_ASSERT_PARAM (tests);
302
- DoubleTest *const test = (DoubleTest *) tests + idx;
303
- fflush (stdout); // Avoid incomplete stdout output from prior tests on error
304
- fprintf (stderr,
305
+ static void _test_dump_Double(void *tests, size_t idx, mc_mincover_t *got) {
306
+ BSON_ASSERT_PARAM(tests);
307
+ DoubleTest *const test = (DoubleTest *)tests + idx;
308
+ fflush(stdout); // Avoid incomplete stdout output from prior tests on error
309
+ fprintf(stderr,
305
310
  "testcase: lowerBound=%f (%s) upperBound=%f (%s)",
306
311
  test->lowerBound,
307
312
  test->includeLowerBound ? "inclusive" : "exclusive",
308
313
  test->upperBound,
309
314
  test->includeUpperBound ? "inclusive" : "exclusive");
310
- if (test->min.set) {
311
- fprintf (stderr, " min=%f", test->min.value);
312
- }
313
- if (test->max.set) {
314
- fprintf (stderr, " max=%f", test->max.value);
315
- }
316
- if (test->precision.set) {
317
- fprintf (stderr, " precision=%" PRIu32, test->precision.value);
318
- }
319
- fprintf (stderr, " sparsity=%zu\n", test->sparsity);
320
- fprintf (stderr, "mincover expected ... begin\n");
321
- for (const char **p = test->expectMincoverStrings; *p; ++p) {
322
- fprintf (stderr, " %s\n", *p);
323
- }
324
- fprintf (stderr, "mincover expected ... end\n");
325
- fprintf (stderr, "mincover got ... begin\n");
326
- for (size_t i = 0; i < mc_mincover_len (got); i++) {
327
- fprintf (stderr, " %s\n", mc_mincover_get (got, i));
328
- }
329
- fprintf (stderr, "mincover got ... end\n");
315
+ if (test->min.set) {
316
+ fprintf(stderr, " min=%f", test->min.value);
317
+ }
318
+ if (test->max.set) {
319
+ fprintf(stderr, " max=%f", test->max.value);
320
+ }
321
+ if (test->precision.set) {
322
+ fprintf(stderr, " precision=%" PRIu32, test->precision.value);
323
+ }
324
+ fprintf(stderr, " sparsity=%zu\n", test->sparsity);
325
+ fprintf(stderr, "mincover expected ... begin\n");
326
+ for (const char **p = test->expectMincoverStrings; *p; ++p) {
327
+ fprintf(stderr, " %s\n", *p);
328
+ }
329
+ fprintf(stderr, "mincover expected ... end\n");
330
+ fprintf(stderr, "mincover got ... begin\n");
331
+ for (size_t i = 0; i < mc_mincover_len(got); i++) {
332
+ fprintf(stderr, " %s\n", mc_mincover_get(got, i));
333
+ }
334
+ fprintf(stderr, "mincover got ... end\n");
330
335
  }
331
336
 
332
337
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
333
- static void
334
- _test_dump_Decimal128 (void *tests, size_t idx, mc_mincover_t *got)
335
- {
336
- BSON_ASSERT_PARAM (tests);
337
- Decimal128Test *const test = (Decimal128Test *) tests + idx;
338
- fflush (stdout); // Avoid incomplete stdout output from prior tests on error
339
- fprintf (stderr,
338
+ static void _test_dump_Decimal128(void *tests, size_t idx, mc_mincover_t *got) {
339
+ BSON_ASSERT_PARAM(tests);
340
+ Decimal128Test *const test = (Decimal128Test *)tests + idx;
341
+ fflush(stdout); // Avoid incomplete stdout output from prior tests on error
342
+ fprintf(stderr,
340
343
  "testcase: lowerBound=%s (%s) upperBound=%s (%s)",
341
- mc_dec128_to_string (test->lowerBound).str,
344
+ mc_dec128_to_string(test->lowerBound).str,
342
345
  test->includeLowerBound ? "inclusive" : "exclusive",
343
- mc_dec128_to_string (test->upperBound).str,
346
+ mc_dec128_to_string(test->upperBound).str,
344
347
  test->includeUpperBound ? "inclusive" : "exclusive");
345
- if (test->min.set) {
346
- fprintf (stderr, " min=%s", mc_dec128_to_string (test->min.value).str);
347
- }
348
- if (test->max.set) {
349
- fprintf (stderr, " max=%s", mc_dec128_to_string (test->max.value).str);
350
- }
351
- if (test->precision.set) {
352
- fprintf (stderr, " precision=%" PRIu32, test->precision.value);
353
- }
354
- fprintf (stderr, " sparsity=%zu\n", test->sparsity);
355
- fprintf (stderr, "mincover expected ... begin\n");
356
- for (const char **p = test->expectMincoverStrings; *p; ++p) {
357
- fprintf (stderr, " %s\n", *p);
358
- }
359
- fprintf (stderr, "mincover expected ... end\n");
360
- fprintf (stderr, "mincover got ... begin\n");
361
- for (size_t i = 0; i < mc_mincover_len (got); i++) {
362
- fprintf (stderr, " %s\n", mc_mincover_get (got, i));
363
- }
364
- fprintf (stderr, "mincover got ... end\n");
348
+ if (test->min.set) {
349
+ fprintf(stderr, " min=%s", mc_dec128_to_string(test->min.value).str);
350
+ }
351
+ if (test->max.set) {
352
+ fprintf(stderr, " max=%s", mc_dec128_to_string(test->max.value).str);
353
+ }
354
+ if (test->precision.set) {
355
+ fprintf(stderr, " precision=%" PRIu32, test->precision.value);
356
+ }
357
+ fprintf(stderr, " sparsity=%zu\n", test->sparsity);
358
+ fprintf(stderr, "mincover expected ... begin\n");
359
+ for (const char **p = test->expectMincoverStrings; *p; ++p) {
360
+ fprintf(stderr, " %s\n", *p);
361
+ }
362
+ fprintf(stderr, "mincover expected ... end\n");
363
+ fprintf(stderr, "mincover got ... begin\n");
364
+ for (size_t i = 0; i < mc_mincover_len(got); i++) {
365
+ fprintf(stderr, " %s\n", mc_mincover_get(got, i));
366
+ }
367
+ fprintf(stderr, "mincover got ... end\n");
365
368
  }
366
369
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
367
370
 
368
- static void
369
- _test_getMincover_impl (void *tests,
370
- size_t num_tests,
371
- _test_getMincover_args args)
372
- {
373
- BSON_ASSERT_PARAM (tests);
374
-
375
- for (size_t i = 0; i < num_tests; i++) {
376
- mongocrypt_status_t *const status = mongocrypt_status_new ();
377
- mc_mincover_t *got = args.getMincover (tests, i, status);
378
- const char *expectError = args.expectError (tests, i);
379
- if (expectError) {
380
- ASSERT_OR_PRINT_MSG (NULL == got, "expected error, got success");
381
- ASSERT_STATUS_CONTAINS (status, expectError);
382
- mongocrypt_status_destroy (status);
383
- continue;
384
- }
385
- ASSERT_OK_STATUS (got != NULL, status);
386
-
387
- size_t numGot = mc_mincover_len (got);
388
- const char *const *expectStrings = args.expectMincoverStrings (tests, i);
389
-
390
- const char *const *exp_iter = expectStrings;
391
- size_t nthItem = 0;
392
- for (; *exp_iter; ++nthItem, ++exp_iter) {
393
- if (nthItem > numGot) {
394
- // List length mismatch. Keep scanning, though. We'll use the
395
- // numbers later
396
- continue;
397
- }
398
- const char *gotItem = mc_mincover_get (got, nthItem);
399
- const char *expectItem = *exp_iter;
400
-
401
- if (0 == strcmp (gotItem, expectItem)) {
402
- // This one matches, Keep going.
371
+ static void _test_getMincover_impl(void *tests, size_t num_tests, _test_getMincover_args args) {
372
+ BSON_ASSERT_PARAM(tests);
373
+
374
+ for (size_t i = 0; i < num_tests; i++) {
375
+ mongocrypt_status_t *const status = mongocrypt_status_new();
376
+ mc_mincover_t *got = args.getMincover(tests, i, status);
377
+ const char *expectError = args.expectError(tests, i);
378
+ if (expectError) {
379
+ ASSERT_OR_PRINT_MSG(NULL == got, "expected error, got success");
380
+ ASSERT_STATUS_CONTAINS(status, expectError);
381
+ mongocrypt_status_destroy(status);
403
382
  continue;
404
- }
405
- args.dump (tests, nthItem, got);
406
- TEST_ERROR ("test %zu: mincover mismatch at index %zu:\n"
407
- " Got: %s\n"
408
- " Expected: %s\n",
409
- i,
410
- nthItem,
411
- gotItem,
412
- expectItem);
413
- }
414
-
415
- if (nthItem != numGot) {
416
- args.dump (tests, i, got);
417
- TEST_ERROR (
418
- "test %zu: Got the wrong number of mincover items. Expected %zu "
419
- "items, but got %zu\n",
420
- i,
421
- nthItem,
422
- numGot);
423
- }
424
-
425
- mc_mincover_destroy (got);
426
- mongocrypt_status_destroy (status);
427
- }
383
+ }
384
+ ASSERT_OK_STATUS(got != NULL, status);
385
+
386
+ size_t numGot = mc_mincover_len(got);
387
+ const char *const *expectStrings = args.expectMincoverStrings(tests, i);
388
+
389
+ const char *const *exp_iter = expectStrings;
390
+ size_t nthItem = 0;
391
+ for (; *exp_iter; ++nthItem, ++exp_iter) {
392
+ if (nthItem > numGot) {
393
+ // List length mismatch. Keep scanning, though. We'll use the
394
+ // numbers later
395
+ continue;
396
+ }
397
+ const char *gotItem = mc_mincover_get(got, nthItem);
398
+ const char *expectItem = *exp_iter;
399
+
400
+ if (0 == strcmp(gotItem, expectItem)) {
401
+ // This one matches, Keep going.
402
+ continue;
403
+ }
404
+ args.dump(tests, nthItem, got);
405
+ TEST_ERROR("test %zu: mincover mismatch at index %zu:\n"
406
+ " Got: %s\n"
407
+ " Expected: %s\n",
408
+ i,
409
+ nthItem,
410
+ gotItem,
411
+ expectItem);
412
+ }
413
+
414
+ if (nthItem != numGot) {
415
+ args.dump(tests, i, got);
416
+ TEST_ERROR("test %zu: Got the wrong number of mincover items. Expected %zu "
417
+ "items, but got %zu\n",
418
+ i,
419
+ nthItem,
420
+ numGot);
421
+ }
422
+
423
+ mc_mincover_destroy(got);
424
+ mongocrypt_status_destroy(status);
425
+ }
428
426
  }
429
427
 
430
- static void
431
- _test_getMincoverInt32 (_mongocrypt_tester_t *tester)
432
- {
433
- static Int32Test tests[] = {
434
- {.lowerBound = 1,
435
- .includeLowerBound = false,
436
- .upperBound = 3,
437
- .includeUpperBound = true,
438
- .min = OPT_I32_C (0),
439
- .max = OPT_I32_C (7),
440
- .sparsity = 1,
441
- .expectMincoverStrings = {"01"}},
442
- {.lowerBound = 1,
443
- .includeLowerBound = true,
444
- .upperBound = 3,
445
- .includeUpperBound = false,
446
- .min = OPT_I32_C (0),
447
- .max = OPT_I32_C (7),
448
- .sparsity = 1,
449
- .expectMincoverStrings = {"001", "010"}},
450
- {.lowerBound = 1,
451
- .includeLowerBound = true,
452
- .upperBound = 3,
453
- .includeUpperBound = true,
454
- .min = OPT_I32_C (0),
455
- .max = OPT_I32_C (7),
456
- .sparsity = 1,
457
- .expectMincoverStrings = {"001", "01"}},
458
- {.lowerBound = 3,
459
- .includeLowerBound = true,
460
- .upperBound = 3,
461
- .includeUpperBound = true,
462
- .min = OPT_I32_C (0),
463
- .max = OPT_I32_C (7),
464
- .sparsity = 1,
465
- .expectMincoverStrings = {"011"}},
466
- {.lowerBound = 4,
467
- .includeLowerBound = true,
468
- .upperBound = 3,
469
- .includeUpperBound = true,
470
- .min = OPT_I32_C (0),
471
- .max = OPT_I32_C (7),
472
- .sparsity = 1,
473
- .expectError = "must be less than or equal to"},
474
- {.lowerBound = 1,
475
- .includeLowerBound = true,
476
- .upperBound = 8,
477
- .includeUpperBound = true,
478
- .min = OPT_I32_C (0),
479
- .max = OPT_I32_C (7),
480
- .sparsity = 1,
481
- .expectError = "less than or equal to the maximum value"},
428
+ static void _test_getMincoverInt32(_mongocrypt_tester_t *tester) {
429
+ static Int32Test tests[] = {
430
+ {.lowerBound = 1,
431
+ .includeLowerBound = false,
432
+ .upperBound = 3,
433
+ .includeUpperBound = true,
434
+ .min = OPT_I32_C(0),
435
+ .max = OPT_I32_C(7),
436
+ .sparsity = 1,
437
+ .expectMincoverStrings = {"01"}},
438
+ {.lowerBound = 1,
439
+ .includeLowerBound = true,
440
+ .upperBound = 3,
441
+ .includeUpperBound = false,
442
+ .min = OPT_I32_C(0),
443
+ .max = OPT_I32_C(7),
444
+ .sparsity = 1,
445
+ .expectMincoverStrings = {"001", "010"}},
446
+ {.lowerBound = 1,
447
+ .includeLowerBound = true,
448
+ .upperBound = 3,
449
+ .includeUpperBound = true,
450
+ .min = OPT_I32_C(0),
451
+ .max = OPT_I32_C(7),
452
+ .sparsity = 1,
453
+ .expectMincoverStrings = {"001", "01"}},
454
+ {.lowerBound = 3,
455
+ .includeLowerBound = true,
456
+ .upperBound = 3,
457
+ .includeUpperBound = true,
458
+ .min = OPT_I32_C(0),
459
+ .max = OPT_I32_C(7),
460
+ .sparsity = 1,
461
+ .expectMincoverStrings = {"011"}},
462
+ {.lowerBound = 4,
463
+ .includeLowerBound = true,
464
+ .upperBound = 3,
465
+ .includeUpperBound = true,
466
+ .min = OPT_I32_C(0),
467
+ .max = OPT_I32_C(7),
468
+ .sparsity = 1,
469
+ .expectError = "must be less than or equal to"},
470
+ {.lowerBound = 1,
471
+ .includeLowerBound = true,
472
+ .upperBound = 8,
473
+ .includeUpperBound = true,
474
+ .min = OPT_I32_C(0),
475
+ .max = OPT_I32_C(7),
476
+ .sparsity = 1,
477
+ .expectError = "less than or equal to the maximum value"},
478
+ {.lowerBound = 0,
479
+ .includeLowerBound = true,
480
+ .upperBound = 7,
481
+ .includeUpperBound = true,
482
+ .min = OPT_I32_C(0),
483
+ .max = OPT_I32_C(7),
484
+ .sparsity = 1,
485
+ .expectMincoverStrings = {"root"}},
486
+ {.lowerBound = 0,
487
+ .includeLowerBound = true,
488
+ .upperBound = 7,
489
+ .includeUpperBound = true,
490
+ .min = OPT_I32_C(0),
491
+ .max = OPT_I32_C(7),
492
+ .sparsity = 1,
493
+ .trimFactor = 1,
494
+ .expectMincoverStrings = {"0", "1"}},
495
+ {.lowerBound = 0,
496
+ .includeLowerBound = true,
497
+ .upperBound = 7,
498
+ .includeUpperBound = true,
499
+ .min = OPT_I32_C(0),
500
+ .max = OPT_I32_C(7),
501
+ .sparsity = 1,
502
+ .trimFactor = 2,
503
+ .expectMincoverStrings = {"00", "01", "10", "11"}},
504
+ {.lowerBound = 0,
505
+ .includeLowerBound = true,
506
+ .upperBound = 7,
507
+ .includeUpperBound = true,
508
+ .min = OPT_I32_C(0),
509
+ .max = OPT_I32_C(7),
510
+ .sparsity = 1,
511
+ .trimFactor = 3,
512
+ .expectError =
513
+ "Trim factor must be less than the number of bits (3) used to represent an element of the domain"},
482
514
 
483
515
  #include "./data/range-min-cover/mincover_int32.cstruct"
484
516
 
485
- };
517
+ };
486
518
 
487
- _test_getMincover_impl (
488
- tests,
489
- sizeof (tests) / sizeof (tests[0]),
490
- (_test_getMincover_args){.getMincover = _test_getMincover32,
491
- .expectMincoverStrings = _test_expectMincover32,
492
- .expectError = _test_expectError32,
493
- .dump = _test_dump_32});
519
+ _test_getMincover_impl(tests,
520
+ sizeof(tests) / sizeof(tests[0]),
521
+ (_test_getMincover_args){.getMincover = _test_getMincover32,
522
+ .expectMincoverStrings = _test_expectMincover32,
523
+ .expectError = _test_expectError32,
524
+ .dump = _test_dump_32});
494
525
  }
495
526
 
496
- static void
497
- _test_getMincoverInt64 (_mongocrypt_tester_t *tester)
498
- {
499
- static Int64Test tests[] = {
500
- {.lowerBound = 1,
501
- .includeLowerBound = false,
502
- .upperBound = 3,
503
- .includeUpperBound = true,
504
- .min = OPT_I64_C (0),
505
- .max = OPT_I64_C (7),
506
- .sparsity = 1,
507
- .expectMincoverStrings = {"01"}},
508
- {.lowerBound = 1,
509
- .includeLowerBound = true,
510
- .upperBound = 3,
511
- .includeUpperBound = false,
512
- .min = OPT_I64_C (0),
513
- .max = OPT_I64_C (7),
514
- .sparsity = 1,
515
- .expectMincoverStrings = {"001", "010"}},
516
- {.lowerBound = 1,
517
- .includeLowerBound = true,
518
- .upperBound = 3,
519
- .includeUpperBound = true,
520
- .min = OPT_I64_C (0),
521
- .max = OPT_I64_C (7),
522
- .sparsity = 1,
523
- .expectMincoverStrings = {"001", "01"}},
524
- {.lowerBound = 3,
525
- .includeLowerBound = true,
526
- .upperBound = 3,
527
- .includeUpperBound = true,
528
- .min = OPT_I64_C (0),
529
- .max = OPT_I64_C (7),
530
- .sparsity = 1,
531
- .expectMincoverStrings = {"011"}},
532
- {.lowerBound = 4,
533
- .includeLowerBound = true,
534
- .upperBound = 3,
535
- .includeUpperBound = true,
536
- .min = OPT_I64_C (0),
537
- .max = OPT_I64_C (7),
538
- .sparsity = 1,
539
- .expectError = "must be less than or equal to"},
540
- {.lowerBound = 1,
541
- .includeLowerBound = true,
542
- .upperBound = 8,
543
- .includeUpperBound = true,
544
- .min = OPT_I64_C (0),
545
- .max = OPT_I64_C (7),
546
- .sparsity = 1,
547
- .expectError = "less than or equal to the maximum value"},
527
+ static void _test_getMincoverInt64(_mongocrypt_tester_t *tester) {
528
+ static Int64Test tests[] = {
529
+ {.lowerBound = 1,
530
+ .includeLowerBound = false,
531
+ .upperBound = 3,
532
+ .includeUpperBound = true,
533
+ .min = OPT_I64_C(0),
534
+ .max = OPT_I64_C(7),
535
+ .sparsity = 1,
536
+ .expectMincoverStrings = {"01"}},
537
+ {.lowerBound = 1,
538
+ .includeLowerBound = true,
539
+ .upperBound = 3,
540
+ .includeUpperBound = false,
541
+ .min = OPT_I64_C(0),
542
+ .max = OPT_I64_C(7),
543
+ .sparsity = 1,
544
+ .expectMincoverStrings = {"001", "010"}},
545
+ {.lowerBound = 1,
546
+ .includeLowerBound = true,
547
+ .upperBound = 3,
548
+ .includeUpperBound = true,
549
+ .min = OPT_I64_C(0),
550
+ .max = OPT_I64_C(7),
551
+ .sparsity = 1,
552
+ .expectMincoverStrings = {"001", "01"}},
553
+ {.lowerBound = 3,
554
+ .includeLowerBound = true,
555
+ .upperBound = 3,
556
+ .includeUpperBound = true,
557
+ .min = OPT_I64_C(0),
558
+ .max = OPT_I64_C(7),
559
+ .sparsity = 1,
560
+ .expectMincoverStrings = {"011"}},
561
+ {.lowerBound = 4,
562
+ .includeLowerBound = true,
563
+ .upperBound = 3,
564
+ .includeUpperBound = true,
565
+ .min = OPT_I64_C(0),
566
+ .max = OPT_I64_C(7),
567
+ .sparsity = 1,
568
+ .expectError = "must be less than or equal to"},
569
+ {.lowerBound = 1,
570
+ .includeLowerBound = true,
571
+ .upperBound = 8,
572
+ .includeUpperBound = true,
573
+ .min = OPT_I64_C(0),
574
+ .max = OPT_I64_C(7),
575
+ .sparsity = 1,
576
+ .expectError = "less than or equal to the maximum value"},
548
577
 
549
578
  #include "./data/range-min-cover/mincover_int64.cstruct"
550
579
 
551
- };
580
+ };
552
581
 
553
- _test_getMincover_impl (
554
- tests,
555
- sizeof (tests) / sizeof (tests[0]),
556
- (_test_getMincover_args){.getMincover = _test_getMincover64,
557
- .expectMincoverStrings = _test_expectMincover64,
558
- .expectError = _test_expectError64,
559
- .dump = _test_dump_64});
582
+ _test_getMincover_impl(tests,
583
+ sizeof(tests) / sizeof(tests[0]),
584
+ (_test_getMincover_args){.getMincover = _test_getMincover64,
585
+ .expectMincoverStrings = _test_expectMincover64,
586
+ .expectError = _test_expectError64,
587
+ .dump = _test_dump_64});
560
588
  }
561
589
 
562
- static void
563
- _test_getMincoverDouble (_mongocrypt_tester_t *tester)
564
- {
565
- static DoubleTest tests[] = {
590
+ static void _test_getMincoverDouble(_mongocrypt_tester_t *tester) {
591
+ static DoubleTest tests[] = {
566
592
  #include "./data/range-min-cover/mincover_double.cstruct"
567
593
  #include "./data/range-min-cover/mincover_double_precision.cstruct"
568
- };
569
-
570
- _test_getMincover_impl (
571
- tests,
572
- sizeof (tests) / sizeof (tests[0]),
573
- (_test_getMincover_args){.getMincover = _test_getMincoverDouble_helper,
574
- .expectMincoverStrings =
575
- _test_expectMincoverDouble,
576
- .expectError = _test_expectErrorDouble,
577
- .dump = _test_dump_Double});
594
+ };
595
+
596
+ _test_getMincover_impl(tests,
597
+ sizeof(tests) / sizeof(tests[0]),
598
+ (_test_getMincover_args){.getMincover = _test_getMincoverDouble_helper,
599
+ .expectMincoverStrings = _test_expectMincoverDouble,
600
+ .expectError = _test_expectErrorDouble,
601
+ .dump = _test_dump_Double});
578
602
  }
579
603
 
580
604
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
581
- static void
582
- _test_getMincoverDecimal128 (_mongocrypt_tester_t *tester)
583
- {
584
- Decimal128Test tests[] = {
605
+ static void _test_getMincoverDecimal128(_mongocrypt_tester_t *tester) {
606
+ Decimal128Test tests[] = {
585
607
  #include "./data/range-min-cover/mincover_decimal128.cstruct"
586
608
  #include "./data/range-min-cover/mincover_decimal128_precision.cstruct"
587
- };
588
-
589
- _test_getMincover_impl (
590
- tests,
591
- sizeof (tests) / sizeof (tests[0]),
592
- (_test_getMincover_args){
593
- .getMincover = _test_getMincoverDecimal128_helper,
594
- .expectMincoverStrings = _test_expectMincoverDecimal128,
595
- .expectError = _test_expectErrorDecimal128,
596
- .dump = _test_dump_Decimal128});
609
+ };
610
+
611
+ _test_getMincover_impl(tests,
612
+ sizeof(tests) / sizeof(tests[0]),
613
+ (_test_getMincover_args){.getMincover = _test_getMincoverDecimal128_helper,
614
+ .expectMincoverStrings = _test_expectMincoverDecimal128,
615
+ .expectError = _test_expectErrorDecimal128,
616
+ .dump = _test_dump_Decimal128});
597
617
  }
598
618
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
599
619
 
600
- void
601
- _mongocrypt_tester_install_range_mincover (_mongocrypt_tester_t *tester)
602
- {
603
- INSTALL_TEST (_test_getMincoverInt32);
604
- INSTALL_TEST (_test_getMincoverInt64);
605
- INSTALL_TEST (_test_getMincoverDouble);
620
+ void _mongocrypt_tester_install_range_mincover(_mongocrypt_tester_t *tester) {
621
+ INSTALL_TEST(_test_getMincoverInt32);
622
+ INSTALL_TEST(_test_getMincoverInt64);
623
+ INSTALL_TEST(_test_getMincoverDouble);
606
624
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
607
- INSTALL_TEST (_test_getMincoverDecimal128);
625
+ INSTALL_TEST(_test_getMincoverDecimal128);
608
626
  #endif
609
627
  }