libmongocrypt-helper 1.7.0.0.1001 → 1.7.4.0.1000

Sign up to get free protection for your applications and to get access to all the features.
Files changed (991) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/ext/libmongocrypt/extconf.rb +70 -0
  4. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +164 -0
  5. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +699 -0
  6. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +13 -0
  7. data/ext/libmongocrypt/libmongocrypt/LICENSE +201 -0
  8. data/ext/libmongocrypt/libmongocrypt/README.md +250 -0
  9. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +1 -0
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +16 -0
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +4 -0
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +131 -0
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/BinarySafeHandle.cs +60 -0
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CheckableSafeHandle.cs +46 -0
  15. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CipherCallbacks.cs +168 -0
  16. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/ContextSafeHandle.cs +48 -0
  17. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +238 -0
  18. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +134 -0
  19. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptContext.cs +214 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptException.cs +37 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptOptions.cs +67 -0
  22. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/HashCallback.cs +59 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/HmacShaCallbacks.cs +96 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/IStatus.cs +26 -0
  25. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/KmsCredentials.cs +53 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/KmsKeyId.cs +91 -0
  27. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/KmsRequest.cs +125 -0
  28. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/KmsRequestCollection.cs +60 -0
  29. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +652 -0
  30. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +252 -0
  31. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoadingException.cs +34 -0
  32. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/License.txt +14 -0
  33. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LogLevel.cs +26 -0
  34. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoCryptSafeHandle.cs +48 -0
  35. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +106 -0
  36. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.ruleset +85 -0
  37. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.targets +21 -0
  38. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/OperatingSystemHelper.cs +59 -0
  39. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Package.include.template.csproj +38 -0
  40. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/PinnedBinary.cs +49 -0
  41. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/SecureRandomCallback.cs +51 -0
  42. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/SigningRSAESPKCSCallback.cs +74 -0
  43. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Status.cs +94 -0
  44. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/StatusSafeHandle.cs +60 -0
  45. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/StyleCop.ruleset +11 -0
  46. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/stylecop.json +8 -0
  47. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +23 -0
  48. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/Package.include.template.csproj +11 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/Program.cs +442 -0
  50. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +748 -0
  51. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BsonUtil.cs +82 -0
  52. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/CallbackUtils.cs +37 -0
  53. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/CipherCallbacksTests.cs +46 -0
  54. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/HashCallbackTests.cs +37 -0
  55. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/HmacShaCallbacksTests.cs +37 -0
  56. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +35 -0
  57. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/Package.include.template.csproj +23 -0
  58. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/SigningRSAESPKCSCallbackTests.cs +64 -0
  59. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/collection-info.json +37 -0
  60. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/command-reply.json +13 -0
  61. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/encrypted-command-reply.json +16 -0
  62. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/encrypted-command.json +11 -0
  63. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/encrypted-value.json +6 -0
  64. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/key-document.json +36 -0
  65. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/key-filter.json +19 -0
  66. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/list-collections-filter.json +3 -0
  67. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/test/example/mongocryptd-command.json +22 -0
  68. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/xunit.runner.json +6 -0
  69. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/BasicTests.cs +54 -0
  70. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +42 -0
  71. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/Package.include.template.csproj +23 -0
  72. data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +66 -0
  73. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +219 -0
  74. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.ps1 +275 -0
  75. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +77 -0
  76. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/README.md +36 -0
  77. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +339 -0
  78. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  79. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +5 -0
  80. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +188 -0
  81. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +100 -0
  82. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/BinaryHolder.java +45 -0
  83. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +1130 -0
  84. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +96 -0
  85. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +66 -0
  86. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/DisposableMemory.java +31 -0
  87. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/JULLogger.java +130 -0
  88. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Logger.java +144 -0
  89. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Loggers.java +50 -0
  90. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MacCallback.java +60 -0
  91. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MessageDigestCallback.java +55 -0
  92. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoAwsKmsProviderOptions.java +104 -0
  93. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypt.java +100 -0
  94. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContext.java +137 -0
  95. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContextImpl.java +164 -0
  96. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptException.java +67 -0
  97. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +408 -0
  98. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptOptions.java +284 -0
  99. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypts.java +38 -0
  100. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoDataKeyOptions.java +125 -0
  101. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +225 -0
  102. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptor.java +76 -0
  103. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptorImpl.java +105 -0
  104. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoLocalKmsProviderOptions.java +83 -0
  105. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoRewrapManyDataKeyOptions.java +104 -0
  106. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SLF4JLogger.java +110 -0
  107. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SecureRandomCallback.java +51 -0
  108. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SigningRSAESPKCSCallback.java +76 -0
  109. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/package-info.java +18 -0
  110. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +345 -0
  111. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/collection-info.json +37 -0
  112. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command-reply.json +13 -0
  113. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command.json +6 -0
  114. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command-reply.json +16 -0
  115. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command.json +11 -0
  116. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-value.json +6 -0
  117. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +26 -0
  118. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
  119. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-filter.json +19 -0
  120. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/rangeopts.json +11 -0
  121. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/value-to-encrypt.json +20 -0
  122. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/json-schema.json +15 -0
  123. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-document.json +36 -0
  124. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter-keyAltName.json +14 -0
  125. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter.json +19 -0
  126. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/keys/ABCDEFAB123498761234123456789012-local-document.json +30 -0
  127. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/kms-reply.txt +6 -0
  128. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/list-collections-filter.json +3 -0
  129. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-command.json +22 -0
  130. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-reply.json +18 -0
  131. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +81 -0
  132. data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +201 -0
  133. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +773 -0
  134. data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +79 -0
  135. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +44 -0
  136. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +39 -0
  137. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +515 -0
  138. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +420 -0
  139. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +123 -0
  140. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +699 -0
  141. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +100 -0
  142. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +33 -0
  143. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +87 -0
  144. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +42 -0
  145. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +66 -0
  146. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +487 -0
  147. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +16051 -0
  148. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +81 -0
  149. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +929 -0
  150. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +114 -0
  151. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +953 -0
  152. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +91 -0
  153. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +701 -0
  154. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +163 -0
  155. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +284 -0
  156. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +5 -0
  157. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +6 -0
  158. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +37 -0
  159. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +8 -0
  160. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +11 -0
  161. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +30 -0
  162. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +32 -0
  163. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +30 -0
  164. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/kms-decrypt-reply.txt +6 -0
  165. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/kms-encrypt-reply.txt +7 -0
  166. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +18 -0
  167. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +48 -0
  168. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +59 -0
  169. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +29 -0
  170. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +331 -0
  171. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +325 -0
  172. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +121 -0
  173. data/ext/libmongocrypt/libmongocrypt/bindings/python/LICENSE +201 -0
  174. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +187 -0
  175. data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +107 -0
  176. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +16 -0
  177. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +16 -0
  178. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +61 -0
  179. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +94 -0
  180. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +1561 -0
  181. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +61 -0
  182. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +136 -0
  183. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +162 -0
  184. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +39 -0
  185. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +248 -0
  186. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +808 -0
  187. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +156 -0
  188. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +17 -0
  189. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +92 -0
  190. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +84 -0
  191. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +51 -0
  192. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +37 -0
  193. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +39 -0
  194. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command-reply.json +13 -0
  195. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +6 -0
  196. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/cmd.json +1 -0
  197. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-field-config-map.json +47 -0
  198. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +23 -0
  199. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +16 -0
  200. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command.json +13 -0
  201. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +48 -0
  202. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-value.json +6 -0
  203. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +26 -0
  204. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/rangeopts.json +11 -0
  205. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/value-to-encrypt.json +20 -0
  206. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +33 -0
  207. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +35 -0
  208. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +33 -0
  209. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +19 -0
  210. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/keys/12345678123498761234123456789012-local-document.json +30 -0
  211. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/keys/12345678123498761234123456789013-local-document.json +30 -0
  212. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/keys/ABCDEFAB123498761234123456789012-local-document.json +30 -0
  213. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/kms-encrypt-reply.txt +7 -0
  214. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/kms-reply-azure.txt +6 -0
  215. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/kms-reply-gcp.txt +6 -0
  216. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/kms-reply.txt +6 -0
  217. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +3 -0
  218. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +26 -0
  219. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +20 -0
  220. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +40 -0
  221. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +71 -0
  222. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +49 -0
  223. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +825 -0
  224. data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +12 -0
  225. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +20 -0
  226. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +209 -0
  227. data/ext/libmongocrypt/libmongocrypt/cmake/ImportDFP.cmake +70 -0
  228. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +409 -0
  229. data/ext/libmongocrypt/libmongocrypt/cmake/LTO.cmake +57 -0
  230. data/ext/libmongocrypt/libmongocrypt/cmake/MongoC-Warnings.cmake +74 -0
  231. data/ext/libmongocrypt/libmongocrypt/cmake/libmongocrypt-hidden-symbols.map +8 -0
  232. data/ext/libmongocrypt/libmongocrypt/cmake/libmongocrypt-hidden-symbols.txt +5 -0
  233. data/ext/libmongocrypt/libmongocrypt/cmake/libmongocrypt-static.pc.in +9 -0
  234. data/ext/libmongocrypt/libmongocrypt/cmake/libmongocrypt.pc.in +10 -0
  235. data/ext/libmongocrypt/libmongocrypt/cmake/ltocheck-lib.c +6 -0
  236. data/ext/libmongocrypt/libmongocrypt/cmake/ltocheck-main.c +9 -0
  237. data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +42 -0
  238. data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +79 -0
  239. data/ext/libmongocrypt/libmongocrypt/debian/changelog +105 -0
  240. data/ext/libmongocrypt/libmongocrypt/debian/compat +1 -0
  241. data/ext/libmongocrypt/libmongocrypt/debian/control +41 -0
  242. data/ext/libmongocrypt/libmongocrypt/debian/copyright +129 -0
  243. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +23 -0
  244. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +2 -0
  245. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +5 -0
  246. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +1 -0
  247. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +1 -0
  248. data/ext/libmongocrypt/libmongocrypt/debian/rules +46 -0
  249. data/ext/libmongocrypt/libmongocrypt/debian/source/format +1 -0
  250. data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +3 -0
  251. data/ext/libmongocrypt/libmongocrypt/debian/source/options +1 -0
  252. data/ext/libmongocrypt/libmongocrypt/debian/watch +3 -0
  253. data/ext/libmongocrypt/libmongocrypt/doc/Doxygen +2474 -0
  254. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +265 -0
  255. data/ext/libmongocrypt/libmongocrypt/etc/debian/control +33 -0
  256. data/ext/libmongocrypt/libmongocrypt/etc/debian/rules +41 -0
  257. data/ext/libmongocrypt/libmongocrypt/etc/debian/source/format +1 -0
  258. data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +41 -0
  259. data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +105 -0
  260. data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto_selftest.py +52 -0
  261. data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +34 -0
  262. data/ext/libmongocrypt/libmongocrypt/etc/generate-kek-tests.py +69 -0
  263. data/ext/libmongocrypt/libmongocrypt/etc/generate-test-data.py +141 -0
  264. data/ext/libmongocrypt/libmongocrypt/etc/list-compile-files.py +20 -0
  265. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-MONGOCRYPT-571.patch +25 -0
  266. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-s390x.patch +134 -0
  267. data/ext/libmongocrypt/libmongocrypt/etc/packager.py +854 -0
  268. data/ext/libmongocrypt/libmongocrypt/etc/print-marking.py +36 -0
  269. data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +257 -0
  270. data/ext/libmongocrypt/libmongocrypt/etc/requirements.txt +2 -0
  271. data/ext/libmongocrypt/libmongocrypt/etc/rewrite.py +16 -0
  272. data/ext/libmongocrypt/libmongocrypt/etc/rpm/libmongocrypt.spec +67 -0
  273. data/ext/libmongocrypt/libmongocrypt/etc/rpm/tweak.awk +19 -0
  274. data/ext/libmongocrypt/libmongocrypt/integrating.md +251 -0
  275. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +305 -0
  276. data/ext/libmongocrypt/libmongocrypt/kms-message/COPYING +177 -0
  277. data/ext/libmongocrypt/libmongocrypt/kms-message/README.md +41 -0
  278. data/ext/libmongocrypt/libmongocrypt/kms-message/THIRD_PARTY_NOTICES +42 -0
  279. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/LICENSE +202 -0
  280. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/NOTICE +2 -0
  281. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.authz +1 -0
  282. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.creq +9 -0
  283. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.req +6 -0
  284. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.sreq +7 -0
  285. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.sts +4 -0
  286. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-multiline/get-header-value-multiline.authz +1 -0
  287. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-multiline/get-header-value-multiline.creq +9 -0
  288. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-multiline/get-header-value-multiline.req +6 -0
  289. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-multiline/get-header-value-multiline.sreq +7 -0
  290. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-multiline/get-header-value-multiline.sts +4 -0
  291. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-order/get-header-value-order.authz +1 -0
  292. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-order/get-header-value-order.creq +9 -0
  293. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-order/get-header-value-order.req +7 -0
  294. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-order/get-header-value-order.sreq +8 -0
  295. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-order/get-header-value-order.sts +4 -0
  296. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-trim/get-header-value-trim.authz +1 -0
  297. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-trim/get-header-value-trim.creq +10 -0
  298. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-trim/get-header-value-trim.req +5 -0
  299. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-trim/get-header-value-trim.sreq +6 -0
  300. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-header-value-trim/get-header-value-trim.sts +4 -0
  301. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-unreserved/get-unreserved.authz +1 -0
  302. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-unreserved/get-unreserved.creq +8 -0
  303. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-unreserved/get-unreserved.req +3 -0
  304. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-unreserved/get-unreserved.sreq +4 -0
  305. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-unreserved/get-unreserved.sts +4 -0
  306. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-utf8/get-utf8.authz +1 -0
  307. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-utf8/get-utf8.creq +8 -0
  308. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-utf8/get-utf8.req +3 -0
  309. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-utf8/get-utf8.sreq +4 -0
  310. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-utf8/get-utf8.sts +4 -0
  311. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla/get-vanilla.authz +1 -0
  312. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla/get-vanilla.creq +8 -0
  313. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla/get-vanilla.req +3 -0
  314. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla/get-vanilla.sreq +4 -0
  315. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla/get-vanilla.sts +4 -0
  316. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-empty-query-key/get-vanilla-empty-query-key.authz +1 -0
  317. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-empty-query-key/get-vanilla-empty-query-key.creq +8 -0
  318. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-empty-query-key/get-vanilla-empty-query-key.req +3 -0
  319. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-empty-query-key/get-vanilla-empty-query-key.sreq +4 -0
  320. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-empty-query-key/get-vanilla-empty-query-key.sts +4 -0
  321. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query/get-vanilla-query.authz +1 -0
  322. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query/get-vanilla-query.creq +8 -0
  323. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query/get-vanilla-query.req +3 -0
  324. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query/get-vanilla-query.sreq +4 -0
  325. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query/get-vanilla-query.sts +4 -0
  326. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key/get-vanilla-query-order-key.authz +1 -0
  327. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key/get-vanilla-query-order-key.creq +8 -0
  328. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key/get-vanilla-query-order-key.req +3 -0
  329. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key/get-vanilla-query-order-key.sreq +4 -0
  330. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key/get-vanilla-query-order-key.sts +4 -0
  331. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key-case/get-vanilla-query-order-key-case.authz +1 -0
  332. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key-case/get-vanilla-query-order-key-case.creq +8 -0
  333. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key-case/get-vanilla-query-order-key-case.req +3 -0
  334. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key-case/get-vanilla-query-order-key-case.sreq +4 -0
  335. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-key-case/get-vanilla-query-order-key-case.sts +4 -0
  336. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-value/get-vanilla-query-order-value.authz +1 -0
  337. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-value/get-vanilla-query-order-value.creq +8 -0
  338. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-value/get-vanilla-query-order-value.req +3 -0
  339. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-value/get-vanilla-query-order-value.sreq +4 -0
  340. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-order-value/get-vanilla-query-order-value.sts +4 -0
  341. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-unreserved/get-vanilla-query-unreserved.authz +1 -0
  342. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-unreserved/get-vanilla-query-unreserved.creq +8 -0
  343. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-unreserved/get-vanilla-query-unreserved.req +3 -0
  344. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-unreserved/get-vanilla-query-unreserved.sreq +4 -0
  345. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-query-unreserved/get-vanilla-query-unreserved.sts +4 -0
  346. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-utf8-query/get-vanilla-utf8-query.authz +1 -0
  347. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-utf8-query/get-vanilla-utf8-query.creq +8 -0
  348. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-utf8-query/get-vanilla-utf8-query.req +3 -0
  349. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-utf8-query/get-vanilla-utf8-query.sreq +4 -0
  350. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/get-vanilla-utf8-query/get-vanilla-utf8-query.sts +4 -0
  351. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative/get-relative.authz +1 -0
  352. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative/get-relative.creq +8 -0
  353. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative/get-relative.req +3 -0
  354. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative/get-relative.sreq +4 -0
  355. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative/get-relative.sts +4 -0
  356. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative-relative/get-relative-relative.authz +1 -0
  357. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative-relative/get-relative-relative.creq +8 -0
  358. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative-relative/get-relative-relative.req +3 -0
  359. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative-relative/get-relative-relative.sreq +4 -0
  360. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-relative-relative/get-relative-relative.sts +4 -0
  361. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash/get-slash.authz +1 -0
  362. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash/get-slash.creq +8 -0
  363. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash/get-slash.req +3 -0
  364. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash/get-slash.sreq +4 -0
  365. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash/get-slash.sts +4 -0
  366. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-dot-slash/get-slash-dot-slash.authz +1 -0
  367. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-dot-slash/get-slash-dot-slash.creq +8 -0
  368. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-dot-slash/get-slash-dot-slash.req +3 -0
  369. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-dot-slash/get-slash-dot-slash.sreq +4 -0
  370. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-dot-slash/get-slash-dot-slash.sts +4 -0
  371. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-pointless-dot/get-slash-pointless-dot.authz +1 -0
  372. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-pointless-dot/get-slash-pointless-dot.creq +8 -0
  373. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-pointless-dot/get-slash-pointless-dot.req +3 -0
  374. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-pointless-dot/get-slash-pointless-dot.sreq +4 -0
  375. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slash-pointless-dot/get-slash-pointless-dot.sts +4 -0
  376. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slashes/get-slashes.authz +1 -0
  377. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slashes/get-slashes.creq +8 -0
  378. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slashes/get-slashes.req +3 -0
  379. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slashes/get-slashes.sreq +4 -0
  380. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-slashes/get-slashes.sts +4 -0
  381. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-space/get-space.authz +1 -0
  382. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-space/get-space.creq +8 -0
  383. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-space/get-space.req +3 -0
  384. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-space/get-space.sreq +4 -0
  385. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/get-space/get-space.sts +4 -0
  386. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/normalize-path/normalize-path.txt +3 -0
  387. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-case/post-header-key-case.authz +1 -0
  388. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-case/post-header-key-case.creq +8 -0
  389. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-case/post-header-key-case.req +3 -0
  390. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-case/post-header-key-case.sreq +4 -0
  391. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-case/post-header-key-case.sts +4 -0
  392. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-sort/post-header-key-sort.authz +1 -0
  393. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-sort/post-header-key-sort.creq +9 -0
  394. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-sort/post-header-key-sort.req +4 -0
  395. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-sort/post-header-key-sort.sreq +5 -0
  396. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-key-sort/post-header-key-sort.sts +4 -0
  397. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-value-case/post-header-value-case.authz +1 -0
  398. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-value-case/post-header-value-case.creq +9 -0
  399. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-value-case/post-header-value-case.req +4 -0
  400. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-value-case/post-header-value-case.sreq +5 -0
  401. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-header-value-case/post-header-value-case.sts +4 -0
  402. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-after/post-sts-header-after.authz +1 -0
  403. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-after/post-sts-header-after.creq +8 -0
  404. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-after/post-sts-header-after.req +3 -0
  405. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-after/post-sts-header-after.sreq +5 -0
  406. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-after/post-sts-header-after.sts +4 -0
  407. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-before/post-sts-header-before.authz +1 -0
  408. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-before/post-sts-header-before.creq +9 -0
  409. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-before/post-sts-header-before.req +4 -0
  410. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-before/post-sts-header-before.sreq +5 -0
  411. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/post-sts-header-before/post-sts-header-before.sts +4 -0
  412. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-sts-token/readme.txt +15 -0
  413. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla/post-vanilla.authz +1 -0
  414. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla/post-vanilla.creq +8 -0
  415. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla/post-vanilla.req +3 -0
  416. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla/post-vanilla.sreq +4 -0
  417. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla/post-vanilla.sts +4 -0
  418. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-empty-query-value/post-vanilla-empty-query-value.authz +1 -0
  419. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-empty-query-value/post-vanilla-empty-query-value.creq +8 -0
  420. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-empty-query-value/post-vanilla-empty-query-value.req +3 -0
  421. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-empty-query-value/post-vanilla-empty-query-value.sreq +4 -0
  422. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-empty-query-value/post-vanilla-empty-query-value.sts +4 -0
  423. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-query/post-vanilla-query.authz +1 -0
  424. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-query/post-vanilla-query.creq +8 -0
  425. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-query/post-vanilla-query.req +3 -0
  426. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-query/post-vanilla-query.sreq +4 -0
  427. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-vanilla-query/post-vanilla-query.sts +4 -0
  428. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded/post-x-www-form-urlencoded.authz +1 -0
  429. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded/post-x-www-form-urlencoded.creq +9 -0
  430. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded/post-x-www-form-urlencoded.req +6 -0
  431. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded/post-x-www-form-urlencoded.sreq +7 -0
  432. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded/post-x-www-form-urlencoded.sts +4 -0
  433. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded-parameters/post-x-www-form-urlencoded-parameters.authz +1 -0
  434. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded-parameters/post-x-www-form-urlencoded-parameters.creq +9 -0
  435. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded-parameters/post-x-www-form-urlencoded-parameters.req +6 -0
  436. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded-parameters/post-x-www-form-urlencoded-parameters.sreq +7 -0
  437. data/ext/libmongocrypt/libmongocrypt/kms-message/aws-sig-v4-test-suite/post-x-www-form-urlencoded-parameters/post-x-www-form-urlencoded-parameters.sts +4 -0
  438. data/ext/libmongocrypt/libmongocrypt/kms-message/cmake/kms_message-config.cmake +1 -0
  439. data/ext/libmongocrypt/libmongocrypt/kms-message/cmake/libkms_message.pc.in +9 -0
  440. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.c +67 -0
  441. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.h +24 -0
  442. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_azure_request.c +219 -0
  443. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_b64.c +654 -0
  444. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_caller_identity_request.c +52 -0
  445. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto.h +70 -0
  446. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_apple.c +159 -0
  447. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c +142 -0
  448. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_none.c +65 -0
  449. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_windows.c +268 -0
  450. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_decrypt_request.c +72 -0
  451. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_encrypt_request.c +73 -0
  452. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_endian_private.h +165 -0
  453. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +286 -0
  454. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_item_type_private.h +59 -0
  455. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +502 -0
  456. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +150 -0
  457. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +256 -0
  458. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +323 -0
  459. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response_parser.c +148 -0
  460. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response_parser_private.h +55 -0
  461. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_result_reason_private.h +77 -0
  462. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_result_status_private.h +54 -0
  463. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +343 -0
  464. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kv_list.c +149 -0
  465. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kv_list.h +56 -0
  466. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_azure_request.h +110 -0
  467. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_b64.h +70 -0
  468. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h +36 -0
  469. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h +37 -0
  470. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h +39 -0
  471. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_gcp_request.h +124 -0
  472. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +58 -0
  473. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +40 -0
  474. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response_parser.h +26 -0
  475. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_message.h +34 -0
  476. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h +72 -0
  477. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_request.h +103 -0
  478. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h +80 -0
  479. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_response.h +43 -0
  480. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h +64 -0
  481. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message.c +47 -0
  482. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +142 -0
  483. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +33 -0
  484. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.h +34 -0
  485. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +925 -0
  486. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt.c +88 -0
  487. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt_private.h +32 -0
  488. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +520 -0
  489. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.h +89 -0
  490. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response.c +54 -0
  491. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response_parser.c +408 -0
  492. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.c +74 -0
  493. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.h +21 -0
  494. data/ext/libmongocrypt/libmongocrypt/kms-message/test/connection_close/connection_close.sreq +5 -0
  495. data/ext/libmongocrypt/libmongocrypt/kms-message/test/content_length/content_length.sreq +7 -0
  496. data/ext/libmongocrypt/libmongocrypt/kms-message/test/decrypt/decrypt.creq +11 -0
  497. data/ext/libmongocrypt/libmongocrypt/kms-message/test/decrypt/decrypt.sreq +9 -0
  498. data/ext/libmongocrypt/libmongocrypt/kms-message/test/encrypt/encrypt.creq +11 -0
  499. data/ext/libmongocrypt/libmongocrypt/kms-message/test/encrypt/encrypt.sreq +9 -0
  500. data/ext/libmongocrypt/libmongocrypt/kms-message/test/example-chunked-response.bin +20 -0
  501. data/ext/libmongocrypt/libmongocrypt/kms-message/test/example-multi-chunked-response.bin +22 -0
  502. data/ext/libmongocrypt/libmongocrypt/kms-message/test/example-response.bin +6 -0
  503. data/ext/libmongocrypt/libmongocrypt/kms-message/test/host/host.sreq +4 -0
  504. data/ext/libmongocrypt/libmongocrypt/kms-message/test/multibyte/multibyte.creq +10 -0
  505. data/ext/libmongocrypt/libmongocrypt/kms-message/test/multibyte/multibyte.sreq +8 -0
  506. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +485 -0
  507. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +147 -0
  508. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +260 -0
  509. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +250 -0
  510. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_request.c +223 -0
  511. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response.c +214 -0
  512. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response_parser.c +197 -0
  513. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.c +120 -0
  514. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.h +35 -0
  515. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +1302 -0
  516. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_util.c +92 -0
  517. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_util.h +45 -0
  518. data/ext/libmongocrypt/libmongocrypt/kms-message/test/windows/dirent.h +1224 -0
  519. data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +640 -0
  520. data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +326 -0
  521. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +341 -0
  522. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +97 -0
  523. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +237 -0
  524. data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +54 -0
  525. data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +102 -0
  526. data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +36 -0
  527. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +743 -0
  528. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +86 -0
  529. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +48 -0
  530. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +127 -0
  531. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +40 -0
  532. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +152 -0
  533. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +487 -0
  534. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +47 -0
  535. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +156 -0
  536. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +95 -0
  537. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +158 -0
  538. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +124 -0
  539. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +316 -0
  540. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +179 -0
  541. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +385 -0
  542. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +93 -0
  543. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +269 -0
  544. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +29 -0
  545. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +91 -0
  546. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +658 -0
  547. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +124 -0
  548. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +161 -0
  549. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +242 -0
  550. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +128 -0
  551. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +620 -0
  552. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +308 -0
  553. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +112 -0
  554. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +341 -0
  555. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +99 -0
  556. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +382 -0
  557. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +130 -0
  558. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +235 -0
  559. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +118 -0
  560. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +151 -0
  561. data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +89 -0
  562. data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +42 -0
  563. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +59 -0
  564. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +685 -0
  565. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.c +3 -0
  566. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +407 -0
  567. data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +53 -0
  568. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +381 -0
  569. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +93 -0
  570. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +1028 -0
  571. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +137 -0
  572. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +88 -0
  573. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +4 -0
  574. data/ext/libmongocrypt/libmongocrypt/src/mlib/windows-lean.h +19 -0
  575. data/ext/libmongocrypt/libmongocrypt/src/mongo_crypt-v1.h +320 -0
  576. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +34 -0
  577. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +87 -0
  578. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +236 -0
  579. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +691 -0
  580. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +24 -0
  581. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +82 -0
  582. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +55 -0
  583. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +190 -0
  584. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +46 -0
  585. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +126 -0
  586. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +96 -0
  587. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +341 -0
  588. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +64 -0
  589. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +212 -0
  590. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +44 -0
  591. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-config.h.in +87 -0
  592. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +303 -0
  593. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1850 -0
  594. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +534 -0
  595. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +773 -0
  596. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +3005 -0
  597. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +269 -0
  598. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +415 -0
  599. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +1283 -0
  600. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +97 -0
  601. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +168 -0
  602. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +64 -0
  603. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +212 -0
  604. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +109 -0
  605. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +325 -0
  606. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +209 -0
  607. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +1189 -0
  608. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +87 -0
  609. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +473 -0
  610. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +154 -0
  611. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1785 -0
  612. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +111 -0
  613. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +123 -0
  614. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +74 -0
  615. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1624 -0
  616. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +46 -0
  617. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +231 -0
  618. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +493 -0
  619. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +197 -0
  620. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +39 -0
  621. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +169 -0
  622. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +59 -0
  623. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +234 -0
  624. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +84 -0
  625. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +203 -0
  626. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +1605 -0
  627. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +1610 -0
  628. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +132 -0
  629. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +57 -0
  630. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +92 -0
  631. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +45 -0
  632. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +155 -0
  633. data/ext/libmongocrypt/libmongocrypt/test/data/NIST-CAVP.cstructs +1350 -0
  634. data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +359 -0
  635. data/ext/libmongocrypt/libmongocrypt/test/data/cache-tests.json +197 -0
  636. data/ext/libmongocrypt/libmongocrypt/test/data/collection-info-no-schema.json +19 -0
  637. data/ext/libmongocrypt/libmongocrypt/test/data/collection-info-no-validator.json +13 -0
  638. data/ext/libmongocrypt/libmongocrypt/test/data/collection-info-view.json +11 -0
  639. data/ext/libmongocrypt/libmongocrypt/test/data/collinfo-siblings.json +40 -0
  640. data/ext/libmongocrypt/libmongocrypt/test/data/compact/missing-key-id/collinfo.json +21 -0
  641. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-fields/collinfo.json +10 -0
  642. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-fields/encrypted-payload.json +4 -0
  643. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/cmd.json +1 -0
  644. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +49 -0
  645. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +47 -0
  646. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +23 -0
  647. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +72 -0
  648. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd-to-mongocryptd.json +34 -0
  649. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd.json +6 -0
  650. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/collinfo.json +27 -0
  651. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/encrypted-payload.json +39 -0
  652. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/mongocryptd-reply.json +45 -0
  653. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/cmd-to-mongocryptd.json +34 -0
  654. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/cmd.json +7 -0
  655. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/collinfo.json +27 -0
  656. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/encrypted-payload.json +40 -0
  657. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/mongocryptd-reply.json +45 -0
  658. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/cmd-to-mongocryptd.json +17 -0
  659. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/cmd.json +7 -0
  660. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/collinfo.json +10 -0
  661. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/encrypted-payload.json +7 -0
  662. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/mongocryptd-reply.json +23 -0
  663. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/cmd-to-mongocryptd.json +26 -0
  664. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/cmd.json +7 -0
  665. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/collinfo.json +25 -0
  666. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/encrypted-payload.json +14 -0
  667. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/mongocryptd-reply.json +15 -0
  668. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-extraField.json +24 -0
  669. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-missingKeyId.json +17 -0
  670. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField.json +23 -0
  671. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-twoFields.json +39 -0
  672. data/ext/libmongocrypt/libmongocrypt/test/data/encrypted-cmd.json +11 -0
  673. data/ext/libmongocrypt/libmongocrypt/test/data/encrypted-field-config-map.json +48 -0
  674. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decryption-input.json +8 -0
  675. data/ext/libmongocrypt/libmongocrypt/test/data/find-with-encryptionInformation.json +16 -0
  676. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/cmd-to-mongocryptd.json +12 -0
  677. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/cmd.json +8 -0
  678. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/cmd.json +8 -0
  679. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/collinfo.json +9 -0
  680. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/mongocryptd-reply.json +14 -0
  681. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/old-mongocryptd/cmd.json +3 -0
  682. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/old-mongocryptd/encrypted-payload.json +3 -0
  683. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/old-mongocryptd/ismaster-to-mongocryptd.json +3 -0
  684. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/old-mongocryptd/mongocryptd-ismaster.json +12 -0
  685. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/cmd-to-mongocryptd.json +20 -0
  686. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/cmd.json +12 -0
  687. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/encrypted-payload.json +12 -0
  688. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/ismaster-to-mongocryptd.json +3 -0
  689. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/mongocryptd-ismaster.json +12 -0
  690. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-cmd-schema/mongocryptd-reply.json +9 -0
  691. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/cmd-to-mongocryptd.json +7 -0
  692. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/cmd.json +3 -0
  693. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/encrypted-payload.json +3 -0
  694. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/ismaster-to-mongocryptd.json +3 -0
  695. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/mongocryptd-ismaster.json +12 -0
  696. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/mongocryptd-reply.json +9 -0
  697. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/with-schema/schema-map.json +5 -0
  698. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/cmd-to-mongocryptd.json +5 -0
  699. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/cmd.json +3 -0
  700. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/encrypted-payload.json +3 -0
  701. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/ismaster-to-mongocryptd.json +3 -0
  702. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/mongocryptd-ismaster.json +12 -0
  703. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-create/without-schema/mongocryptd-reply.json +9 -0
  704. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-csfle/cmd.json +8 -0
  705. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-csfle/collinfo.json +7 -0
  706. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-csfle/encrypted-payload.json +8 -0
  707. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/cmd-to-mongocryptd.json +10 -0
  708. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/cmd.json +8 -0
  709. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/collinfo.json +7 -0
  710. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/encrypted-payload.json +8 -0
  711. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/mongocryptd-reply.json +14 -0
  712. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +109 -0
  713. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/cmd-to-mongocryptd.json +14 -0
  714. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/cmd.json +3 -0
  715. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/encrypted-field-config-map.json +8 -0
  716. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/encrypted-payload.json +3 -0
  717. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/ismaster-to-mongocryptd.json +3 -0
  718. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/mongocryptd-ismaster.json +12 -0
  719. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/mongocryptd-reply.json +9 -0
  720. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-decrypt-ieev/first-filter.json +21 -0
  721. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-decrypt-ieev/second-filter.json +21 -0
  722. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/cmd.json +6 -0
  723. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/collinfo.json +49 -0
  724. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-field-config-map.json +47 -0
  725. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload.json +91 -0
  726. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/mongocryptd-reply.json +66 -0
  727. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/cmd.json +6 -0
  728. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/collinfo.json +49 -0
  729. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-field-config-map.json +47 -0
  730. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload.json +98 -0
  731. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/mongocryptd-reply.json +72 -0
  732. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/cmd.json +8 -0
  733. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +27 -0
  734. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +46 -0
  735. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/cmd-to-mongocryptd.json +36 -0
  736. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/cmd.json +8 -0
  737. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/collinfo.json +27 -0
  738. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/encrypted-payload.json +41 -0
  739. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/mongocryptd-reply.json +47 -0
  740. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1.json +8 -0
  741. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed.json +8 -0
  742. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1.json +8 -0
  743. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key.json +8 -0
  744. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed.json +8 -0
  745. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/cmd.json +6 -0
  746. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/encrypted-field-map.json +23 -0
  747. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/encrypted-payload.json +41 -0
  748. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/mongocryptd-reply.json +19 -0
  749. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongocryptd.json +24 -0
  750. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongod.json +24 -0
  751. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd.json +11 -0
  752. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/reply-from-mongocryptd.json +27 -0
  753. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/README.md +2 -0
  754. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/cmd.json +10 -0
  755. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/encrypted-field-map.json +28 -0
  756. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/encrypted-payload.json +42 -0
  757. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/mongocryptd-reply.json +50 -0
  758. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/cmd.json +6 -0
  759. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-field-map.json +28 -0
  760. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-payload.json +42 -0
  761. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/mongocryptd-reply.json +50 -0
  762. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/cmd.json +6 -0
  763. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-field-map.json +31 -0
  764. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-payload.json +51 -0
  765. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/mongocryptd-reply.json +59 -0
  766. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/cmd.json +8 -0
  767. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/encrypted-field-map.json +28 -0
  768. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/encrypted-payload.json +42 -0
  769. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/mongocryptd-reply.json +50 -0
  770. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/cmd.json +8 -0
  771. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/encrypted-field-map.json +31 -0
  772. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/encrypted-payload.json +45 -0
  773. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/mongocryptd-reply.json +53 -0
  774. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/cmd.json +8 -0
  775. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/encrypted-field-map.json +28 -0
  776. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/encrypted-payload.json +42 -0
  777. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/mongocryptd-reply.json +50 -0
  778. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/cmd.json +8 -0
  779. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-field-map.json +28 -0
  780. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-payload.json +42 -0
  781. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/mongocryptd-reply.json +50 -0
  782. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload.json +26 -0
  783. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/rangeopts.json +5 -0
  784. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/value-to-encrypt.json +20 -0
  785. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload.json +26 -0
  786. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/rangeopts.json +14 -0
  787. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/value-to-encrypt.json +20 -0
  788. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +26 -0
  789. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/rangeopts.json +11 -0
  790. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/value-to-encrypt.json +20 -0
  791. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +26 -0
  792. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +5 -0
  793. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/value-to-encrypt.json +20 -0
  794. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload.json +16 -0
  795. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/rangeopts.json +11 -0
  796. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/value-to-encrypt.json +13 -0
  797. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +9 -0
  798. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/encrypted-field-map.json +23 -0
  799. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/encrypted-payload.json +40 -0
  800. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/mongocryptd-reply.json +50 -0
  801. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/README.md +2 -0
  802. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +67 -0
  803. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/cmd.json +13 -0
  804. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-field-map.json +28 -0
  805. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-payload.json +45 -0
  806. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/mongocryptd-reply.json +53 -0
  807. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +134 -0
  808. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/cmd.json +9 -0
  809. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-field-map.json +28 -0
  810. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-payload.json +45 -0
  811. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/mongocryptd-reply.json +53 -0
  812. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +73 -0
  813. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/cmd.json +9 -0
  814. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-field-map.json +31 -0
  815. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-payload.json +54 -0
  816. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/mongocryptd-reply.json +62 -0
  817. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +70 -0
  818. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/cmd.json +11 -0
  819. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-field-map.json +28 -0
  820. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-payload.json +45 -0
  821. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/mongocryptd-reply.json +53 -0
  822. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +21 -0
  823. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/cmd.json +11 -0
  824. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-field-map.json +31 -0
  825. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-payload.json +48 -0
  826. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/mongocryptd-reply.json +56 -0
  827. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +27 -0
  828. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/cmd.json +11 -0
  829. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-field-map.json +28 -0
  830. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-payload.json +45 -0
  831. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/mongocryptd-reply.json +53 -0
  832. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +67 -0
  833. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/cmd.json +11 -0
  834. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-field-map.json +28 -0
  835. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-payload.json +45 -0
  836. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/mongocryptd-reply.json +53 -0
  837. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +70 -0
  838. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload.json +8 -0
  839. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/rangeopts.json +5 -0
  840. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/value-to-encrypt.json +5 -0
  841. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +21 -0
  842. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload.json +8 -0
  843. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/rangeopts.json +14 -0
  844. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/value-to-encrypt.json +5 -0
  845. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +27 -0
  846. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload.json +8 -0
  847. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/rangeopts.json +11 -0
  848. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/value-to-encrypt.json +5 -0
  849. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +70 -0
  850. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +8 -0
  851. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +5 -0
  852. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +5 -0
  853. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +17 -0
  854. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload.json +8 -0
  855. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/rangeopts.json +11 -0
  856. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/value-to-encrypt.json +5 -0
  857. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/cmd.json +9 -0
  858. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/encrypted-field-map.json +23 -0
  859. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/encrypted-payload.json +14 -0
  860. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/mongocryptd-reply.json +46 -0
  861. data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +33 -0
  862. data/ext/libmongocrypt/libmongocrypt/test/data/gcp-auth/decrypt-response.txt +5 -0
  863. data/ext/libmongocrypt/libmongocrypt/test/data/gcp-auth/encrypt-response.txt +5 -0
  864. data/ext/libmongocrypt/libmongocrypt/test/data/gcp-auth/oauth-response.txt +5 -0
  865. data/ext/libmongocrypt/libmongocrypt/test/data/kek-tests.json +169 -0
  866. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-azure.json +33 -0
  867. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-full.json +36 -0
  868. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-gcp.json +35 -0
  869. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-kmip.json +34 -0
  870. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-local.json +18 -0
  871. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-no-region.json +31 -0
  872. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-with-alt-name-duplicate-id.json +36 -0
  873. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-with-alt-name.json +33 -0
  874. data/ext/libmongocrypt/libmongocrypt/test/data/key-document-with-alt-name2.json +33 -0
  875. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789012-aws-decrypt-reply.txt +11 -0
  876. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789012-aws-document.json +32 -0
  877. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789012-key-material.txt +1 -0
  878. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789012-local-document.json +30 -0
  879. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789013-aws-decrypt-reply.txt +11 -0
  880. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789013-aws-document.json +32 -0
  881. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789013-key-material.txt +1 -0
  882. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789013-local-document.json +30 -0
  883. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789014-key-material.txt +1 -0
  884. data/ext/libmongocrypt/libmongocrypt/test/data/keys/12345678123498761234123456789014-local-document.json +30 -0
  885. data/ext/libmongocrypt/libmongocrypt/test/data/keys/ABCDEFAB123498761234123456789012-aws-decrypt-reply.txt +11 -0
  886. data/ext/libmongocrypt/libmongocrypt/test/data/keys/ABCDEFAB123498761234123456789012-aws-document.json +32 -0
  887. data/ext/libmongocrypt/libmongocrypt/test/data/keys/ABCDEFAB123498761234123456789012-key-material.txt +1 -0
  888. data/ext/libmongocrypt/libmongocrypt/test/data/keys/ABCDEFAB123498761234123456789012-local-document.json +30 -0
  889. data/ext/libmongocrypt/libmongocrypt/test/data/keys/README.md +21 -0
  890. data/ext/libmongocrypt/libmongocrypt/test/data/kms-encrypt-reply.txt +7 -0
  891. data/ext/libmongocrypt/libmongocrypt/test/data/kms-tests.json +297 -0
  892. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-cmd.json +26 -0
  893. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-existing-ciphertext.json +24 -0
  894. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-invalid.json +18 -0
  895. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-key-alt-name.json +18 -0
  896. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-key-alt-name2.json +18 -0
  897. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-no-encryption-needed.json +7 -0
  898. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-no-markings.json +7 -0
  899. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-reply-random.json +18 -0
  900. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +14527 -0
  901. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +7959 -0
  902. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +6906 -0
  903. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +9429 -0
  904. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +4565 -0
  905. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +312 -0
  906. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +3277 -0
  907. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +369 -0
  908. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +4612 -0
  909. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +3398 -0
  910. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/key-document-a.json +35 -0
  911. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/key-document-b.json +37 -0
  912. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/key-document-local.json +30 -0
  913. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/kms-decrypt-reply-a.txt +6 -0
  914. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/kms-decrypt-reply-b.txt +6 -0
  915. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/kms-encrypt-reply-a.txt +7 -0
  916. data/ext/libmongocrypt/libmongocrypt/test/data/rmd/kms-encrypt-reply-b.txt +7 -0
  917. data/ext/libmongocrypt/libmongocrypt/test/data/schema-map.json +40 -0
  918. data/ext/libmongocrypt/libmongocrypt/test/data/schema.json +19 -0
  919. data/ext/libmongocrypt/libmongocrypt/test/example/README.md +5 -0
  920. data/ext/libmongocrypt/libmongocrypt/test/example/cmd.json +6 -0
  921. data/ext/libmongocrypt/libmongocrypt/test/example/collection-info.json +39 -0
  922. data/ext/libmongocrypt/libmongocrypt/test/example/encrypted-command.json +9 -0
  923. data/ext/libmongocrypt/libmongocrypt/test/example/key-document-custom-endpoint.json +34 -0
  924. data/ext/libmongocrypt/libmongocrypt/test/example/key-document.json +33 -0
  925. data/ext/libmongocrypt/libmongocrypt/test/example/kms-decrypt-reply.txt +6 -0
  926. data/ext/libmongocrypt/libmongocrypt/test/example/mongocryptd-reply.json +18 -0
  927. data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +23 -0
  928. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +368 -0
  929. data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +42 -0
  930. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +22 -0
  931. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +312 -0
  932. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +104 -0
  933. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +443 -0
  934. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +184 -0
  935. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +200 -0
  936. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +518 -0
  937. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +468 -0
  938. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +886 -0
  939. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +609 -0
  940. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +174 -0
  941. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +251 -0
  942. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +245 -0
  943. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +1079 -0
  944. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +26 -0
  945. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +218 -0
  946. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +266 -0
  947. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +57 -0
  948. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +264 -0
  949. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +259 -0
  950. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +478 -0
  951. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +917 -0
  952. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +177 -0
  953. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +110 -0
  954. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +892 -0
  955. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +208 -0
  956. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +1134 -0
  957. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +5096 -0
  958. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +1061 -0
  959. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +1301 -0
  960. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +489 -0
  961. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +48 -0
  962. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +138 -0
  963. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +104 -0
  964. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +1174 -0
  965. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +475 -0
  966. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +282 -0
  967. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +561 -0
  968. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +206 -0
  969. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +89 -0
  970. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +137 -0
  971. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +738 -0
  972. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +88 -0
  973. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +548 -0
  974. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +105 -0
  975. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +42 -0
  976. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +1060 -0
  977. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +290 -0
  978. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +102 -0
  979. data/ext/libmongocrypt/libmongocrypt/test/util/README.md +103 -0
  980. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +612 -0
  981. data/ext/libmongocrypt/libmongocrypt/test/util/helpgen.py +7 -0
  982. data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +845 -0
  983. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +969 -0
  984. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +96 -0
  985. data/ext/libmongocrypt/libmongocrypt/third-party/IntelRDFPMathLib20U2.tar.xz +0 -0
  986. data/lib/libmongocrypt_helper/version.rb +2 -2
  987. data/lib/libmongocrypt_helper.rb +13 -1
  988. data.tar.gz.sig +0 -0
  989. metadata +988 -6
  990. metadata.gz.sig +0 -0
  991. data/so/libmongocrypt.so +0 -0
@@ -0,0 +1,1624 @@
1
+ /*
2
+ * Copyright 2019-present MongoDB, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #include "mc-fle-blob-subtype-private.h"
18
+ #include "mc-fle2-encryption-placeholder-private.h"
19
+ #include "mc-fle2-find-equality-payload-private.h"
20
+ #include "mc-fle2-find-range-payload-private.h"
21
+ #include "mc-fle2-insert-update-payload-private.h"
22
+ #include "mc-fle2-payload-uev-private.h"
23
+ #include "mc-range-mincover-private.h"
24
+ #include "mc-range-encoding-private.h"
25
+ #include "mc-range-edge-generation-private.h"
26
+ #include "mc-tokens-private.h"
27
+ #include "mongocrypt.h"
28
+ #include "mongocrypt-buffer-private.h"
29
+ #include "mongocrypt-ciphertext-private.h"
30
+ #include "mongocrypt-crypto-private.h"
31
+ #include "mongocrypt-key-broker-private.h"
32
+ #include "mongocrypt-marking-private.h"
33
+ #include "mongocrypt-util-private.h" // mc_bson_type_to_string
34
+
35
+ #include <math.h> // isinf
36
+
37
+ static bool
38
+ _mongocrypt_marking_parse_fle1_placeholder (const bson_t *in,
39
+ _mongocrypt_marking_t *out,
40
+ mongocrypt_status_t *status)
41
+ {
42
+ bson_iter_t iter;
43
+ bool has_ki = false, has_ka = false, has_a = false, has_v = false;
44
+
45
+ BSON_ASSERT_PARAM (in);
46
+ BSON_ASSERT_PARAM (out);
47
+
48
+ out->type = MONGOCRYPT_MARKING_FLE1_BY_ID;
49
+
50
+ if (!bson_iter_init (&iter, in)) {
51
+ CLIENT_ERR ("invalid BSON");
52
+ return false;
53
+ }
54
+
55
+ while (bson_iter_next (&iter)) {
56
+ const char *field;
57
+
58
+ field = bson_iter_key (&iter);
59
+ BSON_ASSERT (field);
60
+ if (0 == strcmp ("ki", field)) {
61
+ has_ki = true;
62
+ if (!_mongocrypt_buffer_from_uuid_iter (&out->key_id, &iter)) {
63
+ CLIENT_ERR ("key id must be a UUID");
64
+ return false;
65
+ }
66
+ continue;
67
+ }
68
+
69
+ if (0 == strcmp ("ka", field)) {
70
+ has_ka = true;
71
+ /* Some bson_value types are not allowed to be key alt names */
72
+ const bson_value_t *value;
73
+
74
+ value = bson_iter_value (&iter);
75
+
76
+ if (!BSON_ITER_HOLDS_UTF8 (&iter)) {
77
+ CLIENT_ERR ("key alt name must be a UTF8");
78
+ return false;
79
+ }
80
+ /* CDRIVER-3100 We must make a copy of this value; the result of
81
+ * bson_iter_value is ephemeral. */
82
+ bson_value_copy (value, &out->key_alt_name);
83
+ out->type = MONGOCRYPT_MARKING_FLE1_BY_ALTNAME;
84
+ continue;
85
+ }
86
+
87
+ if (0 == strcmp ("v", field)) {
88
+ has_v = true;
89
+ memcpy (&out->v_iter, &iter, sizeof (bson_iter_t));
90
+ continue;
91
+ }
92
+
93
+
94
+ if (0 == strcmp ("a", field)) {
95
+ int32_t algorithm;
96
+
97
+ has_a = true;
98
+ if (!BSON_ITER_HOLDS_INT32 (&iter)) {
99
+ CLIENT_ERR ("invalid marking, 'a' must be an int32");
100
+ return false;
101
+ }
102
+ algorithm = bson_iter_int32 (&iter);
103
+ if (algorithm != MONGOCRYPT_ENCRYPTION_ALGORITHM_DETERMINISTIC &&
104
+ algorithm != MONGOCRYPT_ENCRYPTION_ALGORITHM_RANDOM) {
105
+ CLIENT_ERR ("invalid algorithm value: %d", algorithm);
106
+ return false;
107
+ }
108
+ out->algorithm = (mongocrypt_encryption_algorithm_t) algorithm;
109
+ continue;
110
+ }
111
+
112
+ CLIENT_ERR ("unrecognized field '%s'", field);
113
+ return false;
114
+ }
115
+
116
+ if (!has_v) {
117
+ CLIENT_ERR ("no 'v' specified");
118
+ return false;
119
+ }
120
+
121
+ if (!has_ki && !has_ka) {
122
+ CLIENT_ERR ("neither 'ki' nor 'ka' specified");
123
+ return false;
124
+ }
125
+
126
+ if (has_ki && has_ka) {
127
+ CLIENT_ERR ("both 'ki' and 'ka' specified");
128
+ return false;
129
+ }
130
+
131
+ if (!has_a) {
132
+ CLIENT_ERR ("no 'a' specified");
133
+ return false;
134
+ }
135
+
136
+ return true;
137
+ }
138
+
139
+ static bool
140
+ _mongocrypt_marking_parse_fle2_placeholder (const bson_t *in,
141
+ _mongocrypt_marking_t *out,
142
+ mongocrypt_status_t *status)
143
+ {
144
+ BSON_ASSERT_PARAM (in);
145
+ BSON_ASSERT_PARAM (out);
146
+
147
+ out->type = MONGOCRYPT_MARKING_FLE2_ENCRYPTION;
148
+ return mc_FLE2EncryptionPlaceholder_parse (&out->fle2, in, status);
149
+ }
150
+
151
+ bool
152
+ _mongocrypt_marking_parse_unowned (const _mongocrypt_buffer_t *in,
153
+ _mongocrypt_marking_t *out,
154
+ mongocrypt_status_t *status)
155
+ {
156
+ bson_t bson;
157
+
158
+ BSON_ASSERT_PARAM (in);
159
+ BSON_ASSERT_PARAM (out);
160
+
161
+ _mongocrypt_marking_init (out);
162
+ /* 5 for minimal BSON object, plus one for blob subtype */
163
+ if (in->len < 6) {
164
+ CLIENT_ERR ("invalid marking, length < 6");
165
+ return false;
166
+ }
167
+
168
+ if (!bson_init_static (&bson, in->data + 1, in->len - 1) ||
169
+ !bson_validate (&bson, BSON_VALIDATE_NONE, NULL)) {
170
+ CLIENT_ERR ("invalid BSON");
171
+ return false;
172
+ }
173
+
174
+ if (in->data[0] == MC_SUBTYPE_FLE1EncryptionPlaceholder) {
175
+ return _mongocrypt_marking_parse_fle1_placeholder (&bson, out, status);
176
+ } else if (in->data[0] == MC_SUBTYPE_FLE2EncryptionPlaceholder) {
177
+ return _mongocrypt_marking_parse_fle2_placeholder (&bson, out, status);
178
+ } else {
179
+ CLIENT_ERR ("invalid marking, first byte must be 0 or 3");
180
+ return false;
181
+ }
182
+ }
183
+
184
+
185
+ void
186
+ _mongocrypt_marking_init (_mongocrypt_marking_t *marking)
187
+ {
188
+ BSON_ASSERT_PARAM (marking);
189
+
190
+ memset (marking, 0, sizeof (*marking));
191
+ }
192
+
193
+
194
+ void
195
+ _mongocrypt_marking_cleanup (_mongocrypt_marking_t *marking)
196
+ {
197
+ if (!marking) {
198
+ return;
199
+ }
200
+ if (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION) {
201
+ mc_FLE2EncryptionPlaceholder_cleanup (&marking->fle2);
202
+ return;
203
+ }
204
+
205
+ // else FLE1
206
+ _mongocrypt_buffer_cleanup (&marking->key_id);
207
+ bson_value_destroy (&marking->key_alt_name);
208
+ }
209
+
210
+
211
+ /**
212
+ * Calculates:
213
+ * E?CToken = HMAC(collectionLevel1Token, n)
214
+ * E?CDerivedFromDataToken = HMAC(E?CToken, value)
215
+ * E?CDerivedFromDataTokenAndCounter = HMAC(E?CDerivedFromDataToken, c)
216
+ *
217
+ * E?C = EDC|ESC|ECC
218
+ * n = 1 for EDC, 2 for ESC, 3 for ECC
219
+ * c = maxContentionCounter
220
+ *
221
+ * E?CDerivedFromDataTokenAndCounter is saved to out,
222
+ * which is initialized even on failure.
223
+ */
224
+ #define DERIVE_TOKEN_IMPL(Name) \
225
+ static bool _fle2_derive_##Name##_token ( \
226
+ _mongocrypt_crypto_t *crypto, \
227
+ _mongocrypt_buffer_t *out, \
228
+ const mc_CollectionsLevel1Token_t *level1Token, \
229
+ const _mongocrypt_buffer_t *value, \
230
+ bool useCounter, \
231
+ int64_t counter, \
232
+ mongocrypt_status_t *status) \
233
+ { \
234
+ BSON_ASSERT_PARAM (crypto); \
235
+ BSON_ASSERT_PARAM (out); \
236
+ BSON_ASSERT_PARAM (level1Token); \
237
+ BSON_ASSERT_PARAM (value); \
238
+ \
239
+ _mongocrypt_buffer_init (out); \
240
+ \
241
+ mc_##Name##Token_t *token = \
242
+ mc_##Name##Token_new (crypto, level1Token, status); \
243
+ if (!token) { \
244
+ return false; \
245
+ } \
246
+ \
247
+ mc_##Name##DerivedFromDataToken_t *fromDataToken = \
248
+ mc_##Name##DerivedFromDataToken_new (crypto, token, value, status); \
249
+ mc_##Name##Token_destroy (token); \
250
+ if (!fromDataToken) { \
251
+ return false; \
252
+ } \
253
+ \
254
+ if (!useCounter) { \
255
+ /* FindEqualityPayload uses *fromDataToken */ \
256
+ _mongocrypt_buffer_copy_to ( \
257
+ mc_##Name##DerivedFromDataToken_get (fromDataToken), out); \
258
+ mc_##Name##DerivedFromDataToken_destroy (fromDataToken); \
259
+ return true; \
260
+ } \
261
+ \
262
+ BSON_ASSERT (counter >= 0); \
263
+ /* InsertUpdatePayload continues through *fromDataTokenAndCounter */ \
264
+ mc_##Name##DerivedFromDataTokenAndCounter_t *fromTokenAndCounter = \
265
+ mc_##Name##DerivedFromDataTokenAndCounter_new ( \
266
+ crypto, fromDataToken, (uint64_t) counter, status); \
267
+ mc_##Name##DerivedFromDataToken_destroy (fromDataToken); \
268
+ if (!fromTokenAndCounter) { \
269
+ return false; \
270
+ } \
271
+ \
272
+ _mongocrypt_buffer_copy_to ( \
273
+ mc_##Name##DerivedFromDataTokenAndCounter_get (fromTokenAndCounter), \
274
+ out); \
275
+ mc_##Name##DerivedFromDataTokenAndCounter_destroy (fromTokenAndCounter); \
276
+ \
277
+ return true; \
278
+ }
279
+
280
+ DERIVE_TOKEN_IMPL (EDC)
281
+ DERIVE_TOKEN_IMPL (ESC)
282
+ DERIVE_TOKEN_IMPL (ECC)
283
+
284
+ #undef DERIVE_TOKEN_IMPL
285
+
286
+ static bool
287
+ _fle2_placeholder_aes_ctr_encrypt (_mongocrypt_key_broker_t *kb,
288
+ const _mongocrypt_buffer_t *key,
289
+ const _mongocrypt_buffer_t *in,
290
+ _mongocrypt_buffer_t *out,
291
+ mongocrypt_status_t *status)
292
+ {
293
+ BSON_ASSERT_PARAM (kb);
294
+ BSON_ASSERT_PARAM (key);
295
+ BSON_ASSERT_PARAM (in);
296
+ BSON_ASSERT_PARAM (out);
297
+ BSON_ASSERT (kb->crypt);
298
+
299
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
300
+ _mongocrypt_buffer_t iv;
301
+ const uint32_t cipherlen =
302
+ _mongocrypt_fle2_calculate_ciphertext_len (in->len, status);
303
+ if (cipherlen == 0) {
304
+ return false;
305
+ }
306
+ uint32_t written = 0;
307
+
308
+ _mongocrypt_buffer_init_size (out, cipherlen);
309
+
310
+ BSON_ASSERT (
311
+ _mongocrypt_buffer_from_subrange (&iv, out, 0, MONGOCRYPT_IV_LEN));
312
+ if (!_mongocrypt_random (crypto, &iv, MONGOCRYPT_IV_LEN, status)) {
313
+ return false;
314
+ }
315
+
316
+ if (!_mongocrypt_fle2_do_encryption (
317
+ crypto, &iv, key, in, out, &written, status)) {
318
+ _mongocrypt_buffer_cleanup (out);
319
+ _mongocrypt_buffer_init (out);
320
+ return false;
321
+ }
322
+
323
+ return true;
324
+ }
325
+
326
+
327
+ static bool
328
+ _fle2_placeholder_aead_encrypt (_mongocrypt_key_broker_t *kb,
329
+ const _mongocrypt_buffer_t *keyId,
330
+ const _mongocrypt_buffer_t *in,
331
+ _mongocrypt_buffer_t *out,
332
+ mongocrypt_status_t *status)
333
+ {
334
+ BSON_ASSERT_PARAM (kb);
335
+ BSON_ASSERT_PARAM (keyId);
336
+ BSON_ASSERT_PARAM (in);
337
+ BSON_ASSERT_PARAM (out);
338
+ BSON_ASSERT (kb->crypt);
339
+
340
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
341
+ _mongocrypt_buffer_t iv, key;
342
+ const uint32_t cipherlen =
343
+ _mongocrypt_fle2aead_calculate_ciphertext_len (in->len, status);
344
+ if (cipherlen == 0) {
345
+ return false;
346
+ }
347
+ uint32_t written = 0;
348
+ bool res;
349
+
350
+ if (!_mongocrypt_key_broker_decrypted_key_by_id (kb, keyId, &key)) {
351
+ CLIENT_ERR ("unable to retrieve key");
352
+ return false;
353
+ }
354
+
355
+ _mongocrypt_buffer_init_size (&iv, MONGOCRYPT_IV_LEN);
356
+ if (!_mongocrypt_random (crypto, &iv, iv.len, status)) {
357
+ _mongocrypt_buffer_cleanup (&key);
358
+ return false;
359
+ }
360
+
361
+ _mongocrypt_buffer_init_size (out, cipherlen);
362
+ res = _mongocrypt_fle2aead_do_encryption (
363
+ crypto, &iv, keyId, &key, in, out, &written, status);
364
+ _mongocrypt_buffer_cleanup (&key);
365
+ _mongocrypt_buffer_cleanup (&iv);
366
+
367
+ if (!res) {
368
+ _mongocrypt_buffer_cleanup (out);
369
+ _mongocrypt_buffer_init (out);
370
+ return false;
371
+ }
372
+
373
+ return true;
374
+ }
375
+
376
+
377
+ // Field derivations shared by both INSERT and FIND payloads.
378
+ typedef struct {
379
+ _mongocrypt_buffer_t tokenKey;
380
+ mc_CollectionsLevel1Token_t *collectionsLevel1Token;
381
+ _mongocrypt_buffer_t edcDerivedToken;
382
+ _mongocrypt_buffer_t escDerivedToken;
383
+ _mongocrypt_buffer_t eccDerivedToken;
384
+ } _FLE2EncryptedPayloadCommon_t;
385
+
386
+ static void
387
+ _FLE2EncryptedPayloadCommon_cleanup (_FLE2EncryptedPayloadCommon_t *common)
388
+ {
389
+ if (!common) {
390
+ return;
391
+ }
392
+
393
+ _mongocrypt_buffer_cleanup (&common->tokenKey);
394
+ mc_CollectionsLevel1Token_destroy (common->collectionsLevel1Token);
395
+ _mongocrypt_buffer_cleanup (&common->edcDerivedToken);
396
+ _mongocrypt_buffer_cleanup (&common->escDerivedToken);
397
+ _mongocrypt_buffer_cleanup (&common->eccDerivedToken);
398
+ memset (common, 0, sizeof (*common));
399
+ }
400
+
401
+ // _get_tokenKey returns the tokenKey identified by indexKeyId.
402
+ // Returns false on error.
403
+ static bool
404
+ _get_tokenKey (_mongocrypt_key_broker_t *kb,
405
+ const _mongocrypt_buffer_t *indexKeyId,
406
+ _mongocrypt_buffer_t *tokenKey,
407
+ mongocrypt_status_t *status)
408
+ {
409
+ BSON_ASSERT_PARAM (kb);
410
+ BSON_ASSERT_PARAM (indexKeyId);
411
+ BSON_ASSERT_PARAM (tokenKey);
412
+
413
+ _mongocrypt_buffer_t indexKey = {0};
414
+ _mongocrypt_buffer_init (tokenKey);
415
+
416
+ if (!_mongocrypt_key_broker_decrypted_key_by_id (
417
+ kb, indexKeyId, &indexKey)) {
418
+ CLIENT_ERR ("unable to retrieve key");
419
+ return false;
420
+ }
421
+
422
+ if (indexKey.len != MONGOCRYPT_KEY_LEN) {
423
+ CLIENT_ERR ("invalid indexKey, expected len=%" PRIu32
424
+ ", got len=%" PRIu32,
425
+ MONGOCRYPT_KEY_LEN,
426
+ indexKey.len);
427
+ _mongocrypt_buffer_cleanup (&indexKey);
428
+ return false;
429
+ }
430
+
431
+ // indexKey is 3 equal sized keys: [Ke][Km][TokenKey]
432
+ BSON_ASSERT (MONGOCRYPT_KEY_LEN == (3 * MONGOCRYPT_TOKEN_KEY_LEN));
433
+ if (!_mongocrypt_buffer_copy_from_data_and_size (
434
+ tokenKey,
435
+ indexKey.data + (2 * MONGOCRYPT_TOKEN_KEY_LEN),
436
+ MONGOCRYPT_TOKEN_KEY_LEN)) {
437
+ CLIENT_ERR ("failed allocating memory for token key");
438
+ _mongocrypt_buffer_cleanup (&indexKey);
439
+ return false;
440
+ }
441
+ _mongocrypt_buffer_cleanup (&indexKey);
442
+ return true;
443
+ }
444
+
445
+ static bool
446
+ _mongocrypt_fle2_placeholder_common (_mongocrypt_key_broker_t *kb,
447
+ _FLE2EncryptedPayloadCommon_t *ret,
448
+ const _mongocrypt_buffer_t *indexKeyId,
449
+ const _mongocrypt_buffer_t *value,
450
+ bool useCounter,
451
+ int64_t maxContentionCounter,
452
+ mongocrypt_status_t *status)
453
+ {
454
+ BSON_ASSERT_PARAM (kb);
455
+ BSON_ASSERT_PARAM (ret);
456
+ BSON_ASSERT_PARAM (indexKeyId);
457
+ BSON_ASSERT_PARAM (value);
458
+
459
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
460
+ _mongocrypt_buffer_t indexKey = {0};
461
+ *ret = (_FLE2EncryptedPayloadCommon_t){{0}};
462
+
463
+ if (!_get_tokenKey (kb, indexKeyId, &ret->tokenKey, status)) {
464
+ goto fail;
465
+ }
466
+
467
+ ret->collectionsLevel1Token =
468
+ mc_CollectionsLevel1Token_new (crypto, &ret->tokenKey, status);
469
+ if (!ret->collectionsLevel1Token) {
470
+ CLIENT_ERR ("unable to derive collectionLevel1Token");
471
+ goto fail;
472
+ }
473
+
474
+ if (!_fle2_derive_EDC_token (crypto,
475
+ &ret->edcDerivedToken,
476
+ ret->collectionsLevel1Token,
477
+ value,
478
+ useCounter,
479
+ maxContentionCounter,
480
+ status)) {
481
+ goto fail;
482
+ }
483
+
484
+ if (!_fle2_derive_ESC_token (crypto,
485
+ &ret->escDerivedToken,
486
+ ret->collectionsLevel1Token,
487
+ value,
488
+ useCounter,
489
+ maxContentionCounter,
490
+ status)) {
491
+ goto fail;
492
+ }
493
+
494
+ if (!_fle2_derive_ECC_token (crypto,
495
+ &ret->eccDerivedToken,
496
+ ret->collectionsLevel1Token,
497
+ value,
498
+ useCounter,
499
+ maxContentionCounter,
500
+ status)) {
501
+ goto fail;
502
+ }
503
+
504
+ _mongocrypt_buffer_cleanup (&indexKey);
505
+ return true;
506
+
507
+ fail:
508
+ _FLE2EncryptedPayloadCommon_cleanup (ret);
509
+ _mongocrypt_buffer_cleanup (&indexKey);
510
+ return false;
511
+ }
512
+
513
+
514
+ static bool
515
+ _mongocrypt_fle2_placeholder_to_insert_update_ciphertext (
516
+ _mongocrypt_key_broker_t *kb,
517
+ _mongocrypt_marking_t *marking,
518
+ _mongocrypt_ciphertext_t *ciphertext,
519
+ mongocrypt_status_t *status)
520
+ {
521
+ BSON_ASSERT_PARAM (kb);
522
+ BSON_ASSERT_PARAM (marking);
523
+ BSON_ASSERT_PARAM (ciphertext);
524
+ BSON_ASSERT (kb->crypt);
525
+
526
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
527
+ _FLE2EncryptedPayloadCommon_t common = {{0}};
528
+ _mongocrypt_buffer_t value = {0};
529
+ mc_FLE2EncryptionPlaceholder_t *placeholder = &marking->fle2;
530
+ mc_FLE2InsertUpdatePayload_t payload;
531
+ bool res = false;
532
+
533
+ BSON_ASSERT (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION);
534
+ BSON_ASSERT (placeholder->type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT);
535
+ _mongocrypt_ciphertext_init (ciphertext);
536
+ _mongocrypt_buffer_init (&value);
537
+ mc_FLE2InsertUpdatePayload_init (&payload);
538
+
539
+ _mongocrypt_buffer_from_iter (&value, &placeholder->v_iter);
540
+
541
+ int64_t contentionFactor = 0;
542
+ if (placeholder->maxContentionCounter > 0) {
543
+ /* Choose a random contentionFactor in the inclusive range [0,
544
+ * placeholder->maxContentionCounter] */
545
+ if (!_mongocrypt_random_int64 (crypto,
546
+ placeholder->maxContentionCounter + 1,
547
+ &contentionFactor,
548
+ status)) {
549
+ goto fail;
550
+ }
551
+ }
552
+
553
+ if (!_mongocrypt_fle2_placeholder_common (
554
+ kb,
555
+ &common,
556
+ &placeholder->index_key_id,
557
+ &value,
558
+ true, /* derive tokens using counter */
559
+ contentionFactor,
560
+ status)) {
561
+ goto fail;
562
+ }
563
+
564
+ // d := EDCDerivedToken
565
+ _mongocrypt_buffer_steal (&payload.edcDerivedToken, &common.edcDerivedToken);
566
+ // s := ESCDerivedToken
567
+ _mongocrypt_buffer_steal (&payload.escDerivedToken, &common.escDerivedToken);
568
+ // c := ECCDerivedToken
569
+ _mongocrypt_buffer_steal (&payload.eccDerivedToken, &common.eccDerivedToken);
570
+
571
+ // p := EncryptCTR(ECOCToken, ESCDerivedFromDataTokenAndCounter ||
572
+ // ECCDerivedFromDataTokenAndCounter)
573
+ {
574
+ _mongocrypt_buffer_t tokens[] = {payload.escDerivedToken,
575
+ payload.eccDerivedToken};
576
+ _mongocrypt_buffer_t p;
577
+ _mongocrypt_buffer_concat (&p, tokens, 2);
578
+ mc_ECOCToken_t *ecocToken =
579
+ mc_ECOCToken_new (crypto, common.collectionsLevel1Token, status);
580
+ if (!ecocToken) {
581
+ _mongocrypt_buffer_cleanup (&p);
582
+ goto fail;
583
+ }
584
+ bool ok = _fle2_placeholder_aes_ctr_encrypt (kb,
585
+ mc_ECOCToken_get (ecocToken),
586
+ &p,
587
+ &payload.encryptedTokens,
588
+ status);
589
+ _mongocrypt_buffer_cleanup (&p);
590
+ mc_ECOCToken_destroy (ecocToken);
591
+ if (!ok) {
592
+ goto fail;
593
+ }
594
+ }
595
+
596
+ _mongocrypt_buffer_copy_to (&placeholder->index_key_id,
597
+ &payload.indexKeyId); // u
598
+ payload.valueType = bson_iter_type (&placeholder->v_iter); // t
599
+
600
+ // v := UserKeyId + EncryptAEAD(UserKey, value)
601
+ {
602
+ _mongocrypt_buffer_t tmp[2] = {placeholder->user_key_id, {0}};
603
+ if (!_fle2_placeholder_aead_encrypt (
604
+ kb, &placeholder->user_key_id, &value, &tmp[1], status)) {
605
+ goto fail;
606
+ }
607
+ bool ok = _mongocrypt_buffer_concat (&payload.value, tmp, 2);
608
+ _mongocrypt_buffer_cleanup (&tmp[1]);
609
+ if (!ok) {
610
+ goto fail;
611
+ }
612
+ }
613
+
614
+ // e := ServerDataEncryptionLevel1Token
615
+ {
616
+ mc_ServerDataEncryptionLevel1Token_t *serverToken =
617
+ mc_ServerDataEncryptionLevel1Token_new (
618
+ crypto, &common.tokenKey, status);
619
+ if (!serverToken) {
620
+ goto fail;
621
+ }
622
+ _mongocrypt_buffer_copy_to (
623
+ mc_ServerDataEncryptionLevel1Token_get (serverToken),
624
+ &payload.serverEncryptionToken);
625
+ mc_ServerDataEncryptionLevel1Token_destroy (serverToken);
626
+ }
627
+
628
+ {
629
+ bson_t out;
630
+ bson_init (&out);
631
+ mc_FLE2InsertUpdatePayload_serialize (&payload, &out);
632
+ _mongocrypt_buffer_steal_from_bson (&ciphertext->data, &out);
633
+ }
634
+ // Do not set ciphertext->original_bson_type and ciphertext->key_id. They are
635
+ // not used for FLE2InsertUpdatePayload.
636
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE2InsertUpdatePayload;
637
+
638
+ res = true;
639
+ fail:
640
+ mc_FLE2InsertUpdatePayload_cleanup (&payload);
641
+ _mongocrypt_buffer_cleanup (&value);
642
+ _FLE2EncryptedPayloadCommon_cleanup (&common);
643
+
644
+ return res;
645
+ }
646
+
647
+ // get_edges creates and returns edges from an FLE2RangeInsertSpec. Returns NULL
648
+ // on error.
649
+ static mc_edges_t *
650
+ get_edges (mc_FLE2RangeInsertSpec_t *insertSpec,
651
+ size_t sparsity,
652
+ mongocrypt_status_t *status)
653
+ {
654
+ BSON_ASSERT_PARAM (insertSpec);
655
+
656
+ bson_type_t value_type = bson_iter_type (&insertSpec->v);
657
+
658
+
659
+ if (value_type == BSON_TYPE_INT32) {
660
+ return mc_getEdgesInt32 (
661
+ (mc_getEdgesInt32_args_t){
662
+ .value = bson_iter_int32 (&insertSpec->v),
663
+ .min = OPT_I32 (bson_iter_int32 (&insertSpec->min)),
664
+ .max = OPT_I32 (bson_iter_int32 (&insertSpec->max)),
665
+ .sparsity = sparsity},
666
+ status);
667
+ }
668
+
669
+ else if (value_type == BSON_TYPE_INT64) {
670
+ return mc_getEdgesInt64 (
671
+ (mc_getEdgesInt64_args_t){
672
+ .value = bson_iter_int64 (&insertSpec->v),
673
+ .min = OPT_I64 (bson_iter_int64 (&insertSpec->min)),
674
+ .max = OPT_I64 (bson_iter_int64 (&insertSpec->max)),
675
+ .sparsity = sparsity},
676
+ status);
677
+ }
678
+
679
+ else if (value_type == BSON_TYPE_DATE_TIME) {
680
+ return mc_getEdgesInt64 (
681
+ (mc_getEdgesInt64_args_t){
682
+ .value = bson_iter_date_time (&insertSpec->v),
683
+ .min = OPT_I64 (bson_iter_date_time (&insertSpec->min)),
684
+ .max = OPT_I64 (bson_iter_date_time (&insertSpec->max)),
685
+ .sparsity = sparsity},
686
+ status);
687
+ }
688
+
689
+ else if (value_type == BSON_TYPE_DOUBLE) {
690
+ mc_getEdgesDouble_args_t args = {
691
+ .value = bson_iter_double (&insertSpec->v), .sparsity = sparsity};
692
+ if (insertSpec->precision.set) {
693
+ // If precision is set, pass min/max/precision to mc_getEdgesDouble.
694
+ // Do not pass min/max if precision is not set. All three must be set
695
+ // or all three must be unset in mc_getTypeInfoDouble.
696
+ args.min = OPT_DOUBLE (bson_iter_double (&insertSpec->min));
697
+ args.max = OPT_DOUBLE (bson_iter_double (&insertSpec->max));
698
+ args.precision = insertSpec->precision;
699
+ }
700
+
701
+ return mc_getEdgesDouble (args, status);
702
+ }
703
+
704
+ else if (value_type == BSON_TYPE_DECIMAL128) {
705
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
706
+ const mc_dec128 value = mc_dec128_from_bson_iter (&insertSpec->v);
707
+ mc_getEdgesDecimal128_args_t args = {
708
+ .value = value,
709
+ .sparsity = sparsity,
710
+ };
711
+ if (insertSpec->precision.set) {
712
+ const mc_dec128 min = mc_dec128_from_bson_iter (&insertSpec->min);
713
+ const mc_dec128 max = mc_dec128_from_bson_iter (&insertSpec->max);
714
+ args.min = OPT_MC_DEC128 (min);
715
+ args.max = OPT_MC_DEC128 (max);
716
+ args.precision = insertSpec->precision;
717
+ }
718
+ return mc_getEdgesDecimal128 (args, status);
719
+ #else // ↑↑↑↑↑↑↑↑ With Decimal128 / Without ↓↓↓↓↓↓↓↓↓↓
720
+ CLIENT_ERR ("unsupported BSON type (Decimal128) for range: libmongocrypt "
721
+ "was built without extended Decimal128 support");
722
+ return NULL;
723
+ #endif
724
+ }
725
+
726
+
727
+ CLIENT_ERR ("unsupported BSON type: %s for range",
728
+ mc_bson_type_to_string (value_type));
729
+ return NULL;
730
+ }
731
+
732
+ // _mongocrypt_fle2_placeholder_to_insert_update_ciphertextForRange transforms a
733
+ // FLE2EncryptedPlaceholder to an FLE2InsertUpdatePayload for the range
734
+ // algorithm.
735
+ static bool
736
+ _mongocrypt_fle2_placeholder_to_insert_update_ciphertextForRange (
737
+ _mongocrypt_key_broker_t *kb,
738
+ _mongocrypt_marking_t *marking,
739
+ _mongocrypt_ciphertext_t *ciphertext,
740
+ mongocrypt_status_t *status)
741
+ {
742
+ BSON_ASSERT_PARAM (kb);
743
+ BSON_ASSERT_PARAM (marking);
744
+ BSON_ASSERT_PARAM (ciphertext);
745
+ BSON_ASSERT (kb->crypt);
746
+
747
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
748
+ _FLE2EncryptedPayloadCommon_t common = {{0}};
749
+ _mongocrypt_buffer_t value = {0};
750
+ mc_FLE2EncryptionPlaceholder_t *placeholder = &marking->fle2;
751
+ mc_FLE2InsertUpdatePayload_t payload;
752
+ bool res = false;
753
+ mc_edges_t *edges = NULL;
754
+
755
+ BSON_ASSERT (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION);
756
+ BSON_ASSERT (placeholder->type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT);
757
+ BSON_ASSERT (placeholder->algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
758
+ _mongocrypt_ciphertext_init (ciphertext);
759
+ mc_FLE2InsertUpdatePayload_init (&payload);
760
+
761
+ // Parse the value ("v"), min ("min"), and max ("max") from
762
+ // FLE2EncryptionPlaceholder for range insert.
763
+ mc_FLE2RangeInsertSpec_t insertSpec;
764
+ if (!mc_FLE2RangeInsertSpec_parse (
765
+ &insertSpec, &placeholder->v_iter, status)) {
766
+ goto fail;
767
+ }
768
+
769
+ _mongocrypt_buffer_from_iter (&value, &insertSpec.v);
770
+
771
+ int64_t contentionFactor = 0;
772
+ if (placeholder->maxContentionCounter > 0) {
773
+ /* Choose a random contentionFactor in the inclusive range [0,
774
+ * placeholder->maxContentionCounter] */
775
+ if (!_mongocrypt_random_int64 (crypto,
776
+ placeholder->maxContentionCounter + 1,
777
+ &contentionFactor,
778
+ status)) {
779
+ goto fail;
780
+ }
781
+ }
782
+
783
+ if (!_mongocrypt_fle2_placeholder_common (
784
+ kb,
785
+ &common,
786
+ &placeholder->index_key_id,
787
+ &value,
788
+ true, /* derive tokens using counter */
789
+ contentionFactor,
790
+ status)) {
791
+ goto fail;
792
+ }
793
+
794
+ // d := EDCDerivedToken
795
+ _mongocrypt_buffer_steal (&payload.edcDerivedToken, &common.edcDerivedToken);
796
+ // s := ESCDerivedToken
797
+ _mongocrypt_buffer_steal (&payload.escDerivedToken, &common.escDerivedToken);
798
+ // c := ECCDerivedToken
799
+ _mongocrypt_buffer_steal (&payload.eccDerivedToken, &common.eccDerivedToken);
800
+
801
+ // p := EncryptCTR(ECOCToken, ESCDerivedFromDataTokenAndCounter ||
802
+ // ECCDerivedFromDataTokenAndCounter)
803
+ {
804
+ _mongocrypt_buffer_t tokens[] = {payload.escDerivedToken,
805
+ payload.eccDerivedToken};
806
+ _mongocrypt_buffer_t p;
807
+ _mongocrypt_buffer_concat (&p, tokens, 2);
808
+ mc_ECOCToken_t *ecocToken =
809
+ mc_ECOCToken_new (crypto, common.collectionsLevel1Token, status);
810
+ if (!ecocToken) {
811
+ _mongocrypt_buffer_cleanup (&p);
812
+ goto fail;
813
+ }
814
+ bool ok = _fle2_placeholder_aes_ctr_encrypt (kb,
815
+ mc_ECOCToken_get (ecocToken),
816
+ &p,
817
+ &payload.encryptedTokens,
818
+ status);
819
+ _mongocrypt_buffer_cleanup (&p);
820
+ mc_ECOCToken_destroy (ecocToken);
821
+ if (!ok) {
822
+ goto fail;
823
+ }
824
+ }
825
+
826
+ _mongocrypt_buffer_copy_to (&placeholder->index_key_id,
827
+ &payload.indexKeyId); // u
828
+ payload.valueType = bson_iter_type (&insertSpec.v); // t
829
+
830
+ // v := UserKeyId + EncryptAEAD(UserKey, value)
831
+ {
832
+ _mongocrypt_buffer_t tmp[2] = {placeholder->user_key_id, {0}};
833
+ if (!_fle2_placeholder_aead_encrypt (
834
+ kb, &placeholder->user_key_id, &value, &tmp[1], status)) {
835
+ goto fail;
836
+ }
837
+ bool ok = _mongocrypt_buffer_concat (&payload.value, tmp, 2);
838
+ _mongocrypt_buffer_cleanup (&tmp[1]);
839
+ if (!ok) {
840
+ goto fail;
841
+ }
842
+ }
843
+
844
+ // e := ServerDataEncryptionLevel1Token
845
+ {
846
+ mc_ServerDataEncryptionLevel1Token_t *serverToken =
847
+ mc_ServerDataEncryptionLevel1Token_new (
848
+ crypto, &common.tokenKey, status);
849
+ if (!serverToken) {
850
+ goto fail;
851
+ }
852
+ _mongocrypt_buffer_copy_to (
853
+ mc_ServerDataEncryptionLevel1Token_get (serverToken),
854
+ &payload.serverEncryptionToken);
855
+ mc_ServerDataEncryptionLevel1Token_destroy (serverToken);
856
+ }
857
+
858
+ // g:= array<EdgeTokenSet>
859
+ {
860
+ BSON_ASSERT (placeholder->sparsity >= 0 &&
861
+ (uint64_t) placeholder->sparsity <= (uint64_t) SIZE_MAX);
862
+ edges = get_edges (&insertSpec, (size_t) placeholder->sparsity, status);
863
+ if (!edges) {
864
+ goto fail;
865
+ }
866
+
867
+ for (size_t i = 0; i < mc_edges_len (edges); i++) {
868
+ // Create an EdgeTokenSet from each edge.
869
+ bool loop_ok = false;
870
+ const char *edge = mc_edges_get (edges, i);
871
+ _mongocrypt_buffer_t edge_buf = {0};
872
+ _FLE2EncryptedPayloadCommon_t edge_tokens = {{0}};
873
+ _mongocrypt_buffer_t encryptedTokens = {0};
874
+ mc_EdgeTokenSet_t etc = {{0}};
875
+
876
+ if (!_mongocrypt_buffer_from_string (&edge_buf, edge)) {
877
+ CLIENT_ERR ("failed to copy edge to buffer");
878
+ goto fail_loop;
879
+ }
880
+
881
+ if (!_mongocrypt_fle2_placeholder_common (
882
+ kb,
883
+ &edge_tokens,
884
+ &placeholder->index_key_id,
885
+ &edge_buf,
886
+ true, /* derive tokens using counter */
887
+ contentionFactor,
888
+ status)) {
889
+ goto fail_loop;
890
+ }
891
+
892
+ // p := EncryptCTR(ECOCToken, ESCDerivedFromDataTokenAndCounter ||
893
+ // ECCDerivedFromDataTokenAndCounter)
894
+ {
895
+ _mongocrypt_buffer_t tokens[] = {edge_tokens.escDerivedToken,
896
+ edge_tokens.eccDerivedToken};
897
+ _mongocrypt_buffer_t p;
898
+ _mongocrypt_buffer_concat (&p, tokens, 2);
899
+ mc_ECOCToken_t *ecocToken = mc_ECOCToken_new (
900
+ crypto, edge_tokens.collectionsLevel1Token, status);
901
+ if (!ecocToken) {
902
+ _mongocrypt_buffer_cleanup (&p);
903
+ goto fail_loop;
904
+ }
905
+ bool ok = _fle2_placeholder_aes_ctr_encrypt (
906
+ kb, mc_ECOCToken_get (ecocToken), &p, &encryptedTokens, status);
907
+ _mongocrypt_buffer_cleanup (&p);
908
+ mc_ECOCToken_destroy (ecocToken);
909
+ if (!ok) {
910
+ goto fail_loop;
911
+ }
912
+ }
913
+
914
+ // d := EDCDerivedToken
915
+ _mongocrypt_buffer_steal (&etc.edcDerivedToken,
916
+ &edge_tokens.edcDerivedToken);
917
+ // s := ESCDerivedToken
918
+ _mongocrypt_buffer_steal (&etc.escDerivedToken,
919
+ &edge_tokens.escDerivedToken);
920
+ // c := ECCDerivedToken
921
+ _mongocrypt_buffer_steal (&etc.eccDerivedToken,
922
+ &edge_tokens.eccDerivedToken);
923
+
924
+ _mongocrypt_buffer_steal (&etc.encryptedTokens, &encryptedTokens);
925
+ _mc_array_append_val (&payload.edgeTokenSetArray, etc);
926
+
927
+ loop_ok = true;
928
+ fail_loop:
929
+ _mongocrypt_buffer_cleanup (&encryptedTokens);
930
+ _FLE2EncryptedPayloadCommon_cleanup (&edge_tokens);
931
+ _mongocrypt_buffer_cleanup (&edge_buf);
932
+ if (!loop_ok) {
933
+ goto fail;
934
+ }
935
+ }
936
+ }
937
+
938
+ // Serialize.
939
+ {
940
+ bson_t out;
941
+ bson_init (&out);
942
+ mc_FLE2InsertUpdatePayload_serializeForRange (&payload, &out);
943
+ _mongocrypt_buffer_steal_from_bson (&ciphertext->data, &out);
944
+ }
945
+ // Do not set ciphertext->original_bson_type and ciphertext->key_id. They are
946
+ // not used for FLE2InsertUpdatePayload.
947
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE2InsertUpdatePayload;
948
+
949
+ res = true;
950
+ fail:
951
+ mc_edges_destroy (edges);
952
+ mc_FLE2InsertUpdatePayload_cleanup (&payload);
953
+ _mongocrypt_buffer_cleanup (&value);
954
+ _FLE2EncryptedPayloadCommon_cleanup (&common);
955
+
956
+ return res;
957
+ }
958
+
959
+
960
+ static bool
961
+ _mongocrypt_fle2_placeholder_to_find_ciphertext (
962
+ _mongocrypt_key_broker_t *kb,
963
+ _mongocrypt_marking_t *marking,
964
+ _mongocrypt_ciphertext_t *ciphertext,
965
+ mongocrypt_status_t *status)
966
+ {
967
+ BSON_ASSERT_PARAM (kb);
968
+ BSON_ASSERT_PARAM (marking);
969
+ BSON_ASSERT_PARAM (ciphertext);
970
+
971
+ _FLE2EncryptedPayloadCommon_t common = {{0}};
972
+ _mongocrypt_buffer_t value = {0};
973
+ mc_FLE2EncryptionPlaceholder_t *placeholder = &marking->fle2;
974
+ mc_FLE2FindEqualityPayload_t payload;
975
+ bool res = false;
976
+
977
+ BSON_ASSERT (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION);
978
+ BSON_ASSERT (placeholder->type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND);
979
+ _mongocrypt_ciphertext_init (ciphertext);
980
+ _mongocrypt_buffer_init (&value);
981
+ mc_FLE2FindEqualityPayload_init (&payload);
982
+
983
+ _mongocrypt_buffer_from_iter (&value, &placeholder->v_iter);
984
+
985
+ if (!_mongocrypt_fle2_placeholder_common (
986
+ kb,
987
+ &common,
988
+ &placeholder->index_key_id,
989
+ &value,
990
+ false, /* derive tokens without counter */
991
+ placeholder->maxContentionCounter,
992
+ status)) {
993
+ goto fail;
994
+ }
995
+
996
+ // d := EDCDerivedToken
997
+ _mongocrypt_buffer_steal (&payload.edcDerivedToken, &common.edcDerivedToken);
998
+ // s := ESCDerivedToken
999
+ _mongocrypt_buffer_steal (&payload.escDerivedToken, &common.escDerivedToken);
1000
+ // c := ECCDerivedToken
1001
+ _mongocrypt_buffer_steal (&payload.eccDerivedToken, &common.eccDerivedToken);
1002
+
1003
+ // e := ServerDataEncryptionLevel1Token
1004
+ BSON_ASSERT (kb->crypt);
1005
+ {
1006
+ mc_ServerDataEncryptionLevel1Token_t *serverToken =
1007
+ mc_ServerDataEncryptionLevel1Token_new (
1008
+ kb->crypt->crypto, &common.tokenKey, status);
1009
+ if (!serverToken) {
1010
+ goto fail;
1011
+ }
1012
+ _mongocrypt_buffer_copy_to (
1013
+ mc_ServerDataEncryptionLevel1Token_get (serverToken),
1014
+ &payload.serverEncryptionToken);
1015
+ mc_ServerDataEncryptionLevel1Token_destroy (serverToken);
1016
+ }
1017
+
1018
+ payload.maxContentionCounter = placeholder->maxContentionCounter;
1019
+
1020
+ {
1021
+ bson_t out;
1022
+ bson_init (&out);
1023
+ mc_FLE2FindEqualityPayload_serialize (&payload, &out);
1024
+ _mongocrypt_buffer_steal_from_bson (&ciphertext->data, &out);
1025
+ }
1026
+ // Do not set ciphertext->original_bson_type and ciphertext->key_id. They are
1027
+ // not used for FLE2FindEqualityPayload.
1028
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE2FindEqualityPayload;
1029
+
1030
+ res = true;
1031
+ fail:
1032
+ mc_FLE2FindEqualityPayload_cleanup (&payload);
1033
+ _mongocrypt_buffer_cleanup (&value);
1034
+ _FLE2EncryptedPayloadCommon_cleanup (&common);
1035
+
1036
+ return res;
1037
+ }
1038
+
1039
+ static bool
1040
+ isInfinite (bson_iter_t *iter)
1041
+ {
1042
+ return mc_isinf (bson_iter_double (iter));
1043
+ }
1044
+
1045
+ // mc_get_mincover_from_FLE2RangeFindSpec creates and returns a mincover from an
1046
+ // FLE2RangeFindSpec. Returns NULL on error.
1047
+ mc_mincover_t *
1048
+ mc_get_mincover_from_FLE2RangeFindSpec (mc_FLE2RangeFindSpec_t *findSpec,
1049
+ size_t sparsity,
1050
+ mongocrypt_status_t *status)
1051
+ {
1052
+ BSON_ASSERT_PARAM (findSpec);
1053
+ BSON_ASSERT (findSpec->edgesInfo.set);
1054
+
1055
+ bson_type_t bsonType = bson_iter_type (&findSpec->edgesInfo.value.indexMin);
1056
+
1057
+ if (bson_iter_type (&findSpec->edgesInfo.value.indexMin) !=
1058
+ bson_iter_type (&findSpec->edgesInfo.value.indexMax)) {
1059
+ CLIENT_ERR (
1060
+ "indexMin and indexMax must have the same type. Got: %s indexMin and "
1061
+ "%s indexMax",
1062
+ mc_bson_type_to_string (
1063
+ bson_iter_type (&findSpec->edgesInfo.value.indexMin)),
1064
+ mc_bson_type_to_string (
1065
+ bson_iter_type (&findSpec->edgesInfo.value.indexMax)));
1066
+ return NULL;
1067
+ }
1068
+
1069
+ bson_iter_t lowerBound = findSpec->edgesInfo.value.lowerBound;
1070
+ bson_iter_t upperBound = findSpec->edgesInfo.value.upperBound;
1071
+ bool includeLowerBound = findSpec->edgesInfo.value.lbIncluded;
1072
+ bool includeUpperBound = findSpec->edgesInfo.value.ubIncluded;
1073
+
1074
+ // Open-ended ranges are represented with infinity as the other endpoint.
1075
+ // Resolve infinite bounds at this point to end at the min or max for this
1076
+ // index.
1077
+ if (isInfinite (&lowerBound)) {
1078
+ lowerBound = findSpec->edgesInfo.value.indexMin;
1079
+ includeLowerBound = true;
1080
+ }
1081
+ if (isInfinite (&upperBound)) {
1082
+ upperBound = findSpec->edgesInfo.value.indexMax;
1083
+ includeUpperBound = true;
1084
+ }
1085
+
1086
+ if (bson_iter_type (&lowerBound) != bsonType) {
1087
+ CLIENT_ERR ("expected lowerBound to match index type %s, got %s",
1088
+ mc_bson_type_to_string (bsonType),
1089
+ mc_bson_type_to_string (bson_iter_type (&lowerBound)));
1090
+ return NULL;
1091
+ }
1092
+
1093
+ if (bson_iter_type (&upperBound) != bsonType) {
1094
+ CLIENT_ERR ("expected upperBound to match index type %s, got %s",
1095
+ mc_bson_type_to_string (bsonType),
1096
+ mc_bson_type_to_string (bson_iter_type (&upperBound)));
1097
+ return NULL;
1098
+ }
1099
+
1100
+ switch (bsonType) {
1101
+ case BSON_TYPE_INT32:
1102
+ BSON_ASSERT (bson_iter_type (&lowerBound) == BSON_TYPE_INT32);
1103
+ BSON_ASSERT (bson_iter_type (&upperBound) == BSON_TYPE_INT32);
1104
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMin) ==
1105
+ BSON_TYPE_INT32);
1106
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMax) ==
1107
+ BSON_TYPE_INT32);
1108
+ return mc_getMincoverInt32 (
1109
+ (mc_getMincoverInt32_args_t){
1110
+ .lowerBound = bson_iter_int32 (&lowerBound),
1111
+ .includeLowerBound = includeLowerBound,
1112
+ .upperBound = bson_iter_int32 (&upperBound),
1113
+ .includeUpperBound = includeUpperBound,
1114
+ .min =
1115
+ OPT_I32 (bson_iter_int32 (&findSpec->edgesInfo.value.indexMin)),
1116
+ .max =
1117
+ OPT_I32 (bson_iter_int32 (&findSpec->edgesInfo.value.indexMax)),
1118
+ .sparsity = sparsity},
1119
+ status);
1120
+
1121
+ case BSON_TYPE_INT64:
1122
+ BSON_ASSERT (bson_iter_type (&lowerBound) == BSON_TYPE_INT64);
1123
+ BSON_ASSERT (bson_iter_type (&upperBound) == BSON_TYPE_INT64);
1124
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMin) ==
1125
+ BSON_TYPE_INT64);
1126
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMax) ==
1127
+ BSON_TYPE_INT64);
1128
+ return mc_getMincoverInt64 (
1129
+ (mc_getMincoverInt64_args_t){
1130
+ .lowerBound = bson_iter_int64 (&lowerBound),
1131
+ .includeLowerBound = includeLowerBound,
1132
+ .upperBound = bson_iter_int64 (&upperBound),
1133
+ .includeUpperBound = includeUpperBound,
1134
+ .min =
1135
+ OPT_I64 (bson_iter_int64 (&findSpec->edgesInfo.value.indexMin)),
1136
+ .max =
1137
+ OPT_I64 (bson_iter_int64 (&findSpec->edgesInfo.value.indexMax)),
1138
+ .sparsity = sparsity},
1139
+ status);
1140
+ case BSON_TYPE_DATE_TIME:
1141
+ BSON_ASSERT (bson_iter_type (&lowerBound) == BSON_TYPE_DATE_TIME);
1142
+ BSON_ASSERT (bson_iter_type (&upperBound) == BSON_TYPE_DATE_TIME);
1143
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMin) ==
1144
+ BSON_TYPE_DATE_TIME);
1145
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMax) ==
1146
+ BSON_TYPE_DATE_TIME);
1147
+ return mc_getMincoverInt64 (
1148
+ (mc_getMincoverInt64_args_t){
1149
+ .lowerBound = bson_iter_date_time (&lowerBound),
1150
+ .includeLowerBound = includeLowerBound,
1151
+ .upperBound = bson_iter_date_time (&upperBound),
1152
+ .includeUpperBound = includeUpperBound,
1153
+ .min = OPT_I64 (
1154
+ bson_iter_date_time (&findSpec->edgesInfo.value.indexMin)),
1155
+ .max = OPT_I64 (
1156
+ bson_iter_date_time (&findSpec->edgesInfo.value.indexMax)),
1157
+ .sparsity = sparsity},
1158
+ status);
1159
+ case BSON_TYPE_DOUBLE: {
1160
+ BSON_ASSERT (bson_iter_type (&lowerBound) == BSON_TYPE_DOUBLE);
1161
+ BSON_ASSERT (bson_iter_type (&upperBound) == BSON_TYPE_DOUBLE);
1162
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMin) ==
1163
+ BSON_TYPE_DOUBLE);
1164
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMax) ==
1165
+ BSON_TYPE_DOUBLE);
1166
+
1167
+ mc_getMincoverDouble_args_t args = {
1168
+ .lowerBound = bson_iter_double (&lowerBound),
1169
+ .includeLowerBound = includeLowerBound,
1170
+ .upperBound = bson_iter_double (&upperBound),
1171
+ .includeUpperBound = includeUpperBound,
1172
+ .sparsity = sparsity};
1173
+ if (findSpec->edgesInfo.value.precision.set) {
1174
+ // If precision is set, pass min/max/precision to mc_getMincoverDouble.
1175
+ // Do not pass min/max if precision is not set. All three must be set
1176
+ // or all three must be unset in mc_getTypeInfoDouble.
1177
+ args.min =
1178
+ OPT_DOUBLE (bson_iter_double (&findSpec->edgesInfo.value.indexMin));
1179
+ args.max =
1180
+ OPT_DOUBLE (bson_iter_double (&findSpec->edgesInfo.value.indexMax));
1181
+ args.precision = findSpec->edgesInfo.value.precision;
1182
+ }
1183
+ return mc_getMincoverDouble (args, status);
1184
+ }
1185
+ case BSON_TYPE_DECIMAL128: {
1186
+ #if MONGOCRYPT_HAVE_DECIMAL128_SUPPORT
1187
+ BSON_ASSERT (bson_iter_type (&lowerBound) == BSON_TYPE_DECIMAL128);
1188
+ BSON_ASSERT (bson_iter_type (&upperBound) == BSON_TYPE_DECIMAL128);
1189
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMin) ==
1190
+ BSON_TYPE_DECIMAL128);
1191
+ BSON_ASSERT (bson_iter_type (&findSpec->edgesInfo.value.indexMax) ==
1192
+ BSON_TYPE_DECIMAL128);
1193
+
1194
+ mc_getMincoverDecimal128_args_t args = {
1195
+ .lowerBound = mc_dec128_from_bson_iter (&lowerBound),
1196
+ .includeLowerBound = includeLowerBound,
1197
+ .upperBound = mc_dec128_from_bson_iter (&upperBound),
1198
+ .includeUpperBound = includeUpperBound,
1199
+ .sparsity = sparsity,
1200
+ };
1201
+ if (findSpec->edgesInfo.value.precision.set) {
1202
+ args.min = OPT_MC_DEC128 (
1203
+ mc_dec128_from_bson_iter (&findSpec->edgesInfo.value.indexMin));
1204
+ args.max = OPT_MC_DEC128 (
1205
+ mc_dec128_from_bson_iter (&findSpec->edgesInfo.value.indexMax));
1206
+ args.precision = findSpec->edgesInfo.value.precision;
1207
+ }
1208
+ return mc_getMincoverDecimal128 (args, status);
1209
+ #else // ↑↑↑↑↑↑↑↑ With Decimal128 / Without ↓↓↓↓↓↓↓↓↓↓
1210
+ CLIENT_ERR ("FLE2 find is not supported for Decimal128: libmongocrypt "
1211
+ "was built without Decimal128 support");
1212
+ return NULL;
1213
+ #endif
1214
+ }
1215
+
1216
+ case BSON_TYPE_EOD:
1217
+ case BSON_TYPE_UTF8:
1218
+ case BSON_TYPE_DOCUMENT:
1219
+ case BSON_TYPE_ARRAY:
1220
+ case BSON_TYPE_BINARY:
1221
+ case BSON_TYPE_UNDEFINED:
1222
+ case BSON_TYPE_OID:
1223
+ case BSON_TYPE_BOOL:
1224
+ case BSON_TYPE_NULL:
1225
+ case BSON_TYPE_REGEX:
1226
+ case BSON_TYPE_DBPOINTER:
1227
+ case BSON_TYPE_CODE:
1228
+ case BSON_TYPE_SYMBOL:
1229
+ case BSON_TYPE_CODEWSCOPE:
1230
+ case BSON_TYPE_TIMESTAMP:
1231
+ case BSON_TYPE_MAXKEY:
1232
+ case BSON_TYPE_MINKEY:
1233
+ default:
1234
+ CLIENT_ERR ("FLE2 find is not supported for type: %s",
1235
+ mc_bson_type_to_string (bsonType));
1236
+ return NULL;
1237
+ }
1238
+ }
1239
+
1240
+ static bool
1241
+ _mongocrypt_fle2_placeholder_to_find_ciphertextForRange (
1242
+ _mongocrypt_key_broker_t *kb,
1243
+ _mongocrypt_marking_t *marking,
1244
+ _mongocrypt_ciphertext_t *ciphertext,
1245
+ mongocrypt_status_t *status)
1246
+ {
1247
+ BSON_ASSERT_PARAM (kb);
1248
+ BSON_ASSERT_PARAM (marking);
1249
+ BSON_ASSERT_PARAM (ciphertext);
1250
+ BSON_ASSERT (kb->crypt);
1251
+
1252
+ _mongocrypt_crypto_t *crypto = kb->crypt->crypto;
1253
+ mc_FLE2EncryptionPlaceholder_t *placeholder = &marking->fle2;
1254
+ mc_FLE2FindRangePayload_t payload;
1255
+ bool res = false;
1256
+ mc_mincover_t *mincover = NULL;
1257
+ _mongocrypt_buffer_t tokenKey = {0};
1258
+
1259
+ BSON_ASSERT (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION);
1260
+ BSON_ASSERT (placeholder);
1261
+ BSON_ASSERT (placeholder->type == MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND);
1262
+ BSON_ASSERT (placeholder->algorithm == MONGOCRYPT_FLE2_ALGORITHM_RANGE);
1263
+ _mongocrypt_ciphertext_init (ciphertext);
1264
+ mc_FLE2FindRangePayload_init (&payload);
1265
+
1266
+ // Parse the query bounds and index bounds from FLE2EncryptionPlaceholder for
1267
+ // range find.
1268
+ mc_FLE2RangeFindSpec_t findSpec;
1269
+ if (!mc_FLE2RangeFindSpec_parse (&findSpec, &placeholder->v_iter, status)) {
1270
+ goto fail;
1271
+ }
1272
+
1273
+ if (findSpec.edgesInfo.set) {
1274
+ // cm := Queryable Encryption max counter
1275
+ payload.payload.value.maxContentionCounter =
1276
+ placeholder->maxContentionCounter;
1277
+
1278
+ // e := ServerDataEncryptionLevel1Token
1279
+ {
1280
+ if (!_get_tokenKey (
1281
+ kb, &placeholder->index_key_id, &tokenKey, status)) {
1282
+ goto fail;
1283
+ }
1284
+
1285
+ mc_ServerDataEncryptionLevel1Token_t *serverToken =
1286
+ mc_ServerDataEncryptionLevel1Token_new (crypto, &tokenKey, status);
1287
+ if (!serverToken) {
1288
+ goto fail;
1289
+ }
1290
+ _mongocrypt_buffer_copy_to (
1291
+ mc_ServerDataEncryptionLevel1Token_get (serverToken),
1292
+ &payload.payload.value.serverEncryptionToken);
1293
+ mc_ServerDataEncryptionLevel1Token_destroy (serverToken);
1294
+ }
1295
+
1296
+ // g:= array<EdgeFindTokenSet>
1297
+ {
1298
+ BSON_ASSERT (placeholder->sparsity >= 0 &&
1299
+ (uint64_t) placeholder->sparsity <= (uint64_t) SIZE_MAX);
1300
+ mincover = mc_get_mincover_from_FLE2RangeFindSpec (
1301
+ &findSpec, (size_t) placeholder->sparsity, status);
1302
+ if (!mincover) {
1303
+ goto fail;
1304
+ }
1305
+
1306
+ for (size_t i = 0; i < mc_mincover_len (mincover); i++) {
1307
+ // Create a EdgeFindTokenSet from each edge.
1308
+ bool loop_ok = false;
1309
+ const char *edge = mc_mincover_get (mincover, i);
1310
+ _mongocrypt_buffer_t edge_buf = {0};
1311
+ _FLE2EncryptedPayloadCommon_t edge_tokens = {{0}};
1312
+ mc_EdgeFindTokenSet_t eftc = {{0}};
1313
+
1314
+ if (!_mongocrypt_buffer_from_string (&edge_buf, edge)) {
1315
+ CLIENT_ERR ("failed to copy edge to buffer");
1316
+ goto fail_loop;
1317
+ }
1318
+
1319
+ if (!_mongocrypt_fle2_placeholder_common (
1320
+ kb,
1321
+ &edge_tokens,
1322
+ &placeholder->index_key_id,
1323
+ &edge_buf,
1324
+ false, /* derive tokens using counter */
1325
+ placeholder->maxContentionCounter,
1326
+ status)) {
1327
+ goto fail_loop;
1328
+ }
1329
+
1330
+ // d := EDCDerivedToken
1331
+ _mongocrypt_buffer_steal (&eftc.edcDerivedToken,
1332
+ &edge_tokens.edcDerivedToken);
1333
+ // s := ESCDerivedToken
1334
+ _mongocrypt_buffer_steal (&eftc.escDerivedToken,
1335
+ &edge_tokens.escDerivedToken);
1336
+ // c := ECCDerivedToken
1337
+ _mongocrypt_buffer_steal (&eftc.eccDerivedToken,
1338
+ &edge_tokens.eccDerivedToken);
1339
+
1340
+ _mc_array_append_val (&payload.payload.value.edgeFindTokenSetArray,
1341
+ eftc);
1342
+
1343
+ loop_ok = true;
1344
+ fail_loop:
1345
+ _FLE2EncryptedPayloadCommon_cleanup (&edge_tokens);
1346
+ _mongocrypt_buffer_cleanup (&edge_buf);
1347
+ if (!loop_ok) {
1348
+ goto fail;
1349
+ }
1350
+ }
1351
+ }
1352
+ payload.payload.set = true;
1353
+ }
1354
+
1355
+ payload.payloadId = findSpec.payloadId;
1356
+ payload.firstOperator = findSpec.firstOperator;
1357
+ payload.secondOperator = findSpec.secondOperator;
1358
+
1359
+ // Serialize.
1360
+ {
1361
+ bson_t out = BSON_INITIALIZER;
1362
+ mc_FLE2FindRangePayload_serialize (&payload, &out);
1363
+ _mongocrypt_buffer_steal_from_bson (&ciphertext->data, &out);
1364
+ }
1365
+ _mongocrypt_buffer_steal (&ciphertext->key_id, &placeholder->index_key_id);
1366
+
1367
+ // Do not set ciphertext->original_bson_type and ciphertext->key_id. They are
1368
+ // not used for FLE2FindRangePayload.
1369
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE2FindRangePayload;
1370
+
1371
+ res = true;
1372
+ fail:
1373
+ mc_mincover_destroy (mincover);
1374
+ mc_FLE2FindRangePayload_cleanup (&payload);
1375
+ _mongocrypt_buffer_cleanup (&tokenKey);
1376
+
1377
+ return res;
1378
+ }
1379
+
1380
+ static bool
1381
+ _mongocrypt_fle2_placeholder_to_FLE2UnindexedEncryptedValue (
1382
+ _mongocrypt_key_broker_t *kb,
1383
+ _mongocrypt_marking_t *marking,
1384
+ _mongocrypt_ciphertext_t *ciphertext,
1385
+ mongocrypt_status_t *status)
1386
+ {
1387
+ BSON_ASSERT_PARAM (kb);
1388
+ BSON_ASSERT_PARAM (marking);
1389
+ BSON_ASSERT_PARAM (ciphertext);
1390
+
1391
+ _mongocrypt_buffer_t plaintext = {0};
1392
+ mc_FLE2EncryptionPlaceholder_t *placeholder = &marking->fle2;
1393
+ _mongocrypt_buffer_t user_key = {0};
1394
+ bool res = false;
1395
+
1396
+ BSON_ASSERT (marking->type == MONGOCRYPT_MARKING_FLE2_ENCRYPTION);
1397
+ BSON_ASSERT (placeholder);
1398
+ BSON_ASSERT (placeholder->algorithm == MONGOCRYPT_FLE2_ALGORITHM_UNINDEXED);
1399
+ _mongocrypt_ciphertext_init (ciphertext);
1400
+ _mongocrypt_buffer_from_iter (&plaintext, &placeholder->v_iter);
1401
+
1402
+ if (!_mongocrypt_key_broker_decrypted_key_by_id (
1403
+ kb, &placeholder->user_key_id, &user_key)) {
1404
+ CLIENT_ERR ("unable to retrieve key");
1405
+ goto fail;
1406
+ }
1407
+
1408
+ BSON_ASSERT (kb->crypt);
1409
+ if (!mc_FLE2UnindexedEncryptedValue_encrypt (
1410
+ kb->crypt->crypto,
1411
+ &placeholder->user_key_id,
1412
+ bson_iter_type (&placeholder->v_iter),
1413
+ &plaintext,
1414
+ &user_key,
1415
+ &ciphertext->data,
1416
+ status)) {
1417
+ goto fail;
1418
+ }
1419
+
1420
+ _mongocrypt_buffer_steal (&ciphertext->key_id, &placeholder->user_key_id);
1421
+ ciphertext->original_bson_type =
1422
+ (uint8_t) bson_iter_type (&placeholder->v_iter);
1423
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE2UnindexedEncryptedValue;
1424
+ res = true;
1425
+ fail:
1426
+ _mongocrypt_buffer_cleanup (&plaintext);
1427
+ _mongocrypt_buffer_cleanup (&user_key);
1428
+
1429
+ return res;
1430
+ }
1431
+
1432
+ static bool
1433
+ _mongocrypt_fle1_marking_to_ciphertext (_mongocrypt_key_broker_t *kb,
1434
+ _mongocrypt_marking_t *marking,
1435
+ _mongocrypt_ciphertext_t *ciphertext,
1436
+ mongocrypt_status_t *status)
1437
+ {
1438
+ _mongocrypt_buffer_t plaintext;
1439
+ _mongocrypt_buffer_t iv;
1440
+ _mongocrypt_buffer_t associated_data;
1441
+ _mongocrypt_buffer_t key_material;
1442
+ _mongocrypt_buffer_t key_id;
1443
+ bool ret = false;
1444
+ bool key_found;
1445
+ uint32_t bytes_written;
1446
+
1447
+ BSON_ASSERT_PARAM (kb);
1448
+ BSON_ASSERT_PARAM (marking);
1449
+ BSON_ASSERT_PARAM (ciphertext);
1450
+
1451
+ BSON_ASSERT ((marking->type == MONGOCRYPT_MARKING_FLE1_BY_ID) ||
1452
+ (marking->type == MONGOCRYPT_MARKING_FLE1_BY_ALTNAME));
1453
+
1454
+ _mongocrypt_buffer_init (&plaintext);
1455
+ _mongocrypt_buffer_init (&associated_data);
1456
+ _mongocrypt_buffer_init (&iv);
1457
+ _mongocrypt_buffer_init (&key_id);
1458
+ _mongocrypt_buffer_init (&key_material);
1459
+
1460
+ /* Get the decrypted key for this marking. */
1461
+ if (marking->type == MONGOCRYPT_MARKING_FLE1_BY_ALTNAME) {
1462
+ key_found = _mongocrypt_key_broker_decrypted_key_by_name (
1463
+ kb, &marking->key_alt_name, &key_material, &key_id);
1464
+ } else if (!_mongocrypt_buffer_empty (&marking->key_id)) {
1465
+ key_found = _mongocrypt_key_broker_decrypted_key_by_id (
1466
+ kb, &marking->key_id, &key_material);
1467
+ _mongocrypt_buffer_copy_to (&marking->key_id, &key_id);
1468
+ } else {
1469
+ CLIENT_ERR ("marking must have either key_id or key_alt_name");
1470
+ goto fail;
1471
+ }
1472
+
1473
+ if (!key_found) {
1474
+ _mongocrypt_status_copy_to (kb->status, status);
1475
+ goto fail;
1476
+ }
1477
+
1478
+ _mongocrypt_ciphertext_init (ciphertext);
1479
+ ciphertext->original_bson_type = (uint8_t) bson_iter_type (&marking->v_iter);
1480
+ if (marking->algorithm == MONGOCRYPT_ENCRYPTION_ALGORITHM_DETERMINISTIC) {
1481
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE1DeterministicEncryptedValue;
1482
+ } else {
1483
+ BSON_ASSERT (marking->algorithm ==
1484
+ MONGOCRYPT_ENCRYPTION_ALGORITHM_RANDOM);
1485
+ ciphertext->blob_subtype = MC_SUBTYPE_FLE1RandomEncryptedValue;
1486
+ }
1487
+ _mongocrypt_buffer_copy_to (&key_id, &ciphertext->key_id);
1488
+ if (!_mongocrypt_ciphertext_serialize_associated_data (ciphertext,
1489
+ &associated_data)) {
1490
+ CLIENT_ERR ("could not serialize associated data");
1491
+ goto fail;
1492
+ }
1493
+
1494
+ _mongocrypt_buffer_from_iter (&plaintext, &marking->v_iter);
1495
+ ciphertext->data.len =
1496
+ _mongocrypt_calculate_ciphertext_len (plaintext.len, status);
1497
+ if (ciphertext->data.len == 0) {
1498
+ goto fail;
1499
+ }
1500
+ ciphertext->data.data = bson_malloc (ciphertext->data.len);
1501
+ BSON_ASSERT (ciphertext->data.data);
1502
+
1503
+ ciphertext->data.owned = true;
1504
+
1505
+ BSON_ASSERT (kb->crypt);
1506
+ switch (marking->algorithm) {
1507
+ case MONGOCRYPT_ENCRYPTION_ALGORITHM_DETERMINISTIC:
1508
+ /* Use deterministic encryption. */
1509
+ _mongocrypt_buffer_resize (&iv, MONGOCRYPT_IV_LEN);
1510
+ ret = _mongocrypt_calculate_deterministic_iv (kb->crypt->crypto,
1511
+ &key_material,
1512
+ &plaintext,
1513
+ &associated_data,
1514
+ &iv,
1515
+ status);
1516
+ if (!ret) {
1517
+ goto fail;
1518
+ }
1519
+
1520
+ ret = _mongocrypt_do_encryption (kb->crypt->crypto,
1521
+ &iv,
1522
+ &associated_data,
1523
+ &key_material,
1524
+ &plaintext,
1525
+ &ciphertext->data,
1526
+ &bytes_written,
1527
+ status);
1528
+ break;
1529
+ case MONGOCRYPT_ENCRYPTION_ALGORITHM_RANDOM:
1530
+ /* Use randomized encryption.
1531
+ * In this case, we must generate a new, random iv. */
1532
+ _mongocrypt_buffer_resize (&iv, MONGOCRYPT_IV_LEN);
1533
+ if (!_mongocrypt_random (
1534
+ kb->crypt->crypto, &iv, MONGOCRYPT_IV_LEN, status)) {
1535
+ goto fail;
1536
+ }
1537
+ ret = _mongocrypt_do_encryption (kb->crypt->crypto,
1538
+ &iv,
1539
+ &associated_data,
1540
+ &key_material,
1541
+ &plaintext,
1542
+ &ciphertext->data,
1543
+ &bytes_written,
1544
+ status);
1545
+ break;
1546
+ case MONGOCRYPT_ENCRYPTION_ALGORITHM_NONE:
1547
+ default:
1548
+ /* Error. */
1549
+ CLIENT_ERR ("Unsupported value for encryption algorithm");
1550
+ goto fail;
1551
+ }
1552
+
1553
+ if (!ret) {
1554
+ goto fail;
1555
+ }
1556
+
1557
+ BSON_ASSERT (bytes_written == ciphertext->data.len);
1558
+
1559
+ ret = true;
1560
+
1561
+ fail:
1562
+ _mongocrypt_buffer_cleanup (&iv);
1563
+ _mongocrypt_buffer_cleanup (&key_id);
1564
+ _mongocrypt_buffer_cleanup (&plaintext);
1565
+ _mongocrypt_buffer_cleanup (&associated_data);
1566
+ _mongocrypt_buffer_cleanup (&key_material);
1567
+ return ret;
1568
+ }
1569
+
1570
+ bool
1571
+ _mongocrypt_marking_to_ciphertext (void *ctx,
1572
+ _mongocrypt_marking_t *marking,
1573
+ _mongocrypt_ciphertext_t *ciphertext,
1574
+ mongocrypt_status_t *status)
1575
+ {
1576
+ BSON_ASSERT_PARAM (marking);
1577
+ BSON_ASSERT_PARAM (ciphertext);
1578
+ BSON_ASSERT_PARAM (ctx);
1579
+
1580
+ _mongocrypt_key_broker_t *kb = (_mongocrypt_key_broker_t *) ctx;
1581
+
1582
+ switch (marking->type) {
1583
+ case MONGOCRYPT_MARKING_FLE2_ENCRYPTION:
1584
+ switch (marking->fle2.algorithm) {
1585
+ case MONGOCRYPT_FLE2_ALGORITHM_UNINDEXED:
1586
+ return _mongocrypt_fle2_placeholder_to_FLE2UnindexedEncryptedValue (
1587
+ kb, marking, ciphertext, status);
1588
+ case MONGOCRYPT_FLE2_ALGORITHM_RANGE:
1589
+ switch (marking->fle2.type) {
1590
+ case MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT:
1591
+ return _mongocrypt_fle2_placeholder_to_insert_update_ciphertextForRange (
1592
+ kb, marking, ciphertext, status);
1593
+ case MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND:
1594
+ return _mongocrypt_fle2_placeholder_to_find_ciphertextForRange (
1595
+ kb, marking, ciphertext, status);
1596
+ default:
1597
+ CLIENT_ERR ("unexpected fle2 type: %d", (int) marking->fle2.type);
1598
+ return false;
1599
+ }
1600
+ case MONGOCRYPT_FLE2_ALGORITHM_EQUALITY:
1601
+ switch (marking->fle2.type) {
1602
+ case MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_INSERT:
1603
+ return _mongocrypt_fle2_placeholder_to_insert_update_ciphertext (
1604
+ kb, marking, ciphertext, status);
1605
+ case MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND:
1606
+ return _mongocrypt_fle2_placeholder_to_find_ciphertext (
1607
+ kb, marking, ciphertext, status);
1608
+ default:
1609
+ CLIENT_ERR ("unexpected fle2 type: %d", (int) marking->fle2.type);
1610
+ return false;
1611
+ }
1612
+ default:
1613
+ CLIENT_ERR ("unexpected algorithm: %d", (int) marking->algorithm);
1614
+ return false;
1615
+ }
1616
+ case MONGOCRYPT_MARKING_FLE1_BY_ID:
1617
+ case MONGOCRYPT_MARKING_FLE1_BY_ALTNAME:
1618
+ return _mongocrypt_fle1_marking_to_ciphertext (
1619
+ kb, marking, ciphertext, status);
1620
+ default:
1621
+ CLIENT_ERR ("unexpected marking type: %d", (int) marking->type);
1622
+ return false;
1623
+ }
1624
+ }