libmongocrypt-helper 1.6.1.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 +15 -1
  988. data.tar.gz.sig +0 -0
  989. metadata +1019 -32
  990. metadata.gz.sig +0 -0
  991. data/so/libmongocrypt.so +0 -0
@@ -0,0 +1,1605 @@
1
+ /*
2
+ * Copyright 2018-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 "mlib/thread.h"
18
+ #include "mlib/path.h"
19
+ #include "mlib/error.h"
20
+
21
+ #include <kms_message/kms_message.h>
22
+ #include <bson/bson.h>
23
+
24
+ #include "mongocrypt-private.h"
25
+ #include "mongocrypt-binary-private.h"
26
+ #include "mongocrypt-cache-collinfo-private.h"
27
+ #include "mongocrypt-cache-key-private.h"
28
+ #include "mongocrypt-config.h"
29
+ #include "mongocrypt-crypto-private.h"
30
+ #include "mongocrypt-log-private.h"
31
+ #include "mongocrypt-mutex-private.h"
32
+ #include "mongocrypt-opts-private.h"
33
+ #include "mongocrypt-status-private.h"
34
+ #include "mongocrypt-util-private.h"
35
+
36
+ /* Assert size for interop with wrapper purposes */
37
+ BSON_STATIC_ASSERT (sizeof (mongocrypt_log_level_t) == 4);
38
+
39
+
40
+ const char *
41
+ mongocrypt_version (uint32_t *len)
42
+ {
43
+ if (len) {
44
+ *len = (uint32_t) strlen (MONGOCRYPT_VERSION);
45
+ }
46
+ return MONGOCRYPT_VERSION;
47
+ }
48
+
49
+
50
+ void
51
+ _mongocrypt_set_error (mongocrypt_status_t *status,
52
+ mongocrypt_status_type_t type,
53
+ uint32_t code,
54
+ const char *format,
55
+ ...)
56
+ {
57
+ va_list args;
58
+ char *prepared_message;
59
+
60
+ if (status) {
61
+ va_start (args, format);
62
+ prepared_message = bson_strdupv_printf (format, args);
63
+ if (!prepared_message) {
64
+ mongocrypt_status_set (status, type, code, "Out of memory", -1);
65
+ } else {
66
+ mongocrypt_status_set (status, type, code, prepared_message, -1);
67
+ bson_free (prepared_message);
68
+ }
69
+ va_end (args);
70
+ }
71
+ }
72
+
73
+
74
+ const char *
75
+ tmp_json (const bson_t *bson)
76
+ {
77
+ static char storage[1024];
78
+ char *json;
79
+
80
+ BSON_ASSERT_PARAM (bson);
81
+
82
+ memset (storage, 0, 1024);
83
+ json = bson_as_canonical_extended_json (bson, NULL);
84
+ bson_snprintf (storage, sizeof (storage), "%s", json);
85
+ bson_free (json);
86
+ return (const char *) storage;
87
+ }
88
+
89
+
90
+ const char *
91
+ tmp_buf (const _mongocrypt_buffer_t *buf)
92
+ {
93
+ static char storage[1024];
94
+ size_t i, n;
95
+
96
+ BSON_ASSERT_PARAM (buf);
97
+
98
+ memset (storage, 0, 1024);
99
+ /* capped at two characters per byte, minus 1 for trailing \0 */
100
+ n = sizeof (storage) / 2 - 1;
101
+ if (buf->len < n) {
102
+ n = buf->len;
103
+ }
104
+
105
+ for (i = 0; i < n; i++) {
106
+ bson_snprintf (storage + (i * 2), 3, "%02x", buf->data[i]);
107
+ }
108
+
109
+ return (const char *) storage;
110
+ }
111
+
112
+ static void
113
+ _mongocrypt_do_init (void)
114
+ {
115
+ (void) kms_message_init ();
116
+ _native_crypto_init ();
117
+ }
118
+
119
+
120
+ mongocrypt_t *
121
+ mongocrypt_new (void)
122
+ {
123
+ mongocrypt_t *crypt;
124
+
125
+ crypt = bson_malloc0 (sizeof (mongocrypt_t));
126
+ BSON_ASSERT (crypt);
127
+ crypt->crypto = bson_malloc0 (sizeof (*crypt->crypto));
128
+ BSON_ASSERT (crypt->crypto);
129
+
130
+ _mongocrypt_mutex_init (&crypt->mutex);
131
+ _mongocrypt_cache_collinfo_init (&crypt->cache_collinfo);
132
+ _mongocrypt_cache_key_init (&crypt->cache_key);
133
+ crypt->status = mongocrypt_status_new ();
134
+ _mongocrypt_opts_init (&crypt->opts);
135
+ _mongocrypt_log_init (&crypt->log);
136
+ crypt->ctx_counter = 1;
137
+ crypt->cache_oauth_azure = _mongocrypt_cache_oauth_new ();
138
+ crypt->cache_oauth_gcp = _mongocrypt_cache_oauth_new ();
139
+ crypt->csfle = (_mongo_crypt_v1_vtable){.okay = false};
140
+
141
+ static mlib_once_flag init_flag = MLIB_ONCE_INITIALIZER;
142
+
143
+ if (!mlib_call_once (&init_flag, _mongocrypt_do_init) ||
144
+ !_native_crypto_initialized) {
145
+ mongocrypt_status_t *status = crypt->status;
146
+
147
+ CLIENT_ERR ("failed to initialize");
148
+ /* Return crypt with failure status so caller can obtain error when
149
+ * calling mongocrypt_init */
150
+ }
151
+
152
+ return crypt;
153
+ }
154
+
155
+
156
+ bool
157
+ mongocrypt_setopt_log_handler (mongocrypt_t *crypt,
158
+ mongocrypt_log_fn_t log_fn,
159
+ void *log_ctx)
160
+ {
161
+ if (!crypt) {
162
+ return false;
163
+ }
164
+
165
+ if (crypt->initialized) {
166
+ mongocrypt_status_t *status = crypt->status;
167
+ CLIENT_ERR ("options cannot be set after initialization");
168
+ return false;
169
+ }
170
+ crypt->opts.log_fn = log_fn;
171
+ crypt->opts.log_ctx = log_ctx;
172
+ return true;
173
+ }
174
+
175
+ bool
176
+ mongocrypt_setopt_kms_provider_aws (mongocrypt_t *crypt,
177
+ const char *aws_access_key_id,
178
+ int32_t aws_access_key_id_len,
179
+ const char *aws_secret_access_key,
180
+ int32_t aws_secret_access_key_len)
181
+ {
182
+ BSON_ASSERT_PARAM (crypt);
183
+
184
+ mongocrypt_status_t *status = crypt->status;
185
+ _mongocrypt_opts_kms_providers_t *const kms_providers =
186
+ &crypt->opts.kms_providers;
187
+
188
+ if (crypt->initialized) {
189
+ CLIENT_ERR ("options cannot be set after initialization");
190
+ return false;
191
+ }
192
+
193
+ if (0 !=
194
+ (kms_providers->configured_providers & MONGOCRYPT_KMS_PROVIDER_AWS)) {
195
+ CLIENT_ERR ("aws kms provider already set");
196
+ return false;
197
+ }
198
+
199
+ if (!_mongocrypt_validate_and_copy_string (
200
+ aws_access_key_id,
201
+ aws_access_key_id_len,
202
+ &kms_providers->aws.access_key_id)) {
203
+ CLIENT_ERR ("invalid aws access key id");
204
+ return false;
205
+ }
206
+
207
+ if (!_mongocrypt_validate_and_copy_string (
208
+ aws_secret_access_key,
209
+ aws_secret_access_key_len,
210
+ &kms_providers->aws.secret_access_key)) {
211
+ CLIENT_ERR ("invalid aws secret access key");
212
+ return false;
213
+ }
214
+
215
+ if (crypt->log.trace_enabled) {
216
+ _mongocrypt_log (&crypt->log,
217
+ MONGOCRYPT_LOG_LEVEL_TRACE,
218
+ "%s (%s=\"%s\", %s=%d, %s=\"%s\", %s=%d)",
219
+ BSON_FUNC,
220
+ "aws_access_key_id",
221
+ kms_providers->aws.access_key_id,
222
+ "aws_access_key_id_len",
223
+ aws_access_key_id_len,
224
+ "aws_secret_access_key",
225
+ kms_providers->aws.secret_access_key,
226
+ "aws_secret_access_key_len",
227
+ aws_secret_access_key_len);
228
+ }
229
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_AWS;
230
+ return true;
231
+ }
232
+
233
+ char *
234
+ _mongocrypt_new_string_from_bytes (const void *in, int len)
235
+ {
236
+ const int max_bytes = 100;
237
+ const int chars_per_byte = 2;
238
+ int out_size = max_bytes * chars_per_byte;
239
+ const unsigned char *src = in;
240
+ char *out;
241
+ char *ret;
242
+
243
+ out_size += len > max_bytes ? (int) sizeof ("...") : 1 /* for null */;
244
+ out = bson_malloc0 ((size_t) out_size);
245
+ BSON_ASSERT (out);
246
+
247
+ ret = out;
248
+
249
+ for (int i = 0; i < len && i < max_bytes; i++, out += chars_per_byte) {
250
+ sprintf (out, "%02X", src[i]);
251
+ }
252
+
253
+ sprintf (out, (len > max_bytes) ? "..." : "");
254
+ return ret;
255
+ }
256
+
257
+ char *
258
+ _mongocrypt_new_json_string_from_binary (mongocrypt_binary_t *binary)
259
+ {
260
+ bson_t bson;
261
+ uint32_t len;
262
+
263
+ BSON_ASSERT_PARAM (binary);
264
+
265
+ if (!_mongocrypt_binary_to_bson (binary, &bson) ||
266
+ !bson_validate (&bson, BSON_VALIDATE_NONE, NULL)) {
267
+ char *hex;
268
+ char *full_str;
269
+
270
+ BSON_ASSERT (binary->len <= (uint32_t) INT_MAX);
271
+ hex = _mongocrypt_new_string_from_bytes (binary->data, (int) binary->len);
272
+ full_str = bson_strdup_printf ("(malformed) %s", hex);
273
+ bson_free (hex);
274
+ return full_str;
275
+ }
276
+ return bson_as_canonical_extended_json (&bson, (size_t *) &len);
277
+ }
278
+
279
+ bool
280
+ mongocrypt_setopt_schema_map (mongocrypt_t *crypt,
281
+ mongocrypt_binary_t *schema_map)
282
+ {
283
+ BSON_ASSERT_PARAM (crypt);
284
+
285
+ bson_t tmp;
286
+ bson_error_t bson_err;
287
+ mongocrypt_status_t *status = crypt->status;
288
+
289
+ if (crypt->initialized) {
290
+ CLIENT_ERR ("options cannot be set after initialization");
291
+ return false;
292
+ }
293
+
294
+ if (!schema_map || !mongocrypt_binary_data (schema_map)) {
295
+ CLIENT_ERR ("passed null schema map");
296
+ return false;
297
+ }
298
+
299
+ if (!_mongocrypt_buffer_empty (&crypt->opts.schema_map)) {
300
+ CLIENT_ERR ("already set schema map");
301
+ return false;
302
+ }
303
+
304
+ _mongocrypt_buffer_copy_from_binary (&crypt->opts.schema_map, schema_map);
305
+
306
+ /* validate bson */
307
+ if (!_mongocrypt_buffer_to_bson (&crypt->opts.schema_map, &tmp)) {
308
+ CLIENT_ERR ("invalid bson");
309
+ return false;
310
+ }
311
+
312
+ if (!bson_validate_with_error (&tmp, BSON_VALIDATE_NONE, &bson_err)) {
313
+ CLIENT_ERR ("%s", bson_err.message);
314
+ return false;
315
+ }
316
+
317
+ return true;
318
+ }
319
+
320
+ bool
321
+ mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt,
322
+ mongocrypt_binary_t *efc_map)
323
+ {
324
+ BSON_ASSERT_PARAM (crypt);
325
+
326
+ mongocrypt_status_t *status = crypt->status;
327
+ bson_t as_bson;
328
+ bson_error_t bson_err;
329
+
330
+ if (crypt->initialized) {
331
+ CLIENT_ERR ("options cannot be set after initialization");
332
+ return false;
333
+ }
334
+
335
+ if (!efc_map || !mongocrypt_binary_data (efc_map)) {
336
+ CLIENT_ERR ("passed null encrypted_field_config_map");
337
+ return false;
338
+ }
339
+
340
+ if (!_mongocrypt_buffer_empty (&crypt->opts.encrypted_field_config_map)) {
341
+ CLIENT_ERR ("already set encrypted_field_config_map");
342
+ return false;
343
+ }
344
+
345
+ _mongocrypt_buffer_copy_from_binary (&crypt->opts.encrypted_field_config_map,
346
+ efc_map);
347
+
348
+ /* validate bson */
349
+ if (!_mongocrypt_buffer_to_bson (&crypt->opts.encrypted_field_config_map,
350
+ &as_bson)) {
351
+ CLIENT_ERR ("invalid bson");
352
+ return false;
353
+ }
354
+
355
+ if (!bson_validate_with_error (&as_bson, BSON_VALIDATE_NONE, &bson_err)) {
356
+ CLIENT_ERR ("%s", bson_err.message);
357
+ return false;
358
+ }
359
+
360
+ return true;
361
+ }
362
+
363
+ bool
364
+ mongocrypt_setopt_kms_provider_local (mongocrypt_t *crypt,
365
+ mongocrypt_binary_t *key)
366
+ {
367
+ BSON_ASSERT_PARAM (crypt);
368
+
369
+ mongocrypt_status_t *status = crypt->status;
370
+ _mongocrypt_opts_kms_providers_t *const kms_providers =
371
+ &crypt->opts.kms_providers;
372
+
373
+ if (crypt->initialized) {
374
+ CLIENT_ERR ("options cannot be set after initialization");
375
+ return false;
376
+ }
377
+
378
+ if (0 !=
379
+ (kms_providers->configured_providers & MONGOCRYPT_KMS_PROVIDER_LOCAL)) {
380
+ CLIENT_ERR ("local kms provider already set");
381
+ return false;
382
+ }
383
+
384
+ if (!key) {
385
+ CLIENT_ERR ("passed null key");
386
+ return false;
387
+ }
388
+
389
+ if (mongocrypt_binary_len (key) != MONGOCRYPT_KEY_LEN) {
390
+ CLIENT_ERR ("local key must be %d bytes", MONGOCRYPT_KEY_LEN);
391
+ return false;
392
+ }
393
+
394
+ if (crypt->log.trace_enabled) {
395
+ char *key_val;
396
+ BSON_ASSERT (key->len <= (uint32_t) INT_MAX);
397
+ key_val = _mongocrypt_new_string_from_bytes (key->data, (int) key->len);
398
+
399
+ _mongocrypt_log (&crypt->log,
400
+ MONGOCRYPT_LOG_LEVEL_TRACE,
401
+ "%s (%s=\"%s\")",
402
+ BSON_FUNC,
403
+ "key",
404
+ key_val);
405
+ bson_free (key_val);
406
+ }
407
+
408
+ _mongocrypt_buffer_copy_from_binary (&kms_providers->local.key, key);
409
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_LOCAL;
410
+ return true;
411
+ }
412
+
413
+ typedef struct {
414
+ /// Whether the load is successful
415
+ bool okay;
416
+ /// The DLL handle to the opened library.
417
+ mcr_dll lib;
418
+ /// A vtable for the functions in the DLL
419
+ _mongo_crypt_v1_vtable vtable;
420
+ } _loaded_csfle;
421
+
422
+ /**
423
+ * @brief Attempt to open the CSFLE dynamic library and initialize a vtable for
424
+ * it.
425
+ */
426
+ static _loaded_csfle
427
+ _try_load_csfle (const char *filepath, _mongocrypt_log_t *log)
428
+ {
429
+ // Try to open the dynamic lib
430
+ mcr_dll lib = mcr_dll_open (filepath);
431
+ // Check for errors, which are represented by strings
432
+ if (lib.error_string.data) {
433
+ // Error opening candidate
434
+ _mongocrypt_log (
435
+ log,
436
+ MONGOCRYPT_LOG_LEVEL_WARNING,
437
+ "Error while opening candidate for CSFLE dynamic library [%s]: %s",
438
+ filepath,
439
+ lib.error_string.data);
440
+ // Free resources, which will include the error string
441
+ mcr_dll_close (lib);
442
+ // Bad:
443
+ return (_loaded_csfle){.okay = false};
444
+ }
445
+
446
+ // Successfully opened DLL
447
+ _mongocrypt_log (log,
448
+ MONGOCRYPT_LOG_LEVEL_TRACE,
449
+ "Loading CSFLE dynamic library [%s]",
450
+ filepath);
451
+
452
+ // Construct the library vtable
453
+ _mongo_crypt_v1_vtable vtable = {.okay = true};
454
+ #define X_FUNC(Name, RetType, ...) \
455
+ { \
456
+ /* Symbol names are qualified by the lib name and version: */ \
457
+ const char *symname = "mongo_crypt_v1_" #Name; \
458
+ vtable.Name = mcr_dll_sym (lib, symname); \
459
+ if (vtable.Name == NULL) { \
460
+ /* The requested symbol is not present */ \
461
+ _mongocrypt_log ( \
462
+ log, \
463
+ MONGOCRYPT_LOG_LEVEL_ERROR, \
464
+ "Missing required symbol '%s' from CSFLE dynamic library [%s]", \
465
+ symname, \
466
+ filepath); \
467
+ /* Mark the vtable as broken, but keep trying to load more symbols to \
468
+ * produce error messages for all missing symbols */ \
469
+ vtable.okay = false; \
470
+ } \
471
+ }
472
+ MONGOC_CSFLE_FUNCTIONS_X
473
+ #undef X_FUNC
474
+
475
+ if (!vtable.okay) {
476
+ mcr_dll_close (lib);
477
+ _mongocrypt_log (
478
+ log,
479
+ MONGOCRYPT_LOG_LEVEL_ERROR,
480
+ "One or more required symbols are missing from CSFLE dynamic library "
481
+ "[%s], so this dynamic library will not be used.",
482
+ filepath);
483
+ return (_loaded_csfle){.okay = false};
484
+ }
485
+
486
+ // Success!
487
+ _mongocrypt_log (log,
488
+ MONGOCRYPT_LOG_LEVEL_INFO,
489
+ "Opened CSFLE dynamic library [%s]",
490
+ filepath);
491
+ return (_loaded_csfle){.okay = true, .lib = lib, .vtable = vtable};
492
+ }
493
+
494
+ /**
495
+ * @brief If the leading path element in `filepath` is $ORIGIN, replace that
496
+ * with the directory containing the current executing module.
497
+ *
498
+ * @return true If no error occurred and the path is valid
499
+ * @return false If there was an error and `filepath` cannot be processed
500
+ */
501
+ static bool
502
+ _try_replace_dollar_origin (mstr *filepath, _mongocrypt_log_t *log)
503
+ {
504
+ const mstr_view dollar_origin = mstrv_lit ("$ORIGIN");
505
+
506
+ BSON_ASSERT_PARAM (filepath);
507
+
508
+ if (!mstr_starts_with (filepath->view, dollar_origin)) {
509
+ // Nothing to replace
510
+ return true;
511
+ }
512
+ // Check that the next char is a path separator or end-of-string:
513
+ char peek = filepath->data[dollar_origin.len];
514
+ if (peek != 0 && !mpath_is_sep (peek, MPATH_NATIVE)) {
515
+ // Not a single path element
516
+ return true;
517
+ }
518
+ // Replace $ORIGIN with the directory of the current module
519
+ const current_module_result self_exe_r = current_module_path ();
520
+ if (self_exe_r.error) {
521
+ // Failed to get the current module to load replace $ORIGIN
522
+ mstr error = merror_system_error_string (self_exe_r.error);
523
+ _mongocrypt_log (log,
524
+ MONGOCRYPT_LOG_LEVEL_WARNING,
525
+ "Error while loading the executable module path for "
526
+ "substitution of $ORIGIN in CSFLE search path [%s]: %s",
527
+ filepath->data,
528
+ error.data);
529
+ mstr_free (error);
530
+ return false;
531
+ }
532
+ const mstr_view self_dir = mpath_parent (self_exe_r.path.view, MPATH_NATIVE);
533
+ mstr_inplace_splice (filepath, 0, dollar_origin.len, self_dir);
534
+ mstr_free (self_exe_r.path);
535
+ return true;
536
+ }
537
+
538
+ static _loaded_csfle
539
+ _try_find_csfle (mongocrypt_t *crypt)
540
+ {
541
+ _loaded_csfle candidate_csfle = {0};
542
+ mstr csfle_cand_filepath = MSTR_NULL;
543
+
544
+ BSON_ASSERT_PARAM (crypt);
545
+
546
+ if (crypt->opts.crypt_shared_lib_override_path.data) {
547
+ // If an override path was specified, skip the library searching behavior
548
+ csfle_cand_filepath =
549
+ mstr_copy (crypt->opts.crypt_shared_lib_override_path.view);
550
+ if (_try_replace_dollar_origin (&csfle_cand_filepath, &crypt->log)) {
551
+ // Succesfully substituted $ORIGIN
552
+ // Do not allow a plain filename to go through, as that will cause the
553
+ // DLL load to search the system.
554
+ mstr_assign (&csfle_cand_filepath,
555
+ mpath_absolute (csfle_cand_filepath.view, MPATH_NATIVE));
556
+ candidate_csfle =
557
+ _try_load_csfle (csfle_cand_filepath.data, &crypt->log);
558
+ }
559
+ } else {
560
+ // No override path was specified, so try to find it on the provided
561
+ // search paths.
562
+ for (int i = 0; i < crypt->opts.n_crypt_shared_lib_search_paths; ++i) {
563
+ mstr_view cand_dir = crypt->opts.crypt_shared_lib_search_paths[i].view;
564
+ mstr_view csfle_filename = mstrv_lit ("mongo_crypt_v1" MCR_DLL_SUFFIX);
565
+ if (mstr_eq (cand_dir, mstrv_lit ("$SYSTEM"))) {
566
+ // Caller wants us to search for the library on the system's default
567
+ // library paths. Pass only the library's filename to cause dll_open
568
+ // to search on the library paths.
569
+ mstr_assign (&csfle_cand_filepath, mstr_copy (csfle_filename));
570
+ } else {
571
+ // Compose the candidate filepath:
572
+ mstr_assign (&csfle_cand_filepath,
573
+ mpath_join (cand_dir, csfle_filename, MPATH_NATIVE));
574
+ if (!_try_replace_dollar_origin (&csfle_cand_filepath,
575
+ &crypt->log)) {
576
+ // Error while substituting $ORIGIN
577
+ continue;
578
+ }
579
+ }
580
+ // Try to load the file:
581
+ candidate_csfle =
582
+ _try_load_csfle (csfle_cand_filepath.data, &crypt->log);
583
+ if (candidate_csfle.okay) {
584
+ // Stop searching:
585
+ break;
586
+ }
587
+ }
588
+ }
589
+
590
+ mstr_free (csfle_cand_filepath);
591
+ return candidate_csfle;
592
+ }
593
+
594
+
595
+ /// Global state for the application's csfle library
596
+ typedef struct csfle_global_lib_state {
597
+ /// Synchronization around the reference count:
598
+ mongocrypt_mutex_t mtx;
599
+ int refcount;
600
+ /// The open library handle:
601
+ mcr_dll dll;
602
+ /// vtable for the APIs:
603
+ _mongo_crypt_v1_vtable vtable;
604
+ /// The global library state managed by the csfle library:
605
+ mongo_crypt_v1_lib *csfle_lib;
606
+ } csfle_global_lib_state;
607
+
608
+ csfle_global_lib_state g_csfle_state;
609
+
610
+ static void
611
+ init_csfle_state (void)
612
+ {
613
+ _mongocrypt_mutex_init (&g_csfle_state.mtx);
614
+ }
615
+ mlib_once_flag g_csfle_init_flag = MLIB_ONCE_INITIALIZER;
616
+
617
+ /**
618
+ * @brief Verify that `found` refers to the same library that is globally loaded
619
+ * for the application.
620
+ *
621
+ * @param crypt The requesting mongocrypt_t. Error information may be set
622
+ * through here.
623
+ * @param found The result of _try_load_csfle()
624
+ * @return true If `found` matches the global state
625
+ * @return false Otherwise
626
+ *
627
+ * @note This function assumes that the global csfle state is valid and will not
628
+ * be destroyed by any other thread. (One must hold the reference count >= 1)
629
+ */
630
+ static bool
631
+ _validate_csfle_singleton (mongocrypt_t *crypt, _loaded_csfle found)
632
+ {
633
+ mongocrypt_status_t *status;
634
+
635
+ BSON_ASSERT_PARAM (crypt);
636
+
637
+ status = crypt->status;
638
+
639
+ // Path to the existing loaded csfle:
640
+ mcr_dll_path_result existing_path_ = mcr_dll_path (g_csfle_state.dll);
641
+ assert (existing_path_.path.data &&
642
+ "Failed to get path to already-loaded csfle library");
643
+ mstr_view existing_path = existing_path_.path.view;
644
+ bool okay = true;
645
+ if (!found.okay) {
646
+ // There is one loaded, but we failed to find that same library. Error:
647
+ CLIENT_ERR ("An existing CSFLE library is loaded by the application at "
648
+ "[%s], but the current call to mongocrypt_init() failed to "
649
+ "find that same library.",
650
+ existing_path.data);
651
+ okay = false;
652
+ } else {
653
+ // Get the path to what we found:
654
+ mcr_dll_path_result found_path = mcr_dll_path (found.lib);
655
+ assert (found_path.path.data &&
656
+ "Failed to get the dynamic library filepath of the library that "
657
+ "was loaded for csfle");
658
+ if (!mstr_eq (found_path.path.view, existing_path)) {
659
+ // Our find-result should only ever find the existing same library.
660
+ // Error:
661
+ CLIENT_ERR (
662
+ "An existing CSFLE library is loaded by the application at [%s], "
663
+ "but the current call to mongocrypt_init() attempted to load a "
664
+ "second CSFLE library from [%s]. This is not allowed.",
665
+ existing_path.data,
666
+ found_path.path.data);
667
+ okay = false;
668
+ }
669
+ mstr_free (found_path.path);
670
+ mstr_free (found_path.error_string);
671
+ }
672
+
673
+ mstr_free (existing_path_.path);
674
+ mstr_free (existing_path_.error_string);
675
+ return okay;
676
+ }
677
+
678
+ /**
679
+ * @brief Drop a reference count to the global csfle loaded library.
680
+ *
681
+ * This should be called as part of mongocrypt_t destruction following a
682
+ * successful loading of csfle.
683
+ */
684
+ static void
685
+ _csfle_drop_global_ref (void)
686
+ {
687
+ mlib_call_once (&g_csfle_init_flag, init_csfle_state);
688
+
689
+ bool dropped_last_ref = false;
690
+ csfle_global_lib_state old_state = {.refcount = 0};
691
+ MONGOCRYPT_WITH_MUTEX (g_csfle_state.mtx)
692
+ {
693
+ assert (g_csfle_state.refcount > 0);
694
+ int new_rc = --g_csfle_state.refcount;
695
+ if (new_rc == 0) {
696
+ old_state = g_csfle_state;
697
+ dropped_last_ref = true;
698
+ }
699
+ }
700
+
701
+ if (dropped_last_ref) {
702
+ mongo_crypt_v1_status *status = old_state.vtable.status_create ();
703
+ const int destroy_rc =
704
+ old_state.vtable.lib_destroy (old_state.csfle_lib, status);
705
+ if (destroy_rc != MONGO_CRYPT_V1_SUCCESS && status) {
706
+ fprintf (stderr,
707
+ "csfle lib_destroy() failed: %s [Error %d, code %d]\n",
708
+ old_state.vtable.status_get_explanation (status),
709
+ old_state.vtable.status_get_error (status),
710
+ old_state.vtable.status_get_code (status));
711
+ }
712
+ old_state.vtable.status_destroy (status);
713
+
714
+ #ifndef __linux__
715
+ mcr_dll_close (old_state.dll);
716
+ #endif
717
+ /// NOTE: On Linux, skip closing the CSFLE library itself, since a bug in
718
+ /// the way ld-linux and GCC interact causes static destructors to not run
719
+ /// during dlclose(). Still, free the error string:
720
+ mstr_free (old_state.dll.error_string);
721
+ }
722
+ }
723
+
724
+ /**
725
+ * @brief Following a call to _try_find_csfle, reconcile the result with the
726
+ * current application-global csfle status.
727
+ *
728
+ * csfle contains global state that can only be loaded once for the entire
729
+ * application. For this reason, there is a global object that manages the
730
+ * loaded library. Attempts to create more than one mongocrypt_t that all
731
+ * request csfle requires that all instances attempt to open the same csfle
732
+ * library.
733
+ *
734
+ * This function checks if there is already a csfle loaded for the process. If
735
+ * there is, we validate that the given find-result found the same library
736
+ * that is already loaded. If not, then this function sets an error and returns
737
+ * `false`.
738
+ *
739
+ * If there was no prior loaded csfle and the find-result indicates that it
740
+ * found the library, this function will store the find-result in the global
741
+ * state for later calls to mongocrypt_init() that request csfle.
742
+ *
743
+ * This function performs reference counting on the global state. Following a
744
+ * successful call to this function (i.e. it returns `true`), one must have a
745
+ * corresponding call to _csfle_drop_global_ref(), which will release the
746
+ * resources acquired by this function.
747
+ *
748
+ * @param crypt The requesting mongocrypt_t instance. An error may be set
749
+ * through this object.
750
+ * @param found The result of _try_find_csfle().
751
+ * @return true Upon success AND `found->okay`
752
+ * @return false Otherwise.
753
+ *
754
+ * @note If there was no prior global state loaded, this function will steal
755
+ * the library referenced by `found`. The caller should release `found->lib`
756
+ * regardless.
757
+ */
758
+ static bool
759
+ _csfle_replace_or_take_validate_singleton (mongocrypt_t *crypt,
760
+ _loaded_csfle *found)
761
+ {
762
+ mlib_call_once (&g_csfle_init_flag, init_csfle_state);
763
+
764
+ // If we have a loaded library, create a csfle_status object to use with
765
+ // lib_create
766
+ mongo_crypt_v1_status *csfle_status = NULL;
767
+
768
+ BSON_ASSERT_PARAM (crypt);
769
+ BSON_ASSERT_PARAM (found);
770
+
771
+ if (found->okay) {
772
+ // Create the status. Note that this may fail, so do not assume
773
+ // csfle_status is non-null.
774
+ csfle_status = found->vtable.status_create ();
775
+ }
776
+
777
+ /**
778
+ * Atomically:
779
+ *
780
+ * 1. If there is an existing global library, increment its reference count.
781
+ * 2. Otherwise, if we have successfully loaded a new csfle, replace the
782
+ * global library and set its reference count to 1.
783
+ * 3. Otherwise, do nothing.
784
+ */
785
+ enum {
786
+ TOOK_REFERENCE,
787
+ DID_NOTHING,
788
+ REPLACED_GLOBAL,
789
+ LIB_CREATE_FAILED,
790
+ } action;
791
+ MONGOCRYPT_WITH_MUTEX (g_csfle_state.mtx)
792
+ {
793
+ if (g_csfle_state.refcount) {
794
+ // Increment the refcount to prevent the global csfle library from
795
+ // disappearing
796
+ ++g_csfle_state.refcount;
797
+ action = TOOK_REFERENCE;
798
+ } else if (found->okay) {
799
+ // We have found csfle, and no one else is holding one. Our result will
800
+ // now become the global result.
801
+ // Create the single csfle_lib object for the application:
802
+ mongo_crypt_v1_lib *csfle_lib =
803
+ found->vtable.lib_create (csfle_status);
804
+ if (csfle_lib == NULL) {
805
+ // Creation failed:
806
+ action = LIB_CREATE_FAILED;
807
+ } else {
808
+ // Creation succeeded: Store the result:
809
+ g_csfle_state.dll = found->lib;
810
+ g_csfle_state.vtable = found->vtable;
811
+ g_csfle_state.csfle_lib = csfle_lib;
812
+ g_csfle_state.refcount = 1;
813
+ action = REPLACED_GLOBAL;
814
+ }
815
+ } else {
816
+ // We failed to load the library, and no one else has one either.
817
+ // Nothing to do.
818
+ action = DID_NOTHING;
819
+ }
820
+ }
821
+
822
+ // Get the possible failure status information.
823
+ mstr message = MSTR_NULL;
824
+ int err = 0;
825
+ int code = 0;
826
+ if (csfle_status) {
827
+ assert (found->okay);
828
+ message =
829
+ mstr_copy_cstr (found->vtable.status_get_explanation (csfle_status));
830
+ err = found->vtable.status_get_error (csfle_status);
831
+ code = found->vtable.status_get_code (csfle_status);
832
+ found->vtable.status_destroy (csfle_status);
833
+ }
834
+
835
+ bool have_csfle = true;
836
+ switch (action) {
837
+ case TOOK_REFERENCE: {
838
+ const bool is_valid = _validate_csfle_singleton (crypt, *found);
839
+ if (!is_valid) {
840
+ // We've failed validation, so we're not going to continue to
841
+ // reference the global instance it. Drop it now:
842
+ _csfle_drop_global_ref ();
843
+ }
844
+ have_csfle = is_valid;
845
+ break;
846
+ }
847
+ case REPLACED_GLOBAL:
848
+ // Reset the library in the caller so they can't unload the DLL. The DLL
849
+ // is now managed in the global variable.
850
+ found->lib = MCR_DLL_NULL;
851
+ _mongocrypt_log (&crypt->log,
852
+ MONGOCRYPT_LOG_LEVEL_TRACE,
853
+ "Loading new csfle library for the application.");
854
+ have_csfle = true;
855
+ break;
856
+ case LIB_CREATE_FAILED:
857
+ if (!message.data) {
858
+ // We failed to obtain a message about the failure
859
+ _mongocrypt_set_error (crypt->status,
860
+ MONGOCRYPT_STATUS_ERROR_CRYPT_SHARED,
861
+ MONGOCRYPT_GENERIC_ERROR_CODE,
862
+ "csfle lib_create() failed");
863
+ } else {
864
+ // Record the message, error, and code from csfle about the failure
865
+ _mongocrypt_set_error (
866
+ crypt->status,
867
+ MONGOCRYPT_STATUS_ERROR_CRYPT_SHARED,
868
+ MONGOCRYPT_GENERIC_ERROR_CODE,
869
+ "csfle lib_create() failed: %s [Error %d, code %d]",
870
+ message.data,
871
+ err,
872
+ code);
873
+ }
874
+ have_csfle = false;
875
+ break;
876
+ case DID_NOTHING:
877
+ default:
878
+ have_csfle = false;
879
+ break;
880
+ }
881
+
882
+ mstr_free (message);
883
+ return have_csfle;
884
+ }
885
+
886
+ /**
887
+ * @return true If the given mongocrypt wants csfle
888
+ * @return false Otherwise
889
+ *
890
+ * @note "Requesting csfle" means that it has set at least one search path OR
891
+ * has set the override path
892
+ */
893
+ static bool
894
+ _wants_csfle (mongocrypt_t *c)
895
+ {
896
+ BSON_ASSERT_PARAM (c);
897
+
898
+ if (c->opts.bypass_query_analysis) {
899
+ return false;
900
+ }
901
+ return c->opts.n_crypt_shared_lib_search_paths != 0 ||
902
+ c->opts.crypt_shared_lib_override_path.data != NULL;
903
+ }
904
+
905
+ /**
906
+ * @brief Try to enable csfle for the given mongocrypt
907
+ *
908
+ * @param crypt The crypt object for which we should enable csfle
909
+ * @return true If no errors occurred
910
+ * @return false Otherwise
911
+ *
912
+ * @note Returns `true` even if loading fails to find the csfle library on the
913
+ * requested paths. `false` is only for hard-errors, which includes failure to
914
+ * load from the override path.
915
+ */
916
+ static bool
917
+ _try_enable_csfle (mongocrypt_t *crypt)
918
+ {
919
+ mongocrypt_status_t *status;
920
+ _loaded_csfle found;
921
+
922
+ BSON_ASSERT_PARAM (crypt);
923
+
924
+ found = _try_find_csfle (crypt);
925
+
926
+ status = crypt->status;
927
+
928
+ // If a crypt_shared override path was specified, but we did not succeed in
929
+ // loading crypt_shared, that is a hard-error.
930
+ if (crypt->opts.crypt_shared_lib_override_path.data && !found.okay) {
931
+ CLIENT_ERR (
932
+ "A crypt_shared override path was specified [%s], but we failed to "
933
+ "open a dynamic library at that location",
934
+ crypt->opts.crypt_shared_lib_override_path.data);
935
+ return false;
936
+ }
937
+
938
+ // Attempt to validate the try-find result against the global state:
939
+ const bool got_csfle =
940
+ _csfle_replace_or_take_validate_singleton (crypt, &found);
941
+ // Close the lib we found (may have been stolen in validate_singleton())
942
+ mcr_dll_close (found.lib);
943
+
944
+ if (got_csfle) {
945
+ crypt->csfle = g_csfle_state.vtable;
946
+ crypt->csfle_lib = g_csfle_state.csfle_lib;
947
+ }
948
+ // In cast of failure, validate_singleton() will set a non-ok status.
949
+ return mongocrypt_status_type (status) == MONGOCRYPT_STATUS_OK;
950
+ }
951
+
952
+ bool
953
+ mongocrypt_init (mongocrypt_t *crypt)
954
+ {
955
+ BSON_ASSERT_PARAM (crypt);
956
+
957
+ mongocrypt_status_t *status = crypt->status;
958
+ if (crypt->initialized) {
959
+ CLIENT_ERR ("already initialized");
960
+ return false;
961
+ }
962
+
963
+ crypt->initialized = true;
964
+
965
+ if (!mongocrypt_status_ok (crypt->status)) {
966
+ return false;
967
+ }
968
+
969
+ if (!_mongocrypt_opts_validate (&crypt->opts, status)) {
970
+ return false;
971
+ }
972
+
973
+ if (crypt->opts.log_fn) {
974
+ _mongocrypt_log_set_fn (
975
+ &crypt->log, crypt->opts.log_fn, crypt->opts.log_ctx);
976
+ }
977
+
978
+ if (!crypt->crypto) {
979
+ #ifndef MONGOCRYPT_ENABLE_CRYPTO
980
+ CLIENT_ERR ("libmongocrypt built with native crypto disabled. crypto "
981
+ "hooks required");
982
+ return false;
983
+ #else
984
+ /* set default hooks. */
985
+ crypt->crypto = bson_malloc0 (sizeof (*crypt->crypto));
986
+ BSON_ASSERT (crypt->crypto);
987
+ #endif
988
+ }
989
+
990
+ if (!_wants_csfle (crypt)) {
991
+ // User does not want csfle. Just succeed.
992
+ return true;
993
+ }
994
+
995
+ return _try_enable_csfle (crypt);
996
+ }
997
+
998
+
999
+ bool
1000
+ mongocrypt_status (mongocrypt_t *crypt, mongocrypt_status_t *out)
1001
+ {
1002
+ BSON_ASSERT_PARAM (crypt);
1003
+
1004
+ if (!out) {
1005
+ mongocrypt_status_t *status = crypt->status;
1006
+ CLIENT_ERR ("argument 'out' is required");
1007
+ return false;
1008
+ }
1009
+
1010
+ if (!mongocrypt_status_ok (crypt->status)) {
1011
+ _mongocrypt_status_copy_to (crypt->status, out);
1012
+ return false;
1013
+ }
1014
+ _mongocrypt_status_reset (out);
1015
+ return true;
1016
+ }
1017
+
1018
+
1019
+ void
1020
+ mongocrypt_destroy (mongocrypt_t *crypt)
1021
+ {
1022
+ if (!crypt) {
1023
+ return;
1024
+ }
1025
+ _mongocrypt_opts_cleanup (&crypt->opts);
1026
+ _mongocrypt_cache_cleanup (&crypt->cache_collinfo);
1027
+ _mongocrypt_cache_cleanup (&crypt->cache_key);
1028
+ _mongocrypt_mutex_cleanup (&crypt->mutex);
1029
+ _mongocrypt_log_cleanup (&crypt->log);
1030
+ mongocrypt_status_destroy (crypt->status);
1031
+ bson_free (crypt->crypto);
1032
+ _mongocrypt_cache_oauth_destroy (crypt->cache_oauth_azure);
1033
+ _mongocrypt_cache_oauth_destroy (crypt->cache_oauth_gcp);
1034
+
1035
+ if (crypt->csfle.okay) {
1036
+ _csfle_drop_global_ref ();
1037
+ crypt->csfle.okay = false;
1038
+ }
1039
+
1040
+
1041
+ bson_free (crypt);
1042
+ }
1043
+
1044
+
1045
+ const char *
1046
+ mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt,
1047
+ uint32_t *len)
1048
+ {
1049
+ BSON_ASSERT_PARAM (crypt);
1050
+
1051
+ if (!crypt->csfle.okay) {
1052
+ if (len) {
1053
+ *len = 0;
1054
+ }
1055
+ return NULL;
1056
+ }
1057
+ const char *version = crypt->csfle.get_version_str ();
1058
+ if (len) {
1059
+ *len = (uint32_t) (strlen (version));
1060
+ }
1061
+ return version;
1062
+ }
1063
+
1064
+ uint64_t
1065
+ mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt)
1066
+ {
1067
+ BSON_ASSERT_PARAM (crypt);
1068
+
1069
+ if (!crypt->csfle.okay) {
1070
+ return 0;
1071
+ }
1072
+ return crypt->csfle.get_version ();
1073
+ }
1074
+
1075
+
1076
+ bool
1077
+ _mongocrypt_validate_and_copy_string (const char *in,
1078
+ int32_t in_len,
1079
+ char **out)
1080
+ {
1081
+ BSON_ASSERT_PARAM (out);
1082
+
1083
+ if (!in || in_len < -1) {
1084
+ return false;
1085
+ }
1086
+
1087
+ const size_t len = in_len < 0 ? strlen (in) : (size_t) in_len;
1088
+
1089
+ if (!bson_utf8_validate (in, len, false)) {
1090
+ return false;
1091
+ }
1092
+ *out = bson_strndup (in, len);
1093
+ return true;
1094
+ }
1095
+
1096
+
1097
+ bool
1098
+ mongocrypt_setopt_crypto_hooks (mongocrypt_t *crypt,
1099
+ mongocrypt_crypto_fn aes_256_cbc_encrypt,
1100
+ mongocrypt_crypto_fn aes_256_cbc_decrypt,
1101
+ mongocrypt_random_fn random,
1102
+ mongocrypt_hmac_fn hmac_sha_512,
1103
+ mongocrypt_hmac_fn hmac_sha_256,
1104
+ mongocrypt_hash_fn sha_256,
1105
+ void *ctx)
1106
+ {
1107
+ BSON_ASSERT_PARAM (crypt);
1108
+
1109
+ mongocrypt_status_t *status = crypt->status;
1110
+
1111
+ if (crypt->initialized) {
1112
+ CLIENT_ERR ("options cannot be set after initialization");
1113
+ return false;
1114
+ }
1115
+
1116
+ if (!crypt->crypto) {
1117
+ crypt->crypto = bson_malloc0 (sizeof (*crypt->crypto));
1118
+ BSON_ASSERT (crypt->crypto);
1119
+ }
1120
+
1121
+ crypt->crypto->hooks_enabled = true;
1122
+ crypt->crypto->ctx = ctx;
1123
+
1124
+ if (!aes_256_cbc_encrypt) {
1125
+ CLIENT_ERR ("aes_256_cbc_encrypt not set");
1126
+ return false;
1127
+ }
1128
+ crypt->crypto->aes_256_cbc_encrypt = aes_256_cbc_encrypt;
1129
+
1130
+ if (!aes_256_cbc_decrypt) {
1131
+ CLIENT_ERR ("aes_256_cbc_decrypt not set");
1132
+ return false;
1133
+ }
1134
+ crypt->crypto->aes_256_cbc_decrypt = aes_256_cbc_decrypt;
1135
+
1136
+ if (!random) {
1137
+ CLIENT_ERR ("random not set");
1138
+ return false;
1139
+ }
1140
+ crypt->crypto->random = random;
1141
+
1142
+ if (!hmac_sha_512) {
1143
+ CLIENT_ERR ("hmac_sha_512 not set");
1144
+ return false;
1145
+ }
1146
+ crypt->crypto->hmac_sha_512 = hmac_sha_512;
1147
+
1148
+ if (!hmac_sha_256) {
1149
+ CLIENT_ERR ("hmac_sha_256 not set");
1150
+ return false;
1151
+ }
1152
+ crypt->crypto->hmac_sha_256 = hmac_sha_256;
1153
+
1154
+ if (!sha_256) {
1155
+ CLIENT_ERR ("sha_256 not set");
1156
+ return false;
1157
+ }
1158
+ crypt->crypto->sha_256 = sha_256;
1159
+
1160
+ return true;
1161
+ }
1162
+
1163
+ bool
1164
+ mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5 (
1165
+ mongocrypt_t *crypt,
1166
+ mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
1167
+ void *sign_ctx)
1168
+ {
1169
+ BSON_ASSERT_PARAM (crypt);
1170
+
1171
+ mongocrypt_status_t *status = crypt->status;
1172
+
1173
+ if (crypt->initialized) {
1174
+ CLIENT_ERR ("options cannot be set after initialization");
1175
+ return false;
1176
+ }
1177
+
1178
+ if (crypt->opts.sign_rsaes_pkcs1_v1_5) {
1179
+ CLIENT_ERR ("signature hook already set");
1180
+ return false;
1181
+ }
1182
+
1183
+ crypt->opts.sign_rsaes_pkcs1_v1_5 = sign_rsaes_pkcs1_v1_5;
1184
+ crypt->opts.sign_ctx = sign_ctx;
1185
+ return true;
1186
+ }
1187
+
1188
+ bool
1189
+ mongocrypt_setopt_aes_256_ctr (mongocrypt_t *crypt,
1190
+ mongocrypt_crypto_fn aes_256_ctr_encrypt,
1191
+ mongocrypt_crypto_fn aes_256_ctr_decrypt,
1192
+ void *ctx)
1193
+ {
1194
+ BSON_ASSERT_PARAM (crypt);
1195
+
1196
+ mongocrypt_status_t *status = crypt->status;
1197
+
1198
+ if (!crypt->crypto) {
1199
+ crypt->crypto = bson_malloc0 (sizeof (*crypt->crypto));
1200
+ BSON_ASSERT (crypt->crypto);
1201
+ }
1202
+
1203
+ if (crypt->initialized) {
1204
+ CLIENT_ERR ("options cannot be set after initialization");
1205
+ return false;
1206
+ }
1207
+
1208
+ if (!aes_256_ctr_encrypt) {
1209
+ CLIENT_ERR ("aes_256_ctr_encrypt not set");
1210
+ return false;
1211
+ }
1212
+
1213
+ if (!aes_256_ctr_decrypt) {
1214
+ CLIENT_ERR ("aes_256_ctr_decrypt not set");
1215
+ return false;
1216
+ }
1217
+
1218
+ crypt->crypto->aes_256_ctr_encrypt = aes_256_ctr_encrypt;
1219
+ crypt->crypto->aes_256_ctr_decrypt = aes_256_ctr_decrypt;
1220
+
1221
+ return true;
1222
+ }
1223
+
1224
+ bool
1225
+ mongocrypt_setopt_aes_256_ecb (mongocrypt_t *crypt,
1226
+ mongocrypt_crypto_fn aes_256_ecb_encrypt,
1227
+ void *ctx)
1228
+ {
1229
+ BSON_ASSERT_PARAM (crypt);
1230
+
1231
+ mongocrypt_status_t *status = crypt->status;
1232
+
1233
+ if (!crypt->crypto) {
1234
+ crypt->crypto = bson_malloc0 (sizeof (*crypt->crypto));
1235
+ BSON_ASSERT (crypt->crypto);
1236
+ }
1237
+
1238
+ if (crypt->initialized) {
1239
+ CLIENT_ERR ("options cannot be set after initialization");
1240
+ return false;
1241
+ }
1242
+
1243
+ if (!aes_256_ecb_encrypt) {
1244
+ CLIENT_ERR ("aes_256_ecb_encrypt not set");
1245
+ return false;
1246
+ }
1247
+
1248
+ crypt->crypto->aes_256_ecb_encrypt = aes_256_ecb_encrypt;
1249
+
1250
+ return true;
1251
+ }
1252
+
1253
+ bool
1254
+ mongocrypt_setopt_kms_providers (mongocrypt_t *crypt,
1255
+ mongocrypt_binary_t *kms_providers_definition)
1256
+ {
1257
+ BSON_ASSERT_PARAM (crypt);
1258
+ BSON_ASSERT_PARAM (kms_providers_definition);
1259
+
1260
+ mongocrypt_status_t *const status = crypt->status;
1261
+
1262
+ if (crypt->initialized) {
1263
+ CLIENT_ERR ("options cannot be set after initialization");
1264
+ return false;
1265
+ }
1266
+
1267
+ return _mongocrypt_parse_kms_providers (kms_providers_definition,
1268
+ &crypt->opts.kms_providers,
1269
+ crypt->status,
1270
+ &crypt->log);
1271
+ }
1272
+
1273
+ bool
1274
+ _mongocrypt_parse_kms_providers (
1275
+ mongocrypt_binary_t *kms_providers_definition,
1276
+ _mongocrypt_opts_kms_providers_t *kms_providers,
1277
+ mongocrypt_status_t *status,
1278
+ _mongocrypt_log_t *log)
1279
+ {
1280
+ bson_t as_bson;
1281
+ bson_iter_t iter;
1282
+
1283
+ BSON_ASSERT_PARAM (kms_providers_definition);
1284
+ BSON_ASSERT_PARAM (kms_providers);
1285
+ if (!_mongocrypt_binary_to_bson (kms_providers_definition, &as_bson) ||
1286
+ !bson_iter_init (&iter, &as_bson)) {
1287
+ CLIENT_ERR ("invalid BSON");
1288
+ return false;
1289
+ }
1290
+
1291
+ while (bson_iter_next (&iter)) {
1292
+ const char *field_name;
1293
+ bson_t field_bson;
1294
+
1295
+ field_name = bson_iter_key (&iter);
1296
+ if (!mc_iter_document_as_bson (&iter, &field_bson, status)) {
1297
+ return false;
1298
+ }
1299
+
1300
+ if (0 == strcmp (field_name, "azure") && bson_empty (&field_bson)) {
1301
+ kms_providers->need_credentials |= MONGOCRYPT_KMS_PROVIDER_AZURE;
1302
+ } else if (0 == strcmp (field_name, "azure")) {
1303
+ if (0 != (kms_providers->configured_providers &
1304
+ MONGOCRYPT_KMS_PROVIDER_AZURE)) {
1305
+ CLIENT_ERR ("azure KMS provider already set");
1306
+ return false;
1307
+ }
1308
+
1309
+ if (!_mongocrypt_parse_optional_utf8 (
1310
+ &as_bson,
1311
+ "azure.accessToken",
1312
+ &kms_providers->azure.access_token,
1313
+ status)) {
1314
+ return false;
1315
+ }
1316
+
1317
+ if (kms_providers->azure.access_token) {
1318
+ // Caller provides an accessToken directly
1319
+ if (!_mongocrypt_check_allowed_fields (
1320
+ &as_bson, "azure", status, "accessToken")) {
1321
+ return false;
1322
+ }
1323
+ kms_providers->configured_providers |=
1324
+ MONGOCRYPT_KMS_PROVIDER_AZURE;
1325
+ continue;
1326
+ }
1327
+
1328
+ // No accessToken given, so we'll need to look one up on our own later
1329
+ // using the Azure API
1330
+
1331
+ if (!_mongocrypt_parse_required_utf8 (&as_bson,
1332
+ "azure.tenantId",
1333
+ &kms_providers->azure.tenant_id,
1334
+ status)) {
1335
+ return false;
1336
+ }
1337
+
1338
+ if (!_mongocrypt_parse_required_utf8 (&as_bson,
1339
+ "azure.clientId",
1340
+ &kms_providers->azure.client_id,
1341
+ status)) {
1342
+ return false;
1343
+ }
1344
+
1345
+ if (!_mongocrypt_parse_required_utf8 (
1346
+ &as_bson,
1347
+ "azure.clientSecret",
1348
+ &kms_providers->azure.client_secret,
1349
+ status)) {
1350
+ return false;
1351
+ }
1352
+
1353
+ if (!_mongocrypt_parse_optional_endpoint (
1354
+ &as_bson,
1355
+ "azure.identityPlatformEndpoint",
1356
+ &kms_providers->azure.identity_platform_endpoint,
1357
+ NULL /* opts */,
1358
+ status)) {
1359
+ return false;
1360
+ }
1361
+
1362
+ if (!_mongocrypt_check_allowed_fields (&as_bson,
1363
+ "azure",
1364
+ status,
1365
+ "tenantId",
1366
+ "clientId",
1367
+ "clientSecret",
1368
+ "identityPlatformEndpoint")) {
1369
+ return false;
1370
+ }
1371
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_AZURE;
1372
+ } else if (0 == strcmp (field_name, "gcp") && bson_empty (&field_bson)) {
1373
+ kms_providers->need_credentials |= MONGOCRYPT_KMS_PROVIDER_GCP;
1374
+ } else if (0 == strcmp (field_name, "gcp")) {
1375
+ if (0 != (kms_providers->configured_providers &
1376
+ MONGOCRYPT_KMS_PROVIDER_GCP)) {
1377
+ CLIENT_ERR ("gcp KMS provider already set");
1378
+ return false;
1379
+ }
1380
+
1381
+ if (!_mongocrypt_parse_optional_utf8 (&as_bson,
1382
+ "gcp.accessToken",
1383
+ &kms_providers->gcp.access_token,
1384
+ status)) {
1385
+ return false;
1386
+ }
1387
+
1388
+ if (NULL != kms_providers->gcp.access_token) {
1389
+ /* "gcp" document has form:
1390
+ * {
1391
+ * "accessToken": <required UTF-8>
1392
+ * }
1393
+ */
1394
+ if (!_mongocrypt_check_allowed_fields (
1395
+ &as_bson, "gcp", status, "accessToken")) {
1396
+ return false;
1397
+ }
1398
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_GCP;
1399
+ continue;
1400
+ }
1401
+
1402
+ /* "gcp" document has form:
1403
+ * {
1404
+ * "email": <required UTF-8>
1405
+ * "privateKey": <required UTF-8 or Binary>
1406
+ * }
1407
+ */
1408
+ if (!_mongocrypt_parse_required_utf8 (
1409
+ &as_bson, "gcp.email", &kms_providers->gcp.email, status)) {
1410
+ return false;
1411
+ }
1412
+
1413
+ if (!_mongocrypt_parse_required_binary (
1414
+ &as_bson,
1415
+ "gcp.privateKey",
1416
+ &kms_providers->gcp.private_key,
1417
+ status)) {
1418
+ return false;
1419
+ }
1420
+
1421
+ if (!_mongocrypt_parse_optional_endpoint (&as_bson,
1422
+ "gcp.endpoint",
1423
+ &kms_providers->gcp.endpoint,
1424
+ NULL /* opts */,
1425
+ status)) {
1426
+ return false;
1427
+ }
1428
+
1429
+ if (!_mongocrypt_check_allowed_fields (
1430
+ &as_bson, "gcp", status, "email", "privateKey", "endpoint")) {
1431
+ return false;
1432
+ }
1433
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_GCP;
1434
+ } else if (0 == strcmp (field_name, "local") &&
1435
+ bson_empty (&field_bson)) {
1436
+ kms_providers->need_credentials |= MONGOCRYPT_KMS_PROVIDER_LOCAL;
1437
+ } else if (0 == strcmp (field_name, "local")) {
1438
+ if (!_mongocrypt_parse_required_binary (
1439
+ &as_bson, "local.key", &kms_providers->local.key, status)) {
1440
+ return false;
1441
+ }
1442
+
1443
+ if (kms_providers->local.key.len != MONGOCRYPT_KEY_LEN) {
1444
+ CLIENT_ERR ("local key must be %d bytes", MONGOCRYPT_KEY_LEN);
1445
+ return false;
1446
+ }
1447
+
1448
+ if (!_mongocrypt_check_allowed_fields (
1449
+ &as_bson, "local", status, "key")) {
1450
+ return false;
1451
+ }
1452
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_LOCAL;
1453
+ } else if (0 == strcmp (field_name, "aws") && bson_empty (&field_bson)) {
1454
+ kms_providers->need_credentials |= MONGOCRYPT_KMS_PROVIDER_AWS;
1455
+ } else if (0 == strcmp (field_name, "aws")) {
1456
+ if (!_mongocrypt_parse_required_utf8 (
1457
+ &as_bson,
1458
+ "aws.accessKeyId",
1459
+ &kms_providers->aws.access_key_id,
1460
+ status)) {
1461
+ return false;
1462
+ }
1463
+ if (!_mongocrypt_parse_required_utf8 (
1464
+ &as_bson,
1465
+ "aws.secretAccessKey",
1466
+ &kms_providers->aws.secret_access_key,
1467
+ status)) {
1468
+ return false;
1469
+ }
1470
+
1471
+ if (!_mongocrypt_parse_optional_utf8 (
1472
+ &as_bson,
1473
+ "aws.sessionToken",
1474
+ &kms_providers->aws.session_token,
1475
+ status)) {
1476
+ return false;
1477
+ }
1478
+
1479
+ if (!_mongocrypt_check_allowed_fields (&as_bson,
1480
+ "aws",
1481
+ status,
1482
+ "accessKeyId",
1483
+ "secretAccessKey",
1484
+ "sessionToken")) {
1485
+ return false;
1486
+ }
1487
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_AWS;
1488
+ } else if (0 == strcmp (field_name, "kmip") && bson_empty (&field_bson)) {
1489
+ kms_providers->need_credentials |= MONGOCRYPT_KMS_PROVIDER_KMIP;
1490
+ } else if (0 == strcmp (field_name, "kmip")) {
1491
+ _mongocrypt_endpoint_parse_opts_t opts = {0};
1492
+
1493
+ opts.allow_empty_subdomain = true;
1494
+ if (!_mongocrypt_parse_required_endpoint (
1495
+ &as_bson,
1496
+ "kmip.endpoint",
1497
+ &kms_providers->kmip.endpoint,
1498
+ &opts,
1499
+ status)) {
1500
+ return false;
1501
+ }
1502
+
1503
+ if (!_mongocrypt_check_allowed_fields (
1504
+ &as_bson, "kmip", status, "endpoint")) {
1505
+ return false;
1506
+ }
1507
+ kms_providers->configured_providers |= MONGOCRYPT_KMS_PROVIDER_KMIP;
1508
+ } else {
1509
+ CLIENT_ERR ("unsupported KMS provider: %s", field_name);
1510
+ return false;
1511
+ }
1512
+ }
1513
+
1514
+ if (log && log->trace_enabled) {
1515
+ char *as_str = bson_as_json (&as_bson, NULL);
1516
+ _mongocrypt_log (log,
1517
+ MONGOCRYPT_LOG_LEVEL_TRACE,
1518
+ "%s (%s=\"%s\")",
1519
+ BSON_FUNC,
1520
+ "kms_providers",
1521
+ as_str);
1522
+ bson_free (as_str);
1523
+ }
1524
+
1525
+ return true;
1526
+ }
1527
+
1528
+
1529
+ void
1530
+ mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt,
1531
+ const char *path)
1532
+ {
1533
+ BSON_ASSERT_PARAM (crypt);
1534
+ BSON_ASSERT_PARAM (path);
1535
+
1536
+ // Dup the path string for us to manage
1537
+ mstr pathdup = mstr_copy_cstr (path);
1538
+ // Increase array len
1539
+ BSON_ASSERT (crypt->opts.n_crypt_shared_lib_search_paths < INT_MAX);
1540
+ const int new_len = crypt->opts.n_crypt_shared_lib_search_paths + 1;
1541
+ BSON_ASSERT (new_len > 0 && sizeof (mstr) <= SIZE_MAX / (size_t) new_len);
1542
+ mstr *const new_array =
1543
+ bson_realloc (crypt->opts.crypt_shared_lib_search_paths,
1544
+ sizeof (mstr) * (size_t) new_len);
1545
+
1546
+ // Store the path
1547
+ new_array[new_len - 1] = pathdup;
1548
+ // Write back opts
1549
+ crypt->opts.crypt_shared_lib_search_paths = new_array;
1550
+ crypt->opts.n_crypt_shared_lib_search_paths = new_len;
1551
+ }
1552
+
1553
+
1554
+ void
1555
+ mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t *crypt)
1556
+ {
1557
+ BSON_ASSERT_PARAM (crypt);
1558
+
1559
+ crypt->opts.use_need_kms_credentials_state = true;
1560
+ }
1561
+
1562
+
1563
+ void
1564
+ mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt,
1565
+ const char *path)
1566
+ {
1567
+ BSON_ASSERT_PARAM (crypt);
1568
+ BSON_ASSERT_PARAM (path);
1569
+
1570
+ mstr_assign (&crypt->opts.crypt_shared_lib_override_path,
1571
+ mstr_copy_cstr (path));
1572
+ }
1573
+
1574
+ bool
1575
+ _mongocrypt_needs_credentials (mongocrypt_t *crypt)
1576
+ {
1577
+ BSON_ASSERT_PARAM (crypt);
1578
+
1579
+ if (!crypt->opts.use_need_kms_credentials_state) {
1580
+ return false;
1581
+ }
1582
+
1583
+ return crypt->opts.kms_providers.need_credentials != 0;
1584
+ }
1585
+
1586
+ bool
1587
+ _mongocrypt_needs_credentials_for_provider (mongocrypt_t *crypt,
1588
+ _mongocrypt_kms_provider_t provider)
1589
+ {
1590
+ BSON_ASSERT_PARAM (crypt);
1591
+
1592
+ if (!crypt->opts.use_need_kms_credentials_state) {
1593
+ return false;
1594
+ }
1595
+
1596
+ return (crypt->opts.kms_providers.need_credentials & (int) provider) != 0;
1597
+ }
1598
+
1599
+ void
1600
+ mongocrypt_setopt_bypass_query_analysis (mongocrypt_t *crypt)
1601
+ {
1602
+ BSON_ASSERT_PARAM (crypt);
1603
+
1604
+ crypt->opts.bypass_query_analysis = true;
1605
+ }