libmongocrypt-helper 1.7.4.0.1002 → 1.11.0.0.1001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (600) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +40 -5
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +29 -24
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
  5. data/ext/libmongocrypt/libmongocrypt/Earthfile +522 -0
  6. data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
  7. data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
  8. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +25 -6
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +35 -3
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
  15. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
  16. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
  17. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -1
  18. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
  19. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +22 -26
  22. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
  25. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
  27. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +22 -7
  28. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  29. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
  30. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
  31. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
  32. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
  33. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
  34. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
  35. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
  36. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
  37. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
  38. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
  39. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
  40. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +50 -6
  41. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  42. data/ext/libmongocrypt/libmongocrypt/bindings/{python/test/data/fle2-find-range-explicit → java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2}/int32/rangeopts.json +3 -0
  43. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -771
  44. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +86 -0
  45. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
  46. data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
  47. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
  48. data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
  50. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
  51. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
  52. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
  53. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
  54. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
  55. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
  56. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
  57. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +232 -296
  58. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -31
  59. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
  60. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
  61. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
  62. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
  63. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -254
  64. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
  65. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
  66. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
  67. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
  68. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
  69. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
  70. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
  71. data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
  72. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
  73. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements-test.txt +7 -0
  74. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
  75. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
  76. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
  77. data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
  78. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +2 -10
  79. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
  80. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
  81. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
  82. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
  83. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
  84. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  85. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +14 -0
  86. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
  87. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
  88. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
  89. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
  90. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
  91. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
  92. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
  93. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
  94. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
  95. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
  96. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
  97. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
  98. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +991 -343
  99. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
  100. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
  101. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +31 -6
  102. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +20 -227
  103. data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
  104. data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
  105. data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -0
  106. data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
  107. data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
  108. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
  109. data/ext/libmongocrypt/libmongocrypt/etc/c6-vault.repo +39 -0
  110. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
  111. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
  112. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
  113. data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +15 -24
  114. data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
  115. data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
  116. data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
  117. data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
  118. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
  119. data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
  120. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
  121. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
  122. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -0
  123. data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
  124. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
  125. data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
  126. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
  127. data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
  128. data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
  129. data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
  130. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
  131. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  132. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +17 -0
  133. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
  134. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
  135. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
  136. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
  137. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
  138. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
  139. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
  140. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
  141. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
  142. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
  143. data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +381 -436
  144. data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
  145. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +183 -248
  146. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
  147. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
  148. data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
  149. data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
  150. data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
  151. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
  152. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
  153. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +21 -11
  154. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +175 -99
  155. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
  156. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +69 -70
  157. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +445 -439
  158. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
  159. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
  160. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
  161. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
  162. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +103 -0
  163. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +28 -31
  164. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +173 -0
  165. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
  166. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +130 -0
  167. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +36 -44
  168. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +382 -0
  169. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
  170. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
  171. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
  172. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
  173. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +454 -325
  174. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
  175. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
  176. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
  177. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
  178. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
  179. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
  180. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
  181. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +56 -56
  182. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +520 -580
  183. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +47 -66
  184. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +67 -76
  185. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +201 -190
  186. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +55 -42
  187. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +809 -558
  188. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +177 -201
  189. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +54 -53
  190. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +188 -240
  191. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +43 -35
  192. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +484 -337
  193. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
  194. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
  195. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +87 -65
  196. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +153 -125
  197. data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
  198. data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
  199. data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
  200. data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
  201. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
  202. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +461 -499
  203. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +256 -334
  204. data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
  205. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
  206. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
  207. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
  208. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
  209. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
  210. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
  211. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +1 -9
  212. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
  213. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
  214. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +442 -565
  215. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
  216. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
  217. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
  218. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +104 -132
  219. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -24
  220. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +110 -93
  221. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
  222. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
  223. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
  224. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
  225. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
  226. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
  227. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1145 -1567
  228. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +510 -476
  229. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
  230. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2775 -2697
  231. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +189 -184
  232. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
  233. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +990 -1139
  234. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +23 -24
  235. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
  236. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
  237. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
  238. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +42 -44
  239. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +292 -272
  240. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +70 -110
  241. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +1010 -1033
  242. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
  243. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
  244. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +127 -120
  245. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1692 -1611
  246. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
  247. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
  248. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +31 -36
  249. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1923 -1479
  250. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
  251. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +124 -107
  252. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +925 -419
  253. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +99 -122
  254. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
  255. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
  256. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
  257. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
  258. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
  259. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +98 -136
  260. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +924 -1339
  261. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +199 -313
  262. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +83 -79
  263. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
  264. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +64 -73
  265. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
  266. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
  267. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
  268. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
  269. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
  270. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
  272. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
  273. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
  274. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
  276. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
  277. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
  278. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
  279. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
  280. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
  281. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
  282. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
  283. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
  284. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
  286. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
  287. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
  288. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
  289. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
  290. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
  291. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
  292. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
  293. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
  294. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
  295. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
  296. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
  297. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
  298. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
  300. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +60 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
  303. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +5 -5
  304. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
  306. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
  309. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
  310. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
  311. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
  312. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
  313. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
  314. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
  315. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
  316. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
  317. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
  318. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  319. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
  320. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
  321. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
  322. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
  323. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
  324. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
  325. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
  326. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
  327. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
  328. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
  329. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
  330. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
  331. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
  332. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
  333. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
  334. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
  335. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
  336. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
  337. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
  338. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
  339. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
  340. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
  341. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
  342. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
  343. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
  344. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
  345. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
  346. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
  347. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
  348. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
  349. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
  350. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
  351. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
  352. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
  353. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
  354. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
  355. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  356. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
  357. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
  358. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
  359. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
  360. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
  361. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
  362. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
  363. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
  364. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
  365. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
  366. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
  367. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
  368. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
  369. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
  370. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
  371. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
  372. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
  373. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
  374. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
  375. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
  376. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
  377. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
  378. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
  379. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
  380. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
  381. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
  382. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
  383. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
  384. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
  385. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
  386. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
  387. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
  388. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
  389. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
  390. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
  391. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
  392. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
  393. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
  394. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
  395. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
  396. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
  397. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
  398. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
  399. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
  400. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
  401. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
  402. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
  403. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
  404. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
  405. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
  406. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
  407. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
  408. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
  409. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
  410. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
  411. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
  412. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
  413. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
  414. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
  415. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
  416. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
  417. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
  418. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
  419. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
  420. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
  421. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
  422. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
  423. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
  424. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
  425. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
  426. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
  427. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
  428. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
  429. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
  430. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
  431. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
  432. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
  433. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
  434. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
  435. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
  436. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
  437. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/README.md +17 -0
  438. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
  439. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
  440. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
  441. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
  442. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
  443. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
  444. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
  445. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
  446. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
  447. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
  448. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +30 -0
  449. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +25 -0
  450. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +25 -0
  451. data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
  452. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +279 -323
  453. data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
  454. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
  455. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
  456. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +60 -73
  457. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
  458. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +129 -0
  459. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
  460. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
  461. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +248 -0
  462. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
  463. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
  464. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
  465. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
  466. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +421 -388
  467. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +974 -825
  468. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +499 -481
  469. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +312 -148
  470. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
  471. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +249 -213
  472. data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
  473. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +632 -808
  474. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -2
  475. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
  476. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
  477. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +118 -37
  478. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
  479. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
  480. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
  481. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +410 -445
  482. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +798 -812
  483. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +142 -135
  484. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +70 -71
  485. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
  486. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
  487. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +870 -1045
  488. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +5183 -4717
  489. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
  490. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +1093 -1178
  491. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +348 -420
  492. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
  493. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
  494. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
  495. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
  496. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
  497. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
  498. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +705 -368
  499. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
  500. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
  501. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
  502. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +1073 -690
  503. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
  504. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
  505. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +381 -451
  506. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +55 -67
  507. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +7 -10
  508. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +879 -918
  509. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +119 -169
  510. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
  511. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
  512. data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
  513. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +512 -559
  514. data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
  515. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +771 -882
  516. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
  517. data/lib/libmongocrypt_helper/version.rb +2 -2
  518. metadata +245 -111
  519. checksums.yaml.gz.sig +0 -0
  520. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
  521. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  522. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
  523. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -81
  524. data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
  525. data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
  526. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
  527. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -39
  528. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -515
  529. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
  530. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
  531. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -699
  532. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -100
  533. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
  534. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
  535. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -42
  536. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
  537. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -487
  538. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -16051
  539. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -81
  540. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -929
  541. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
  542. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -953
  543. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
  544. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -701
  545. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
  546. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -284
  547. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
  548. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
  549. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
  550. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
  551. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
  552. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
  553. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
  554. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
  555. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
  556. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
  557. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -59
  558. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -29
  559. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
  560. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
  561. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -84
  562. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  563. data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +0 -12
  564. data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
  565. data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
  566. data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
  567. data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
  568. data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
  569. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
  570. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
  571. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
  572. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
  573. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
  574. data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
  575. data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
  576. data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
  577. data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
  578. data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
  579. data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +0 -359
  580. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
  581. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
  582. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
  583. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
  584. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
  585. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
  586. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
  587. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
  588. data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
  589. data.tar.gz.sig +0 -0
  590. metadata.gz.sig +0 -0
  591. /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/key-filter.json +0 -0
  592. /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
  593. /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
  594. /data/ext/libmongocrypt/libmongocrypt/bindings/{java/mongocrypt/src/test/resources/fle2-find-range-explicit → python/test/data/fle2-find-rangePreview-explicit}/int32/rangeopts.json +0 -0
  595. /data/ext/libmongocrypt/libmongocrypt/{test/data/fle2-find-range-explicit/int32-nominmax → bindings/python/test/data/fle2-find-rangePreview-explicit/int32}/value-to-encrypt.json +0 -0
  596. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
  597. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
  598. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
  599. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
  600. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -23,446 +23,479 @@
23
23
  #include <float.h> // DBL_MIN
24
24
 
25
25
  #define MAX_INT32_EDGES 33
26
+
26
27
  typedef struct {
27
- int32_t value;
28
- mc_optional_int32_t min;
29
- mc_optional_int32_t max;
30
- size_t sparsity;
31
- // expectEdges includes a trailing NULL pointer.
32
- const char *expectEdges[MAX_INT32_EDGES + 1];
33
- const char *expectError;
28
+ int32_t value;
29
+ mc_optional_int32_t min;
30
+ mc_optional_int32_t max;
31
+ size_t sparsity;
32
+ // expectEdges includes a trailing NULL pointer.
33
+ const char *expectEdges[MAX_INT32_EDGES + 1];
34
+ const char *expectError;
35
+ int32_t trimFactor;
34
36
  } Int32Test;
37
+
35
38
  #undef MAX_INT32_EDGES
36
39
 
37
- static void
38
- print_edges_compared (mc_edges_t *edgesGot, const char *const *edgesExpected)
39
- {
40
- fflush (stdout); // Avoid incomplete stdout output from prior tests on error
41
- fprintf (stderr, "edges got ... begin\n");
42
- for (size_t i = 0; i < mc_edges_len (edgesGot); i++) {
43
- fprintf (stderr, " %s\n", mc_edges_get (edgesGot, i));
44
- }
45
- fprintf (stderr, "edges got ... end\n");
46
-
47
- fprintf (stderr, "edges expected ... begin\n");
48
- const char *const *iter = edgesExpected;
49
- while (*iter != NULL) {
50
- fprintf (stderr, " %s\n", *iter);
51
- iter++;
52
- }
53
- fprintf (stderr, "edges expected ... end\n");
40
+ static void print_edges_compared(mc_edges_t *edgesGot, const char *const *edgesExpected) {
41
+ fflush(stdout); // Avoid incomplete stdout output from prior tests on error
42
+ fprintf(stderr, "edges got ... begin\n");
43
+ for (size_t i = 0; i < mc_edges_len(edgesGot); i++) {
44
+ fprintf(stderr, " %s\n", mc_edges_get(edgesGot, i));
45
+ }
46
+ fprintf(stderr, "edges got ... end\n");
47
+
48
+ fprintf(stderr, "edges expected ... begin\n");
49
+ const char *const *iter = edgesExpected;
50
+ while (*iter != NULL) {
51
+ fprintf(stderr, " %s\n", *iter);
52
+ iter++;
53
+ }
54
+ fprintf(stderr, "edges expected ... end\n");
54
55
  }
55
56
 
56
- static void
57
- _test_getEdgesInt32 (_mongocrypt_tester_t *tester)
58
- {
59
- static const Int32Test tests[] = {
60
- {.value = 2,
61
- .min = OPT_I32_C (0),
62
- .max = OPT_I32_C (7),
63
- .sparsity = 1,
64
- .expectEdges = {"root", "010", "0", "01"}},
65
- {.value = 2,
66
- .min = OPT_I32_C (0),
67
- .max = OPT_I32_C (7),
68
- .sparsity = 2,
69
- .expectEdges = {"root", "010", "01"}},
70
- {.value = 1,
71
- .sparsity = 0,
72
- .expectError = "sparsity must be 1 or larger"},
57
+ static void _test_getEdgesInt32(_mongocrypt_tester_t *tester) {
58
+ static const Int32Test tests[] = {
59
+ {.value = 2,
60
+ .min = OPT_I32_C(0),
61
+ .max = OPT_I32_C(7),
62
+ .sparsity = 1,
63
+ .expectEdges = {"root", "010", "0", "01"}},
64
+ {.value = 2, .min = OPT_I32_C(0), .max = OPT_I32_C(7), .sparsity = 2, .expectEdges = {"root", "010", "01"}},
65
+ {.value = 1, .sparsity = 0, .expectError = "sparsity must be 1 or larger"},
66
+ {.value = 2,
67
+ .min = OPT_I32_C(0),
68
+ .max = OPT_I32_C(7),
69
+ .sparsity = 1,
70
+ .trimFactor = 1,
71
+ .expectEdges = {"010", "0", "01"}},
72
+ {.value = 2,
73
+ .min = OPT_I32_C(0),
74
+ .max = OPT_I32_C(7),
75
+ .sparsity = 1,
76
+ .trimFactor = 2,
77
+ .expectEdges = {"010", "01"}},
78
+ {.value = 2,
79
+ .min = OPT_I32_C(0),
80
+ .max = OPT_I32_C(7),
81
+ .sparsity = 1,
82
+ .trimFactor = 3,
83
+ .expectError =
84
+ "trimFactor must be less than the number of bits (3) used to represent an element of the domain"},
85
+ {.value = 2,
86
+ .min = OPT_I32_C(0),
87
+ .max = OPT_I32_C(7),
88
+ .sparsity = 1,
89
+ .trimFactor = -1,
90
+ .expectError = "trimFactor must be >= 0"},
91
+ {.value = 2,
92
+ .min = OPT_I32_C(0),
93
+ .max = OPT_I32_C(7),
94
+ .sparsity = 2,
95
+ .trimFactor = 0,
96
+ .expectEdges = {"root", "010", "01"}},
97
+ {.value = 2,
98
+ .min = OPT_I32_C(0),
99
+ .max = OPT_I32_C(7),
100
+ .sparsity = 2,
101
+ .trimFactor = 1,
102
+ .expectEdges = {"010", "01"}},
103
+ {.value = 2,
104
+ .min = OPT_I32_C(0),
105
+ .max = OPT_I32_C(7),
106
+ .sparsity = 2,
107
+ .trimFactor = 2,
108
+ .expectEdges = {"010", "01"}},
73
109
  #include "data/range-edge-generation/edges_int32.cstruct"
74
- };
75
-
76
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
77
- mongocrypt_status_t *const status = mongocrypt_status_new ();
78
- const Int32Test *test = tests + i;
79
- mc_getEdgesInt32_args_t args = {.value = test->value,
80
- .min = test->min,
81
- .max = test->max,
82
- .sparsity = test->sparsity};
83
- mc_edges_t *got = mc_getEdgesInt32 (args, status);
84
- if (test->expectError != NULL) {
85
- ASSERT_OR_PRINT_MSG (NULL == got, "expected error, got success");
86
- ASSERT_STATUS_CONTAINS (status, test->expectError);
87
- mongocrypt_status_destroy (status);
88
- continue;
89
- }
90
- ASSERT_OK_STATUS (got != NULL, status);
91
-
92
- size_t numGot = mc_edges_len (got);
93
- size_t numExpected = 0;
94
- while (test->expectEdges[numExpected] != NULL) {
95
- ++numExpected;
96
- }
97
-
98
- if (numExpected != numGot) {
99
- print_edges_compared (got, test->expectEdges);
100
- TEST_ERROR (
101
- "got %zu edges, expected %zu edges\n", numGot, numExpected);
102
- }
103
-
104
- for (size_t gotI = 0; gotI < numGot; gotI++) {
105
- const char *edgeGot = mc_edges_get (got, gotI);
106
- const char *edgeExpected = test->expectEdges[gotI];
107
- if (0 == strcmp (edgeGot, edgeExpected)) {
110
+ };
111
+
112
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
113
+ mongocrypt_status_t *const status = mongocrypt_status_new();
114
+ const Int32Test *test = tests + i;
115
+ mc_getEdgesInt32_args_t args = {.value = test->value,
116
+ .min = test->min,
117
+ .max = test->max,
118
+ .sparsity = test->sparsity,
119
+ .trimFactor = OPT_I32(test->trimFactor)};
120
+ const bool use_range_v2 = true;
121
+ mc_edges_t *got = mc_getEdgesInt32(args, status, use_range_v2);
122
+ if (test->expectError != NULL) {
123
+ ASSERT_OR_PRINT_MSG(NULL == got, "expected error, got success");
124
+ ASSERT_STATUS_CONTAINS(status, test->expectError);
125
+ mongocrypt_status_destroy(status);
108
126
  continue;
109
- }
110
- print_edges_compared (got, test->expectEdges);
111
- TEST_ERROR ("edge mismatch at index %zu. %s != %s\n",
112
- gotI,
113
- edgeGot,
114
- edgeExpected);
115
- }
116
- mc_edges_destroy (got);
117
- mongocrypt_status_destroy (status);
118
- }
127
+ }
128
+ ASSERT_OK_STATUS(got != NULL, status);
129
+
130
+ size_t numGot = mc_edges_len(got);
131
+ size_t numExpected = 0;
132
+ while (test->expectEdges[numExpected] != NULL) {
133
+ ++numExpected;
134
+ }
135
+
136
+ if (numExpected != numGot) {
137
+ print_edges_compared(got, test->expectEdges);
138
+ TEST_ERROR("got %zu edges, expected %zu edges\n", numGot, numExpected);
139
+ }
140
+
141
+ for (size_t gotI = 0; gotI < numGot; gotI++) {
142
+ const char *edgeGot = mc_edges_get(got, gotI);
143
+ const char *edgeExpected = test->expectEdges[gotI];
144
+ if (0 == strcmp(edgeGot, edgeExpected)) {
145
+ continue;
146
+ }
147
+ print_edges_compared(got, test->expectEdges);
148
+ TEST_ERROR("edge mismatch at index %zu. %s != %s\n", gotI, edgeGot, edgeExpected);
149
+ }
150
+ mc_edges_destroy(got);
151
+ mongocrypt_status_destroy(status);
152
+ }
119
153
  }
120
154
 
121
155
  #define MAX_INT64_EDGES 65
156
+
122
157
  typedef struct {
123
- int64_t value;
124
- mc_optional_int64_t min;
125
- mc_optional_int64_t max;
126
- size_t sparsity;
127
- // expectEdges includes a trailing NULL pointer.
128
- const char *expectEdges[MAX_INT64_EDGES + 1];
129
- const char *expectError;
158
+ int64_t value;
159
+ mc_optional_int64_t min;
160
+ mc_optional_int64_t max;
161
+ size_t sparsity;
162
+ // expectEdges includes a trailing NULL pointer.
163
+ const char *expectEdges[MAX_INT64_EDGES + 1];
164
+ const char *expectError;
165
+ uint32_t trimFactor;
130
166
  } Int64Test;
167
+
131
168
  #undef MAX_INT64_EDGES
132
169
 
133
- static void
134
- _test_getEdgesInt64 (_mongocrypt_tester_t *tester)
135
- {
136
- static const Int64Test tests[] = {
137
- {.value = INT64_C (2),
138
- .min = OPT_I64_C (0),
139
- .max = OPT_I64_C (7),
140
- .sparsity = 1,
141
- .expectEdges = {"root", "010", "0", "01"}},
142
- {.value = INT64_C (2),
143
- .min = OPT_I64_C (0),
144
- .max = OPT_I64_C (7),
145
- .sparsity = 2,
146
- .expectEdges = {"root", "010", "01"}},
147
- {.value = 1,
148
- .sparsity = 0,
149
- .expectError = "sparsity must be 1 or larger"},
170
+ static void _test_getEdgesInt64(_mongocrypt_tester_t *tester) {
171
+ static const Int64Test tests[] = {
172
+ {.value = INT64_C(2),
173
+ .min = OPT_I64_C(0),
174
+ .max = OPT_I64_C(7),
175
+ .sparsity = 1,
176
+ .expectEdges = {"root", "010", "0", "01"}},
177
+ {.value = INT64_C(2),
178
+ .min = OPT_I64_C(0),
179
+ .max = OPT_I64_C(7),
180
+ .sparsity = 2,
181
+ .expectEdges = {"root", "010", "01"}},
182
+ {.value = INT64_C(2),
183
+ .min = OPT_I64_C(0),
184
+ .max = OPT_I64_C(7),
185
+ .sparsity = 1,
186
+ .trimFactor = 1,
187
+ .expectEdges = {"010", "0", "01"}},
188
+ {.value = INT64_C(2),
189
+ .min = OPT_I64_C(0),
190
+ .max = OPT_I64_C(7),
191
+ .sparsity = 1,
192
+ .trimFactor = 2,
193
+ .expectEdges = {"010", "01"}},
194
+ {.value = INT64_C(2),
195
+ .min = OPT_I64_C(0),
196
+ .max = OPT_I64_C(7),
197
+ .sparsity = 1,
198
+ .trimFactor = 3,
199
+ .expectError =
200
+ "trimFactor must be less than the number of bits (3) used to represent an element of the domain"},
201
+ {.value = 1, .sparsity = 0, .expectError = "sparsity must be 1 or larger"},
150
202
  #include "data/range-edge-generation/edges_int64.cstruct"
151
- };
152
-
153
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
154
- mongocrypt_status_t *const status = mongocrypt_status_new ();
155
- const Int64Test *test = tests + i;
156
- mc_getEdgesInt64_args_t args = {.value = test->value,
157
- .min = test->min,
158
- .max = test->max,
159
- .sparsity = test->sparsity};
160
- mc_edges_t *got = mc_getEdgesInt64 (args, status);
161
- if (test->expectError != NULL) {
162
- ASSERT_OR_PRINT_MSG (NULL == got, "expected error, got success");
163
- ASSERT_STATUS_CONTAINS (status, test->expectError);
164
- mongocrypt_status_destroy (status);
165
- continue;
166
- }
167
- ASSERT_OK_STATUS (got != NULL, status);
168
-
169
- size_t numGot = mc_edges_len (got);
170
- size_t numExpected = 0;
171
- while (test->expectEdges[numExpected] != NULL) {
172
- ++numExpected;
173
- }
174
-
175
- if (numExpected != numGot) {
176
- print_edges_compared (got, test->expectEdges);
177
- TEST_ERROR (
178
- "got %zu edges, expected %zu edges\n", numGot, numExpected);
179
- }
180
-
181
- for (size_t gotI = 0; gotI < numGot; gotI++) {
182
- const char *edgeGot = mc_edges_get (got, gotI);
183
- const char *edgeExpected = test->expectEdges[gotI];
184
- if (0 == strcmp (edgeGot, edgeExpected)) {
203
+ };
204
+
205
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
206
+ mongocrypt_status_t *const status = mongocrypt_status_new();
207
+ const Int64Test *test = tests + i;
208
+ mc_getEdgesInt64_args_t args = {.value = test->value,
209
+ .min = test->min,
210
+ .max = test->max,
211
+ .sparsity = test->sparsity,
212
+ .trimFactor = OPT_I32(test->trimFactor)};
213
+ const bool use_range_v2 = true;
214
+ mc_edges_t *got = mc_getEdgesInt64(args, status, use_range_v2);
215
+ if (test->expectError != NULL) {
216
+ ASSERT_OR_PRINT_MSG(NULL == got, "expected error, got success");
217
+ ASSERT_STATUS_CONTAINS(status, test->expectError);
218
+ mongocrypt_status_destroy(status);
185
219
  continue;
186
- }
187
- print_edges_compared (got, test->expectEdges);
188
- TEST_ERROR ("edge mismatch at index %zu. %s != %s\n",
189
- gotI,
190
- edgeGot,
191
- edgeExpected);
192
- }
193
- mc_edges_destroy (got);
194
- mongocrypt_status_destroy (status);
195
- }
220
+ }
221
+ ASSERT_OK_STATUS(got != NULL, status);
222
+
223
+ size_t numGot = mc_edges_len(got);
224
+ size_t numExpected = 0;
225
+ while (test->expectEdges[numExpected] != NULL) {
226
+ ++numExpected;
227
+ }
228
+
229
+ if (numExpected != numGot) {
230
+ print_edges_compared(got, test->expectEdges);
231
+ TEST_ERROR("got %zu edges, expected %zu edges\n", numGot, numExpected);
232
+ }
233
+
234
+ for (size_t gotI = 0; gotI < numGot; gotI++) {
235
+ const char *edgeGot = mc_edges_get(got, gotI);
236
+ const char *edgeExpected = test->expectEdges[gotI];
237
+ if (0 == strcmp(edgeGot, edgeExpected)) {
238
+ continue;
239
+ }
240
+ print_edges_compared(got, test->expectEdges);
241
+ TEST_ERROR("edge mismatch at index %zu. %s != %s\n", gotI, edgeGot, edgeExpected);
242
+ }
243
+ mc_edges_destroy(got);
244
+ mongocrypt_status_destroy(status);
245
+ }
196
246
  }
197
247
 
198
248
  #define MAX_DOUBLE_EDGES 65
249
+
199
250
  typedef struct {
200
- double value;
201
- size_t sparsity;
202
- // expectEdges includes a trailing NULL pointer.
203
- const char *expectEdges[MAX_DOUBLE_EDGES + 1];
204
- const char *expectError;
251
+ double value;
252
+ mc_optional_double_t min; // Unused. Kept for consistency with server test data.
253
+ mc_optional_double_t max; // Unused. Kept for consistency with server test data.
254
+ size_t sparsity;
255
+ // expectEdges includes a trailing NULL pointer.
256
+ const char *expectEdges[MAX_DOUBLE_EDGES + 1];
257
+ const char *expectError;
205
258
  } DoubleTest;
259
+
206
260
  #undef MAX_DOUBLE_EDGES
207
261
 
208
- static void
209
- _test_getEdgesDouble (_mongocrypt_tester_t *tester)
210
- {
211
- static const DoubleTest tests[] = {
262
+ static void _test_getEdgesDouble(_mongocrypt_tester_t *tester) {
263
+ static const DoubleTest tests[] = {
212
264
  #include "data/range-edge-generation/edges_double.cstruct"
213
- };
214
-
215
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
216
- mongocrypt_status_t *const status = mongocrypt_status_new ();
217
- const DoubleTest *test = tests + i;
218
- mc_getEdgesDouble_args_t args = {.value = test->value,
219
- .sparsity = test->sparsity};
220
- mc_edges_t *got = mc_getEdgesDouble (args, status);
221
-
222
- if (test->expectError != NULL) {
223
- if (NULL != got) {
224
- TEST_ERROR ("test %zu expected error, got success", i);
225
- }
226
- ASSERT_STATUS_CONTAINS (status, test->expectError);
227
- mongocrypt_status_destroy (status);
228
- continue;
229
- }
230
- ASSERT_OK_STATUS (got != NULL, status);
231
-
232
- size_t numGot = mc_edges_len (got);
233
- size_t numExpected = 0;
234
- while (test->expectEdges[numExpected] != NULL) {
235
- ++numExpected;
236
- }
237
-
238
- if (numExpected != numGot) {
239
- print_edges_compared (got, test->expectEdges);
240
- TEST_ERROR ("test %zu got %zu edges, expected %zu edges\n",
241
- i,
242
- numGot,
243
- numExpected);
244
- }
245
-
246
- for (size_t gotI = 0; gotI < numGot; gotI++) {
247
- const char *edgeGot = mc_edges_get (got, gotI);
248
- const char *edgeExpected = test->expectEdges[gotI];
249
- if (0 == strcmp (edgeGot, edgeExpected)) {
265
+ };
266
+
267
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
268
+ mongocrypt_status_t *const status = mongocrypt_status_new();
269
+ const DoubleTest *test = tests + i;
270
+ const uint32_t trimFactor = 0; // At present, all test cases expect trimFactor=0.
271
+ mc_getEdgesDouble_args_t args = {.value = test->value,
272
+ .sparsity = test->sparsity,
273
+ .trimFactor = OPT_I32(trimFactor)};
274
+ const bool use_range_v2 = true;
275
+ mc_edges_t *got = mc_getEdgesDouble(args, status, use_range_v2);
276
+
277
+ if (test->expectError != NULL) {
278
+ if (NULL != got) {
279
+ TEST_ERROR("test %zu expected error, got success", i);
280
+ }
281
+ ASSERT_STATUS_CONTAINS(status, test->expectError);
282
+ mongocrypt_status_destroy(status);
250
283
  continue;
251
- }
252
- print_edges_compared (got, test->expectEdges);
253
- TEST_ERROR ("test %zu got edge mismatch at index %zu. %s != %s\n",
254
- i,
255
- gotI,
256
- edgeGot,
257
- edgeExpected);
258
- }
259
- mc_edges_destroy (got);
260
- mongocrypt_status_destroy (status);
261
- }
284
+ }
285
+ ASSERT_OK_STATUS(got != NULL, status);
286
+
287
+ size_t numGot = mc_edges_len(got);
288
+ size_t numExpected = 0;
289
+ while (test->expectEdges[numExpected] != NULL) {
290
+ ++numExpected;
291
+ }
292
+
293
+ if (numExpected != numGot) {
294
+ print_edges_compared(got, test->expectEdges);
295
+ TEST_ERROR("test %zu got %zu edges, expected %zu edges\n", i, numGot, numExpected);
296
+ }
297
+
298
+ for (size_t gotI = 0; gotI < numGot; gotI++) {
299
+ const char *edgeGot = mc_edges_get(got, gotI);
300
+ const char *edgeExpected = test->expectEdges[gotI];
301
+ if (0 == strcmp(edgeGot, edgeExpected)) {
302
+ continue;
303
+ }
304
+ print_edges_compared(got, test->expectEdges);
305
+ TEST_ERROR("test %zu got edge mismatch at index %zu. %s != %s\n", i, gotI, edgeGot, edgeExpected);
306
+ }
307
+ mc_edges_destroy(got);
308
+ mongocrypt_status_destroy(status);
309
+ }
262
310
  }
263
311
 
264
-
265
312
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
266
313
  #define MAX_DEC128_EDGES 129
314
+
267
315
  typedef struct {
268
- mc_dec128 value;
269
- mc_optional_dec128_t min;
270
- mc_optional_dec128_t max;
271
- int sparsity;
272
- // expectEdges includes a trailing NULL pointer.
273
- const char *expectEdges[MAX_DEC128_EDGES + 1];
274
- const char *expectError;
316
+ mc_dec128 value;
317
+ mc_optional_dec128_t min;
318
+ mc_optional_dec128_t max;
319
+ int sparsity;
320
+ // expectEdges includes a trailing NULL pointer.
321
+ const char *expectEdges[MAX_DEC128_EDGES + 1];
322
+ const char *expectError;
275
323
  } Decimal128Test;
324
+
276
325
  #undef MAX_DEC128_EDGES
277
326
 
278
- static void
279
- _test_getEdgesDecimal128 (_mongocrypt_tester_t *tester)
280
- {
281
- Decimal128Test tests[] = {
327
+ static void _test_getEdgesDecimal128(_mongocrypt_tester_t *tester) {
328
+ Decimal128Test tests[] = {
282
329
  #include "data/range-edge-generation/edges_decimal128.cstruct"
283
- };
284
-
285
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
286
- const Decimal128Test *test = tests + i;
287
- mongocrypt_status_t *const status = mongocrypt_status_new ();
288
- mc_getEdgesDecimal128_args_t args = {
289
- .value = test->value,
290
- // Some edges specify min/max values, but we don't use them (yet)
291
- // .min = test->min,
292
- // .max = test->max,
293
- .sparsity = (size_t) test->sparsity,
294
- };
295
- mc_edges_t *got = mc_getEdgesDecimal128 (args, status);
296
-
297
- if (test->expectError != NULL) {
298
- if (NULL != got) {
299
- TEST_ERROR ("test %zu expected error, got success", i);
300
- }
301
- ASSERT_STATUS_CONTAINS (status, test->expectError);
302
- mongocrypt_status_destroy (status);
303
- continue;
304
- }
305
- ASSERT_OK_STATUS (got != NULL, status);
306
-
307
- size_t numGot = mc_edges_len (got);
308
- size_t numExpected = 0;
309
- while (test->expectEdges[numExpected] != NULL) {
310
- ++numExpected;
311
- }
312
-
313
- if (numExpected != numGot) {
314
- print_edges_compared (got, test->expectEdges);
315
- TEST_ERROR ("test %zu got %zu edges, expected %zu edges\n",
316
- i,
317
- numGot,
318
- numExpected);
319
- }
320
- for (size_t gotI = 0; gotI < numGot; gotI++) {
321
- const char *edgeGot = mc_edges_get (got, gotI);
322
- const char *edgeExpected = test->expectEdges[gotI];
323
- if (0 == strcmp (edgeGot, edgeExpected)) {
330
+ };
331
+
332
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
333
+ const Decimal128Test *test = tests + i;
334
+ mongocrypt_status_t *const status = mongocrypt_status_new();
335
+ const uint32_t trimFactor = 0; // At present, all test cases expect trimFactor=0.
336
+ mc_getEdgesDecimal128_args_t args = {.value = test->value,
337
+ // Some edges specify min/max values, but we don't use them (yet)
338
+ // .min = test->min,
339
+ // .max = test->max,
340
+ .sparsity = (size_t)test->sparsity,
341
+ .trimFactor = OPT_I32(trimFactor)};
342
+ const bool use_range_v2 = true;
343
+ mc_edges_t *got = mc_getEdgesDecimal128(args, status, use_range_v2);
344
+
345
+ if (test->expectError != NULL) {
346
+ if (NULL != got) {
347
+ TEST_ERROR("test %zu expected error, got success", i);
348
+ }
349
+ ASSERT_STATUS_CONTAINS(status, test->expectError);
350
+ mongocrypt_status_destroy(status);
324
351
  continue;
325
- }
326
- print_edges_compared (got, test->expectEdges);
327
- TEST_ERROR ("test %zu got edge mismatch at index %zu. (actual) '%s' "
328
- "!= '%s' (expected)\n",
329
- i,
330
- gotI,
331
- edgeGot,
332
- edgeExpected);
333
- }
334
- mc_edges_destroy (got);
335
- mongocrypt_status_destroy (status);
336
- }
352
+ }
353
+ ASSERT_OK_STATUS(got != NULL, status);
354
+
355
+ size_t numGot = mc_edges_len(got);
356
+ size_t numExpected = 0;
357
+ while (test->expectEdges[numExpected] != NULL) {
358
+ ++numExpected;
359
+ }
360
+
361
+ if (numExpected != numGot) {
362
+ print_edges_compared(got, test->expectEdges);
363
+ TEST_ERROR("test %zu got %zu edges, expected %zu edges\n", i, numGot, numExpected);
364
+ }
365
+ for (size_t gotI = 0; gotI < numGot; gotI++) {
366
+ const char *edgeGot = mc_edges_get(got, gotI);
367
+ const char *edgeExpected = test->expectEdges[gotI];
368
+ if (0 == strcmp(edgeGot, edgeExpected)) {
369
+ continue;
370
+ }
371
+ print_edges_compared(got, test->expectEdges);
372
+ TEST_ERROR("test %zu got edge mismatch at index %zu. (actual) '%s' "
373
+ "!= '%s' (expected)\n",
374
+ i,
375
+ gotI,
376
+ edgeGot,
377
+ edgeExpected);
378
+ }
379
+ mc_edges_destroy(got);
380
+ mongocrypt_status_destroy(status);
381
+ }
337
382
  }
338
383
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
339
384
 
340
- static void
341
- _test_count_leading_zeros (_mongocrypt_tester_t *tester)
342
- {
343
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u64 (UINT64_C (0)), ==, 64);
344
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u64 (UINT64_C (1)), ==, 63);
345
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u64 (UINT64_MAX), ==, 0);
346
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u64 ((~UINT64_C (0)) >> 1), ==, 1);
347
-
348
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u32 (UINT32_C (0)), ==, 32);
349
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u32 (UINT32_C (1)), ==, 31);
350
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u32 (UINT32_MAX), ==, 0);
351
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u32 ((~UINT32_C (0)) >> 1), ==, 1);
352
-
353
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u128 (MLIB_INT128 (0)), ==, 128);
354
- ASSERT_CMPSIZE_T (mc_count_leading_zeros_u128 (MLIB_INT128 (8)), ==, 124);
355
- ASSERT_CMPSIZE_T (
356
- mc_count_leading_zeros_u128 ((mlib_int128) MLIB_INT128_FROM_PARTS (0, 8)),
357
- ==,
358
- 60);
385
+ static void _test_count_leading_zeros(_mongocrypt_tester_t *tester) {
386
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u64(UINT64_C(0)), ==, 64);
387
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u64(UINT64_C(1)), ==, 63);
388
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u64(UINT64_MAX), ==, 0);
389
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u64((~UINT64_C(0)) >> 1), ==, 1);
390
+
391
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u32(UINT32_C(0)), ==, 32);
392
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u32(UINT32_C(1)), ==, 31);
393
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u32(UINT32_MAX), ==, 0);
394
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u32((~UINT32_C(0)) >> 1), ==, 1);
395
+
396
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u128(MLIB_INT128(0)), ==, 128);
397
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u128(MLIB_INT128(8)), ==, 124);
398
+ ASSERT_CMPSIZE_T(mc_count_leading_zeros_u128((mlib_int128)MLIB_INT128_FROM_PARTS(0, 8)), ==, 60);
359
399
  }
360
400
 
361
401
  typedef struct {
362
- uint32_t in;
363
- const char *expect;
402
+ uint32_t in;
403
+ const char *expect;
364
404
  } bitstring_u32_test;
365
405
 
366
406
  typedef struct {
367
- uint64_t in;
368
- const char *expect;
407
+ uint64_t in;
408
+ const char *expect;
369
409
  } bitstring_u64_test;
370
410
 
371
411
  typedef struct {
372
- mlib_int128 in;
373
- const char *expect;
412
+ mlib_int128 in;
413
+ const char *expect;
374
414
  } bitstring_u128_test;
375
415
 
376
- static void
377
- _test_convert_to_bitstring (_mongocrypt_tester_t *tester)
378
- {
379
- // Test uint32_t.
380
- {
381
- bitstring_u32_test tests[] = {
382
- {.in = 0, .expect = "00000000000000000000000000000000"},
383
- {.in = 1, .expect = "00000000000000000000000000000001"},
384
- {.in = 123, .expect = "00000000000000000000000001111011"},
385
- {.in = UINT32_MAX, .expect = "11111111111111111111111111111111"},
386
- {.in = UINT32_MAX - 1u, .expect = "11111111111111111111111111111110"}};
387
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
388
- bitstring_u32_test *test = tests + i;
389
- mc_bitstring got = mc_convert_to_bitstring_u32 (test->in);
390
- ASSERT_STREQUAL (test->expect, got.str);
391
- }
392
- }
393
- // Test uint64_t.
394
- {
395
- bitstring_u64_test tests[] = {
396
- {.in = 0,
397
- .expect = "0000000000000000000000000000000000000000000000000000000000"
398
- "000000"},
399
- {.in = 1,
400
- .expect = "0000000000000000000000000000000000000000000000000000000000"
401
- "000001"},
402
- {.in = 123,
403
- .expect = "0000000000000000000000000000000000000000000000000000000001"
404
- "111011"},
405
- {.in = UINT64_MAX,
406
- .expect = "1111111111111111111111111111111111111111111111111111111111"
407
- "111111"},
408
- {.in = UINT64_MAX - 1u,
409
- .expect = "1111111111111111111111111111111111111111111111111111111111"
410
- "111110"}};
411
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
412
- bitstring_u64_test *test = tests + i;
413
- mc_bitstring got = mc_convert_to_bitstring_u64 (test->in);
414
- ASSERT_STREQUAL (test->expect, got.str);
415
- }
416
- }
417
- // Tests for u128
418
- {
419
- bitstring_u128_test tests[] = {
420
- {
421
- .in = MLIB_INT128 (0),
422
- .expect = "00000000000000000000000000000000000000000000000000000000"
423
- "00000000000000000000000000000000000000000000000000000000"
424
- "0000000000000000",
425
- },
426
- {
427
- .in = MLIB_INT128 (1),
428
- .expect = "00000000000000000000000000000000000000000000000000000000"
429
- "00000000000000000000000000000000000000000000000000000000"
430
- "0000000000000001",
431
- },
432
- {
433
- .in = MLIB_INT128 (256),
434
- .expect = "00000000000000000000000000000000000000000000000000000000"
435
- "00000000000000000000000000000000000000000000000000000000"
436
- "0000000100000000",
437
- },
438
- {
439
- .in = mlib_int128_from_string (
440
- "0b1011010010001011101010010100101010010101010101001010010100100"
441
- "101010101010010001010011010110110100110010101010010101001111010"
442
- "1011",
443
- NULL),
444
- .expect = "10110100100010111010100101001010100101010101010010100101"
445
- "00100101010101010010001010011010110110100110010101010010"
446
- "1010011110101011",
447
- },
448
- };
449
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
450
- bitstring_u128_test *test = tests + i;
451
- mc_bitstring got = mc_convert_to_bitstring_u128 (test->in);
452
- ASSERT_STREQUAL (test->expect, got.str);
453
- }
454
- }
416
+ static void _test_convert_to_bitstring(_mongocrypt_tester_t *tester) {
417
+ // Test uint32_t.
418
+ {
419
+ bitstring_u32_test tests[] = {{.in = 0, .expect = "00000000000000000000000000000000"},
420
+ {.in = 1, .expect = "00000000000000000000000000000001"},
421
+ {.in = 123, .expect = "00000000000000000000000001111011"},
422
+ {.in = UINT32_MAX, .expect = "11111111111111111111111111111111"},
423
+ {.in = UINT32_MAX - 1u, .expect = "11111111111111111111111111111110"}};
424
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
425
+ bitstring_u32_test *test = tests + i;
426
+ mc_bitstring got = mc_convert_to_bitstring_u32(test->in);
427
+ ASSERT_STREQUAL(test->expect, got.str);
428
+ }
429
+ }
430
+ // Test uint64_t.
431
+ {
432
+ bitstring_u64_test tests[] = {{.in = 0,
433
+ .expect = "0000000000000000000000000000000000000000000000000000000000"
434
+ "000000"},
435
+ {.in = 1,
436
+ .expect = "0000000000000000000000000000000000000000000000000000000000"
437
+ "000001"},
438
+ {.in = 123,
439
+ .expect = "0000000000000000000000000000000000000000000000000000000001"
440
+ "111011"},
441
+ {.in = UINT64_MAX,
442
+ .expect = "1111111111111111111111111111111111111111111111111111111111"
443
+ "111111"},
444
+ {.in = UINT64_MAX - 1u,
445
+ .expect = "1111111111111111111111111111111111111111111111111111111111"
446
+ "111110"}};
447
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
448
+ bitstring_u64_test *test = tests + i;
449
+ mc_bitstring got = mc_convert_to_bitstring_u64(test->in);
450
+ ASSERT_STREQUAL(test->expect, got.str);
451
+ }
452
+ }
453
+ // Tests for u128
454
+ {
455
+ bitstring_u128_test tests[] = {
456
+ {
457
+ .in = MLIB_INT128(0),
458
+ .expect = "00000000000000000000000000000000000000000000000000000000"
459
+ "00000000000000000000000000000000000000000000000000000000"
460
+ "0000000000000000",
461
+ },
462
+ {
463
+ .in = MLIB_INT128(1),
464
+ .expect = "00000000000000000000000000000000000000000000000000000000"
465
+ "00000000000000000000000000000000000000000000000000000000"
466
+ "0000000000000001",
467
+ },
468
+ {
469
+ .in = MLIB_INT128(256),
470
+ .expect = "00000000000000000000000000000000000000000000000000000000"
471
+ "00000000000000000000000000000000000000000000000000000000"
472
+ "0000000100000000",
473
+ },
474
+ {
475
+ .in = mlib_int128_from_string("0b1011010010001011101010010100101010010101010101001010010100100"
476
+ "101010101010010001010011010110110100110010101010010101001111010"
477
+ "1011",
478
+ NULL),
479
+ .expect = "10110100100010111010100101001010100101010101010010100101"
480
+ "00100101010101010010001010011010110110100110010101010010"
481
+ "1010011110101011",
482
+ },
483
+ };
484
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
485
+ bitstring_u128_test *test = tests + i;
486
+ mc_bitstring got = mc_convert_to_bitstring_u128(test->in);
487
+ ASSERT_STREQUAL(test->expect, got.str);
488
+ }
489
+ }
455
490
  }
456
491
 
457
- void
458
- _mongocrypt_tester_install_range_edge_generation (_mongocrypt_tester_t *tester)
459
- {
460
- INSTALL_TEST (_test_getEdgesInt32);
461
- INSTALL_TEST (_test_getEdgesInt64);
462
- INSTALL_TEST (_test_getEdgesDouble);
492
+ void _mongocrypt_tester_install_range_edge_generation(_mongocrypt_tester_t *tester) {
493
+ INSTALL_TEST(_test_getEdgesInt32);
494
+ INSTALL_TEST(_test_getEdgesInt64);
495
+ INSTALL_TEST(_test_getEdgesDouble);
463
496
  #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
464
- INSTALL_TEST (_test_getEdgesDecimal128);
497
+ INSTALL_TEST(_test_getEdgesDecimal128);
465
498
  #endif
466
- INSTALL_TEST (_test_count_leading_zeros);
467
- INSTALL_TEST (_test_convert_to_bitstring);
499
+ INSTALL_TEST(_test_count_leading_zeros);
500
+ INSTALL_TEST(_test_convert_to_bitstring);
468
501
  }