libmongocrypt-helper 1.12.0.0.1001 → 1.14.0.0.1001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (648) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +27 -0
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +15 -1
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +3 -3
  5. data/ext/libmongocrypt/libmongocrypt/CONTRIBUTING.md +14 -0
  6. data/ext/libmongocrypt/libmongocrypt/Earthfile +50 -50
  7. data/ext/libmongocrypt/libmongocrypt/README.md +8 -17
  8. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +13 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/python/CONTRIBUTING.md +34 -0
  10. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +1 -1
  11. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +6 -2
  12. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +57 -3
  13. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +40 -0
  14. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +14 -0
  15. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +6 -2
  16. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +1 -1
  17. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +8 -8
  18. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/libmongocrypt-version.txt +1 -0
  19. data/ext/libmongocrypt/libmongocrypt/bindings/python/{release.sh → scripts/release.sh} +9 -3
  20. data/ext/libmongocrypt/libmongocrypt/bindings/python/{synchro.py → scripts/synchro.py} +16 -9
  21. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.sh +8 -0
  22. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update-version.sh +27 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update_binding.py +78 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-field-config-map.json +0 -1
  25. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +0 -2
  26. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +26 -11
  27. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +4 -2
  28. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +3 -5
  29. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +37 -43
  30. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +39 -13
  31. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +1 -1
  32. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +9 -9
  33. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +0 -2
  34. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-in-functions.patch +158 -0
  35. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +3 -3
  36. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +1 -1
  37. data/ext/libmongocrypt/libmongocrypt/integrating.md +42 -11
  38. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +1 -1
  39. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.c +5 -0
  40. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.h +1 -1
  41. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_azure_request.c +1 -1
  42. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_windows.c +2 -2
  43. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  44. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +4 -2
  45. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +1 -2
  46. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message.c +1 -1
  47. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +7 -3
  48. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -4
  49. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt.c +1 -1
  50. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -8
  51. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.h +9 -0
  52. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response_parser.c +0 -1
  53. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.c +7 -3
  54. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.h +2 -0
  55. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +13 -6
  56. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +29 -11
  57. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +3 -3
  58. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +4 -4
  59. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_request.c +4 -0
  60. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response.c +3 -0
  61. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response_parser.c +4 -0
  62. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.c +1 -1
  63. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.h +1 -1
  64. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +50 -48
  65. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +235 -65
  66. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +1 -1
  67. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +4 -2
  68. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +2 -2
  69. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +2 -2
  70. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +6 -4
  71. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +44 -12
  72. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +5 -1
  73. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +89 -8
  74. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +346 -131
  75. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +6 -18
  76. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +6 -18
  77. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +1 -1
  78. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +25 -26
  79. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +2 -1
  80. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload-private.h +122 -0
  81. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload.c +477 -0
  82. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +35 -3
  83. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +193 -44
  84. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +6 -18
  85. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +105 -7
  86. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +386 -74
  87. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +13 -10
  88. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +3 -2
  89. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +7 -6
  90. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block-private.h +7 -2
  91. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c +21 -3
  92. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +1 -1
  93. data/ext/libmongocrypt/libmongocrypt/{bindings/java/mongocrypt/benchmarks/build.gradle.kts → src/mc-parse-utils-private.h} +10 -11
  94. data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils.c +48 -0
  95. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +5 -5
  96. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +15 -20
  97. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +4 -6
  98. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +9 -18
  99. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +4 -5
  100. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +5 -9
  101. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +14 -19
  102. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +2 -4
  103. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +109 -119
  104. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +2 -2
  105. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +4 -2
  106. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker-private.h +123 -0
  107. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker.c +1065 -0
  108. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets-private.h +95 -0
  109. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets.c +304 -0
  110. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode-private.h +52 -0
  111. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode.c +324 -0
  112. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +130 -2
  113. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +159 -3
  114. data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +1 -1
  115. data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +4 -2
  116. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +1 -1
  117. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +12 -1
  118. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
  119. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +5 -5
  120. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +2 -5
  121. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +65 -58
  122. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +3 -3
  123. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +1 -1
  124. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +1 -1
  125. data/ext/libmongocrypt/libmongocrypt/src/mlib/windows-lean.h +2 -0
  126. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +11 -0
  127. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +36 -3
  128. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -1
  129. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +4 -0
  130. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +1 -1
  131. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +4 -4
  132. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +29 -25
  133. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +3 -2
  134. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +14 -7
  135. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +463 -900
  136. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +5 -19
  137. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +12 -0
  138. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +5 -13
  139. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +19 -2
  140. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +9 -9
  141. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1 -1
  142. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +3 -4
  143. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +773 -584
  144. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +0 -6
  145. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +0 -1
  146. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +8 -13
  147. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +1 -1
  148. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +7 -2
  149. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +53 -40
  150. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +17 -0
  151. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +5 -1
  152. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +1 -1
  153. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +3 -1
  154. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +1 -1
  155. data/ext/libmongocrypt/libmongocrypt/src/unicode/case-fold-map.c +1434 -0
  156. data/ext/libmongocrypt/libmongocrypt/src/unicode/diacritic-fold-map.c +2884 -0
  157. data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.c +139 -0
  158. data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.h +58 -0
  159. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +0 -14
  160. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +2 -2
  161. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +1 -0
  162. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +1 -0
  163. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +1 -0
  164. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +1 -1
  165. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +20 -21
  166. data/ext/libmongocrypt/libmongocrypt/test/data/compact/missing-key-id/collinfo.json +2 -2
  167. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-fields/collinfo.json +1 -1
  168. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +1 -1
  169. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +1 -1
  170. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +6 -2
  171. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +20 -21
  172. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd-to-mongocryptd.json +1 -2
  173. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/collinfo.json +2 -2
  174. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/encrypted-payload.json +2 -3
  175. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/mongocryptd-reply.json +1 -2
  176. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/cmd-to-mongocryptd.json +1 -2
  177. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/collinfo.json +2 -2
  178. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/encrypted-payload.json +2 -3
  179. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/mongocryptd-reply.json +1 -2
  180. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/cmd-to-mongocryptd.json +1 -2
  181. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/collinfo.json +2 -2
  182. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/mongocryptd-reply.json +1 -2
  183. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/collinfo.json +2 -1
  184. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-extraField.json +0 -1
  185. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-missingKeyId.json +0 -1
  186. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField-badVersionSet.json +23 -0
  187. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField-goodVersionSet.json +23 -0
  188. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField.json +0 -1
  189. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields-badVersionSet.json +48 -0
  190. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields-goodVersionSet.json +48 -0
  191. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields.json +47 -0
  192. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-twoFields.json +0 -1
  193. data/ext/libmongocrypt/libmongocrypt/test/data/encrypted-field-config-map.json +1 -3
  194. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1DeterministicEncryptedValue.json +8 -0
  195. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1EncryptionPlaceholder.json +8 -0
  196. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1RandomEncryptedValue.json +8 -0
  197. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EncryptionPlaceholder.json +8 -0
  198. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2FindEqualityPayloadV2.json +8 -0
  199. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValue.json +8 -0
  200. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValueV2.json +8 -0
  201. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValue.json +8 -0
  202. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValueV2.json +8 -0
  203. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-RangeV1.json +8 -0
  204. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-explicit/insert-indexed.json → explicit-decrypt/FLE2InsertUpdatePayload.json} +1 -1
  205. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV1.json +8 -0
  206. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV2.json +8 -0
  207. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2.json +8 -0
  208. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValue.json +8 -0
  209. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValueV2.json +8 -0
  210. data/ext/libmongocrypt/libmongocrypt/test/data/find-with-encryptionInformation.json +0 -1
  211. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-csfle/collinfo.json +2 -1
  212. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/collinfo.json +2 -1
  213. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-collinfo.json +26 -0
  214. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd-mongocryptd-reply.json +51 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd-to-mongocryptd.json +45 -0
  216. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd.json +18 -0
  217. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/int32/encrypted-field-map.json → fle2-bad-str-encode-version/bad-encrypted-field-config-map.json} +7 -12
  218. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-bad-str-encode-version}/encrypted-payload.json +4 -4
  219. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/cmd-to-mongocryptd.json +1 -2
  220. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/encrypted-field-config-map.json +1 -2
  221. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/cmd-to-mongocryptd.json +44 -0
  222. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/cmd.json +17 -0
  223. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-equality/encrypted-field-map.json → fle2-create-encrypted-collection/encrypted-field-config-map.json} +9 -8
  224. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/encrypted-payload.json +17 -0
  225. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/mongocryptd-reply.json +50 -0
  226. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-encrypted-fields-unset-str-encode-version/cmd-to-mongocryptd.json +45 -0
  227. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-encrypted-fields-unset-str-encode-version/mongocryptd-reply.json +51 -0
  228. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/cmd-to-mongocryptd.json +46 -0
  229. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/cmd.json +18 -0
  230. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/encrypted-field-config-map.json +25 -0
  231. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/encrypted-payload.json +18 -0
  232. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/mongocryptd-reply.json +52 -0
  233. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/collinfo.json +1 -1
  234. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-field-config-map.json +0 -1
  235. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +57 -59
  236. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/mongocryptd-reply.json +63 -64
  237. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/collinfo.json +1 -1
  238. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-field-config-map.json +0 -1
  239. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +64 -66
  240. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/mongocryptd-reply.json +69 -70
  241. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +1 -1
  242. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +1 -2
  243. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/cmd-to-mongocryptd.json +1 -2
  244. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/collinfo.json +2 -2
  245. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/encrypted-payload.json +2 -3
  246. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/mongocryptd-reply.json +1 -2
  247. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongocryptd.json +0 -1
  248. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongod.json +0 -1
  249. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/reply-from-mongocryptd.json +0 -1
  250. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +1 -1
  251. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +6 -4
  252. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +1 -1
  253. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
  254. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +6 -4
  255. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +2 -2
  256. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +1 -1
  257. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +6 -4
  258. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +1 -1
  259. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +14 -6
  260. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +1 -1
  261. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +6 -4
  262. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +1 -1
  263. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +1 -1
  264. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +6 -4
  265. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +1 -1
  266. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +1 -1
  267. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +6 -4
  268. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +1 -1
  269. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +1 -1
  270. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
  271. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +1 -1
  272. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +1 -1
  273. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +1 -1
  274. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +6 -4
  275. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +1 -1
  276. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
  277. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +6 -4
  278. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +1 -1
  279. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +1 -1
  280. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +6 -4
  281. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +1 -1
  282. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +14 -6
  283. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +1 -1
  284. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +6 -4
  285. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +1 -1
  286. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-field-map.json +0 -1
  287. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +1 -1
  288. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +3 -3
  289. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +1 -1
  290. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +1 -1
  291. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +6 -4
  292. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +1 -1
  293. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +1 -1
  294. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
  295. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +1 -1
  296. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +1 -1
  297. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/cmd.json +9 -0
  298. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/double → fle2-insert-text-search}/encrypted-field-map.json +10 -9
  299. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/encrypted-payload.json +47 -0
  300. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/mongocryptd-reply.json +55 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/double-precision → fle2-insert-text-search-with-str-encode-version}/encrypted-field-map.json +12 -13
  302. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search-with-str-encode-version/encrypted-payload.json +47 -0
  303. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search-with-str-encode-version/mongocryptd-reply.json +55 -0
  304. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2-with-str-encode-version/cmd.json +9 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-v2-with-str-encode-version}/encrypted-field-map.json +2 -2
  306. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2-with-str-encode-version/encrypted-payload.json +40 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-v2-with-str-encode-version}/mongocryptd-reply.json +2 -2
  308. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/cmd-to-mongocryptd.json +55 -0
  309. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/cmd.json +22 -0
  310. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/encrypted-field-config-map.json +29 -0
  311. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/encrypted-payload.json +23 -0
  312. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/mongocryptd-reply.json +61 -0
  313. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/cmd-to-mongocryptd.json +56 -0
  314. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/cmd.json +23 -0
  315. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/encrypted-field-config-map.json +30 -0
  316. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/encrypted-payload.json +23 -0
  317. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/mongocryptd-reply.json +62 -0
  318. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneText.json +20 -0
  319. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneTextLarge.json +930 -0
  320. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/cmd-to-mongocryptd.json +60 -0
  321. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/cmd.json +14 -0
  322. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/collInfo-c1.json +39 -0
  323. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/collInfo-c2.json +39 -0
  324. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-facet/cmd.json +20 -0
  325. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-mismatch/cmd.json +14 -0
  326. data/ext/libmongocrypt/libmongocrypt/{bindings/java/mongocrypt/src/test/resources/collection-info.json → test/data/lookup/csfle-mismatch/collInfo-c1.json} +13 -11
  327. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-mismatch/collInfo-c3.json +39 -0
  328. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-nested/cmd.json +24 -0
  329. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/cmd-to-mongocryptd.json +60 -0
  330. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/cmd.json +14 -0
  331. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/schemaMap.json +40 -0
  332. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/cmd-to-mongocryptd.json +60 -0
  333. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/cmd.json +14 -0
  334. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/collInfo-c1.json +39 -0
  335. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/schemaMap.json +21 -0
  336. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/cmd-to-mongocryptd.json +34 -0
  337. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/cmd.json +14 -0
  338. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/collInfo-c1.json +39 -0
  339. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/cmd-to-mongocryptd.json +49 -0
  340. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/cmd.json +14 -0
  341. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/collInfo-c1.json +39 -0
  342. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/collInfo-c2.json +29 -0
  343. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/reply-from-mongocryptd.json +18 -0
  344. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-unionWith/cmd.json +21 -0
  345. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/cmd.json +14 -0
  346. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/collInfo-c1.json +39 -0
  347. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/collInfo-v1.json +11 -0
  348. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd-to-mongocryptd.json +65 -0
  349. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd-to-mongod.json +26 -0
  350. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd.json +19 -0
  351. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/collInfo-c1.json +39 -0
  352. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/collInfo-c2.json +39 -0
  353. data/ext/libmongocrypt/libmongocrypt/{bindings/java/mongocrypt/src/test/resources/keys/ABCDEFAB123498761234123456789012-local-document.json → test/data/lookup/mixed/csfle/csfle/key-doc.json} +4 -4
  354. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/reply-from-mongocryptd.json +33 -0
  355. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd-to-mongocryptd.json +47 -0
  356. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd-to-mongod.json +26 -0
  357. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd.json +19 -0
  358. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/collInfo-c1.json +39 -0
  359. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/collInfo-c2.json +17 -0
  360. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/key-doc.json +30 -0
  361. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/reply-from-mongocryptd.json +33 -0
  362. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/cmd-to-mongocryptd.json +70 -0
  363. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/cmd.json +19 -0
  364. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/collInfo-c1.json +39 -0
  365. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/collInfo-c2.json +42 -0
  366. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd-to-mongocryptd.json +47 -0
  367. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd-to-mongod.json +26 -0
  368. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd.json +19 -0
  369. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/collInfo-c1.json +17 -0
  370. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/collInfo-c2.json +39 -0
  371. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/key-doc.json +30 -0
  372. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/reply-from-mongocryptd.json +33 -0
  373. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd-to-mongocryptd.json +29 -0
  374. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd-to-mongod.json +19 -0
  375. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd.json +19 -0
  376. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/collInfo-c1.json +17 -0
  377. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/collInfo-c2.json +17 -0
  378. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/reply-from-mongocryptd.json +26 -0
  379. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd-to-mongocryptd.json +53 -0
  380. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd-to-mongod.json +58 -0
  381. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd.json +19 -0
  382. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/collInfo-c1.json +17 -0
  383. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/collInfo-c2.json +42 -0
  384. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/key-doc.json +30 -0
  385. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/reply-from-mongocryptd.json +65 -0
  386. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/cmd-to-mongocryptd.json +70 -0
  387. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/cmd.json +19 -0
  388. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/collInfo-c1.json +42 -0
  389. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/collInfo-c2.json +39 -0
  390. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd-to-mongocryptd.json +53 -0
  391. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd-to-mongod.json +56 -0
  392. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd.json +19 -0
  393. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/collInfo-c1.json +42 -0
  394. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/collInfo-c2.json +17 -0
  395. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/key-doc.json +30 -0
  396. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/reply-from-mongocryptd.json +63 -0
  397. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd-to-mongocryptd.json +66 -0
  398. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd-to-mongod.json +71 -0
  399. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd.json +19 -0
  400. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/collInfo-c1.json +42 -0
  401. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/collInfo-c2.json +42 -0
  402. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/key-doc.json +30 -0
  403. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/reply-from-mongocryptd.json +78 -0
  404. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd-to-mongocryptd.json +61 -0
  405. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd-to-mongod.json +14 -0
  406. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd.json +14 -0
  407. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/collInfo-c1.json +42 -0
  408. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/collInfo-c2.json +42 -0
  409. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/reply-from-mongocryptd.json +68 -0
  410. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd-to-mongocryptd.json +66 -0
  411. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd-to-mongod.json +71 -0
  412. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd.json +19 -0
  413. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/collInfo-c1.json +42 -0
  414. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert-unindexed/encrypted-field-map.json → lookup/qe-encryptedFieldsMap/encryptedFieldsMap.json} +6 -7
  415. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/key-doc.json +30 -0
  416. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/reply-from-mongocryptd.json +78 -0
  417. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd-to-mongocryptd.json +46 -0
  418. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd-to-mongod.json +53 -0
  419. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd.json +19 -0
  420. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/collInfo-c1.json +42 -0
  421. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/key-doc.json +30 -0
  422. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/reply-from-mongocryptd.json +58 -0
  423. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd-to-mongocryptd.json +66 -0
  424. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd-to-mongod.json +75 -0
  425. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd.json +19 -0
  426. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/collInfo-c1.json +42 -0
  427. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/collInfo-c2.json +42 -0
  428. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/key-doc.json +30 -0
  429. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/reply-from-mongocryptd.json +78 -0
  430. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-create/mongocryptd-ismaster.json → mongocryptd-ismaster-17.json} +1 -1
  431. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-ismaster-26.json +12 -0
  432. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-encryptedFields.json +42 -0
  433. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-encryptedFields2.json +42 -0
  434. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-jsonSchema.json +43 -0
  435. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-noSchema.json +21 -0
  436. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/create-with-jsonSchema.json +24 -0
  437. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFields.json +20 -0
  438. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFields2.json +20 -0
  439. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFieldsMap.json +42 -0
  440. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/jsonSchema.json +19 -0
  441. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/jsonSchema2.json +19 -0
  442. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/schemaMap.json +40 -0
  443. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +36 -2
  444. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +36 -2
  445. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +5 -5
  446. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +11 -5
  447. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +2 -2
  448. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +74 -6
  449. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c +457 -0
  450. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +20 -1
  451. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +2 -18
  452. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-text-payload.c +320 -0
  453. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +286 -24
  454. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +1 -1
  455. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +24 -17
  456. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +24 -1
  457. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +2 -2
  458. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +10 -7
  459. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-tag-and-encrypted-metadata-block.c +36 -1
  460. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +12 -17
  461. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +58 -63
  462. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +69 -85
  463. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +7 -22
  464. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +5 -5
  465. data/ext/libmongocrypt/libmongocrypt/test/test-mc-schema-broker.c +1124 -0
  466. data/ext/libmongocrypt/libmongocrypt/test/test-mc-text-search-str-encode.c +1336 -0
  467. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +165 -37
  468. data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +10 -10
  469. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +16 -21
  470. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +55 -26
  471. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +29 -4
  472. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +5 -4
  473. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +13 -13
  474. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +49 -55
  475. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +64 -67
  476. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +19 -19
  477. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +4 -0
  478. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +41 -10
  479. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +33 -2
  480. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +247 -149
  481. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +1342 -1229
  482. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +28 -1
  483. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +50 -91
  484. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +1 -1
  485. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +7 -4
  486. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +1 -1
  487. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +2 -2
  488. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +9 -11
  489. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +2 -2
  490. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +2 -2
  491. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +1 -1
  492. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +2 -2
  493. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +1101 -161
  494. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +1 -1
  495. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +157 -82
  496. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +38 -6
  497. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +11 -11
  498. data/ext/libmongocrypt/libmongocrypt/test/test-unicode-fold.c +101 -0
  499. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +1 -1
  500. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +1 -1
  501. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +5 -5
  502. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +7 -6
  503. data/lib/libmongocrypt_helper/version.rb +2 -2
  504. metadata +219 -165
  505. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/README.md +0 -36
  506. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +0 -217
  507. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +0 -24
  508. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +0 -354
  509. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  510. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +0 -5
  511. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +0 -234
  512. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +0 -89
  513. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +0 -1
  514. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/BinaryHolder.java +0 -45
  515. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +0 -1165
  516. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +0 -96
  517. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +0 -92
  518. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/DisposableMemory.java +0 -31
  519. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/JULLogger.java +0 -130
  520. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Logger.java +0 -144
  521. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Loggers.java +0 -50
  522. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MacCallback.java +0 -60
  523. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MessageDigestCallback.java +0 -55
  524. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoAwsKmsProviderOptions.java +0 -104
  525. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypt.java +0 -100
  526. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContext.java +0 -137
  527. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContextImpl.java +0 -164
  528. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptException.java +0 -67
  529. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +0 -423
  530. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptOptions.java +0 -284
  531. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypts.java +0 -38
  532. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoDataKeyOptions.java +0 -125
  533. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +0 -227
  534. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptor.java +0 -76
  535. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptorImpl.java +0 -105
  536. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoLocalKmsProviderOptions.java +0 -83
  537. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoRewrapManyDataKeyOptions.java +0 -104
  538. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SLF4JLogger.java +0 -110
  539. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SecureRandomCallback.java +0 -51
  540. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SigningRSAESPKCSCallback.java +0 -76
  541. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/package-info.java +0 -18
  542. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +0 -180
  543. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +0 -134
  544. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +0 -389
  545. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command-reply.json +0 -13
  546. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command.json +0 -6
  547. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command-reply.json +0 -16
  548. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command.json +0 -11
  549. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-value.json +0 -6
  550. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +0 -26
  551. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/key-filter.json +0 -19
  552. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/rangeopts.json +0 -14
  553. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/value-to-encrypt.json +0 -20
  554. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/json-schema.json +0 -15
  555. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-document.json +0 -36
  556. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter-keyAltName.json +0 -14
  557. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter.json +0 -19
  558. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/kms-reply.txt +0 -6
  559. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/list-collections-filter.json +0 -3
  560. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-command.json +0 -22
  561. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-reply.json +0 -18
  562. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +0 -1
  563. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +0 -50
  564. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +0 -14
  565. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +0 -70
  566. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +0 -20
  567. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +0 -29
  568. data/ext/libmongocrypt/libmongocrypt/test/data/collection-info-no-schema.json +0 -19
  569. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +0 -47
  570. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +0 -29
  571. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/cmd.json +0 -8
  572. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/collinfo.json +0 -9
  573. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/ismaster-to-mongocryptd.json +0 -3
  574. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload.json +0 -91
  575. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload.json +0 -98
  576. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1.json +0 -8
  577. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1.json +0 -8
  578. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key.json +0 -8
  579. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/cmd.json +0 -6
  580. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/encrypted-payload.json +0 -41
  581. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/mongocryptd-reply.json +0 -19
  582. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/cmd.json +0 -10
  583. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/encrypted-field-map.json +0 -28
  584. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/encrypted-payload.json +0 -42
  585. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/mongocryptd-reply.json +0 -50
  586. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/cmd.json +0 -6
  587. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-field-map.json +0 -28
  588. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-payload.json +0 -42
  589. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/mongocryptd-reply.json +0 -50
  590. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/cmd.json +0 -6
  591. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-field-map.json +0 -31
  592. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-payload.json +0 -51
  593. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/mongocryptd-reply.json +0 -59
  594. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/cmd.json +0 -8
  595. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/encrypted-payload.json +0 -42
  596. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/mongocryptd-reply.json +0 -50
  597. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/cmd.json +0 -8
  598. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/encrypted-payload.json +0 -45
  599. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/mongocryptd-reply.json +0 -53
  600. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/cmd.json +0 -8
  601. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/encrypted-payload.json +0 -42
  602. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/mongocryptd-reply.json +0 -50
  603. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/cmd.json +0 -8
  604. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-field-map.json +0 -28
  605. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-payload.json +0 -42
  606. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/mongocryptd-reply.json +0 -50
  607. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload.json +0 -26
  608. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload.json +0 -26
  609. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  610. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +0 -26
  611. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload.json +0 -16
  612. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/cmd.json +0 -13
  613. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-field-map.json +0 -28
  614. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-payload.json +0 -45
  615. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/mongocryptd-reply.json +0 -53
  616. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/cmd.json +0 -9
  617. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-field-map.json +0 -28
  618. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-payload.json +0 -45
  619. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/mongocryptd-reply.json +0 -53
  620. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/cmd.json +0 -9
  621. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-field-map.json +0 -31
  622. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-payload.json +0 -54
  623. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/mongocryptd-reply.json +0 -62
  624. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/cmd.json +0 -11
  625. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-field-map.json +0 -28
  626. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-payload.json +0 -45
  627. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/mongocryptd-reply.json +0 -53
  628. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/cmd.json +0 -11
  629. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-field-map.json +0 -31
  630. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-payload.json +0 -48
  631. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/mongocryptd-reply.json +0 -56
  632. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-payload.json +0 -45
  633. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/mongocryptd-reply.json +0 -53
  634. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/cmd.json +0 -11
  635. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-field-map.json +0 -28
  636. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-payload.json +0 -45
  637. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/mongocryptd-reply.json +0 -53
  638. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload.json +0 -8
  639. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload.json +0 -8
  640. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +0 -8
  641. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload.json +0 -8
  642. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/cmd.json +0 -9
  643. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/encrypted-payload.json +0 -14
  644. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/mongocryptd-reply.json +0 -46
  645. data/ext/libmongocrypt/libmongocrypt/test/data/schema.json +0 -19
  646. /data/ext/libmongocrypt/libmongocrypt/bindings/python/{build-manylinux-wheel.sh → scripts/build-manylinux-wheel.sh} +0 -0
  647. /data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-explicit/find-indexed.json → explicit-decrypt/FLE2FindEqualityPayload.json} +0 -0
  648. /data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-text-search-with-str-encode-version}/cmd.json +0 -0
@@ -20,6 +20,7 @@
20
20
  #include "mongocrypt-crypto-private.h" // MONGOCRYPT_KEY_LEN
21
21
  #include "mongocrypt.h"
22
22
  #include "test-mongocrypt-assert-match-bson.h"
23
+ #include "test-mongocrypt-assert.h"
23
24
  #include "test-mongocrypt-crypto-std-hooks.h"
24
25
  #include "test-mongocrypt.h"
25
26
 
@@ -508,9 +509,7 @@ static void _test_encrypt_need_markings(_mongocrypt_tester_t *tester) {
508
509
 
509
510
  static void _test_encrypt_csfle_no_needs_markings(_mongocrypt_tester_t *tester) {
510
511
  if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) {
511
- fputs("No 'real' csfle library is available. The "
512
- "_test_encrypt_csfle_no_needs_markings test is a no-op.",
513
- stderr);
512
+ TEST_STDERR_PRINTF("No 'real' csfle library is available. The %s test is a no-op.\n", BSON_FUNC);
514
513
  return;
515
514
  }
516
515
 
@@ -617,7 +616,7 @@ static void _test_view(_mongocrypt_tester_t *tester) {
617
616
 
618
617
  crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
619
618
  ctx = mongocrypt_ctx_new(crypt);
620
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_FILE("./test/example/cmd.json")), ctx);
619
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON(BSON_STR({"find" : "v", "filter" : {}}))), ctx);
621
620
  _mongocrypt_tester_run_ctx_to(tester, ctx, MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
622
621
  ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/collection-info-view.json")),
623
622
  ctx,
@@ -763,7 +762,9 @@ static void _test_encrypt_cache_expiration(_mongocrypt_tester_t *tester) {
763
762
  _mongocrypt_tester_run_ctx_to(tester, ctx, MONGOCRYPT_CTX_DONE);
764
763
  mongocrypt_ctx_destroy(ctx);
765
764
 
766
- _usleep(2000);
765
+ // Sleep to trigger cache expiration.
766
+ // Cache entries expire after 1ms, but use 20ms to avoid timing errors observed on Windows distros: CDRIVER-4526
767
+ _usleep(20 * 1000);
767
768
  /* The next context requests keys again
768
769
  */
769
770
  ctx = mongocrypt_ctx_new(crypt);
@@ -882,7 +883,7 @@ static void _init_fails(_mongocrypt_tester_t *tester, const char *json, const ch
882
883
 
883
884
  crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
884
885
  ctx = mongocrypt_ctx_new(crypt);
885
- ASSERT_FAILS(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON(json)), ctx, msg);
886
+ ASSERT_FAILS(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON_STR(json)), ctx, msg);
886
887
  mongocrypt_ctx_destroy(ctx);
887
888
  mongocrypt_destroy(crypt);
888
889
  }
@@ -894,7 +895,7 @@ static void _init_ok(_mongocrypt_tester_t *tester, const char *json) {
894
895
  crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
895
896
  ctx = mongocrypt_ctx_new(crypt);
896
897
 
897
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON(json)), ctx);
898
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON_STR(json)), ctx);
898
899
 
899
900
  if (MONGOCRYPT_CTX_NEED_MONGO_COLLINFO == mongocrypt_ctx_state(ctx)) {
900
901
  mongocrypt_binary_t *filter;
@@ -922,10 +923,10 @@ static void _init_bypass(_mongocrypt_tester_t *tester, const char *json) {
922
923
  bin = mongocrypt_binary_new();
923
924
  crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
924
925
  ctx = mongocrypt_ctx_new(crypt);
925
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON(json)), ctx);
926
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_BSON_STR(json)), ctx);
926
927
  BSON_ASSERT(MONGOCRYPT_CTX_READY == mongocrypt_ctx_state(ctx));
927
928
  ASSERT_OK(mongocrypt_ctx_finalize(ctx, bin), ctx);
928
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_BSON(json), (bin));
929
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_BSON_STR(json), (bin));
929
930
 
930
931
  mongocrypt_binary_destroy(bin);
931
932
  mongocrypt_ctx_destroy(ctx);
@@ -1004,28 +1005,8 @@ static void _test_encrypt_invalid_siblings(_mongocrypt_tester_t *tester) {
1004
1005
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
1005
1006
 
1006
1007
  BSON_ASSERT(MONGOCRYPT_CTX_NEED_MONGO_MARKINGS == mongocrypt_ctx_state(ctx));
1007
- ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/example/mongocryptd-reply.json")),
1008
- ctx,
1009
- "JSON schema validator has siblings");
1010
-
1011
- mongocrypt_ctx_destroy(ctx);
1012
- mongocrypt_destroy(crypt);
1013
- }
1014
-
1015
- static void _test_encrypt_dupe_jsonschema(_mongocrypt_tester_t *tester) {
1016
- mongocrypt_t *crypt;
1017
- mongocrypt_ctx_t *ctx;
1018
-
1019
- crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
1020
- ctx = mongocrypt_ctx_new(crypt);
1021
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_FILE("./test/example/cmd.json")), ctx);
1022
-
1023
- BSON_ASSERT(MONGOCRYPT_CTX_NEED_MONGO_COLLINFO == mongocrypt_ctx_state(ctx));
1024
- ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx,
1025
- TEST_BSON("{'options': {'validator': { '$jsonSchema': {}, "
1026
- "'$jsonSchema': {} } } }")),
1027
- ctx,
1028
- "duplicate $jsonSchema");
1008
+ // MONGOCRYPT-771 removes checks for sibling validators.
1009
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/example/mongocryptd-reply.json")), ctx);
1029
1010
 
1030
1011
  mongocrypt_ctx_destroy(ctx);
1031
1012
  mongocrypt_destroy(crypt);
@@ -1106,7 +1087,7 @@ static void _test_explicit_encryption(_mongocrypt_tester_t *tester) {
1106
1087
  }
1107
1088
 
1108
1089
  /* Test with empty AWS credentials. */
1109
- void _test_encrypt_empty_aws(_mongocrypt_tester_t *tester) {
1090
+ static void _test_encrypt_empty_aws(_mongocrypt_tester_t *tester) {
1110
1091
  mongocrypt_t *crypt;
1111
1092
  mongocrypt_ctx_t *ctx;
1112
1093
 
@@ -1327,9 +1308,6 @@ static void _test_encrypt_with_encrypted_field_config_map(_mongocrypt_tester_t *
1327
1308
  mongocrypt_setopt_kms_providers(crypt, TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
1328
1309
  crypt);
1329
1310
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, TEST_BSON("{'db.coll': {'fields': []}}")), crypt);
1330
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
1331
- // QEv1 is still supported.
1332
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
1333
1311
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
1334
1312
 
1335
1313
  /* Test encrypting a command on a collection present in the encrypted field
@@ -1437,9 +1415,6 @@ static void _test_encrypt_remote_encryptedfields(_mongocrypt_tester_t *tester) {
1437
1415
  ASSERT_OK(
1438
1416
  mongocrypt_setopt_kms_providers(crypt, TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
1439
1417
  crypt);
1440
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
1441
- // QEv1 is still supported.
1442
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
1443
1418
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
1444
1419
  /* Test success. */
1445
1420
  {
@@ -1502,9 +1477,6 @@ static void _test_encrypt_remote_encryptedfields(_mongocrypt_tester_t *tester) {
1502
1477
  mongocrypt_setopt_kms_providers(crypt,
1503
1478
  TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
1504
1479
  crypt);
1505
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
1506
- // QEv1 is still supported.
1507
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
1508
1480
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
1509
1481
  ctx = mongocrypt_ctx_new(crypt);
1510
1482
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-find-explicit/cmd.json")),
@@ -1552,9 +1524,6 @@ static void _test_encrypt_with_bypassqueryanalysis(_mongocrypt_tester_t *tester)
1552
1524
  crypt);
1553
1525
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, TEST_BSON("{'db.coll': {'fields': []}}")), crypt);
1554
1526
  mongocrypt_setopt_bypass_query_analysis(crypt);
1555
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
1556
- // QEv1 is still supported.
1557
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
1558
1527
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
1559
1528
 
1560
1529
  ctx = mongocrypt_ctx_new(crypt);
@@ -1584,9 +1553,6 @@ static void _test_encrypt_with_bypassqueryanalysis(_mongocrypt_tester_t *tester)
1584
1553
  TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
1585
1554
  crypt);
1586
1555
  mongocrypt_setopt_bypass_query_analysis(crypt);
1587
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
1588
- // QEv1 is still supported.
1589
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
1590
1556
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
1591
1557
 
1592
1558
  ctx = mongocrypt_ctx_new(crypt);
@@ -1595,7 +1561,9 @@ static void _test_encrypt_with_bypassqueryanalysis(_mongocrypt_tester_t *tester)
1595
1561
 
1596
1562
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
1597
1563
  {
1598
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_BSON("{'options': {'encryptedFields': {'fields': []}}}")),
1564
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(
1565
+ ctx,
1566
+ TEST_BSON("{'name': 'coll', 'options': {'encryptedFields': {'fields': []}}}")),
1599
1567
  ctx);
1600
1568
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
1601
1569
  }
@@ -1615,301 +1583,6 @@ static void _test_encrypt_with_bypassqueryanalysis(_mongocrypt_tester_t *tester)
1615
1583
  }
1616
1584
  }
1617
1585
 
1618
- static void _test_FLE2EncryptionPlaceholder_parse(_mongocrypt_tester_t *tester) {
1619
- mc_FLE2EncryptionPlaceholder_t placeholder;
1620
- bson_t as_bson;
1621
- mongocrypt_status_t *status;
1622
- _mongocrypt_buffer_t buf;
1623
-
1624
- status = mongocrypt_status_new();
1625
- _mongocrypt_buffer_copy_from_hex(&buf,
1626
- "03610000001074000100000010610002000000056b690010000000041234567812349876"
1627
- "1234123456789012056b75001000000004abcdefab123498761234123456789012027600"
1628
- "0900000076616c75653132330012636d00000000000000000000");
1629
- ASSERT(bson_init_static(&as_bson, buf.data + 1, buf.len - 1));
1630
- mc_FLE2EncryptionPlaceholder_init(&placeholder);
1631
- ASSERT_OK_STATUS(mc_FLE2EncryptionPlaceholder_parse(&placeholder, &as_bson, status), status);
1632
-
1633
- ASSERT(placeholder.type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT);
1634
- ASSERT(placeholder.algorithm == MONGOCRYPT_FLE2_ALGORITHM_EQUALITY);
1635
- ASSERT(BSON_ITER_HOLDS_UTF8(&placeholder.v_iter));
1636
- ASSERT_STREQUAL(bson_iter_utf8(&placeholder.v_iter, NULL), "value123");
1637
-
1638
- _mongocrypt_buffer_t expect_index_key_id;
1639
- _mongocrypt_buffer_copy_from_hex(&expect_index_key_id, "12345678123498761234123456789012");
1640
- ASSERT_CMPBUF(placeholder.index_key_id, expect_index_key_id);
1641
- _mongocrypt_buffer_cleanup(&expect_index_key_id);
1642
-
1643
- _mongocrypt_buffer_t expect_user_key_id;
1644
- _mongocrypt_buffer_copy_from_hex(&expect_user_key_id, "abcdefab123498761234123456789012");
1645
- ASSERT_CMPBUF(placeholder.user_key_id, expect_user_key_id);
1646
- _mongocrypt_buffer_cleanup(&expect_user_key_id);
1647
-
1648
- ASSERT(placeholder.maxContentionFactor == 0);
1649
-
1650
- mc_FLE2EncryptionPlaceholder_cleanup(&placeholder);
1651
- _mongocrypt_buffer_cleanup(&buf);
1652
- mongocrypt_status_destroy(status);
1653
- }
1654
-
1655
- static void _test_FLE2EncryptionPlaceholder_range_parse(_mongocrypt_tester_t *tester) {
1656
- // Test type=MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT.
1657
- {
1658
- mc_FLE2EncryptionPlaceholder_t placeholder;
1659
- bson_t as_bson;
1660
- mongocrypt_status_t *status;
1661
- _mongocrypt_buffer_t buf;
1662
-
1663
- status = mongocrypt_status_new();
1664
- _mongocrypt_buffer_copy_from_hex(&buf,
1665
- "037d0000001074000100000010610003000000056b690010000000041234567812349"
1666
- "8761234123456789012056b75001000000004abcdefab123498761234123456789012"
1667
- "0376001e00000010760040e20100106d696e0000000000106d61780087d6120000126"
1668
- "36d000000000000000000127300010000000000000000");
1669
- ASSERT(bson_init_static(&as_bson, buf.data + 1, buf.len - 1));
1670
- mc_FLE2EncryptionPlaceholder_init(&placeholder);
1671
- ASSERT_OK_STATUS(mc_FLE2EncryptionPlaceholder_parse(&placeholder, &as_bson, status), status);
1672
-
1673
- ASSERT(placeholder.type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT);
1674
- ASSERT(placeholder.algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
1675
-
1676
- _mongocrypt_buffer_t expect_index_key_id;
1677
- _mongocrypt_buffer_copy_from_hex(&expect_index_key_id, "12345678123498761234123456789012");
1678
- ASSERT_CMPBUF(placeholder.index_key_id, expect_index_key_id);
1679
- _mongocrypt_buffer_cleanup(&expect_index_key_id);
1680
-
1681
- _mongocrypt_buffer_t expect_user_key_id;
1682
- _mongocrypt_buffer_copy_from_hex(&expect_user_key_id, "abcdefab123498761234123456789012");
1683
- ASSERT_CMPBUF(placeholder.user_key_id, expect_user_key_id);
1684
- _mongocrypt_buffer_cleanup(&expect_user_key_id);
1685
-
1686
- ASSERT_CMPINT64(placeholder.sparsity, ==, 1);
1687
-
1688
- // Parse FLE2RangeInsertSpec.
1689
- {
1690
- mc_FLE2RangeInsertSpec_t spec;
1691
-
1692
- ASSERT_OK_STATUS(mc_FLE2RangeInsertSpec_parse(&spec, &placeholder.v_iter, false /* use_range_v2 */, status),
1693
- status);
1694
-
1695
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.v));
1696
- ASSERT_CMPINT32(bson_iter_int32(&spec.v), ==, 123456);
1697
-
1698
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.min));
1699
- ASSERT_CMPINT32(bson_iter_int32(&spec.min), ==, 0);
1700
-
1701
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.max));
1702
- ASSERT_CMPINT32(bson_iter_int32(&spec.max), ==, 1234567);
1703
- }
1704
-
1705
- mc_FLE2EncryptionPlaceholder_cleanup(&placeholder);
1706
- _mongocrypt_buffer_cleanup(&buf);
1707
- mongocrypt_status_destroy(status);
1708
- }
1709
-
1710
- // Test type=MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND.
1711
- {
1712
- mc_FLE2EncryptionPlaceholder_t placeholder;
1713
- bson_t as_bson;
1714
- mongocrypt_status_t *status;
1715
- _mongocrypt_buffer_t buf;
1716
-
1717
- status = mongocrypt_status_new();
1718
- _mongocrypt_buffer_copy_from_hex(&buf,
1719
- "03ec0000001074000200000010610003000000056b690010000000041234567812349"
1720
- "8761234123456789012056b75001000000004abcdefab123498761234123456789012"
1721
- "0376008d000000036564676573496e666f005b000000106c6f776572426f756e64000"
1722
- "0000000086c62496e636c756465640001107570706572426f756e640087d612000875"
1723
- "62496e636c75646564000110696e6465784d696e000000000010696e6465784d61780"
1724
- "087d6120000107061796c6f6164496400d20400001066697273744f70657261746f72"
1725
- "00010000000012636d000000000000000000127300010000000000000000");
1726
- ASSERT(bson_init_static(&as_bson, buf.data + 1, buf.len - 1));
1727
- mc_FLE2EncryptionPlaceholder_init(&placeholder);
1728
- ASSERT_OK_STATUS(mc_FLE2EncryptionPlaceholder_parse(&placeholder, &as_bson, status), status);
1729
-
1730
- ASSERT(placeholder.type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND);
1731
- ASSERT(placeholder.algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
1732
-
1733
- _mongocrypt_buffer_t expect_index_key_id;
1734
- _mongocrypt_buffer_copy_from_hex(&expect_index_key_id, "12345678123498761234123456789012");
1735
- ASSERT_CMPBUF(placeholder.index_key_id, expect_index_key_id);
1736
- _mongocrypt_buffer_cleanup(&expect_index_key_id);
1737
-
1738
- _mongocrypt_buffer_t expect_user_key_id;
1739
- _mongocrypt_buffer_copy_from_hex(&expect_user_key_id, "abcdefab123498761234123456789012");
1740
- ASSERT_CMPBUF(placeholder.user_key_id, expect_user_key_id);
1741
- _mongocrypt_buffer_cleanup(&expect_user_key_id);
1742
-
1743
- ASSERT_CMPINT64(placeholder.sparsity, ==, 1);
1744
-
1745
- // Parse FLE2RangeFindSpec.
1746
- {
1747
- mc_FLE2RangeFindSpec_t spec;
1748
-
1749
- ASSERT_OK_STATUS(mc_FLE2RangeFindSpec_parse(&spec, &placeholder.v_iter, false /* use_range_v2 */, status),
1750
- status);
1751
-
1752
- ASSERT(spec.edgesInfo.set);
1753
-
1754
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.edgesInfo.value.lowerBound));
1755
- ASSERT_CMPINT32(bson_iter_int32(&spec.edgesInfo.value.lowerBound), ==, 0);
1756
- ASSERT(spec.edgesInfo.value.lbIncluded);
1757
-
1758
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.edgesInfo.value.upperBound));
1759
- ASSERT_CMPINT32(bson_iter_int32(&spec.edgesInfo.value.upperBound), ==, 1234567);
1760
- ASSERT(spec.edgesInfo.value.ubIncluded);
1761
-
1762
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.edgesInfo.value.indexMin));
1763
- ASSERT_CMPINT32(bson_iter_int32(&spec.edgesInfo.value.indexMin), ==, 0);
1764
- ASSERT(spec.edgesInfo.value.ubIncluded);
1765
-
1766
- ASSERT(BSON_ITER_HOLDS_INT32(&spec.edgesInfo.value.indexMax));
1767
- ASSERT_CMPINT32(bson_iter_int32(&spec.edgesInfo.value.indexMax), ==, 1234567);
1768
- ASSERT(spec.edgesInfo.value.ubIncluded);
1769
-
1770
- ASSERT_CMPINT32(spec.payloadId, ==, 1234);
1771
-
1772
- ASSERT_CMPINT(spec.firstOperator, ==, FLE2RangeOperator_kGt);
1773
- ASSERT_CMPINT(spec.secondOperator, ==, FLE2RangeOperator_kNone);
1774
- }
1775
-
1776
- mc_FLE2EncryptionPlaceholder_cleanup(&placeholder);
1777
- _mongocrypt_buffer_cleanup(&buf);
1778
- mongocrypt_status_destroy(status);
1779
- }
1780
-
1781
- // Test type=MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND with precision.
1782
- {
1783
- mc_FLE2EncryptionPlaceholder_t placeholder;
1784
- bson_t as_bson;
1785
- mongocrypt_status_t *status;
1786
- _mongocrypt_buffer_t buf;
1787
-
1788
- status = mongocrypt_status_new();
1789
- _mongocrypt_buffer_copy_from_hex(&buf,
1790
- "030b0100001074000200000010610003000000056b690010000000041234567812349"
1791
- "8761234123456789012056b75001000000004abcdefab123498761234123456789012"
1792
- "037600ac000000036564676573496e666f007a000000016c6f776572426f756e64000"
1793
- "000000000000000086c62496e636c756465640001017570706572426f756e64000000"
1794
- "000000006940087562496e636c75646564000110707265636973696f6e00020000000"
1795
- "1696e6465784d696e00000000000000000001696e6465784d61780000000000000069"
1796
- "4000107061796c6f6164496400d20400001066697273744f70657261746f720001000"
1797
- "0000012636d000000000000000000127300010000000000000000");
1798
- ASSERT(bson_init_static(&as_bson, buf.data + 1, buf.len - 1));
1799
- mc_FLE2EncryptionPlaceholder_init(&placeholder);
1800
- ASSERT_OK_STATUS(mc_FLE2EncryptionPlaceholder_parse(&placeholder, &as_bson, status), status);
1801
-
1802
- ASSERT(placeholder.type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND);
1803
- ASSERT(placeholder.algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
1804
-
1805
- _mongocrypt_buffer_t expect_index_key_id;
1806
- _mongocrypt_buffer_copy_from_hex(&expect_index_key_id, "12345678123498761234123456789012");
1807
- ASSERT_CMPBUF(placeholder.index_key_id, expect_index_key_id);
1808
- _mongocrypt_buffer_cleanup(&expect_index_key_id);
1809
-
1810
- _mongocrypt_buffer_t expect_user_key_id;
1811
- _mongocrypt_buffer_copy_from_hex(&expect_user_key_id, "abcdefab123498761234123456789012");
1812
- ASSERT_CMPBUF(placeholder.user_key_id, expect_user_key_id);
1813
- _mongocrypt_buffer_cleanup(&expect_user_key_id);
1814
-
1815
- ASSERT_CMPINT64(placeholder.sparsity, ==, 1);
1816
-
1817
- // Parse FLE2RangeFindSpec.
1818
- {
1819
- mc_FLE2RangeFindSpec_t spec;
1820
-
1821
- ASSERT_OK_STATUS(mc_FLE2RangeFindSpec_parse(&spec, &placeholder.v_iter, false /* use_range_v2 */, status),
1822
- status);
1823
-
1824
- ASSERT(spec.edgesInfo.set);
1825
-
1826
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.edgesInfo.value.lowerBound));
1827
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.edgesInfo.value.lowerBound), ==, 0.0);
1828
- ASSERT(spec.edgesInfo.value.lbIncluded);
1829
-
1830
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.edgesInfo.value.upperBound));
1831
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.edgesInfo.value.upperBound), ==, 200.0);
1832
- ASSERT(spec.edgesInfo.value.ubIncluded);
1833
-
1834
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.edgesInfo.value.indexMin));
1835
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.edgesInfo.value.indexMin), ==, 0);
1836
- ASSERT(spec.edgesInfo.value.ubIncluded);
1837
-
1838
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.edgesInfo.value.indexMax));
1839
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.edgesInfo.value.indexMax), ==, 200.0);
1840
- ASSERT(spec.edgesInfo.value.ubIncluded);
1841
-
1842
- ASSERT_CMPDOUBLE(spec.payloadId, ==, 1234);
1843
-
1844
- ASSERT_CMPINT(spec.firstOperator, ==, FLE2RangeOperator_kGt);
1845
- ASSERT(spec.edgesInfo.value.precision.set);
1846
- ASSERT_CMPUINT32(spec.edgesInfo.value.precision.value, ==, 2);
1847
- }
1848
-
1849
- mc_FLE2EncryptionPlaceholder_cleanup(&placeholder);
1850
- _mongocrypt_buffer_cleanup(&buf);
1851
- mongocrypt_status_destroy(status);
1852
- }
1853
-
1854
- // Test type=MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT with precision.
1855
- {
1856
- mc_FLE2EncryptionPlaceholder_t placeholder;
1857
- bson_t as_bson;
1858
- mongocrypt_status_t *status;
1859
- _mongocrypt_buffer_t buf;
1860
-
1861
- status = mongocrypt_status_new();
1862
- _mongocrypt_buffer_copy_from_hex(&buf,
1863
- "03980000001074000100000010610003000000056b690010000000041234567812349"
1864
- "8761234123456789012056b75001000000004abcdefab123498761234123456789012"
1865
- "0376003900000001760077be9f1a2fdd5e40016d696e000000000000000000016d617"
1866
- "800000000000000694010707265636973696f6e00020000000012636d000000000000"
1867
- "000000127300010000000000000000");
1868
- ASSERT(bson_init_static(&as_bson, buf.data + 1, buf.len - 1));
1869
- mc_FLE2EncryptionPlaceholder_init(&placeholder);
1870
- ASSERT_OK_STATUS(mc_FLE2EncryptionPlaceholder_parse(&placeholder, &as_bson, status), status);
1871
-
1872
- ASSERT(placeholder.type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT);
1873
- ASSERT(placeholder.algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
1874
-
1875
- _mongocrypt_buffer_t expect_index_key_id;
1876
- _mongocrypt_buffer_copy_from_hex(&expect_index_key_id, "12345678123498761234123456789012");
1877
- ASSERT_CMPBUF(placeholder.index_key_id, expect_index_key_id);
1878
- _mongocrypt_buffer_cleanup(&expect_index_key_id);
1879
-
1880
- _mongocrypt_buffer_t expect_user_key_id;
1881
- _mongocrypt_buffer_copy_from_hex(&expect_user_key_id, "abcdefab123498761234123456789012");
1882
- ASSERT_CMPBUF(placeholder.user_key_id, expect_user_key_id);
1883
- _mongocrypt_buffer_cleanup(&expect_user_key_id);
1884
-
1885
- ASSERT_CMPINT64(placeholder.sparsity, ==, 1);
1886
-
1887
- // Parse FLE2RangeInsertSpec.
1888
- {
1889
- mc_FLE2RangeInsertSpec_t spec;
1890
-
1891
- ASSERT_OK_STATUS(mc_FLE2RangeInsertSpec_parse(&spec, &placeholder.v_iter, false /* use_range_v2 */, status),
1892
- status);
1893
-
1894
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.v));
1895
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.v), ==, 123.456);
1896
-
1897
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.min));
1898
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.min), ==, 0.0);
1899
-
1900
- ASSERT(BSON_ITER_HOLDS_DOUBLE(&spec.max));
1901
- ASSERT_CMPDOUBLE(bson_iter_double(&spec.max), ==, 200.0);
1902
-
1903
- ASSERT(spec.precision.set);
1904
- ASSERT_CMPUINT32(spec.precision.value, ==, 2);
1905
- }
1906
-
1907
- mc_FLE2EncryptionPlaceholder_cleanup(&placeholder);
1908
- _mongocrypt_buffer_cleanup(&buf);
1909
- mongocrypt_status_destroy(status);
1910
- }
1911
- }
1912
-
1913
1586
  // Shared implementation for insert and find tests
1914
1587
  typedef struct {
1915
1588
  _mongocrypt_buffer_t buf;
@@ -1931,27 +1604,19 @@ static bool _test_rng_source(void *ctx, mongocrypt_binary_t *out, uint32_t count
1931
1604
 
1932
1605
  typedef enum {
1933
1606
  kFLE2v2Default,
1934
- kFLE2v2Disable,
1935
1607
  kFLE2v2Enable,
1936
1608
  } _test_fle2v2_option;
1937
1609
 
1938
1610
  #define TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, data_path, rng_source, v2_failure) \
1939
- { \
1940
- (rng_source)->pos = 0; \
1941
- _test_encrypt_fle2_encryption_placeholder(tester, data_path, rng_source, kFLE2v2Disable, NULL); \
1942
- char v2path[4096]; \
1943
- /* transitional: Use v1 data path if expecting failure */ \
1944
- ASSERT(snprintf(v2path, sizeof(v2path), "%s%s", data_path, v2_failure ? "" : "-v2")); \
1945
- (rng_source)->pos = 0; \
1946
- _test_encrypt_fle2_encryption_placeholder(tester, v2path, rng_source, kFLE2v2Default, NULL); \
1611
+ if (1) { \
1947
1612
  (rng_source)->pos = 0; \
1948
- _test_encrypt_fle2_encryption_placeholder(tester, v2path, rng_source, kFLE2v2Enable, v2_failure); \
1949
- }
1613
+ _test_encrypt_fle2_encryption_placeholder(tester, data_path, rng_source, NULL); \
1614
+ } else \
1615
+ ((void)0)
1950
1616
 
1951
1617
  static void _test_encrypt_fle2_encryption_placeholder(_mongocrypt_tester_t *tester,
1952
1618
  const char *data_path,
1953
1619
  _test_rng_data_source *rng_source,
1954
- _test_fle2v2_option test_fle2v2_option,
1955
1620
  const char *finalize_failure) {
1956
1621
  mongocrypt_t *crypt;
1957
1622
  char pathbuf[2048];
@@ -1964,7 +1629,7 @@ static void _test_encrypt_fle2_encryption_placeholder(_mongocrypt_tester_t *test
1964
1629
  ((void)0)
1965
1630
 
1966
1631
  if (!_aes_ctr_is_supported_by_os) {
1967
- printf("Common Crypto with no CTR support detected. Skipping.");
1632
+ TEST_PRINTF("Common Crypto with no CTR support detected. Skipping.");
1968
1633
  return;
1969
1634
  }
1970
1635
 
@@ -1976,9 +1641,6 @@ static void _test_encrypt_fle2_encryption_placeholder(_mongocrypt_tester_t *test
1976
1641
  mongocrypt_binary_t *localkey;
1977
1642
 
1978
1643
  crypt = mongocrypt_new();
1979
- if (test_fle2v2_option == kFLE2v2Disable) {
1980
- ASSERT(mongocrypt_setopt_fle2v2(crypt, false));
1981
- }
1982
1644
  mongocrypt_setopt_log_handler(crypt, _mongocrypt_stdout_log_fn, NULL);
1983
1645
  localkey = mongocrypt_binary_new_from_data((uint8_t *)localkey_data, sizeof localkey_data);
1984
1646
  ASSERT_OK(mongocrypt_setopt_kms_provider_local(crypt, localkey), crypt);
@@ -2055,7 +1717,28 @@ static void _test_encrypt_fle2_insert_payload(_mongocrypt_tester_t *tester) {
2055
1717
  uint8_t rng_data[] = RNG_DATA;
2056
1718
 
2057
1719
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2058
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert", &source, NULL)
1720
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-v2", &source, NULL);
1721
+ }
1722
+
1723
+ static void _test_encrypt_fle2_insert_payload_with_str_encode_version(_mongocrypt_tester_t *tester) {
1724
+ uint8_t rng_data[] = RNG_DATA;
1725
+
1726
+ _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
1727
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-v2-with-str-encode-version", &source, NULL);
1728
+ }
1729
+
1730
+ static void _test_encrypt_fle2_insert_text_search_payload(_mongocrypt_tester_t *tester) {
1731
+ uint8_t rng_data[] = RNG_DATA;
1732
+
1733
+ _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
1734
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-text-search", &source, NULL);
1735
+ }
1736
+
1737
+ static void _test_encrypt_fle2_insert_text_search_payload_with_str_encode_version(_mongocrypt_tester_t *tester) {
1738
+ uint8_t rng_data[] = RNG_DATA;
1739
+
1740
+ _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
1741
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-text-search-with-str-encode-version", &source, NULL);
2059
1742
  }
2060
1743
 
2061
1744
  #undef RNG_DATA
@@ -2063,7 +1746,7 @@ static void _test_encrypt_fle2_insert_payload(_mongocrypt_tester_t *tester) {
2063
1746
  // FLE2FindEqualityPayload only uses deterministic token generation.
2064
1747
  static void _test_encrypt_fle2_find_payload(_mongocrypt_tester_t *tester) {
2065
1748
  _test_rng_data_source source = {{0}};
2066
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-equality", &source, NULL)
1749
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-equality-v2", &source, NULL);
2067
1750
  }
2068
1751
 
2069
1752
  /* 16 bytes of random data are used for IV. This IV produces the expected test
@@ -2073,7 +1756,7 @@ static void _test_encrypt_fle2_find_payload(_mongocrypt_tester_t *tester) {
2073
1756
  static void _test_encrypt_fle2_unindexed_encrypted_payload(_mongocrypt_tester_t *tester) {
2074
1757
  uint8_t rng_data[] = RNG_DATA;
2075
1758
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2076
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-unindexed", &source, NULL);
1759
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-unindexed-v2", &source, NULL);
2077
1760
  }
2078
1761
 
2079
1762
  #undef RNG_DATA
@@ -2083,7 +1766,7 @@ static void _test_encrypt_fle2_unindexed_encrypted_payload(_mongocrypt_tester_t
2083
1766
  static void _test_encrypt_fle2_insert_range_payload_int32(_mongocrypt_tester_t *tester) {
2084
1767
  uint8_t rng_data[] = RNG_DATA;
2085
1768
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2086
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/int32", &source, NULL)
1769
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/int32-v2", &source, NULL);
2087
1770
  }
2088
1771
 
2089
1772
  #undef RNG_DATA
@@ -2093,7 +1776,7 @@ static void _test_encrypt_fle2_insert_range_payload_int32(_mongocrypt_tester_t *
2093
1776
  static void _test_encrypt_fle2_insert_range_payload_int64(_mongocrypt_tester_t *tester) {
2094
1777
  uint8_t rng_data[] = RNG_DATA;
2095
1778
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2096
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/int64", &source, NULL)
1779
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/int64-v2", &source, NULL);
2097
1780
  }
2098
1781
 
2099
1782
  #undef RNG_DATA
@@ -2103,7 +1786,7 @@ static void _test_encrypt_fle2_insert_range_payload_int64(_mongocrypt_tester_t *
2103
1786
  static void _test_encrypt_fle2_insert_range_payload_date(_mongocrypt_tester_t *tester) {
2104
1787
  uint8_t rng_data[] = RNG_DATA;
2105
1788
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2106
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/date", &source, NULL)
1789
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/date-v2", &source, NULL);
2107
1790
  }
2108
1791
 
2109
1792
  #undef RNG_DATA
@@ -2113,7 +1796,7 @@ static void _test_encrypt_fle2_insert_range_payload_date(_mongocrypt_tester_t *t
2113
1796
  static void _test_encrypt_fle2_insert_range_payload_double(_mongocrypt_tester_t *tester) {
2114
1797
  uint8_t rng_data[] = RNG_DATA;
2115
1798
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2116
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/double", &source, NULL)
1799
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/double-v2", &source, NULL);
2117
1800
  }
2118
1801
 
2119
1802
  #undef RNG_DATA
@@ -2123,18 +1806,18 @@ static void _test_encrypt_fle2_insert_range_payload_double(_mongocrypt_tester_t
2123
1806
  static void _test_encrypt_fle2_insert_range_payload_double_precision(_mongocrypt_tester_t *tester) {
2124
1807
  uint8_t rng_data[] = RNG_DATA;
2125
1808
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2126
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/double-precision", &source, NULL)
1809
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/double-precision-v2", &source, NULL);
2127
1810
  }
2128
1811
 
2129
1812
  #undef RNG_DATA
2130
1813
 
2131
- #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
1814
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT()
2132
1815
  #include "./data/fle2-insert-range/decimal128/RNG_DATA.h"
2133
1816
 
2134
1817
  static void _test_encrypt_fle2_insert_range_payload_decimal128(_mongocrypt_tester_t *tester) {
2135
1818
  uint8_t rng_data[] = RNG_DATA;
2136
1819
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2137
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/decimal128", &source, NULL)
1820
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/decimal128-v2", &source, NULL);
2138
1821
  }
2139
1822
 
2140
1823
  #undef RNG_DATA
@@ -2144,7 +1827,7 @@ static void _test_encrypt_fle2_insert_range_payload_decimal128(_mongocrypt_teste
2144
1827
  static void _test_encrypt_fle2_insert_range_payload_decimal128_precision(_mongocrypt_tester_t *tester) {
2145
1828
  uint8_t rng_data[] = RNG_DATA;
2146
1829
  _test_rng_data_source source = {.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2147
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/decimal128-precision", &source, NULL)
1830
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-insert-range/decimal128-precision-v2", &source, NULL);
2148
1831
  }
2149
1832
 
2150
1833
  #undef RNG_DATA
@@ -2153,48 +1836,48 @@ static void _test_encrypt_fle2_insert_range_payload_decimal128_precision(_mongoc
2153
1836
  // FLE2FindRangePayload only uses deterministic token generation.
2154
1837
  static void _test_encrypt_fle2_find_range_payload_int32(_mongocrypt_tester_t *tester) {
2155
1838
  _test_rng_data_source source = {{0}};
2156
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/int32", &source, NULL)
1839
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/int32-v2", &source, NULL);
2157
1840
  }
2158
1841
 
2159
1842
  // FLE2FindRangePayload only uses deterministic token generation.
2160
1843
  static void _test_encrypt_fle2_find_range_payload_int64(_mongocrypt_tester_t *tester) {
2161
1844
  _test_rng_data_source source = {{0}};
2162
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/int64", &source, NULL)
1845
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/int64-v2", &source, NULL);
2163
1846
  }
2164
1847
 
2165
1848
  // FLE2FindRangePayload only uses deterministic token generation.
2166
1849
  static void _test_encrypt_fle2_find_range_payload_date(_mongocrypt_tester_t *tester) {
2167
1850
  _test_rng_data_source source = {{0}};
2168
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/date", &source, NULL)
1851
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/date-v2", &source, NULL);
2169
1852
  }
2170
1853
 
2171
1854
  // FLE2FindRangePayload only uses deterministic token generation.
2172
1855
  static void _test_encrypt_fle2_find_range_payload_double(_mongocrypt_tester_t *tester) {
2173
1856
  _test_rng_data_source source = {{0}};
2174
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/double", &source, NULL)
1857
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/double-v2", &source, NULL);
2175
1858
  }
2176
1859
 
2177
1860
  // FLE2FindRangePayload only uses deterministic token generation.
2178
1861
  static void _test_encrypt_fle2_find_range_payload_double_precision(_mongocrypt_tester_t *tester) {
2179
1862
  _test_rng_data_source source = {{0}};
2180
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/double-precision", &source, NULL)
1863
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/double-precision-v2", &source, NULL);
2181
1864
  }
2182
1865
 
2183
- #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
1866
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT()
2184
1867
  // FLE2FindRangePayload only uses deterministic token generation.
2185
1868
  static void _test_encrypt_fle2_find_range_payload_decimal128(_mongocrypt_tester_t *tester) {
2186
1869
  _test_rng_data_source source = {{0}};
2187
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/decimal128", &source, NULL)
1870
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/decimal128-v2", &source, NULL);
2188
1871
  }
2189
1872
 
2190
1873
  // FLE2FindRangePayload only uses deterministic token generation.
2191
1874
  static void _test_encrypt_fle2_find_range_payload_decimal128_precision(_mongocrypt_tester_t *tester) {
2192
1875
  _test_rng_data_source source = {{0}};
2193
- TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/decimal128-precision", &source, NULL)
1876
+ TEST_ENCRYPT_FLE2_ENCRYPTION_PLACEHOLDER(tester, "fle2-find-range/decimal128-precision-v2", &source, NULL);
2194
1877
  }
2195
1878
  #endif // MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
2196
1879
 
2197
- static mongocrypt_t *_crypt_with_rng(_test_rng_data_source *rng_source, bool use_v2, bool use_range_v2) {
1880
+ static mongocrypt_t *_crypt_with_rng(_test_rng_data_source *rng_source) {
2198
1881
  mongocrypt_t *crypt;
2199
1882
  mongocrypt_binary_t *localkey;
2200
1883
  /* localkey_data is the KEK used to encrypt the keyMaterial
@@ -2216,15 +1899,7 @@ static mongocrypt_t *_crypt_with_rng(_test_rng_data_source *rng_source, bool use
2216
1899
  crypt);
2217
1900
 
2218
1901
  mongocrypt_binary_destroy(localkey);
2219
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
2220
- // QEv1 is still supported.
2221
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, use_v2), crypt);
2222
- if (use_range_v2) {
2223
- ASSERT_OK(mongocrypt_setopt_use_range_v2(crypt), crypt);
2224
- ASSERT_OK(mongocrypt_init(crypt), crypt);
2225
- } else {
2226
- ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
2227
- }
1902
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
2228
1903
  return crypt;
2229
1904
  }
2230
1905
 
@@ -2243,28 +1918,19 @@ typedef struct {
2243
1918
  const char *expect_finalize_error;
2244
1919
  const char *expect_init_error;
2245
1920
  bool is_expression;
2246
- bool use_v2;
2247
- bool use_range_v2;
2248
1921
  } ee_testcase;
2249
1922
 
2250
1923
  static void ee_testcase_run(ee_testcase *tc) {
2251
- printf(" explicit_encryption_finalize test case: %s ... begin\n", tc->desc);
1924
+ TEST_PRINTF(" explicit_encryption_finalize test case: %s ... begin\n", tc->desc);
2252
1925
  extern void mc_reset_payloadId_for_testing(void);
2253
1926
  mc_reset_payloadId_for_testing();
2254
1927
  mongocrypt_t *crypt;
2255
1928
  if (tc->rng_data.buf.len > 0) {
2256
1929
  // Use fixed data for random number generation to produce deterministic
2257
1930
  // results.
2258
- crypt = _crypt_with_rng(&tc->rng_data, tc->use_v2, tc->use_range_v2);
1931
+ crypt = _crypt_with_rng(&tc->rng_data);
2259
1932
  } else {
2260
1933
  tester_mongocrypt_flags flags = TESTER_MONGOCRYPT_DEFAULT;
2261
- // TODO(MONGOCRYPT-572): Remove tests cases for QEv1.
2262
- if (!tc->use_v2) {
2263
- flags |= TESTER_MONGOCRYPT_WITH_CRYPT_V1;
2264
- }
2265
- if (tc->use_range_v2) {
2266
- flags |= TESTER_MONGOCRYPT_WITH_RANGE_V2;
2267
- }
2268
1934
  crypt = _mongocrypt_tester_mongocrypt(flags);
2269
1935
  }
2270
1936
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
@@ -2330,7 +1996,7 @@ static void ee_testcase_run(ee_testcase *tc) {
2330
1996
  }
2331
1997
 
2332
1998
  cleanup:
2333
- printf(" explicit_encryption_finalize test case: %s ... end\n", tc->desc);
1999
+ TEST_PRINTF(" explicit_encryption_finalize test case: %s ... end\n", tc->desc);
2334
2000
  mongocrypt_ctx_destroy(ctx);
2335
2001
  mongocrypt_destroy(crypt);
2336
2002
  }
@@ -2341,7 +2007,7 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2341
2007
  _mongocrypt_buffer_t key123_id;
2342
2008
 
2343
2009
  if (!_aes_ctr_is_supported_by_os) {
2344
- printf("Common Crypto with no CTR support detected. Skipping.");
2010
+ TEST_PRINTF("Common Crypto with no CTR support detected. Skipping.");
2345
2011
  return;
2346
2012
  }
2347
2013
 
@@ -2355,26 +2021,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2355
2021
  "12345678123498761234123456789012-local-"
2356
2022
  "document.json");
2357
2023
 
2358
- {
2359
- ee_testcase tc = {0};
2360
- tc.desc = "Unindexed";
2361
- #define RNG_DATA "\x4d\x06\x95\x64\xf5\xa0\x5e\x9e\x35\x23\xb9\x8f\x57\x5a\xcb\x15"
2362
- uint8_t rng_data[] = RNG_DATA;
2363
- tc.rng_data = (_test_rng_data_source){.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2364
- #undef RNG_DATA
2365
- tc.algorithm = MONGOCRYPT_ALGORITHM_UNINDEXED_STR;
2366
- tc.user_key_id = &keyABC_id;
2367
- tc.index_key_id = &key123_id;
2368
- tc.msg = TEST_BSON("{'v': 'value123'}");
2369
- tc.keys_to_feed[0] = keyABC;
2370
- tc.keys_to_feed[1] = key123;
2371
- tc.expect = TEST_BSON("{'v': { '$binary': { 'base64': "
2372
- "'BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjc"
2373
- "dSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ=='"
2374
- ", 'subType': '06' } }}");
2375
- ee_testcase_run(&tc);
2376
- }
2377
-
2378
2024
  {
2379
2025
  ee_testcase tc = {0};
2380
2026
  tc.desc = "Unindexed (v2)";
@@ -2391,27 +2037,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2391
2037
  tc.expect = TEST_BSON("{'v' : {'$binary' : {'base64': "
2392
2038
  "'EKvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFVl3jjP90PgD4T+Mtubn/"
2393
2039
  "mm4CKsKGaV1yxlic9Dty1Adef4Y+bsLGKhBbCa5eojM/A==','subType' : '06'}}}");
2394
- tc.use_v2 = true;
2395
- ee_testcase_run(&tc);
2396
- }
2397
-
2398
- {
2399
- ee_testcase tc = {0};
2400
- tc.desc = "Indexed";
2401
- #define RNG_DATA \
2402
- "\xc7\x43\xd6\x75\x76\x9e\xa7\x88\xd5\xe5\xc4\x40\xdb\x24\x0d\xf9" \
2403
- "\x4c\xd9\x64\x10\x43\x81\xe6\x61\xfa\x1f\xa0\x5c\x49\x8e\xad\x21"
2404
- uint8_t rng_data[] = RNG_DATA;
2405
- tc.rng_data = (_test_rng_data_source){.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2406
- #undef RNG_DATA
2407
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2408
- tc.user_key_id = &keyABC_id;
2409
- tc.index_key_id = &key123_id;
2410
- tc.contention_factor = OPT_I64(0);
2411
- tc.msg = TEST_BSON("{'v': 'value123'}");
2412
- tc.keys_to_feed[0] = keyABC;
2413
- tc.keys_to_feed[1] = key123;
2414
- tc.expect = TEST_FILE("./test/data/fle2-explicit/insert-indexed.json");
2415
2040
  ee_testcase_run(&tc);
2416
2041
  }
2417
2042
 
@@ -2432,32 +2057,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2432
2057
  tc.keys_to_feed[0] = keyABC;
2433
2058
  tc.keys_to_feed[1] = key123;
2434
2059
  tc.expect = TEST_FILE("./test/data/fle2-explicit/insert-indexed-v2.json");
2435
- tc.use_v2 = true;
2436
- ee_testcase_run(&tc);
2437
- }
2438
-
2439
- {
2440
- ee_testcase tc = {0};
2441
- tc.desc = "Indexed with non-zero ContentionFactor. Random number chosen is 0";
2442
- /* First 8 bytes are for random ContentionFactor.
2443
- * Second 16 bytes are IV for 'p' field in FLE2InsertUpdatePayload
2444
- * Third 16 bytes are IV for 'v' field in FLE2InsertUpdatePayload
2445
- */
2446
- #define RNG_DATA \
2447
- "\x00\x00\x00\x00\x00\x00\x00\x00" \
2448
- "\xc7\x43\xd6\x75\x76\x9e\xa7\x88\xd5\xe5\xc4\x40\xdb\x24\x0d\xf9" \
2449
- "\x4c\xd9\x64\x10\x43\x81\xe6\x61\xfa\x1f\xa0\x5c\x49\x8e\xad\x21"
2450
- uint8_t rng_data[] = RNG_DATA;
2451
- tc.rng_data = (_test_rng_data_source){.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2452
- #undef RNG_DATA
2453
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2454
- tc.user_key_id = &keyABC_id;
2455
- tc.index_key_id = &key123_id;
2456
- tc.contention_factor = OPT_I64(1);
2457
- tc.msg = TEST_BSON("{'v': 'value123'}");
2458
- tc.keys_to_feed[0] = keyABC;
2459
- tc.keys_to_feed[1] = key123;
2460
- tc.expect = TEST_FILE("./test/data/fle2-explicit/insert-indexed.json");
2461
2060
  ee_testcase_run(&tc);
2462
2061
  }
2463
2062
 
@@ -2483,33 +2082,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2483
2082
  tc.keys_to_feed[0] = keyABC;
2484
2083
  tc.keys_to_feed[1] = key123;
2485
2084
  tc.expect = TEST_FILE("./test/data/fle2-explicit/insert-indexed-v2.json");
2486
- tc.use_v2 = true;
2487
- ee_testcase_run(&tc);
2488
- }
2489
-
2490
- {
2491
- ee_testcase tc = {0};
2492
- tc.desc = "Indexed with non-zero ContentionFactor. Random number chosen is 1";
2493
- /* First 8 bytes are for random ContentionFactor.
2494
- * Second 16 bytes are IV for 'p' field in FLE2InsertUpdatePayload
2495
- * Third 16 bytes are IV for 'v' field in FLE2InsertUpdatePayload
2496
- */
2497
- #define RNG_DATA \
2498
- "\x01\x00\x00\x00\x00\x00\x00\x00" \
2499
- "\xc7\x43\xd6\x75\x76\x9e\xa7\x88\xd5\xe5\xc4\x40\xdb\x24\x0d\xf9" \
2500
- "\x4c\xd9\x64\x10\x43\x81\xe6\x61\xfa\x1f\xa0\x5c\x49\x8e\xad\x21"
2501
- uint8_t rng_data[] = RNG_DATA;
2502
- tc.rng_data = (_test_rng_data_source){.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2503
- #undef RNG_DATA
2504
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2505
- tc.user_key_id = &keyABC_id;
2506
- tc.index_key_id = &key123_id;
2507
- tc.contention_factor = OPT_I64(1);
2508
- tc.msg = TEST_BSON("{'v': 'value123'}");
2509
- tc.keys_to_feed[0] = keyABC;
2510
- tc.keys_to_feed[1] = key123;
2511
- tc.expect = TEST_FILE("./test/data/fle2-explicit/"
2512
- "insert-indexed-contentionFactor1.json");
2513
2085
  ee_testcase_run(&tc);
2514
2086
  }
2515
2087
 
@@ -2536,26 +2108,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2536
2108
  tc.keys_to_feed[1] = key123;
2537
2109
  tc.expect = TEST_FILE("./test/data/fle2-explicit/"
2538
2110
  "insert-indexed-contentionFactor1-v2.json");
2539
- tc.use_v2 = true;
2540
- ee_testcase_run(&tc);
2541
- }
2542
-
2543
- {
2544
- ee_testcase tc = {0};
2545
- tc.desc = "omitted index_key_id defaults to using user_key_id";
2546
- #define RNG_DATA \
2547
- "\xc7\x43\xd6\x75\x76\x9e\xa7\x88\xd5\xe5\xc4\x40\xdb\x24\x0d\xf9" \
2548
- "\x4c\xd9\x64\x10\x43\x81\xe6\x61\xfa\x1f\xa0\x5c\x49\x8e\xad\x21"
2549
- uint8_t rng_data[] = RNG_DATA;
2550
- tc.rng_data = (_test_rng_data_source){.buf = {.data = rng_data, .len = sizeof(rng_data) - 1u}};
2551
- #undef RNG_DATA
2552
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2553
- tc.user_key_id = &keyABC_id;
2554
- tc.contention_factor = OPT_I64(0);
2555
- tc.msg = TEST_BSON("{'v': 'value123'}");
2556
- tc.keys_to_feed[0] = keyABC;
2557
- tc.expect = TEST_FILE("./test/data/fle2-explicit/"
2558
- "insert-indexed-same-user-and-index-key.json");
2559
2111
  ee_testcase_run(&tc);
2560
2112
  }
2561
2113
 
@@ -2575,22 +2127,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2575
2127
  tc.keys_to_feed[0] = keyABC;
2576
2128
  tc.expect = TEST_FILE("./test/data/fle2-explicit/"
2577
2129
  "insert-indexed-same-user-and-index-key-v2.json");
2578
- tc.use_v2 = true;
2579
- ee_testcase_run(&tc);
2580
- }
2581
-
2582
- {
2583
- ee_testcase tc = {0};
2584
- tc.desc = "algorithm='Indexed' with query type";
2585
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2586
- tc.query_type = MONGOCRYPT_QUERY_TYPE_EQUALITY_STR;
2587
- tc.user_key_id = &keyABC_id;
2588
- tc.index_key_id = &key123_id;
2589
- tc.contention_factor = OPT_I64(0);
2590
- tc.msg = TEST_BSON("{'v': 123456}");
2591
- tc.keys_to_feed[0] = keyABC;
2592
- tc.keys_to_feed[1] = key123;
2593
- tc.expect = TEST_FILE("./test/data/fle2-explicit/find-indexed.json");
2594
2130
  ee_testcase_run(&tc);
2595
2131
  }
2596
2132
 
@@ -2606,13 +2142,12 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2606
2142
  tc.keys_to_feed[0] = keyABC;
2607
2143
  tc.keys_to_feed[1] = key123;
2608
2144
  tc.expect = TEST_FILE("./test/data/fle2-explicit/find-indexed-v2.json");
2609
- tc.use_v2 = true;
2610
2145
  ee_testcase_run(&tc);
2611
2146
  }
2612
2147
 
2613
2148
  {
2614
2149
  ee_testcase tc = {0};
2615
- tc.desc = "algorithm='Indexed' with query type and non-zero contention factor";
2150
+ tc.desc = "algorithm='Indexed' with query type and non-zero contention factor (v2)";
2616
2151
  tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2617
2152
  tc.query_type = MONGOCRYPT_QUERY_TYPE_EQUALITY_STR;
2618
2153
  tc.user_key_id = &keyABC_id;
@@ -2621,90 +2156,29 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2621
2156
  tc.msg = TEST_BSON("{'v': 123456}");
2622
2157
  tc.keys_to_feed[0] = keyABC;
2623
2158
  tc.keys_to_feed[1] = key123;
2624
- tc.expect = TEST_FILE("./test/data/fle2-explicit/find-indexed-contentionFactor1.json");
2159
+ tc.expect = TEST_FILE("./test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json");
2625
2160
  ee_testcase_run(&tc);
2626
2161
  }
2627
2162
 
2628
2163
  {
2629
2164
  ee_testcase tc = {0};
2630
- tc.desc = "algorithm='Indexed' with query type and non-zero contention factor (v2)";
2165
+ tc.desc = "Negative contention factor is an error on insert (v2)";
2631
2166
  tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2632
- tc.query_type = MONGOCRYPT_QUERY_TYPE_EQUALITY_STR;
2633
2167
  tc.user_key_id = &keyABC_id;
2634
- tc.index_key_id = &key123_id;
2635
- tc.contention_factor = OPT_I64(1);
2168
+ tc.contention_factor = OPT_I64(-1);
2636
2169
  tc.msg = TEST_BSON("{'v': 123456}");
2637
- tc.keys_to_feed[0] = keyABC;
2638
- tc.keys_to_feed[1] = key123;
2639
- tc.expect = TEST_FILE("./test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json");
2640
- tc.use_v2 = true;
2170
+ tc.expect_init_error = "contention must be non-negative";
2641
2171
  ee_testcase_run(&tc);
2642
2172
  }
2643
2173
 
2644
2174
  {
2645
2175
  ee_testcase tc = {0};
2646
- tc.desc = "Negative contention factor is an error on insert";
2176
+ tc.desc = "INT64_MAX contention factor is an error on insert (v2)";
2647
2177
  tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2648
2178
  tc.user_key_id = &keyABC_id;
2649
- tc.contention_factor = OPT_I64(-1);
2179
+ tc.contention_factor = OPT_I64(INT64_MAX);
2650
2180
  tc.msg = TEST_BSON("{'v': 123456}");
2651
- tc.expect_init_error = "contention must be non-negative";
2652
- ee_testcase_run(&tc);
2653
- }
2654
-
2655
- {
2656
- ee_testcase tc = {0};
2657
- tc.desc = "Negative contention factor is an error on insert (v2)";
2658
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2659
- tc.user_key_id = &keyABC_id;
2660
- tc.contention_factor = OPT_I64(-1);
2661
- tc.msg = TEST_BSON("{'v': 123456}");
2662
- tc.expect_init_error = "contention must be non-negative";
2663
- tc.use_v2 = true;
2664
- ee_testcase_run(&tc);
2665
- }
2666
-
2667
- {
2668
- ee_testcase tc = {0};
2669
- tc.desc = "INT64_MAX contention factor is an error on insert";
2670
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2671
- tc.user_key_id = &keyABC_id;
2672
- tc.contention_factor = OPT_I64(INT64_MAX);
2673
- tc.msg = TEST_BSON("{'v': 123456}");
2674
- tc.expect_init_error = "contention must be < INT64_MAX";
2675
- ee_testcase_run(&tc);
2676
- }
2677
-
2678
- {
2679
- ee_testcase tc = {0};
2680
- tc.desc = "INT64_MAX contention factor is an error on insert (v2)";
2681
- tc.algorithm = MONGOCRYPT_ALGORITHM_INDEXED_STR;
2682
- tc.user_key_id = &keyABC_id;
2683
- tc.contention_factor = OPT_I64(INT64_MAX);
2684
- tc.msg = TEST_BSON("{'v': 123456}");
2685
- tc.expect_init_error = "contention must be < INT64_MAX";
2686
- tc.use_v2 = true;
2687
- ee_testcase_run(&tc);
2688
- }
2689
-
2690
- {
2691
- ee_testcase tc = {0};
2692
- tc.desc = "algorithm='Range' with int32";
2693
- #include "./data/fle2-insert-range-explicit/int32/RNG_DATA.h"
2694
- tc.rng_data = (_test_rng_data_source){.buf = {.data = (uint8_t *)RNG_DATA, .len = sizeof(RNG_DATA) - 1}};
2695
- #undef RNG_DATA
2696
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2697
- tc.user_key_id = &keyABC_id;
2698
- tc.index_key_id = &key123_id;
2699
- tc.contention_factor = OPT_I64(0);
2700
- tc.range_opts = TEST_FILE("./test/data/fle2-insert-range-explicit/"
2701
- "int32/rangeopts.json");
2702
- tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/int32/"
2703
- "value-to-encrypt.json");
2704
- tc.keys_to_feed[0] = keyABC;
2705
- tc.keys_to_feed[1] = key123;
2706
- tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/int32/"
2707
- "encrypted-payload.json");
2181
+ tc.expect_init_error = "contention must be < INT64_MAX";
2708
2182
  ee_testcase_run(&tc);
2709
2183
  }
2710
2184
 
@@ -2726,28 +2200,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2726
2200
  tc.keys_to_feed[1] = key123;
2727
2201
  tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/int32/"
2728
2202
  "encrypted-payload-v2.json");
2729
- tc.use_v2 = true;
2730
- ee_testcase_run(&tc);
2731
- }
2732
-
2733
- {
2734
- ee_testcase tc = {0};
2735
- tc.desc = "algorithm='Range' with sparsity=2 with int32";
2736
- #include "./data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h"
2737
- tc.rng_data = (_test_rng_data_source){.buf = {.data = (uint8_t *)RNG_DATA, .len = sizeof(RNG_DATA) - 1}};
2738
- #undef RNG_DATA
2739
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2740
- tc.user_key_id = &keyABC_id;
2741
- tc.index_key_id = &key123_id;
2742
- tc.contention_factor = OPT_I64(0);
2743
- tc.range_opts = TEST_FILE("./test/data/fle2-insert-range-explicit/"
2744
- "sparsity-2/rangeopts.json");
2745
- tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/sparsity-2/"
2746
- "value-to-encrypt.json");
2747
- tc.keys_to_feed[0] = keyABC;
2748
- tc.keys_to_feed[1] = key123;
2749
- tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/sparsity-2/"
2750
- "encrypted-payload.json");
2751
2203
  ee_testcase_run(&tc);
2752
2204
  }
2753
2205
 
@@ -2769,26 +2221,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2769
2221
  tc.keys_to_feed[1] = key123;
2770
2222
  tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/sparsity-2/"
2771
2223
  "encrypted-payload-v2.json");
2772
- tc.use_v2 = true;
2773
- ee_testcase_run(&tc);
2774
- }
2775
-
2776
- {
2777
- ee_testcase tc = {0};
2778
- tc.desc = "algorithm='Range' with query_type='range' with int32";
2779
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2780
- tc.user_key_id = &keyABC_id;
2781
- tc.index_key_id = &keyABC_id;
2782
- tc.contention_factor = OPT_I64(4);
2783
- tc.query_type = MONGOCRYPT_QUERY_TYPE_RANGE_STR;
2784
- tc.range_opts = TEST_FILE("./test/data/fle2-find-range-explicit/"
2785
- "int32/rangeopts.json");
2786
- tc.msg = TEST_FILE("./test/data/fle2-find-range-explicit/int32/"
2787
- "value-to-encrypt.json");
2788
- tc.keys_to_feed[0] = keyABC;
2789
- tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/int32/"
2790
- "encrypted-payload.json");
2791
- tc.is_expression = true;
2792
2224
  ee_testcase_run(&tc);
2793
2225
  }
2794
2226
 
@@ -2808,20 +2240,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2808
2240
  tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/int32/"
2809
2241
  "encrypted-payload-v2.json");
2810
2242
  tc.is_expression = true;
2811
- tc.use_v2 = true;
2812
- ee_testcase_run(&tc);
2813
- }
2814
-
2815
- {
2816
- ee_testcase tc = {0};
2817
- tc.desc = "An unsupported range BSON type is an error";
2818
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2819
- tc.user_key_id = &keyABC_id;
2820
- tc.contention_factor = OPT_I64(0);
2821
- tc.range_opts = TEST_BSON("{'min': 0, 'max': 1, 'sparsity': {'$numberLong': '1'}}");
2822
- tc.msg = TEST_BSON("{'v': 'abc'}");
2823
- tc.keys_to_feed[0] = keyABC;
2824
- tc.expect_finalize_error = "expected matching 'min' and value type";
2825
2243
  ee_testcase_run(&tc);
2826
2244
  }
2827
2245
 
@@ -2835,28 +2253,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2835
2253
  tc.msg = TEST_BSON("{'v': 'abc'}");
2836
2254
  tc.keys_to_feed[0] = keyABC;
2837
2255
  tc.expect_finalize_error = "expected matching 'min' and value type";
2838
- tc.use_v2 = true;
2839
- ee_testcase_run(&tc);
2840
- }
2841
-
2842
- {
2843
- ee_testcase tc = {0};
2844
- tc.desc = "algorithm='Range' with query_type='range' with double with "
2845
- "precision";
2846
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2847
- tc.user_key_id = &keyABC_id;
2848
- tc.index_key_id = &key123_id;
2849
- tc.contention_factor = OPT_I64(0);
2850
- tc.query_type = MONGOCRYPT_QUERY_TYPE_RANGE_STR;
2851
- tc.range_opts = TEST_FILE("./test/data/fle2-find-range-explicit/double-precision/"
2852
- "rangeopts.json");
2853
- tc.msg = TEST_FILE("./test/data/fle2-find-range-explicit/"
2854
- "double-precision/value-to-encrypt.json");
2855
- tc.keys_to_feed[0] = keyABC;
2856
- tc.keys_to_feed[1] = key123;
2857
- tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/"
2858
- "double-precision/encrypted-payload.json");
2859
- tc.is_expression = true;
2860
2256
  ee_testcase_run(&tc);
2861
2257
  }
2862
2258
 
@@ -2878,28 +2274,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2878
2274
  tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/"
2879
2275
  "double-precision/encrypted-payload-v2.json");
2880
2276
  tc.is_expression = true;
2881
- tc.use_v2 = true;
2882
- ee_testcase_run(&tc);
2883
- }
2884
-
2885
- {
2886
- ee_testcase tc = {0};
2887
- tc.desc = "algorithm='Range' with double precision with precision";
2888
- #include "./data/fle2-insert-range-explicit/double-precision/RNG_DATA.h"
2889
- tc.rng_data = (_test_rng_data_source){.buf = {.data = (uint8_t *)RNG_DATA, .len = sizeof(RNG_DATA) - 1}};
2890
- #undef RNG_DATA
2891
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2892
- tc.user_key_id = &keyABC_id;
2893
- tc.index_key_id = &key123_id;
2894
- tc.contention_factor = OPT_I64(0);
2895
- tc.range_opts = TEST_FILE("./test/data/fle2-insert-range-explicit/double-precision/"
2896
- "rangeopts.json");
2897
- tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/"
2898
- "double-precision/value-to-encrypt.json");
2899
- tc.keys_to_feed[0] = keyABC;
2900
- tc.keys_to_feed[1] = key123;
2901
- tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/double-precision/"
2902
- "encrypted-payload.json");
2903
2277
  ee_testcase_run(&tc);
2904
2278
  }
2905
2279
 
@@ -2921,26 +2295,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2921
2295
  tc.keys_to_feed[1] = key123;
2922
2296
  tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/double-precision/"
2923
2297
  "encrypted-payload-v2.json");
2924
- tc.use_v2 = true;
2925
- ee_testcase_run(&tc);
2926
- }
2927
-
2928
- {
2929
- ee_testcase tc = {0};
2930
- tc.desc = "algorithm='Range' with query_type='range' with double without "
2931
- "precision";
2932
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2933
- tc.user_key_id = &keyABC_id;
2934
- tc.index_key_id = &key123_id;
2935
- tc.contention_factor = OPT_I64(0);
2936
- tc.query_type = MONGOCRYPT_QUERY_TYPE_RANGE_STR;
2937
- tc.range_opts = TEST_FILE("./test/data/fle2-find-range-explicit/double/"
2938
- "rangeopts.json");
2939
- tc.msg = TEST_FILE("./test/data/fle2-find-range-explicit/double/value-to-encrypt.json");
2940
- tc.keys_to_feed[0] = keyABC;
2941
- tc.keys_to_feed[1] = key123;
2942
- tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/double/encrypted-payload.json");
2943
- tc.is_expression = true;
2944
2298
  ee_testcase_run(&tc);
2945
2299
  }
2946
2300
 
@@ -2960,27 +2314,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
2960
2314
  tc.keys_to_feed[1] = key123;
2961
2315
  tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json");
2962
2316
  tc.is_expression = true;
2963
- tc.use_v2 = true;
2964
- ee_testcase_run(&tc);
2965
- }
2966
-
2967
- {
2968
- ee_testcase tc = {0};
2969
- tc.desc = "algorithm='Range' with double without precision";
2970
- #include "./data/fle2-insert-range-explicit/double/RNG_DATA.h"
2971
- tc.rng_data = (_test_rng_data_source){.buf = {.data = (uint8_t *)RNG_DATA, .len = sizeof(RNG_DATA) - 1}};
2972
- #undef RNG_DATA
2973
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
2974
- tc.user_key_id = &keyABC_id;
2975
- tc.index_key_id = &key123_id;
2976
- tc.contention_factor = OPT_I64(0);
2977
- tc.range_opts = TEST_FILE("./test/data/fle2-insert-range-explicit/double/"
2978
- "rangeopts.json");
2979
- tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/double/value-to-encrypt.json");
2980
- tc.keys_to_feed[0] = keyABC;
2981
- tc.keys_to_feed[1] = key123;
2982
- tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/double/"
2983
- "encrypted-payload.json");
2984
2317
  ee_testcase_run(&tc);
2985
2318
  }
2986
2319
 
@@ -3001,20 +2334,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
3001
2334
  tc.keys_to_feed[1] = key123;
3002
2335
  tc.expect = TEST_FILE("./test/data/fle2-insert-range-explicit/double/"
3003
2336
  "encrypted-payload-v2.json");
3004
- tc.use_v2 = true;
3005
- ee_testcase_run(&tc);
3006
- }
3007
-
3008
- {
3009
- ee_testcase tc = {0};
3010
- tc.desc = "min > max for insert";
3011
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
3012
- tc.user_key_id = &keyABC_id;
3013
- tc.contention_factor = OPT_I64(0);
3014
- tc.range_opts = TEST_BSON("{'min': 1, 'max': 0, 'sparsity': {'$numberLong': '1'}}");
3015
- tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/int32/value-to-encrypt.json");
3016
- tc.keys_to_feed[0] = keyABC;
3017
- tc.expect_finalize_error = "minimum value must be less than the maximum value";
3018
2337
  ee_testcase_run(&tc);
3019
2338
  }
3020
2339
 
@@ -3028,22 +2347,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
3028
2347
  tc.msg = TEST_FILE("./test/data/fle2-insert-range-explicit/int32/value-to-encrypt.json");
3029
2348
  tc.keys_to_feed[0] = keyABC;
3030
2349
  tc.expect_finalize_error = "minimum value must be less than the maximum value";
3031
- tc.use_v2 = true;
3032
- ee_testcase_run(&tc);
3033
- }
3034
-
3035
- {
3036
- ee_testcase tc = {0};
3037
- tc.desc = "min > max for find";
3038
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
3039
- tc.query_type = MONGOCRYPT_QUERY_TYPE_RANGE_STR;
3040
- tc.user_key_id = &keyABC_id;
3041
- tc.contention_factor = OPT_I64(0);
3042
- tc.range_opts = TEST_BSON("{'min': 25, 'max': 24, 'sparsity': {'$numberLong': '1'}}");
3043
- tc.msg = TEST_FILE("./test/data/fle2-find-range-explicit/int32/value-to-encrypt.json");
3044
- tc.keys_to_feed[0] = keyABC;
3045
- tc.expect_finalize_error = "minimum value must be less than the maximum value";
3046
- tc.is_expression = true;
3047
2350
  ee_testcase_run(&tc);
3048
2351
  }
3049
2352
 
@@ -3062,24 +2365,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
3062
2365
  ee_testcase_run(&tc);
3063
2366
  }
3064
2367
 
3065
- {
3066
- ee_testcase tc = {0};
3067
- tc.desc = "open interval";
3068
- tc.algorithm = MONGOCRYPT_ALGORITHM_RANGE_STR;
3069
- tc.query_type = MONGOCRYPT_QUERY_TYPE_RANGE_STR;
3070
- tc.user_key_id = &keyABC_id;
3071
- tc.contention_factor = OPT_I64(0);
3072
- tc.range_opts = TEST_FILE("./test/data/fle2-find-range-explicit/"
3073
- "int32-openinterval/rangeopts.json");
3074
- tc.msg = TEST_FILE("./test/data/fle2-find-range-explicit/"
3075
- "int32-openinterval/value-to-encrypt.json");
3076
- tc.keys_to_feed[0] = keyABC;
3077
- tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/"
3078
- "int32-openinterval/encrypted-payload.json");
3079
- tc.is_expression = true;
3080
- ee_testcase_run(&tc);
3081
- }
3082
-
3083
2368
  {
3084
2369
  ee_testcase tc = {0};
3085
2370
  tc.desc = "open interval (v2)";
@@ -3095,7 +2380,6 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
3095
2380
  tc.expect = TEST_FILE("./test/data/fle2-find-range-explicit/"
3096
2381
  "int32-openinterval/encrypted-payload-v2.json");
3097
2382
  tc.is_expression = true;
3098
- tc.use_v2 = true;
3099
2383
  ee_testcase_run(&tc);
3100
2384
  }
3101
2385
 
@@ -3179,17 +2463,13 @@ static void _test_encrypt_applies_default_state_collections(_mongocrypt_tester_t
3179
2463
  TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
3180
2464
  crypt);
3181
2465
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, TEST_BSON("{'db.coll': {'fields': []}}")), crypt);
3182
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3183
- // QEv1 is still supported.
3184
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
3185
2466
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3186
2467
  ctx = mongocrypt_ctx_new(crypt);
3187
2468
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_BSON("{'find': 'coll'}")), ctx);
3188
2469
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3189
2470
  {
3190
2471
  const char *expect_schema = "{ 'fields': [], 'escCollection': "
3191
- "'enxcol_.coll.esc', 'eccCollection': "
3192
- "'enxcol_.coll.ecc', 'ecocCollection': "
2472
+ "'enxcol_.coll.esc', 'ecocCollection': "
3193
2473
  "'enxcol_.coll.ecoc' }";
3194
2474
  mongocrypt_binary_t *cmd_to_mongocryptd;
3195
2475
 
@@ -3214,17 +2494,14 @@ static void _test_encrypt_applies_default_state_collections(_mongocrypt_tester_t
3214
2494
  crypt);
3215
2495
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(
3216
2496
  crypt,
3217
- TEST_BSON("{'db.coll': { 'fields': [], 'escCollection': 'esc', "
3218
- "'eccCollection': 'ecc', 'ecocCollection': 'ecoc'}}")),
2497
+ TEST_BSON("{'db.coll': { 'fields': [], 'escCollection': 'esc', 'ecocCollection': 'ecoc'}}")),
3219
2498
  crypt);
3220
2499
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3221
2500
  ctx = mongocrypt_ctx_new(crypt);
3222
2501
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_BSON("{'find': 'coll'}")), ctx);
3223
2502
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3224
2503
  {
3225
- const char *expect_schema = "{'fields': [], 'escCollection': 'esc', "
3226
- "'eccCollection': 'ecc', "
3227
- "'ecocCollection': 'ecoc' }";
2504
+ const char *expect_schema = "{'fields': [], 'escCollection': 'esc', 'ecocCollection': 'ecoc' }";
3228
2505
  mongocrypt_binary_t *cmd_to_mongocryptd;
3229
2506
 
3230
2507
  cmd_to_mongocryptd = mongocrypt_binary_new();
@@ -3246,19 +2523,17 @@ static void _test_encrypt_applies_default_state_collections(_mongocrypt_tester_t
3246
2523
  mongocrypt_setopt_kms_providers(crypt,
3247
2524
  TEST_BSON("{'aws': {'accessKeyId': 'foo', 'secretAccessKey': 'bar'}}")),
3248
2525
  crypt);
3249
- ASSERT_OK(
3250
- mongocrypt_setopt_encrypted_field_config_map(crypt,
3251
- TEST_BSON("{'fields': [], 'db.coll': {'escCollection': "
3252
- "'esc', 'eccCollection': 'ecc', 'fields': []}}")),
3253
- crypt);
2526
+ ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt,
2527
+ TEST_BSON("{'fields': [], 'db.coll': {'escCollection': "
2528
+ "'esc', 'fields': []}}")),
2529
+ crypt);
3254
2530
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3255
2531
  ctx = mongocrypt_ctx_new(crypt);
3256
2532
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_BSON("{'find': 'coll'}")), ctx);
3257
2533
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3258
2534
  {
3259
- const char *expect_schema = "{'escCollection': 'esc', "
3260
- "'eccCollection': 'ecc', 'fields': [], "
3261
- "'ecocCollection': 'enxcol_.coll.ecoc' }";
2535
+ const char *expect_schema =
2536
+ "{'escCollection': 'esc', 'fields': [], 'ecocCollection': 'enxcol_.coll.ecoc' }";
3262
2537
  mongocrypt_binary_t *cmd_to_mongocryptd;
3263
2538
 
3264
2539
  cmd_to_mongocryptd = mongocrypt_binary_new();
@@ -3276,13 +2551,13 @@ static void _test_encrypt_applies_default_state_collections(_mongocrypt_tester_t
3276
2551
  }
3277
2552
 
3278
2553
  /* Test encrypting an empty 'delete' command without values to be encrypted.
3279
- * Expect deleteTokens to be applied. */
3280
- static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
2554
+ * Expect deleteTokens to not be applied. */
2555
+ static void _test_encrypt_fle2_delete_v2(_mongocrypt_tester_t *tester) {
2556
+ tester_mongocrypt_flags flags = TESTER_MONGOCRYPT_DEFAULT;
2557
+
3281
2558
  /* Test success. */
3282
2559
  {
3283
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3284
- // QEv1 is still supported.
3285
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2560
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(flags);
3286
2561
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3287
2562
 
3288
2563
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/success/cmd.json")),
@@ -3312,10 +2587,6 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3312
2587
  TEST_FILE("./test/data/keys/"
3313
2588
  "12345678123498761234123456789012-local-document.json")),
3314
2589
  ctx);
3315
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3316
- TEST_FILE("./test/data/keys/"
3317
- "12345678123498761234123456789013-local-document.json")),
3318
- ctx);
3319
2590
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3320
2591
  }
3321
2592
 
@@ -3323,7 +2594,7 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3323
2594
  {
3324
2595
  mongocrypt_binary_t *out = mongocrypt_binary_new();
3325
2596
  ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3326
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/success/encrypted-payload.json"),
2597
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/success/encrypted-payload-v2.json"),
3327
2598
  out);
3328
2599
  mongocrypt_binary_destroy(out);
3329
2600
  }
@@ -3333,9 +2604,7 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3333
2604
  }
3334
2605
  /* Test with no encrypted values. */
3335
2606
  {
3336
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3337
- // QEv1 is still supported.
3338
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2607
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(flags);
3339
2608
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3340
2609
 
3341
2610
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/empty/cmd.json")), ctx);
@@ -3353,24 +2622,13 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3353
2622
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3354
2623
  }
3355
2624
 
3356
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
3357
- {
3358
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3359
- TEST_FILE("./test/data/keys/"
3360
- "12345678123498761234123456789012-local-document.json")),
3361
- ctx);
3362
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3363
- TEST_FILE("./test/data/keys/"
3364
- "12345678123498761234123456789013-local-document.json")),
3365
- ctx);
3366
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3367
- }
3368
-
2625
+ /* We do not need delete tokens in v2 so we skip need keys state. */
3369
2626
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3370
2627
  {
3371
2628
  mongocrypt_binary_t *out = mongocrypt_binary_new();
3372
2629
  ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3373
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload.json"), out);
2630
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload-v2.json"),
2631
+ out);
3374
2632
  mongocrypt_binary_destroy(out);
3375
2633
  }
3376
2634
 
@@ -3378,7 +2636,7 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3378
2636
  mongocrypt_destroy(crypt);
3379
2637
  }
3380
2638
 
3381
- /* deleteTokens are appended when bypassQueryAnalysis is true. */
2639
+ /* Test that deleteTokens are not appended when bypassQueryAnalysis is true in v2. */
3382
2640
  {
3383
2641
  mongocrypt_t *crypt = mongocrypt_new();
3384
2642
  /* Configure crypt. */
@@ -3389,10 +2647,6 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3389
2647
  ASSERT_OK(mongocrypt_setopt_kms_provider_local(crypt, localkey), crypt);
3390
2648
  mongocrypt_binary_destroy(localkey);
3391
2649
  mongocrypt_setopt_bypass_query_analysis(crypt);
3392
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note:
3393
- // decrypting
3394
- // QEv1 is still supported.
3395
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
3396
2650
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3397
2651
  }
3398
2652
 
@@ -3406,267 +2660,13 @@ static void _test_encrypt_fle2_delete_v1(_mongocrypt_tester_t *tester) {
3406
2660
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3407
2661
  }
3408
2662
 
3409
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
3410
- {
3411
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3412
- TEST_FILE("./test/data/keys/"
3413
- "12345678123498761234123456789012-local-document.json")),
3414
- ctx);
3415
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3416
- TEST_FILE("./test/data/keys/"
3417
- "12345678123498761234123456789013-local-document.json")),
3418
- ctx);
3419
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3420
- }
3421
-
2663
+ /* We do not need delete tokens in v2 so we skip need keys state. */
3422
2664
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3423
2665
  {
3424
2666
  mongocrypt_binary_t *out = mongocrypt_binary_new();
3425
2667
  ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3426
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload.json"), out);
3427
- mongocrypt_binary_destroy(out);
3428
- }
3429
-
3430
- mongocrypt_ctx_destroy(ctx);
3431
- mongocrypt_destroy(crypt);
3432
- }
3433
-
3434
- /* Test that deleteTokens are appended when using an
3435
- * encrypted_field_config_map. */
3436
- {
3437
- mongocrypt_t *crypt = mongocrypt_new();
3438
- /* Configure crypt. */
3439
- {
3440
- char localkey_data[MONGOCRYPT_KEY_LEN] = {0};
3441
- mongocrypt_binary_t *localkey;
3442
- localkey = mongocrypt_binary_new_from_data((uint8_t *)localkey_data, sizeof localkey_data);
3443
- ASSERT_OK(mongocrypt_setopt_kms_provider_local(crypt, localkey), crypt);
3444
- mongocrypt_binary_destroy(localkey);
3445
- ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt,
3446
- TEST_FILE("./test/data/fle2-delete/success/"
3447
- "encrypted-field-config-map.json")),
3448
- crypt);
3449
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note:
3450
- // decrypting
3451
- // QEv1 is still supported.
3452
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
3453
- ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3454
- }
3455
-
3456
- mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3457
-
3458
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/success/cmd.json")),
3459
- ctx);
3460
-
3461
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3462
- {
3463
- ASSERT_OK(
3464
- mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/success/mongocryptd-reply.json")),
3465
- ctx);
3466
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3467
- }
3468
-
3469
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
3470
- {
3471
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3472
- TEST_FILE("./test/data/keys/"
3473
- "ABCDEFAB123498761234123456789012-local-document.json")),
3474
- ctx);
3475
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3476
- TEST_FILE("./test/data/keys/"
3477
- "12345678123498761234123456789012-local-document.json")),
3478
- ctx);
3479
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3480
- TEST_FILE("./test/data/keys/"
3481
- "12345678123498761234123456789013-local-document.json")),
3482
- ctx);
3483
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3484
- }
3485
-
3486
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3487
- {
3488
- mongocrypt_binary_t *out = mongocrypt_binary_new();
3489
- ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3490
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/success/encrypted-payload.json"),
3491
- out);
3492
- mongocrypt_binary_destroy(out);
3493
- }
3494
-
3495
- mongocrypt_ctx_destroy(ctx);
3496
- mongocrypt_destroy(crypt);
3497
- }
3498
-
3499
- /* Test that deleteTokens are appended when using an
3500
- * encrypted_field_config_map and bypass_query_analysis. */
3501
- {
3502
- mongocrypt_t *crypt = mongocrypt_new();
3503
- /* Configure crypt. */
3504
- {
3505
- char localkey_data[MONGOCRYPT_KEY_LEN] = {0};
3506
- mongocrypt_binary_t *localkey;
3507
- localkey = mongocrypt_binary_new_from_data((uint8_t *)localkey_data, sizeof localkey_data);
3508
- ASSERT_OK(mongocrypt_setopt_kms_provider_local(crypt, localkey), crypt);
3509
- mongocrypt_binary_destroy(localkey);
3510
- ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt,
3511
- TEST_FILE("./test/data/fle2-delete/empty/"
3512
- "encrypted-field-config-map.json")),
3513
- crypt);
3514
- mongocrypt_setopt_bypass_query_analysis(crypt);
3515
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note:
3516
- // decrypting
3517
- // QEv1 is still supported.
3518
- ASSERT_OK(mongocrypt_setopt_fle2v2(crypt, false), crypt);
3519
- ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3520
- }
3521
-
3522
- mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3523
-
3524
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/empty/cmd.json")), ctx);
3525
-
3526
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
3527
- {
3528
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3529
- TEST_FILE("./test/data/keys/"
3530
- "12345678123498761234123456789012-local-document.json")),
3531
- ctx);
3532
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3533
- TEST_FILE("./test/data/keys/"
3534
- "12345678123498761234123456789013-local-document.json")),
3535
- ctx);
3536
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3537
- }
3538
-
3539
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3540
- {
3541
- mongocrypt_binary_t *out = mongocrypt_binary_new();
3542
- ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3543
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload.json"), out);
3544
- mongocrypt_binary_destroy(out);
3545
- }
3546
-
3547
- mongocrypt_ctx_destroy(ctx);
3548
- mongocrypt_destroy(crypt);
3549
- }
3550
- }
3551
-
3552
- /* Test encrypting an empty 'delete' command without values to be encrypted.
3553
- * Expect deleteTokens to not be applied. */
3554
- static void _test_encrypt_fle2_delete_v2(_mongocrypt_tester_t *tester) {
3555
- tester_mongocrypt_flags flags = TESTER_MONGOCRYPT_DEFAULT;
3556
-
3557
- /* Test success. */
3558
- {
3559
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(flags);
3560
- mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3561
-
3562
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/success/cmd.json")),
3563
- ctx);
3564
-
3565
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
3566
- {
3567
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/success/collinfo.json")), ctx);
3568
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3569
- }
3570
-
3571
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3572
- {
3573
- ASSERT_OK(
3574
- mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/success/mongocryptd-reply.json")),
3575
- ctx);
3576
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3577
- }
3578
-
3579
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
3580
- {
3581
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3582
- TEST_FILE("./test/data/keys/"
3583
- "ABCDEFAB123498761234123456789012-local-document.json")),
3584
- ctx);
3585
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
3586
- TEST_FILE("./test/data/keys/"
3587
- "12345678123498761234123456789012-local-document.json")),
3588
- ctx);
3589
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3590
- }
3591
-
3592
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3593
- {
3594
- mongocrypt_binary_t *out = mongocrypt_binary_new();
3595
- ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3596
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/success/encrypted-payload-v2.json"),
3597
- out);
3598
- mongocrypt_binary_destroy(out);
3599
- }
3600
-
3601
- mongocrypt_ctx_destroy(ctx);
3602
- mongocrypt_destroy(crypt);
3603
- }
3604
- /* Test with no encrypted values. */
3605
- {
3606
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(flags);
3607
- mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3608
-
3609
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/empty/cmd.json")), ctx);
3610
-
3611
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
3612
- {
3613
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/empty/collinfo.json")), ctx);
3614
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3615
- }
3616
-
3617
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3618
- {
3619
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/empty/mongocryptd-reply.json")),
3620
- ctx);
3621
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3622
- }
3623
-
3624
- /* We do not need delete tokens in v2 so we skip need keys state. */
3625
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3626
- {
3627
- mongocrypt_binary_t *out = mongocrypt_binary_new();
3628
- ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3629
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload-v2.json"),
3630
- out);
3631
- mongocrypt_binary_destroy(out);
3632
- }
3633
-
3634
- mongocrypt_ctx_destroy(ctx);
3635
- mongocrypt_destroy(crypt);
3636
- }
3637
-
3638
- /* Test that deleteTokens are no appended when bypassQueryAnalysis is true in v2. */
3639
- {
3640
- mongocrypt_t *crypt = mongocrypt_new();
3641
- /* Configure crypt. */
3642
- {
3643
- char localkey_data[MONGOCRYPT_KEY_LEN] = {0};
3644
- mongocrypt_binary_t *localkey;
3645
- localkey = mongocrypt_binary_new_from_data((uint8_t *)localkey_data, sizeof localkey_data);
3646
- ASSERT_OK(mongocrypt_setopt_kms_provider_local(crypt, localkey), crypt);
3647
- mongocrypt_binary_destroy(localkey);
3648
- mongocrypt_setopt_bypass_query_analysis(crypt);
3649
- mongocrypt_setopt_fle2v2(crypt, true);
3650
- ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3651
- }
3652
-
3653
- mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3654
-
3655
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-delete/empty/cmd.json")), ctx);
3656
-
3657
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
3658
- {
3659
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-delete/empty/collinfo.json")), ctx);
3660
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
3661
- }
3662
-
3663
- /* We do not need delete tokens in v2 so we skip need keys state. */
3664
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
3665
- {
3666
- mongocrypt_binary_t *out = mongocrypt_binary_new();
3667
- ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
3668
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload-v2.json"),
3669
- out);
2668
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-delete/empty/encrypted-payload-v2.json"),
2669
+ out);
3670
2670
  mongocrypt_binary_destroy(out);
3671
2671
  }
3672
2672
 
@@ -3689,7 +2689,6 @@ static void _test_encrypt_fle2_delete_v2(_mongocrypt_tester_t *tester) {
3689
2689
  TEST_FILE("./test/data/fle2-delete/success/"
3690
2690
  "encrypted-field-config-map.json")),
3691
2691
  crypt);
3692
- mongocrypt_setopt_fle2v2(crypt, true);
3693
2692
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3694
2693
  }
3695
2694
 
@@ -3748,7 +2747,6 @@ static void _test_encrypt_fle2_delete_v2(_mongocrypt_tester_t *tester) {
3748
2747
  "encrypted-field-config-map.json")),
3749
2748
  crypt);
3750
2749
  mongocrypt_setopt_bypass_query_analysis(crypt);
3751
- mongocrypt_setopt_fle2v2(crypt, true);
3752
2750
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
3753
2751
  }
3754
2752
 
@@ -3771,7 +2769,6 @@ static void _test_encrypt_fle2_delete_v2(_mongocrypt_tester_t *tester) {
3771
2769
  }
3772
2770
 
3773
2771
  static void _test_encrypt_fle2_delete(_mongocrypt_tester_t *tester) {
3774
- _test_encrypt_fle2_delete_v1(tester);
3775
2772
  _test_encrypt_fle2_delete_v2(tester);
3776
2773
  }
3777
2774
 
@@ -3781,9 +2778,7 @@ static void _test_encrypt_fle2_omits_encryptionInformation(_mongocrypt_tester_t
3781
2778
  /* 'find' does not include 'encryptionInformation' if no fields are
3782
2779
  * encrypted. */
3783
2780
  {
3784
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3785
- // QEv1 is still supported.
3786
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2781
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
3787
2782
  mongocrypt_ctx_t *ctx;
3788
2783
 
3789
2784
  ctx = mongocrypt_ctx_new(crypt);
@@ -3826,9 +2821,7 @@ static void _test_encrypt_fle2_omits_encryptionInformation(_mongocrypt_tester_t
3826
2821
  /* 'find' includes encryptionInformation if the initial command includes an
3827
2822
  * explicitly encrypted payload. */
3828
2823
  {
3829
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3830
- // QEv1 is still supported.
3831
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2824
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
3832
2825
  mongocrypt_ctx_t *ctx;
3833
2826
 
3834
2827
  ctx = mongocrypt_ctx_new(crypt);
@@ -3875,9 +2868,7 @@ static void _test_encrypt_fle2_explain_with_mongocryptd(_mongocrypt_tester_t *te
3875
2868
  /* Test with an encrypted value. Otherwise 'encryptionInformation' is not
3876
2869
  * appended. */
3877
2870
  {
3878
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
3879
- // QEv1 is still supported.
3880
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2871
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
3881
2872
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3882
2873
 
3883
2874
  ASSERT_OK(
@@ -3939,17 +2930,14 @@ static void _test_encrypt_fle2_explain_with_mongocryptd(_mongocrypt_tester_t *te
3939
2930
 
3940
2931
  static void _test_encrypt_fle2_explain_with_csfle(_mongocrypt_tester_t *tester) {
3941
2932
  if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) {
3942
- fputs("No 'real' csfle library is available. The "
3943
- "_test_encrypt_fle2_explain_with_csfle test is a no-op.",
3944
- stderr);
2933
+ TEST_STDERR_PRINTF("No 'real' csfle library is available. The %s test is a no-op.\n", BSON_FUNC);
3945
2934
  return;
3946
2935
  }
3947
2936
 
3948
2937
  /* Test with an encrypted value. Otherwise 'encryptionInformation' is not
3949
2938
  * appended. */
3950
2939
  {
3951
- mongocrypt_t *crypt =
3952
- _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB | TESTER_MONGOCRYPT_WITH_CRYPT_V1);
2940
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB);
3953
2941
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3954
2942
 
3955
2943
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-explain/with-csfle/cmd.json")),
@@ -4037,9 +3025,7 @@ static void _test_encrypt_fle1_explain_with_mongocryptd(_mongocrypt_tester_t *te
4037
3025
 
4038
3026
  static void _test_encrypt_fle1_explain_with_csfle(_mongocrypt_tester_t *tester) {
4039
3027
  if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) {
4040
- fputs("No 'real' csfle library is available. The "
4041
- "_test_encrypt_fle1_explain_with_csfle test is a no-op.",
4042
- stderr);
3028
+ TEST_STDERR_PRINTF("No 'real' csfle library is available. The %s test is a no-op.\n", BSON_FUNC);
4043
3029
  return;
4044
3030
  }
4045
3031
 
@@ -4075,9 +3061,7 @@ static void _test_encrypt_fle1_explain_with_csfle(_mongocrypt_tester_t *tester)
4075
3061
  // Test that an input command with $db preserves $db in the output.
4076
3062
  static void _test_dollardb_preserved(_mongocrypt_tester_t *tester) {
4077
3063
  /* Test with an encrypted value. */
4078
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
4079
- // QEv1 is still supported.
4080
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
3064
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4081
3065
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4082
3066
 
4083
3067
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/dollardb/preserved/cmd.json")), ctx);
@@ -4180,9 +3164,7 @@ static void _test_dollardb_preserved_empty(_mongocrypt_tester_t *tester) {
4180
3164
 
4181
3165
  // Test that an input command with no $db does not include $db in the output.
4182
3166
  static void _test_dollardb_omitted(_mongocrypt_tester_t *tester) {
4183
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
4184
- // QEv1 is still supported.
4185
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
3167
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4186
3168
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4187
3169
 
4188
3170
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/dollardb/omitted/cmd.json")), ctx);
@@ -4291,6 +3273,24 @@ static void _test_dollardb_preserved_fle1(_mongocrypt_tester_t *tester) {
4291
3273
  mongocrypt_destroy(crypt);
4292
3274
  }
4293
3275
 
3276
+ #define expect_mongo_op(ctx, expect) \
3277
+ if (1) { \
3278
+ mongocrypt_binary_t *got = mongocrypt_binary_new(); \
3279
+ ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, got), ctx); \
3280
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON((expect), got); \
3281
+ mongocrypt_binary_destroy(got); \
3282
+ } else \
3283
+ ((void)0)
3284
+
3285
+ #define expect_and_reply_to_ismaster(ctx) \
3286
+ if (1) { \
3287
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS); \
3288
+ expect_mongo_op(ctx, TEST_BSON("{'isMaster': 1}")); \
3289
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/mongocryptd-ismaster-26.json")), ctx); \
3290
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx); \
3291
+ } else \
3292
+ ((void)0)
3293
+
4294
3294
  static void _test_fle1_create_without_schema(_mongocrypt_tester_t *tester) {
4295
3295
  mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4296
3296
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
@@ -4298,21 +3298,7 @@ static void _test_fle1_create_without_schema(_mongocrypt_tester_t *tester) {
4298
3298
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle1-create/without-schema/cmd.json")),
4299
3299
  ctx);
4300
3300
 
4301
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4302
- {
4303
- mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4304
-
4305
- ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4306
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/without-schema/"
4307
- "ismaster-to-mongocryptd.json"),
4308
- cmd_to_mongocryptd);
4309
- mongocrypt_binary_destroy(cmd_to_mongocryptd);
4310
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
4311
- TEST_FILE("./test/data/fle1-create/without-schema/"
4312
- "mongocryptd-ismaster.json")),
4313
- ctx);
4314
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4315
- }
3301
+ expect_and_reply_to_ismaster(ctx);
4316
3302
 
4317
3303
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4318
3304
  {
@@ -4356,28 +3342,14 @@ static void _test_fle1_create_with_schema(_mongocrypt_tester_t *tester) {
4356
3342
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle1-create/with-schema/cmd.json")),
4357
3343
  ctx);
4358
3344
 
3345
+ expect_and_reply_to_ismaster(ctx);
3346
+
4359
3347
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4360
3348
  {
4361
3349
  mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4362
3350
 
4363
3351
  ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4364
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/with-schema/"
4365
- "ismaster-to-mongocryptd.json"),
4366
- cmd_to_mongocryptd);
4367
- mongocrypt_binary_destroy(cmd_to_mongocryptd);
4368
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
4369
- TEST_FILE("./test/data/fle1-create/with-schema/"
4370
- "mongocryptd-ismaster.json")),
4371
- ctx);
4372
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4373
- }
4374
-
4375
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4376
- {
4377
- mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4378
-
4379
- ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4380
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/with-schema/cmd-to-mongocryptd.json"),
3352
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/with-schema/cmd-to-mongocryptd.json"),
4381
3353
  cmd_to_mongocryptd);
4382
3354
  mongocrypt_binary_destroy(cmd_to_mongocryptd);
4383
3355
  ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
@@ -4409,21 +3381,7 @@ static void _test_fle1_create_with_cmd_schema(_mongocrypt_tester_t *tester) {
4409
3381
  ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle1-create/with-cmd-schema/cmd.json")),
4410
3382
  ctx);
4411
3383
 
4412
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4413
- {
4414
- mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4415
-
4416
- ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4417
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/with-cmd-schema/"
4418
- "ismaster-to-mongocryptd.json"),
4419
- cmd_to_mongocryptd);
4420
- mongocrypt_binary_destroy(cmd_to_mongocryptd);
4421
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
4422
- TEST_FILE("./test/data/fle1-create/with-cmd-schema/"
4423
- "mongocryptd-ismaster.json")),
4424
- ctx);
4425
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4426
- }
3384
+ expect_and_reply_to_ismaster(ctx);
4427
3385
 
4428
3386
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4429
3387
  {
@@ -4494,9 +3452,7 @@ static void _test_fle1_create_old_mongocryptd(_mongocrypt_tester_t *tester) {
4494
3452
 
4495
3453
  static void _test_fle1_create_with_csfle(_mongocrypt_tester_t *tester) {
4496
3454
  if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) {
4497
- fputs("No 'real' csfle library is available. The "
4498
- "_test_fle1_create_with_csfle test is a no-op.",
4499
- stderr);
3455
+ TEST_STDERR_PRINTF("No 'real' csfle library is available. The %s test is a no-op.\n", BSON_FUNC);
4500
3456
  return;
4501
3457
  }
4502
3458
 
@@ -4519,45 +3475,32 @@ static void _test_fle1_create_with_csfle(_mongocrypt_tester_t *tester) {
4519
3475
  mongocrypt_destroy(crypt);
4520
3476
  }
4521
3477
 
4522
- static void _test_fle2_create(_mongocrypt_tester_t *tester) {
3478
+ static void test_successful_fle2_create(_mongocrypt_tester_t *tester,
3479
+ const char *efc_map_path,
3480
+ const char *cmd_path,
3481
+ const char *cmd_to_cryptd_path,
3482
+ const char *cryptd_reply_path,
3483
+ const char *encrypted_payload_path) {
4523
3484
  mongocrypt_t *crypt = mongocrypt_new();
4524
3485
 
4525
3486
  ASSERT_OK(mongocrypt_setopt_kms_provider_aws(crypt, "example", -1, "example", -1), crypt);
4526
- ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(
4527
- crypt,
4528
- TEST_FILE("./test/data/fle2-create/encrypted-field-config-map.json")),
4529
- crypt);
3487
+ ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, TEST_FILE(efc_map_path)), crypt);
4530
3488
  ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
4531
3489
 
4532
3490
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4533
3491
 
4534
- ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-create/cmd.json")), ctx);
4535
-
4536
- ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4537
- {
4538
- mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
3492
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE(cmd_path)), ctx);
4539
3493
 
4540
- ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4541
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle1-create/without-schema/"
4542
- "ismaster-to-mongocryptd.json"),
4543
- cmd_to_mongocryptd);
4544
- mongocrypt_binary_destroy(cmd_to_mongocryptd);
4545
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx,
4546
- TEST_FILE("./test/data/fle1-create/without-schema/"
4547
- "mongocryptd-ismaster.json")),
4548
- ctx);
4549
- ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4550
- }
3494
+ expect_and_reply_to_ismaster(ctx);
4551
3495
 
4552
3496
  ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4553
3497
  {
4554
3498
  mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4555
3499
 
4556
3500
  ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4557
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-create/cmd-to-mongocryptd.json"),
4558
- cmd_to_mongocryptd);
3501
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE(cmd_to_cryptd_path), cmd_to_mongocryptd);
4559
3502
  mongocrypt_binary_destroy(cmd_to_mongocryptd);
4560
- ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-create/mongocryptd-reply.json")), ctx);
3503
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE(cryptd_reply_path)), ctx);
4561
3504
  ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4562
3505
  }
4563
3506
 
@@ -4565,7 +3508,7 @@ static void _test_fle2_create(_mongocrypt_tester_t *tester) {
4565
3508
  {
4566
3509
  mongocrypt_binary_t *out = mongocrypt_binary_new();
4567
3510
  ASSERT_OK(mongocrypt_ctx_finalize(ctx, out), ctx);
4568
- ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE("./test/data/fle2-create/encrypted-payload.json"), out);
3511
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(TEST_FILE(encrypted_payload_path), out);
4569
3512
  mongocrypt_binary_destroy(out);
4570
3513
  }
4571
3514
 
@@ -4573,6 +3516,85 @@ static void _test_fle2_create(_mongocrypt_tester_t *tester) {
4573
3516
  mongocrypt_destroy(crypt);
4574
3517
  }
4575
3518
 
3519
+ #define TEST_SUCCESSFUL_FLE2_CREATE(efc_path, cmd_path, cryptd_path, payload_path) \
3520
+ test_successful_fle2_create(tester, \
3521
+ "./test/data/" efc_path "/encrypted-field-config-map.json", \
3522
+ "./test/data/" cmd_path "/cmd.json", \
3523
+ "./test/data/" cryptd_path "/cmd-to-mongocryptd.json", \
3524
+ "./test/data/" cryptd_path "/mongocryptd-reply.json", \
3525
+ "./test/data/" payload_path "/encrypted-payload.json")
3526
+
3527
+ #define TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR(path) TEST_SUCCESSFUL_FLE2_CREATE(path, path, path, path)
3528
+
3529
+ static void _test_fle2_create(_mongocrypt_tester_t *tester) {
3530
+ TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR("fle2-create");
3531
+ }
3532
+
3533
+ static void _test_fle2_create_with_encrypted_fields(_mongocrypt_tester_t *tester) {
3534
+ TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR("fle2-create-encrypted-collection");
3535
+ }
3536
+
3537
+ static void _test_fle2_create_with_encrypted_fields_and_str_encode_version(_mongocrypt_tester_t *tester) {
3538
+ TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR("fle2-create-encrypted-collection-with-str-encode-version");
3539
+ }
3540
+
3541
+ static void _test_fle2_create_with_encrypted_fields_unset_str_encode_version(_mongocrypt_tester_t *tester) {
3542
+ TEST_SUCCESSFUL_FLE2_CREATE("fle2-create-encrypted-collection-with-str-encode-version",
3543
+ "fle2-create-encrypted-collection",
3544
+ "fle2-create-encrypted-collection-encrypted-fields-unset-str-encode-version",
3545
+ "fle2-create-encrypted-collection-with-str-encode-version");
3546
+ }
3547
+
3548
+ static void _test_fle2_text_search_create_with_encrypted_fields(_mongocrypt_tester_t *tester) {
3549
+ TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR("fle2-text-search-create-encrypted-collection");
3550
+ }
3551
+
3552
+ static void _test_fle2_text_search_create_with_encrypted_fields_and_str_encode_version(_mongocrypt_tester_t *tester) {
3553
+ TEST_SUCCESSFUL_FLE2_CREATE_ONEDIR("fle2-text-search-create-encrypted-collection-with-str-encode-version");
3554
+ }
3555
+
3556
+ static void _test_fle2_text_search_create_with_encrypted_fields_unset_str_encode_version(_mongocrypt_tester_t *tester) {
3557
+ TEST_SUCCESSFUL_FLE2_CREATE("fle2-text-search-create-encrypted-collection-with-str-encode-version",
3558
+ "fle2-text-search-create-encrypted-collection",
3559
+ "fle2-text-search-create-encrypted-collection",
3560
+ "fle2-text-search-create-encrypted-collection-with-str-encode-version");
3561
+ }
3562
+
3563
+ static void
3564
+ _test_fle2_text_search_create_with_encrypted_fields_unmatching_str_encode_version(_mongocrypt_tester_t *tester) {
3565
+ TEST_SUCCESSFUL_FLE2_CREATE("fle2-text-search-create-encrypted-collection",
3566
+ "fle2-text-search-create-encrypted-collection-with-str-encode-version",
3567
+ "fle2-text-search-create-encrypted-collection-with-str-encode-version",
3568
+ "fle2-text-search-create-encrypted-collection-with-str-encode-version");
3569
+ }
3570
+
3571
+ // Test that the JSON Schema found from a "create" command is not cached.
3572
+ static void _test_fle2_create_does_not_cache_empty_schema(_mongocrypt_tester_t *tester) {
3573
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
3574
+ // Auto encrypt a "create" to "db.coll".
3575
+ {
3576
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3577
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-create/cmd.json")), ctx);
3578
+ expect_and_reply_to_ismaster(ctx);
3579
+
3580
+ // Expect MONGOCRYPT_CTX_NEED_MONGO_COLLINFO is skipped since no server-side schema is expected for "create".
3581
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
3582
+ mongocrypt_ctx_destroy(ctx);
3583
+ }
3584
+
3585
+ // Auto encrypt "find" to "db.coll". Expect server-side schema is requested.
3586
+ {
3587
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
3588
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_BSON(BSON_STR({"find" : "coll", "filter" : {}}))),
3589
+ ctx);
3590
+ // The MONGOCRYPT_CTX_NEED_COLLINFO state is entered to request a server-side schema.
3591
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
3592
+ mongocrypt_ctx_destroy(ctx);
3593
+ }
3594
+
3595
+ mongocrypt_destroy(crypt);
3596
+ }
3597
+
4576
3598
  /* Regression test for MONGOCRYPT-435 */
4577
3599
  static void _test_fle2_create_bypass_query_analysis(_mongocrypt_tester_t *tester) {
4578
3600
  mongocrypt_t *crypt = mongocrypt_new();
@@ -4607,15 +3629,13 @@ static void _test_encrypt_macos_no_ctr(_mongocrypt_tester_t *tester) {
4607
3629
  _mongocrypt_buffer_t key_id;
4608
3630
 
4609
3631
  if (_aes_ctr_is_supported_by_os) {
4610
- printf("Common Crypto with CTR support detected. Skipping.");
3632
+ TEST_PRINTF("Common Crypto with CTR support detected. Skipping.");
4611
3633
  return;
4612
3634
  }
4613
3635
 
4614
3636
  _mongocrypt_buffer_copy_from_hex(&key_id, "ABCDEFAB123498761234123456789012");
4615
3637
 
4616
- // TODO(MONGOCRYPT-572): This test uses the QEv1 protocol. Update this test for QEv2 or remove. Note: decrypting
4617
- // QEv1 is still supported.
4618
- mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_WITH_CRYPT_V1);
3638
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4619
3639
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4620
3640
 
4621
3641
  ASSERT_OK(mongocrypt_ctx_setopt_algorithm(ctx, MONGOCRYPT_ALGORITHM_UNINDEXED_STR, -1), ctx);
@@ -4688,7 +3708,7 @@ static void _test_fle1_collmod_without_jsonSchema(_mongocrypt_tester_t *tester)
4688
3708
 
4689
3709
  static void _test_bulkWrite(_mongocrypt_tester_t *tester) {
4690
3710
  if (!_aes_ctr_is_supported_by_os) {
4691
- printf("Common Crypto with no CTR support detected. Required by QEv2 encryption. Skipping.");
3711
+ TEST_PRINTF("Common Crypto with no CTR support detected. Required by QEv2 encryption. Skipping.");
4692
3712
  return;
4693
3713
  }
4694
3714
 
@@ -5086,7 +4106,7 @@ static void _test_bulkWrite(_mongocrypt_tester_t *tester) {
5086
4106
  bson_free(local_kek);
5087
4107
  }
5088
4108
 
5089
- // `_test_rangePreview_fails` tests that use of "rangePreview" errors when rangeV2 is opted-in.
4109
+ // `_test_rangePreview_fails` tests that use of "rangePreview" errors.
5090
4110
  static void _test_rangePreview_fails(_mongocrypt_tester_t *tester) {
5091
4111
  // local_kek is the KEK used to encrypt the keyMaterial in ./test/data/key-document-local.json
5092
4112
  uint8_t local_kek_raw[MONGOCRYPT_KEY_LEN] = {0};
@@ -5098,7 +4118,6 @@ static void _test_rangePreview_fails(_mongocrypt_tester_t *tester) {
5098
4118
  {
5099
4119
  mongocrypt_t *crypt = mongocrypt_new();
5100
4120
  mongocrypt_setopt_kms_providers(crypt, kms_providers);
5101
- ASSERT_OK(mongocrypt_setopt_use_range_v2(crypt), crypt);
5102
4121
  ASSERT_OK(mongocrypt_init(crypt), crypt);
5103
4122
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5104
4123
  ASSERT_OK(ctx, crypt);
@@ -5113,7 +4132,6 @@ static void _test_rangePreview_fails(_mongocrypt_tester_t *tester) {
5113
4132
  {
5114
4133
  mongocrypt_t *crypt = mongocrypt_new();
5115
4134
  mongocrypt_setopt_kms_providers(crypt, kms_providers);
5116
- ASSERT_OK(mongocrypt_setopt_use_range_v2(crypt), crypt);
5117
4135
  ASSERT_OK(mongocrypt_init(crypt), crypt);
5118
4136
  mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5119
4137
  ASSERT_OK(ctx, crypt);
@@ -5128,7 +4146,6 @@ static void _test_rangePreview_fails(_mongocrypt_tester_t *tester) {
5128
4146
  {
5129
4147
  mongocrypt_t *crypt = mongocrypt_new();
5130
4148
  mongocrypt_setopt_kms_providers(crypt, kms_providers);
5131
- ASSERT_OK(mongocrypt_setopt_use_range_v2(crypt), crypt);
5132
4149
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(
5133
4150
  crypt,
5134
4151
  TEST_FILE("./test/data/fle2-insert-range/int32/encrypted-field-map.json")), // Uses 'rangePreview'
@@ -5160,11 +4177,11 @@ typedef struct {
5160
4177
 
5161
4178
  static void autoencryption_test_run(autoencryption_test *aet) {
5162
4179
  if (!_aes_ctr_is_supported_by_os) {
5163
- printf("Common Crypto with no CTR support detected. Skipping.");
4180
+ TEST_PRINTF("Common Crypto with no CTR support detected. Skipping.");
5164
4181
  return;
5165
4182
  }
5166
4183
 
5167
- printf(" auto_encryption test: '%s' ... begin\n", aet->desc);
4184
+ TEST_PRINTF(" auto_encryption test: '%s' ... begin\n", aet->desc);
5168
4185
 
5169
4186
  // Reset global counter for the `payloadId` to produce deterministic payloads.
5170
4187
  extern void mc_reset_payloadId_for_testing(void);
@@ -5199,7 +4216,6 @@ static void autoencryption_test_run(autoencryption_test *aet) {
5199
4216
  }
5200
4217
 
5201
4218
  ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, aet->encrypted_field_map), crypt);
5202
- ASSERT_OK(mongocrypt_setopt_use_range_v2(crypt), crypt);
5203
4219
  ASSERT_OK(mongocrypt_init(crypt), crypt);
5204
4220
  }
5205
4221
 
@@ -5231,14 +4247,14 @@ static void autoencryption_test_run(autoencryption_test *aet) {
5231
4247
  mongocrypt_binary_destroy(got);
5232
4248
  }
5233
4249
 
5234
- printf(" auto_encryption test: '%s' ... end\n", aet->desc);
4250
+ TEST_PRINTF(" auto_encryption test: '%s' ... end\n", aet->desc);
5235
4251
  mongocrypt_ctx_destroy(ctx);
5236
4252
  mongocrypt_destroy(crypt);
5237
4253
  }
5238
4254
 
5239
4255
  static void _test_no_trimFactor(_mongocrypt_tester_t *tester) {
5240
4256
  if (!_aes_ctr_is_supported_by_os) {
5241
- printf("Common Crypto with no CTR support detected. Skipping.");
4257
+ TEST_PRINTF("Common Crypto with no CTR support detected. Skipping.");
5242
4258
  return;
5243
4259
  }
5244
4260
 
@@ -5306,7 +4322,7 @@ static void lookup_payload_bson(mongocrypt_binary_t *result, char *path, bson_t
5306
4322
  // Test that the crypto params added in SERVER-91889 are sent for "range" payloads.
5307
4323
  static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5308
4324
  if (!_aes_ctr_is_supported_by_os) {
5309
- printf("Common Crypto with no CTR support detected. Skipping.");
4325
+ TEST_PRINTF("Common Crypto with no CTR support detected. Skipping.");
5310
4326
  return;
5311
4327
  }
5312
4328
 
@@ -5329,8 +4345,6 @@ static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5329
4345
  tc.msg = TEST_BSON("{'v': 123456}");
5330
4346
  tc.keys_to_feed[0] = key123;
5331
4347
  tc.expect = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json");
5332
- tc.use_v2 = true; // Use QEv2 protocol.
5333
- tc.use_range_v2 = true; // Use RangeV2 protocol.
5334
4348
  ee_testcase_run(&tc);
5335
4349
  // Check the parameters are present in the final payload.
5336
4350
  {
@@ -5355,8 +4369,6 @@ static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5355
4369
  tc.msg = TEST_BSON("{'v': 123456}");
5356
4370
  tc.keys_to_feed[0] = key123;
5357
4371
  tc.expect = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json");
5358
- tc.use_v2 = true; // Use QEv2 protocol.
5359
- tc.use_range_v2 = true; // Use RangeV2 protocol.
5360
4372
  ee_testcase_run(&tc);
5361
4373
  // Check the parameters are present in the final payload.
5362
4374
  {
@@ -5382,8 +4394,6 @@ static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5382
4394
  tc.msg = TEST_BSON("{'v': 123456.0}");
5383
4395
  tc.keys_to_feed[0] = key123;
5384
4396
  tc.expect = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-insert-double/expected.json");
5385
- tc.use_v2 = true; // Use QEv2 protocol.
5386
- tc.use_range_v2 = true; // Use RangeV2 protocol.
5387
4397
  ee_testcase_run(&tc);
5388
4398
  // Check the parameters are present in the final payload.
5389
4399
  {
@@ -5408,8 +4418,6 @@ static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5408
4418
  tc.msg = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json");
5409
4419
  tc.keys_to_feed[0] = key123;
5410
4420
  tc.expect = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json");
5411
- tc.use_v2 = true; // Use QEv2 protocol.
5412
- tc.use_range_v2 = true; // Use RangeV2 protocol.
5413
4421
  ee_testcase_run(&tc);
5414
4422
  // Check the parameters are present in the final payload.
5415
4423
  {
@@ -5434,8 +4442,6 @@ static void _test_range_sends_cryptoParams(_mongocrypt_tester_t *tester) {
5434
4442
  tc.msg = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json");
5435
4443
  tc.keys_to_feed[0] = key123;
5436
4444
  tc.expect = TEST_FILE("./test/data/range-sends-cryptoParams/explicit-find-int32/expected.json");
5437
- tc.use_v2 = true; // Use QEv2 protocol.
5438
- tc.use_range_v2 = true; // Use RangeV2 protocol.
5439
4445
  ee_testcase_run(&tc);
5440
4446
  // Check the parameters are present in the final payload.
5441
4447
  {
@@ -5674,6 +4680,1100 @@ static void _test_encrypt_retry(_mongocrypt_tester_t *tester) {
5674
4680
  mongocrypt_ctx_destroy(ctx);
5675
4681
  mongocrypt_destroy(crypt);
5676
4682
  }
4683
+
4684
+ // Test network retry does not occur if not enabled.
4685
+ {
4686
+ mongocrypt_t *crypt = mongocrypt_new();
4687
+ ASSERT_OK(mongocrypt_setopt_kms_providers(
4688
+ crypt,
4689
+ TEST_BSON(BSON_STR({"aws" : {"accessKeyId" : "foo", "secretAccessKey" : "bar"}}))),
4690
+ crypt);
4691
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
4692
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4693
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "test", -1, TEST_FILE("./test/example/cmd.json")), ctx);
4694
+ _mongocrypt_tester_run_ctx_to(tester, ctx, MONGOCRYPT_CTX_NEED_KMS);
4695
+ mongocrypt_kms_ctx_t *kms_ctx = mongocrypt_ctx_next_kms_ctx(ctx);
4696
+ ASSERT_OK(kms_ctx, ctx); // Give a retryable network error. Expect error due to retry disabled.
4697
+ ASSERT_FAILS(mongocrypt_kms_ctx_fail(kms_ctx), kms_ctx, "KMS request failed due to network error");
4698
+ mongocrypt_ctx_destroy(ctx);
4699
+ mongocrypt_destroy(crypt);
4700
+ }
4701
+ }
4702
+
4703
+ static void capture_logs(mongocrypt_log_level_t level, const char *message, uint32_t message_len, void *ctx) {
4704
+ mc_array_t *log_msgs = ctx;
4705
+ char *message_copy = bson_strdup(message);
4706
+ _mc_array_append_val(log_msgs, message_copy);
4707
+ }
4708
+
4709
+ // Regression test for: MONGOCRYPT-770
4710
+ static void _test_does_not_warn_for_empty_local_schema(_mongocrypt_tester_t *tester) {
4711
+ mongocrypt_t *crypt = mongocrypt_new();
4712
+ ASSERT_OK(mongocrypt_setopt_kms_providers(
4713
+ crypt,
4714
+ TEST_BSON(BSON_STR({"aws" : {"accessKeyId" : "foo", "secretAccessKey" : "bar"}}))),
4715
+ crypt);
4716
+
4717
+ mc_array_t log_msgs; // Array of char *;
4718
+ _mc_array_init(&log_msgs, sizeof(char *));
4719
+ ASSERT_OK(mongocrypt_setopt_log_handler(crypt, capture_logs, &log_msgs), crypt);
4720
+
4721
+ // Configure a local schema for "db.coll":
4722
+ ASSERT_OK(mongocrypt_setopt_schema_map(crypt, TEST_BSON(BSON_STR({"db.coll" : {}}))), crypt);
4723
+
4724
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
4725
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4726
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_BSON(BSON_STR({"find" : "coll", "filter" : {}}))), ctx);
4727
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4728
+
4729
+ // Feed mongocryptd reply indicating `schemaRequiresEncryption: false`.
4730
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_BSON(BSON_STR({
4731
+ "hasEncryptionPlaceholders" : false,
4732
+ "schemaRequiresEncryption" : false,
4733
+ "result" : {"find" : "test", "filter" : {}},
4734
+ "ok" : {"$numberDouble" : "1.0"}
4735
+ }))),
4736
+ ctx);
4737
+
4738
+ // Expect no warning (passing an empty local schema is a valid use-case).
4739
+ if (log_msgs.len > 0) {
4740
+ TEST_STDERR_PRINTF("Got unexpected log messages:\n");
4741
+ for (size_t i = 0; i < log_msgs.len; i++) {
4742
+ TEST_STDERR_PRINTF("> %s\n", _mc_array_index(&log_msgs, char *, i));
4743
+ }
4744
+ abort();
4745
+ }
4746
+
4747
+ for (size_t i = 0; i < log_msgs.len; i++) {
4748
+ bson_free(_mc_array_index(&log_msgs, char *, i));
4749
+ }
4750
+ _mc_array_destroy(&log_msgs);
4751
+ mongocrypt_ctx_destroy(ctx);
4752
+ mongocrypt_destroy(crypt);
4753
+ }
4754
+
4755
+ static void _test_fle2_encrypted_field_config_with_bad_str_encode_version(_mongocrypt_tester_t *tester) {
4756
+ mongocrypt_t *crypt = mongocrypt_new();
4757
+
4758
+ ASSERT_OK(mongocrypt_setopt_kms_provider_aws(crypt, "example", -1, "example", -1), crypt);
4759
+ ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(
4760
+ crypt,
4761
+ TEST_FILE("./test/data/fle2-bad-str-encode-version/bad-encrypted-field-config-map.json")),
4762
+ crypt);
4763
+ ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
4764
+
4765
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4766
+ ASSERT_FAILS(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-insert-v2/cmd.json")),
4767
+ ctx,
4768
+ "'strEncodeVersion' of 99 is not supported");
4769
+
4770
+ mongocrypt_ctx_destroy(ctx);
4771
+ mongocrypt_destroy(crypt);
4772
+ }
4773
+
4774
+ static void _test_fle2_encrypted_fields_with_unmatching_str_encode_version(_mongocrypt_tester_t *tester) {
4775
+ mongocrypt_t *crypt = mongocrypt_new();
4776
+
4777
+ ASSERT_OK(mongocrypt_setopt_kms_provider_aws(crypt, "example", -1, "example", -1), crypt);
4778
+ ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt,
4779
+ TEST_FILE("./test/data/fle2-create-encrypted-collection/"
4780
+ "encrypted-field-config-map.json")),
4781
+ crypt);
4782
+ ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
4783
+
4784
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4785
+
4786
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(
4787
+ ctx,
4788
+ "db",
4789
+ -1,
4790
+ TEST_FILE("./test/data/fle2-create-encrypted-collection-with-str-encode-version/cmd.json")),
4791
+ ctx);
4792
+
4793
+ expect_and_reply_to_ismaster(ctx);
4794
+
4795
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4796
+ {
4797
+ mongocrypt_binary_t *cmd_to_mongocryptd = mongocrypt_binary_new();
4798
+
4799
+ ASSERT_OK(mongocrypt_ctx_mongo_op(ctx, cmd_to_mongocryptd), ctx);
4800
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(
4801
+ TEST_FILE("./test/data/fle2-bad-str-encode-version/bad-create-cmd-to-mongocryptd.json"),
4802
+ cmd_to_mongocryptd);
4803
+ mongocrypt_binary_destroy(cmd_to_mongocryptd);
4804
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(
4805
+ ctx,
4806
+ TEST_FILE("./test/data/fle2-bad-str-encode-version/bad-create-cmd-mongocryptd-reply.json")),
4807
+ ctx);
4808
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4809
+ }
4810
+
4811
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
4812
+ {
4813
+ mongocrypt_binary_t *out = mongocrypt_binary_new();
4814
+ ASSERT_FAILS(mongocrypt_ctx_finalize(ctx, out),
4815
+ ctx,
4816
+ "'strEncodeVersion' of 1 does not match efc->str_encode_version of 0");
4817
+ mongocrypt_binary_destroy(out);
4818
+ }
4819
+
4820
+ mongocrypt_ctx_destroy(ctx);
4821
+ mongocrypt_destroy(crypt);
4822
+ }
4823
+
4824
+ static void _test_fle2_collinfo_with_bad_str_encode_version(_mongocrypt_tester_t *tester) {
4825
+ mongocrypt_t *crypt = mongocrypt_new();
4826
+ ASSERT_OK(mongocrypt_setopt_kms_provider_aws(crypt, "example", -1, "example", -1), crypt);
4827
+ ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
4828
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4829
+
4830
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TEST_FILE("./test/data/fle2-insert-v2/cmd.json")), ctx);
4831
+
4832
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4833
+ ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/fle2-bad-str-encode-version/bad-collinfo.json")),
4834
+ ctx,
4835
+ "'strEncodeVersion' of 99 is not supported");
4836
+
4837
+ mongocrypt_ctx_destroy(ctx);
4838
+ mongocrypt_destroy(crypt);
4839
+ }
4840
+
4841
+ static void _test_lookup(_mongocrypt_tester_t *tester) {
4842
+ // Test $lookup works.
4843
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
4844
+ {
4845
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4846
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4847
+
4848
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4849
+
4850
+ expect_and_reply_to_ismaster(ctx);
4851
+
4852
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4853
+ {
4854
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
4855
+ // Feed both needed schemas.
4856
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
4857
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
4858
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4859
+ }
4860
+
4861
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4862
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
4863
+
4864
+ mongocrypt_ctx_destroy(ctx);
4865
+ mongocrypt_destroy(crypt);
4866
+ }
4867
+ #undef TF
4868
+
4869
+ // Test $lookup errors if multiple-collection support is not opted-in.
4870
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
4871
+ {
4872
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4873
+ crypt->multiple_collinfo_enabled = false;
4874
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4875
+ ASSERT_FAILS(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")),
4876
+ ctx,
4877
+ "not configured to support encrypting a command with multiple collections");
4878
+ mongocrypt_ctx_destroy(ctx);
4879
+ mongocrypt_destroy(crypt);
4880
+ }
4881
+ #undef TF
4882
+
4883
+ // Test $lookup errors if mongocryptd is too old.
4884
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
4885
+ {
4886
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4887
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4888
+
4889
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4890
+
4891
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4892
+ {
4893
+ expect_mongo_op(ctx, TEST_BSON("{'isMaster': 1}"));
4894
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TEST_FILE("./test/data/mongocryptd-ismaster-17.json")), ctx);
4895
+ ASSERT_FAILS(mongocrypt_ctx_mongo_done(ctx), ctx, "Upgrade mongocryptd");
4896
+ }
4897
+
4898
+ mongocrypt_ctx_destroy(ctx);
4899
+ mongocrypt_destroy(crypt);
4900
+ }
4901
+ #undef TF
4902
+
4903
+ // Test nested $lookup.
4904
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-nested/" suffix)
4905
+ {
4906
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4907
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4908
+
4909
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4910
+
4911
+ expect_and_reply_to_ismaster(ctx);
4912
+
4913
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4914
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2", "c3" ]}})));
4915
+
4916
+ mongocrypt_ctx_destroy(ctx);
4917
+ mongocrypt_destroy(crypt);
4918
+ }
4919
+ #undef TF
4920
+
4921
+ // Test $lookup within $unionWith.
4922
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-unionWith/" suffix)
4923
+ {
4924
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4925
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4926
+
4927
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4928
+
4929
+ expect_and_reply_to_ismaster(ctx);
4930
+
4931
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4932
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2", "c3" ]}})));
4933
+
4934
+ mongocrypt_ctx_destroy(ctx);
4935
+ mongocrypt_destroy(crypt);
4936
+ }
4937
+ #undef TF
4938
+
4939
+ // Test $lookup within $facet.
4940
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-facet/" suffix)
4941
+ {
4942
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4943
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4944
+
4945
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4946
+
4947
+ expect_and_reply_to_ismaster(ctx);
4948
+
4949
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4950
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
4951
+
4952
+ mongocrypt_ctx_destroy(ctx);
4953
+ mongocrypt_destroy(crypt);
4954
+ }
4955
+ #undef TF
4956
+
4957
+ // Test $lookup when one schema is in the schemaMap.
4958
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-schemaMap/" suffix)
4959
+ {
4960
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_SKIP_INIT);
4961
+ ASSERT_OK(mongocrypt_setopt_schema_map(crypt, TF("schemaMap.json")), crypt);
4962
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
4963
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4964
+
4965
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4966
+
4967
+ expect_and_reply_to_ismaster(ctx);
4968
+
4969
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4970
+ {
4971
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
4972
+ // Feed remote schema for "c1". "c2" is found in the schemaMap.
4973
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
4974
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4975
+ }
4976
+
4977
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
4978
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
4979
+
4980
+ mongocrypt_ctx_destroy(ctx);
4981
+ mongocrypt_destroy(crypt);
4982
+ }
4983
+ #undef TF
4984
+
4985
+ // Test $lookup with a self-lookup.
4986
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-self/" suffix)
4987
+ {
4988
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
4989
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
4990
+
4991
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
4992
+
4993
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
4994
+ {
4995
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
4996
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
4997
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
4998
+ }
4999
+
5000
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5001
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5002
+
5003
+ mongocrypt_ctx_destroy(ctx);
5004
+ mongocrypt_destroy(crypt);
5005
+ }
5006
+ #undef TF
5007
+
5008
+ // Test $lookup when one schema is already cached.
5009
+ {
5010
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5011
+
5012
+ // Do a self-lookup to add only "c1" to the cache.
5013
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-self/" suffix)
5014
+ {
5015
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5016
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5017
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5018
+ {
5019
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
5020
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5021
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5022
+ }
5023
+ mongocrypt_ctx_destroy(ctx);
5024
+ }
5025
+ #undef TF
5026
+
5027
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
5028
+ // Expect "c1" schema is not requested again.
5029
+ {
5030
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5031
+
5032
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5033
+ expect_and_reply_to_ismaster(ctx);
5034
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5035
+ {
5036
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c2"})));
5037
+ // Feed remaining needed schema.
5038
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5039
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5040
+ }
5041
+
5042
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5043
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5044
+
5045
+ mongocrypt_ctx_destroy(ctx);
5046
+ }
5047
+ mongocrypt_destroy(crypt);
5048
+ }
5049
+
5050
+ #undef TF
5051
+
5052
+ // Test $lookup caches no collinfo results as empty schemas.
5053
+ {
5054
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5055
+
5056
+ // Do a self-lookup to add only "c1" to the cache.
5057
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
5058
+ {
5059
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5060
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5061
+ expect_and_reply_to_ismaster(ctx);
5062
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5063
+ // Feed no collinfo results. Expect "c1" and "c2" to be cached as empty schemas.
5064
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5065
+ mongocrypt_ctx_destroy(ctx);
5066
+ }
5067
+ #undef TF
5068
+
5069
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
5070
+ // Expect "c1" schema is not requested again.
5071
+ {
5072
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5073
+
5074
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5075
+ expect_and_reply_to_ismaster(ctx);
5076
+ // Expect no more schemas are needed (both empty).
5077
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5078
+ mongocrypt_ctx_destroy(ctx);
5079
+ }
5080
+ mongocrypt_destroy(crypt);
5081
+ }
5082
+ #undef TF
5083
+ // Test $lookup from a view.
5084
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-view/" suffix)
5085
+ {
5086
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5087
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5088
+
5089
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5090
+ expect_and_reply_to_ismaster(ctx);
5091
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5092
+ {
5093
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "v1" ]}})));
5094
+
5095
+ // Feed both needed schemas.
5096
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5097
+ ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-v1.json")), ctx, "cannot auto encrypt a view");
5098
+ }
5099
+
5100
+ mongocrypt_ctx_destroy(ctx);
5101
+ mongocrypt_destroy(crypt);
5102
+ }
5103
+ #undef TF
5104
+ // Test $lookup with feeding the same schema twice.
5105
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle/" suffix)
5106
+ {
5107
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5108
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5109
+
5110
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5111
+ expect_and_reply_to_ismaster(ctx);
5112
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5113
+ {
5114
+ // Feed schema for "c2" twice.
5115
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5116
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5117
+ ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx, "unexpected duplicate");
5118
+ }
5119
+
5120
+ mongocrypt_ctx_destroy(ctx);
5121
+ mongocrypt_destroy(crypt);
5122
+ }
5123
+ #undef TF
5124
+
5125
+ // Test $lookup with with feeding a non-matching schema.
5126
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-mismatch/" suffix)
5127
+ {
5128
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5129
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5130
+
5131
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5132
+ expect_and_reply_to_ismaster(ctx);
5133
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5134
+ {
5135
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5136
+ ASSERT_FAILS(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c3.json")), ctx, "got unexpected collinfo");
5137
+ }
5138
+
5139
+ mongocrypt_ctx_destroy(ctx);
5140
+ mongocrypt_destroy(crypt);
5141
+ }
5142
+ #undef TF
5143
+
5144
+ // Test $lookup with only local schemas.
5145
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-only-schemaMap/" suffix)
5146
+ {
5147
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_SKIP_INIT);
5148
+ ASSERT_OK(mongocrypt_setopt_schema_map(crypt, TF("schemaMap.json")), crypt);
5149
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
5150
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5151
+
5152
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5153
+ expect_and_reply_to_ismaster(ctx);
5154
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5155
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5156
+
5157
+ mongocrypt_ctx_destroy(ctx);
5158
+ mongocrypt_destroy(crypt);
5159
+ }
5160
+ #undef TF
5161
+
5162
+ // Test $lookup from a collection that has no $jsonSchema configured.
5163
+ #define TF(suffix) TEST_FILE("./test/data/lookup/csfle-sibling/" suffix)
5164
+ {
5165
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5166
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5167
+
5168
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5169
+ expect_and_reply_to_ismaster(ctx);
5170
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5171
+ {
5172
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5173
+ // Feed both needed schemas.
5174
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5175
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5176
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5177
+ }
5178
+
5179
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5180
+ {
5181
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5182
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("reply-from-mongocryptd.json")), ctx);
5183
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5184
+ }
5185
+
5186
+ mongocrypt_ctx_destroy(ctx);
5187
+ mongocrypt_destroy(crypt);
5188
+ }
5189
+ #undef TF
5190
+
5191
+ // Test $lookup with QE.
5192
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe/" suffix)
5193
+ {
5194
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5195
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5196
+
5197
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5198
+ expect_and_reply_to_ismaster(ctx);
5199
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5200
+ {
5201
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5202
+ // Feed both needed schemas.
5203
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5204
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5205
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5206
+ }
5207
+
5208
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5209
+ {
5210
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5211
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5212
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5213
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5214
+ }
5215
+
5216
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5217
+ {
5218
+ // Expect no `encryptionInformation` since no encryption payloads.
5219
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5220
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5221
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5222
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5223
+ mongocrypt_binary_destroy(got);
5224
+ }
5225
+
5226
+ mongocrypt_ctx_destroy(ctx);
5227
+ mongocrypt_destroy(crypt);
5228
+ }
5229
+ #undef TF
5230
+
5231
+ // Test $lookup with QE with an encrypted payload.
5232
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe-with-payload/" suffix)
5233
+ {
5234
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5235
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5236
+
5237
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5238
+ expect_and_reply_to_ismaster(ctx);
5239
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5240
+ {
5241
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5242
+ // Feed both needed schemas.
5243
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5244
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5245
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5246
+ }
5247
+
5248
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5249
+ {
5250
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5251
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5252
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5253
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5254
+ }
5255
+
5256
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5257
+ {
5258
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5259
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5260
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5261
+ }
5262
+
5263
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5264
+ {
5265
+ // Expect `encryptionInformation` since command has encryption payloads.
5266
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5267
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5268
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5269
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5270
+ mongocrypt_binary_destroy(got);
5271
+ }
5272
+
5273
+ mongocrypt_ctx_destroy(ctx);
5274
+ mongocrypt_destroy(crypt);
5275
+ }
5276
+ #undef TF
5277
+
5278
+ // Test $lookup with QE from encryptedFieldsMap.
5279
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe-encryptedFieldsMap/" suffix)
5280
+ {
5281
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_SKIP_INIT);
5282
+ ASSERT_OK(mongocrypt_setopt_encrypted_field_config_map(crypt, TF("encryptedFieldsMap.json")), crypt);
5283
+ ASSERT_OK(mongocrypt_init(crypt), crypt);
5284
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5285
+
5286
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5287
+ expect_and_reply_to_ismaster(ctx);
5288
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5289
+ {
5290
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
5291
+ // Only feed collinfo for c1. c2 is included in encryptedFieldsMap.
5292
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5293
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5294
+ }
5295
+
5296
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5297
+ {
5298
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5299
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5300
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5301
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5302
+ }
5303
+
5304
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5305
+ {
5306
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5307
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5308
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5309
+ }
5310
+
5311
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5312
+ {
5313
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5314
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5315
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5316
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5317
+ mongocrypt_binary_destroy(got);
5318
+ }
5319
+
5320
+ mongocrypt_ctx_destroy(ctx);
5321
+ mongocrypt_destroy(crypt);
5322
+ }
5323
+ #undef TF
5324
+
5325
+ // Test $lookup with QE with self-lookup.
5326
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe-self/" suffix)
5327
+ {
5328
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5329
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5330
+
5331
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5332
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5333
+ {
5334
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
5335
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5336
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5337
+ }
5338
+
5339
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5340
+ {
5341
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5342
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5343
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5344
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5345
+ }
5346
+
5347
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5348
+ {
5349
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5350
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5351
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5352
+ }
5353
+
5354
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5355
+ {
5356
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5357
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5358
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5359
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5360
+ mongocrypt_binary_destroy(got);
5361
+ }
5362
+
5363
+ mongocrypt_ctx_destroy(ctx);
5364
+ mongocrypt_destroy(crypt);
5365
+ }
5366
+ #undef TF
5367
+
5368
+ // Test $lookup with QE from from cache.
5369
+ {
5370
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5371
+
5372
+ // Do a self-lookup to add only "c1" to the cache.
5373
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe-self/" suffix)
5374
+ {
5375
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5376
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5377
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5378
+ {
5379
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c1"})));
5380
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5381
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5382
+ }
5383
+ mongocrypt_ctx_destroy(ctx);
5384
+ }
5385
+ #undef TF
5386
+
5387
+ #define TF(suffix) TEST_FILE("./test/data/lookup/qe-with-payload/" suffix)
5388
+ // Expect "c1" schema is not requested again.
5389
+ {
5390
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5391
+
5392
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5393
+ expect_and_reply_to_ismaster(ctx);
5394
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5395
+ {
5396
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : "c2"})));
5397
+ // Feed remaining needed schema.
5398
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5399
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5400
+ }
5401
+
5402
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5403
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5404
+
5405
+ mongocrypt_ctx_destroy(ctx);
5406
+ }
5407
+ mongocrypt_destroy(crypt);
5408
+ }
5409
+
5410
+ #undef TF
5411
+
5412
+ // Test $lookup with mixed: QE + CSFLE
5413
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/qe/csfle/" suffix)
5414
+ {
5415
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5416
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5417
+
5418
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5419
+ expect_and_reply_to_ismaster(ctx);
5420
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5421
+ {
5422
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5423
+
5424
+ // Feed both needed schemas.
5425
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5426
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5427
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5428
+ }
5429
+
5430
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5431
+ {
5432
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5433
+ ASSERT_FAILS(mongocrypt_ctx_mongo_op(ctx, got), ctx, "currently not supported");
5434
+ mongocrypt_binary_destroy(got);
5435
+ }
5436
+
5437
+ mongocrypt_ctx_destroy(ctx);
5438
+ mongocrypt_destroy(crypt);
5439
+ }
5440
+ #undef TF
5441
+
5442
+ // Test $lookup with mixed: QE + no-schema
5443
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/qe/no-schema/" suffix)
5444
+ {
5445
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5446
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5447
+
5448
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5449
+ expect_and_reply_to_ismaster(ctx);
5450
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5451
+ {
5452
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5453
+ // Feed both needed schemas.
5454
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5455
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5456
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5457
+ }
5458
+
5459
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5460
+ {
5461
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5462
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5463
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5464
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5465
+ }
5466
+
5467
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5468
+ {
5469
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5470
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5471
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5472
+ }
5473
+
5474
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5475
+ {
5476
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5477
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5478
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5479
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5480
+ mongocrypt_binary_destroy(got);
5481
+ }
5482
+
5483
+ mongocrypt_ctx_destroy(ctx);
5484
+ mongocrypt_destroy(crypt);
5485
+ }
5486
+ #undef TF
5487
+
5488
+ // Test $lookup with mixed: QE + QE
5489
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/qe/qe/" suffix)
5490
+ {
5491
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5492
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5493
+
5494
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5495
+ expect_and_reply_to_ismaster(ctx);
5496
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5497
+ {
5498
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5499
+ // Feed both needed schemas.
5500
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5501
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5502
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5503
+ }
5504
+
5505
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5506
+ {
5507
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5508
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5509
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5510
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5511
+ }
5512
+
5513
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5514
+ {
5515
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5516
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5517
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5518
+ }
5519
+
5520
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5521
+ {
5522
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5523
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5524
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5525
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5526
+ mongocrypt_binary_destroy(got);
5527
+ }
5528
+
5529
+ mongocrypt_ctx_destroy(ctx);
5530
+ mongocrypt_destroy(crypt);
5531
+ }
5532
+ #undef TF
5533
+
5534
+ // Test $lookup with mixed: CSFLE + CSFLE.
5535
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/csfle/csfle/" suffix)
5536
+ {
5537
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5538
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5539
+
5540
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5541
+ expect_and_reply_to_ismaster(ctx);
5542
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5543
+ {
5544
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5545
+ // Feed both needed schemas.
5546
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5547
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5548
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5549
+ }
5550
+
5551
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5552
+ {
5553
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5554
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5555
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5556
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5557
+ }
5558
+
5559
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5560
+ {
5561
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5562
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5563
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5564
+ }
5565
+
5566
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5567
+ {
5568
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5569
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5570
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5571
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5572
+ mongocrypt_binary_destroy(got);
5573
+ }
5574
+
5575
+ mongocrypt_ctx_destroy(ctx);
5576
+ mongocrypt_destroy(crypt);
5577
+ }
5578
+ #undef TF
5579
+
5580
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/csfle/qe/" suffix)
5581
+ {
5582
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5583
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5584
+
5585
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5586
+ expect_and_reply_to_ismaster(ctx);
5587
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5588
+ {
5589
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5590
+ // Feed both needed schemas.
5591
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5592
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5593
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5594
+ }
5595
+
5596
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5597
+ {
5598
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5599
+ ASSERT_FAILS(mongocrypt_ctx_mongo_op(ctx, got), ctx, "This is currently not supported");
5600
+ mongocrypt_binary_destroy(got);
5601
+ }
5602
+
5603
+ mongocrypt_ctx_destroy(ctx);
5604
+ mongocrypt_destroy(crypt);
5605
+ }
5606
+ #undef TF
5607
+
5608
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/csfle/no-schema/" suffix)
5609
+ {
5610
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5611
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5612
+
5613
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5614
+ expect_and_reply_to_ismaster(ctx);
5615
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5616
+ {
5617
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5618
+ // Feed both needed schemas.
5619
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5620
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5621
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5622
+ }
5623
+
5624
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5625
+ {
5626
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5627
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5628
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5629
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5630
+ }
5631
+
5632
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5633
+ {
5634
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5635
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5636
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5637
+ }
5638
+
5639
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5640
+ {
5641
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5642
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5643
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5644
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5645
+ mongocrypt_binary_destroy(got);
5646
+ }
5647
+
5648
+ mongocrypt_ctx_destroy(ctx);
5649
+ mongocrypt_destroy(crypt);
5650
+ }
5651
+ #undef TF
5652
+
5653
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/no-schema/csfle/" suffix)
5654
+ {
5655
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5656
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5657
+
5658
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5659
+ expect_and_reply_to_ismaster(ctx);
5660
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5661
+ {
5662
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5663
+ // Feed both needed schemas.
5664
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5665
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5666
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5667
+ }
5668
+
5669
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5670
+ {
5671
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5672
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5673
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5674
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5675
+ }
5676
+
5677
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5678
+ {
5679
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5680
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5681
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5682
+ }
5683
+
5684
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5685
+ {
5686
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5687
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5688
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5689
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5690
+ mongocrypt_binary_destroy(got);
5691
+ }
5692
+ mongocrypt_ctx_destroy(ctx);
5693
+ mongocrypt_destroy(crypt);
5694
+ }
5695
+ #undef TF
5696
+
5697
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/no-schema/no-schema/" suffix)
5698
+ {
5699
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5700
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5701
+
5702
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5703
+ expect_and_reply_to_ismaster(ctx);
5704
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5705
+ {
5706
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5707
+ // Feed both needed schemas.
5708
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5709
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5710
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5711
+ }
5712
+
5713
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5714
+ {
5715
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5716
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5717
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5718
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5719
+ }
5720
+
5721
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5722
+ {
5723
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5724
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5725
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5726
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5727
+ mongocrypt_binary_destroy(got);
5728
+ }
5729
+ mongocrypt_ctx_destroy(ctx);
5730
+ mongocrypt_destroy(crypt);
5731
+ }
5732
+ #undef TF
5733
+
5734
+ #define TF(suffix) TEST_FILE("./test/data/lookup/mixed/no-schema/qe/" suffix)
5735
+ {
5736
+ mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt(TESTER_MONGOCRYPT_DEFAULT);
5737
+ mongocrypt_ctx_t *ctx = mongocrypt_ctx_new(crypt);
5738
+
5739
+ ASSERT_OK(mongocrypt_ctx_encrypt_init(ctx, "db", -1, TF("cmd.json")), ctx);
5740
+ expect_and_reply_to_ismaster(ctx);
5741
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_COLLINFO);
5742
+ {
5743
+ expect_mongo_op(ctx, TEST_BSON(BSON_STR({"name" : {"$in" : [ "c1", "c2" ]}})));
5744
+ // Feed both needed schemas.
5745
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c1.json")), ctx);
5746
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, TF("collInfo-c2.json")), ctx);
5747
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5748
+ }
5749
+
5750
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_MARKINGS);
5751
+ {
5752
+ expect_mongo_op(ctx, TF("cmd-to-mongocryptd.json"));
5753
+ mongocrypt_binary_t *to_feed = TF("reply-from-mongocryptd.json");
5754
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5755
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5756
+ }
5757
+
5758
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_MONGO_KEYS);
5759
+ {
5760
+ mongocrypt_binary_t *to_feed = TF("key-doc.json");
5761
+ ASSERT_OK(mongocrypt_ctx_mongo_feed(ctx, to_feed), ctx);
5762
+ ASSERT_OK(mongocrypt_ctx_mongo_done(ctx), ctx);
5763
+ }
5764
+
5765
+ ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY);
5766
+ {
5767
+ mongocrypt_binary_t *expect = TF("cmd-to-mongod.json");
5768
+ mongocrypt_binary_t *got = mongocrypt_binary_new();
5769
+ ASSERT_OK(mongocrypt_ctx_finalize(ctx, got), ctx);
5770
+ ASSERT_MONGOCRYPT_BINARY_EQUAL_BSON(expect, got);
5771
+ mongocrypt_binary_destroy(got);
5772
+ }
5773
+ mongocrypt_ctx_destroy(ctx);
5774
+ mongocrypt_destroy(crypt);
5775
+ }
5776
+ #undef TF
5677
5777
  }
5678
5778
 
5679
5779
  void _mongocrypt_tester_install_ctx_encrypt(_mongocrypt_tester_t *tester) {
@@ -5695,7 +5795,6 @@ void _mongocrypt_tester_install_ctx_encrypt(_mongocrypt_tester_t *tester) {
5695
5795
  INSTALL_TEST(_test_encrypt_is_remote_schema);
5696
5796
  INSTALL_TEST(_test_encrypt_init_each_cmd);
5697
5797
  INSTALL_TEST(_test_encrypt_invalid_siblings);
5698
- INSTALL_TEST(_test_encrypt_dupe_jsonschema);
5699
5798
  INSTALL_TEST(_test_encrypting_with_explicit_encryption);
5700
5799
  INSTALL_TEST(_test_explicit_encryption);
5701
5800
  INSTALL_TEST(_test_encrypt_empty_aws);
@@ -5711,8 +5810,8 @@ void _mongocrypt_tester_install_ctx_encrypt(_mongocrypt_tester_t *tester) {
5711
5810
  INSTALL_TEST(_test_encrypt_no_schema);
5712
5811
  INSTALL_TEST(_test_encrypt_remote_encryptedfields);
5713
5812
  INSTALL_TEST(_test_encrypt_with_bypassqueryanalysis);
5714
- INSTALL_TEST(_test_FLE2EncryptionPlaceholder_parse);
5715
5813
  INSTALL_TEST(_test_encrypt_fle2_insert_payload);
5814
+ INSTALL_TEST(_test_encrypt_fle2_insert_payload_with_str_encode_version);
5716
5815
  INSTALL_TEST(_test_encrypt_fle2_find_payload);
5717
5816
  INSTALL_TEST(_test_encrypt_fle2_unindexed_encrypted_payload);
5718
5817
  INSTALL_TEST(_test_encrypt_fle2_explicit);
@@ -5733,17 +5832,24 @@ void _mongocrypt_tester_install_ctx_encrypt(_mongocrypt_tester_t *tester) {
5733
5832
  INSTALL_TEST(_test_fle1_create_old_mongocryptd);
5734
5833
  INSTALL_TEST(_test_fle1_create_with_csfle);
5735
5834
  INSTALL_TEST(_test_fle2_create);
5835
+ INSTALL_TEST(_test_fle2_create_with_encrypted_fields);
5836
+ INSTALL_TEST(_test_fle2_create_with_encrypted_fields_and_str_encode_version);
5837
+ INSTALL_TEST(_test_fle2_create_with_encrypted_fields_unset_str_encode_version);
5838
+ INSTALL_TEST(_test_fle2_text_search_create_with_encrypted_fields);
5839
+ INSTALL_TEST(_test_fle2_text_search_create_with_encrypted_fields_and_str_encode_version);
5840
+ INSTALL_TEST(_test_fle2_text_search_create_with_encrypted_fields_unset_str_encode_version);
5841
+ INSTALL_TEST(_test_fle2_text_search_create_with_encrypted_fields_unmatching_str_encode_version);
5842
+ INSTALL_TEST(_test_fle2_create_does_not_cache_empty_schema);
5736
5843
  INSTALL_TEST(_test_fle2_create_bypass_query_analysis);
5737
5844
  INSTALL_TEST(_test_encrypt_macos_no_ctr);
5738
5845
  INSTALL_TEST(_test_fle1_collmod_with_jsonSchema);
5739
5846
  INSTALL_TEST(_test_fle1_collmod_without_jsonSchema);
5740
- INSTALL_TEST(_test_FLE2EncryptionPlaceholder_range_parse);
5741
5847
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_int32);
5742
5848
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_int64);
5743
5849
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_date);
5744
5850
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_double);
5745
5851
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_double_precision);
5746
- #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
5852
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT()
5747
5853
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_decimal128);
5748
5854
  INSTALL_TEST(_test_encrypt_fle2_insert_range_payload_decimal128_precision);
5749
5855
  #endif
@@ -5752,13 +5858,20 @@ void _mongocrypt_tester_install_ctx_encrypt(_mongocrypt_tester_t *tester) {
5752
5858
  INSTALL_TEST(_test_encrypt_fle2_find_range_payload_date);
5753
5859
  INSTALL_TEST(_test_encrypt_fle2_find_range_payload_double);
5754
5860
  INSTALL_TEST(_test_encrypt_fle2_find_range_payload_double_precision);
5755
- #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
5861
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT()
5756
5862
  INSTALL_TEST(_test_encrypt_fle2_find_range_payload_decimal128);
5757
5863
  INSTALL_TEST(_test_encrypt_fle2_find_range_payload_decimal128_precision);
5758
5864
  #endif
5865
+ INSTALL_TEST(_test_encrypt_fle2_insert_text_search_payload);
5866
+ INSTALL_TEST(_test_encrypt_fle2_insert_text_search_payload_with_str_encode_version);
5759
5867
  INSTALL_TEST(_test_bulkWrite);
5760
5868
  INSTALL_TEST(_test_rangePreview_fails);
5761
5869
  INSTALL_TEST(_test_no_trimFactor);
5762
5870
  INSTALL_TEST(_test_range_sends_cryptoParams);
5763
5871
  INSTALL_TEST(_test_encrypt_retry);
5872
+ INSTALL_TEST(_test_does_not_warn_for_empty_local_schema);
5873
+ INSTALL_TEST(_test_fle2_encrypted_field_config_with_bad_str_encode_version);
5874
+ INSTALL_TEST(_test_fle2_encrypted_fields_with_unmatching_str_encode_version);
5875
+ INSTALL_TEST(_test_fle2_collinfo_with_bad_str_encode_version);
5876
+ INSTALL_TEST(_test_lookup);
5764
5877
  }