libmongocrypt-helper 1.7.4.0.1001 → 1.8.0.0.1001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/ext/libmongocrypt/extconf.rb +2 -2
  4. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +9 -7
  5. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +17 -23
  6. data/ext/libmongocrypt/libmongocrypt/Earthfile +374 -0
  7. data/ext/libmongocrypt/libmongocrypt/README.md +7 -7
  8. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +1 -1
  9. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +25 -6
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +25 -3
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -1
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +3 -2
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/cs.sln +79 -0
  15. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +2 -2
  16. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +6 -4
  17. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  18. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +24 -0
  19. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +134 -5
  20. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +3 -6
  21. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +203 -77
  22. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +1 -1
  23. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +165 -43
  24. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +12 -14
  25. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/errors.js +75 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +34 -3
  27. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js +26 -0
  28. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/azure.js +178 -0
  29. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/gcp.js +24 -0
  30. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/index.js +54 -0
  31. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/utils.js +39 -0
  32. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +9 -4
  33. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +4440 -5189
  34. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +27 -8
  35. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +65 -38
  36. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +4 -7
  37. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +434 -42
  38. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/common.test.js +94 -0
  39. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +1 -45
  40. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/index.test.js +45 -0
  41. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +1 -1
  42. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/providers/credentialsProvider.test.js +551 -0
  43. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +10 -3
  44. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +23 -1
  45. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +1 -1
  46. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/chai-addons.js +8 -0
  47. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/types/index.test-d.ts +63 -0
  48. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +26 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +2 -2
  50. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +1 -1
  51. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +128 -238
  52. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +0 -27
  53. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +1 -1
  54. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +5 -21
  55. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
  56. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +5 -5
  57. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +14 -9
  58. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +1 -10
  59. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
  60. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +5 -5
  61. data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +4 -12
  62. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +8 -6
  63. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +2 -1
  64. data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
  65. data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -0
  66. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +2 -2
  67. data/ext/libmongocrypt/libmongocrypt/etc/c6-vault.repo +39 -0
  68. data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +15 -24
  69. data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
  70. data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
  71. data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
  72. data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
  73. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
  74. data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
  75. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -0
  76. data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +381 -436
  77. data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
  78. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +180 -248
  79. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
  80. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
  81. data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
  82. data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
  83. data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
  84. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
  85. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
  86. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +7 -11
  87. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +80 -92
  88. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
  89. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +59 -70
  90. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +384 -439
  91. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
  92. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
  93. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
  94. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
  95. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +88 -0
  96. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +24 -27
  97. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +137 -0
  98. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
  99. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +117 -0
  100. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +28 -36
  101. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +294 -0
  102. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
  103. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
  104. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
  105. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
  106. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +476 -325
  107. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
  108. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
  109. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
  110. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
  111. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
  112. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
  113. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
  114. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +55 -56
  115. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +517 -580
  116. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +36 -66
  117. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +57 -76
  118. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +158 -189
  119. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +36 -42
  120. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +515 -558
  121. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +155 -191
  122. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +43 -53
  123. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +170 -240
  124. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +29 -34
  125. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +289 -338
  126. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
  127. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
  128. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +55 -49
  129. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +109 -125
  130. data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
  131. data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
  132. data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
  133. data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
  134. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
  135. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +444 -499
  136. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +251 -334
  137. data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
  138. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
  139. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
  140. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
  141. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
  142. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
  143. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
  144. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +3 -6
  145. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
  146. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
  147. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +444 -565
  148. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
  149. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
  150. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
  151. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +103 -132
  152. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +8 -14
  153. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +78 -90
  154. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
  155. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
  156. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
  157. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
  158. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
  159. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
  160. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1137 -1565
  161. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +425 -472
  162. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
  163. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2394 -2697
  164. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +166 -186
  165. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
  166. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +921 -1138
  167. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +16 -24
  168. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
  169. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
  170. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
  171. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +37 -43
  172. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +215 -253
  173. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +73 -108
  174. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +889 -1034
  175. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
  176. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
  177. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +92 -120
  178. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1397 -1612
  179. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
  180. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
  181. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +30 -36
  182. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1821 -1470
  183. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
  184. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +80 -108
  185. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +354 -424
  186. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +101 -117
  187. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
  188. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
  189. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
  190. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
  191. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
  192. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +96 -135
  193. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +1092 -1320
  194. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +130 -295
  195. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +66 -78
  196. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
  197. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +60 -73
  198. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
  199. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
  200. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +60 -0
  201. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -0
  202. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +2 -2
  203. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
  204. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
  205. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
  206. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
  207. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
  208. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
  209. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
  210. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
  211. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
  212. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
  213. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
  214. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
  216. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
  217. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  218. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
  219. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
  220. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
  221. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
  222. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
  223. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
  224. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
  225. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
  226. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
  227. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
  228. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
  229. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
  230. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
  231. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
  232. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
  233. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
  234. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
  235. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
  236. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
  237. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
  238. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
  239. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
  240. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
  241. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
  242. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
  243. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
  244. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
  245. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
  246. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
  247. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
  248. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
  249. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
  250. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
  251. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
  252. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
  253. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
  254. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
  255. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
  256. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
  257. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
  258. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
  259. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
  260. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
  261. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
  262. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
  263. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
  264. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
  265. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
  266. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
  267. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
  268. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
  269. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
  270. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
  272. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
  273. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
  274. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
  276. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
  277. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
  278. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
  279. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
  280. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
  281. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
  282. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
  283. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
  284. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
  286. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
  287. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
  288. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
  289. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
  290. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
  291. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
  292. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
  293. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
  294. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
  295. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
  296. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
  297. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
  298. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
  300. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/README.md +17 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
  303. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
  304. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
  306. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
  309. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
  310. data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
  311. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +27 -0
  312. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +21 -0
  313. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +21 -0
  314. data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
  315. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +278 -323
  316. data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
  317. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
  318. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
  319. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +58 -73
  320. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
  321. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +89 -0
  322. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
  323. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
  324. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +172 -0
  325. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
  326. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
  327. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
  328. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
  329. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +346 -388
  330. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +708 -825
  331. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +417 -481
  332. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +110 -144
  333. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
  334. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +223 -213
  335. data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
  336. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +634 -807
  337. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +1 -2
  338. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
  339. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
  340. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +34 -36
  341. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
  342. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
  343. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +331 -445
  344. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +670 -814
  345. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +102 -135
  346. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +54 -71
  347. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
  348. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
  349. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +867 -1045
  350. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +4349 -4713
  351. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
  352. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +991 -1178
  353. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +342 -419
  354. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
  355. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
  356. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
  357. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
  358. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
  359. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
  360. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +286 -370
  361. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
  362. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
  363. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
  364. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +656 -692
  365. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
  366. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +377 -451
  367. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +48 -67
  368. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +4 -10
  369. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +827 -918
  370. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +111 -172
  371. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +508 -559
  372. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +735 -881
  373. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
  374. data/lib/libmongocrypt_helper/version.rb +2 -2
  375. data/lib/libmongocrypt_helper.rb +2 -2
  376. data.tar.gz.sig +0 -0
  377. metadata +154 -26
  378. metadata.gz.sig +0 -0
  379. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  380. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
  381. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
  382. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
  383. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  384. data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +0 -359
  385. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
  386. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
  387. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
  388. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/value-to-encrypt.json +0 -20
  389. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
  390. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
  391. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
  392. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
  393. data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
  394. /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/key-filter.json +0 -0
  395. /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/rangeopts.json +0 -0
  396. /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
  397. /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/rangeopts.json +0 -0
  398. /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
@@ -14,161 +14,127 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- #include "test-mongocrypt.h"
18
17
  #include "mc-rangeopts-private.h"
18
+ #include "test-mongocrypt.h"
19
19
 
20
20
  #define RAW_STRING(...) #__VA_ARGS__
21
21
 
22
- static void
23
- test_mc_RangeOpts_parse (_mongocrypt_tester_t *tester)
24
- {
25
- typedef struct {
26
- const char *desc;
27
- const char *in;
28
- const char *expectError;
29
- mc_optional_int32_t expectMin;
30
- mc_optional_int32_t expectMax;
31
- int64_t expectSparsity;
32
- mc_optional_uint32_t expectPrecision;
33
- } testcase;
22
+ static void test_mc_RangeOpts_parse(_mongocrypt_tester_t *tester) {
23
+ typedef struct {
24
+ const char *desc;
25
+ const char *in;
26
+ const char *expectError;
27
+ mc_optional_int32_t expectMin;
28
+ mc_optional_int32_t expectMax;
29
+ int64_t expectSparsity;
30
+ mc_optional_uint32_t expectPrecision;
31
+ } testcase;
34
32
 
35
- testcase tests[] = {
36
- {.desc = "Works",
37
- .in = RAW_STRING (
38
- {"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
39
- .expectSparsity = 1,
40
- .expectMin = OPT_I32_C (123),
41
- .expectMax = OPT_I32_C (456)},
42
- {.desc = "Errors if precision is set with int min/max",
43
- .in = RAW_STRING ({
44
- "min" : 123,
45
- "max" : 456,
46
- "precision" : 2,
47
- "sparsity" : {"$numberLong" : "1"}
48
- }),
49
- .expectError =
50
- "expected 'precision' to be set with double or decimal128 index"},
51
- {.desc = "Errors on missing fields",
52
- .in = RAW_STRING ({"min" : 123, "max" : 456}),
53
- .expectError = "Missing field 'sparsity'"},
54
- {.desc = "Errors on extra fields",
55
- .in = RAW_STRING ({
56
- "min" : 123,
57
- "max" : 456,
58
- "sparsity" : {"$numberLong" : "1"},
59
- "foo" : 1
60
- }),
61
- .expectError = "Unrecognized field: 'foo'"},
62
- {.desc = "Errors if min/max types mismatch",
63
- .in = RAW_STRING (
64
- {"min" : 123, "max" : 456.0, "sparsity" : {"$numberLong" : "1"}}),
65
- .expectError = "expected 'min' and 'max' to be same type"},
66
- {
67
- .desc = "Does not require min/max",
68
- .in = RAW_STRING ({"sparsity" : {"$numberLong" : "1"}}),
33
+ testcase tests[] = {
34
+ {.desc = "Works",
35
+ .in = RAW_STRING({"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
69
36
  .expectSparsity = 1,
70
- },
71
- {.desc = "Requires precision for double when min/max is set",
72
- .in = RAW_STRING (
73
- {"min" : 0.0, "max" : 1.0, "sparsity" : {"$numberLong" : "1"}}),
74
- .expectError = "expected 'precision'"},
75
- {.desc = "Requires min/max for double when precision is set",
76
- .in = RAW_STRING ({"precision" : 1, "sparsity" : {"$numberLong" : "1"}}),
77
- .expectError = "setting precision requires min"},
78
- {.desc = "Requires precision for double when only min is set",
79
- .in = RAW_STRING ({"min" : 0.0, "sparsity" : {"$numberLong" : "1"}}),
80
- .expectError = "expected 'precision'"},
81
- };
37
+ .expectMin = OPT_I32_C(123),
38
+ .expectMax = OPT_I32_C(456)},
39
+ {.desc = "Errors if precision is set with int min/max",
40
+ .in = RAW_STRING({"min" : 123, "max" : 456, "precision" : 2, "sparsity" : {"$numberLong" : "1"}}),
41
+ .expectError = "expected 'precision' to be set with double or decimal128 index"},
42
+ {.desc = "Errors on missing fields",
43
+ .in = RAW_STRING({"min" : 123, "max" : 456}),
44
+ .expectError = "Missing field 'sparsity'"},
45
+ {.desc = "Errors on extra fields",
46
+ .in = RAW_STRING({"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}, "foo" : 1}),
47
+ .expectError = "Unrecognized field: 'foo'"},
48
+ {.desc = "Errors if min/max types mismatch",
49
+ .in = RAW_STRING({"min" : 123, "max" : 456.0, "sparsity" : {"$numberLong" : "1"}}),
50
+ .expectError = "expected 'min' and 'max' to be same type"},
51
+ {
52
+ .desc = "Does not require min/max",
53
+ .in = RAW_STRING({"sparsity" : {"$numberLong" : "1"}}),
54
+ .expectSparsity = 1,
55
+ },
56
+ {.desc = "Requires precision for double when min/max is set",
57
+ .in = RAW_STRING({"min" : 0.0, "max" : 1.0, "sparsity" : {"$numberLong" : "1"}}),
58
+ .expectError = "expected 'precision'"},
59
+ {.desc = "Requires min/max for double when precision is set",
60
+ .in = RAW_STRING({"precision" : 1, "sparsity" : {"$numberLong" : "1"}}),
61
+ .expectError = "setting precision requires min"},
62
+ {.desc = "Requires precision for double when only min is set",
63
+ .in = RAW_STRING({"min" : 0.0, "sparsity" : {"$numberLong" : "1"}}),
64
+ .expectError = "expected 'precision'"},
65
+ };
82
66
 
83
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
84
- testcase *test = tests + i;
85
- mongocrypt_status_t *status = mongocrypt_status_new ();
86
- mc_RangeOpts_t ro;
87
- printf ("running test_mc_RangeOpts_parse subtest: %s\n", test->desc);
88
- bool ret = mc_RangeOpts_parse (&ro, TMP_BSON (test->in), status);
89
- if (!test->expectError) {
90
- ASSERT_OK_STATUS (ret, status);
91
- ASSERT_CMPINT (test->expectMin.set, ==, ro.min.set);
92
- if (test->expectMin.set) {
93
- ASSERT_CMPINT32 (
94
- test->expectMin.value, ==, bson_iter_int32 (&ro.min.value));
95
- }
96
- ASSERT_CMPINT (test->expectMax.set, ==, ro.max.set);
97
- if (test->expectMax.set) {
98
- ASSERT_CMPINT32 (
99
- test->expectMax.value, ==, bson_iter_int32 (&ro.max.value));
100
- }
101
- ASSERT_CMPINT64 (test->expectSparsity, ==, ro.sparsity);
102
- ASSERT_CMPINT (test->expectPrecision.set, ==, ro.precision.set);
103
- ASSERT_CMPINT (test->expectPrecision.value, ==, ro.precision.value);
104
- } else {
105
- ASSERT_FAILS_STATUS (ret, status, test->expectError);
106
- }
107
- mc_RangeOpts_cleanup (&ro);
108
- mongocrypt_status_destroy (status);
109
- }
67
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
68
+ testcase *test = tests + i;
69
+ mongocrypt_status_t *status = mongocrypt_status_new();
70
+ mc_RangeOpts_t ro;
71
+ printf("running test_mc_RangeOpts_parse subtest: %s\n", test->desc);
72
+ bool ret = mc_RangeOpts_parse(&ro, TMP_BSON(test->in), status);
73
+ if (!test->expectError) {
74
+ ASSERT_OK_STATUS(ret, status);
75
+ ASSERT_CMPINT(test->expectMin.set, ==, ro.min.set);
76
+ if (test->expectMin.set) {
77
+ ASSERT_CMPINT32(test->expectMin.value, ==, bson_iter_int32(&ro.min.value));
78
+ }
79
+ ASSERT_CMPINT(test->expectMax.set, ==, ro.max.set);
80
+ if (test->expectMax.set) {
81
+ ASSERT_CMPINT32(test->expectMax.value, ==, bson_iter_int32(&ro.max.value));
82
+ }
83
+ ASSERT_CMPINT64(test->expectSparsity, ==, ro.sparsity);
84
+ ASSERT_CMPINT(test->expectPrecision.set, ==, ro.precision.set);
85
+ ASSERT_CMPINT(test->expectPrecision.value, ==, ro.precision.value);
86
+ } else {
87
+ ASSERT_FAILS_STATUS(ret, status, test->expectError);
88
+ }
89
+ mc_RangeOpts_cleanup(&ro);
90
+ mongocrypt_status_destroy(status);
91
+ }
110
92
  }
111
93
 
112
- static void
113
- test_mc_RangeOpts_to_FLE2RangeInsertSpec (_mongocrypt_tester_t *tester)
114
- {
115
- typedef struct {
116
- const char *desc;
117
- const char *in;
118
- const char *v;
119
- const char *expectError;
120
- const char *expect;
121
- } testcase;
94
+ static void test_mc_RangeOpts_to_FLE2RangeInsertSpec(_mongocrypt_tester_t *tester) {
95
+ typedef struct {
96
+ const char *desc;
97
+ const char *in;
98
+ const char *v;
99
+ const char *expectError;
100
+ const char *expect;
101
+ } testcase;
122
102
 
123
- testcase tests[] = {
124
- {.desc = "Works",
125
- .in = RAW_STRING (
126
- {"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
127
- .v = RAW_STRING ({"v" : 789}),
128
- .expect = RAW_STRING ({"v" : {"v" : 789, "min" : 123, "max" : 456}})},
129
- {.desc = "Works with precision",
130
- .in = RAW_STRING ({
131
- "min" : 123.0,
132
- "max" : 456.0,
133
- "precision" : 2,
134
- "sparsity" : {"$numberLong" : "1"}
135
- }),
136
- .v = RAW_STRING ({"v" : 789.0}),
137
- .expect = RAW_STRING ({
138
- "v" : {"v" : 789.0, "min" : 123.0, "max" : 456.0, "precision" : 2}
139
- })},
140
- {.desc = "Errors with missing 'v'",
141
- .in = RAW_STRING (
142
- {"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
143
- .v = RAW_STRING ({"foo" : "bar"}),
144
- .expectError = "Unable to find 'v'"}};
103
+ testcase tests[] = {
104
+ {.desc = "Works",
105
+ .in = RAW_STRING({"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
106
+ .v = RAW_STRING({"v" : 789}),
107
+ .expect = RAW_STRING({"v" : {"v" : 789, "min" : 123, "max" : 456}})},
108
+ {.desc = "Works with precision",
109
+ .in = RAW_STRING({"min" : 123.0, "max" : 456.0, "precision" : 2, "sparsity" : {"$numberLong" : "1"}}),
110
+ .v = RAW_STRING({"v" : 789.0}),
111
+ .expect = RAW_STRING({"v" : {"v" : 789.0, "min" : 123.0, "max" : 456.0, "precision" : 2}})},
112
+ {.desc = "Errors with missing 'v'",
113
+ .in = RAW_STRING({"min" : 123, "max" : 456, "sparsity" : {"$numberLong" : "1"}}),
114
+ .v = RAW_STRING({"foo" : "bar"}),
115
+ .expectError = "Unable to find 'v'"}};
145
116
 
146
- for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) {
147
- testcase *test = tests + i;
148
- mongocrypt_status_t *status = mongocrypt_status_new ();
149
- mc_RangeOpts_t ro;
150
- printf ("running test_mc_RangeOpts_to_FLE2RangeInsertSpec subtest: %s\n",
151
- test->desc);
152
- ASSERT_OK_STATUS (mc_RangeOpts_parse (&ro, TMP_BSON (test->in), status),
153
- status);
154
- bson_t out = BSON_INITIALIZER;
155
- bool ret = mc_RangeOpts_to_FLE2RangeInsertSpec (
156
- &ro, TMP_BSON (test->v), &out, status);
157
- if (!test->expectError) {
158
- ASSERT_OK_STATUS (ret, status);
159
- ASSERT_EQUAL_BSON (TMP_BSON (test->expect), &out);
160
- } else {
161
- ASSERT_FAILS_STATUS (ret, status, test->expectError);
162
- }
163
- bson_destroy (&out);
164
- mc_RangeOpts_cleanup (&ro);
165
- mongocrypt_status_destroy (status);
166
- }
117
+ for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
118
+ testcase *test = tests + i;
119
+ mongocrypt_status_t *status = mongocrypt_status_new();
120
+ mc_RangeOpts_t ro;
121
+ printf("running test_mc_RangeOpts_to_FLE2RangeInsertSpec subtest: %s\n", test->desc);
122
+ ASSERT_OK_STATUS(mc_RangeOpts_parse(&ro, TMP_BSON(test->in), status), status);
123
+ bson_t out = BSON_INITIALIZER;
124
+ bool ret = mc_RangeOpts_to_FLE2RangeInsertSpec(&ro, TMP_BSON(test->v), &out, status);
125
+ if (!test->expectError) {
126
+ ASSERT_OK_STATUS(ret, status);
127
+ ASSERT_EQUAL_BSON(TMP_BSON(test->expect), &out);
128
+ } else {
129
+ ASSERT_FAILS_STATUS(ret, status, test->expectError);
130
+ }
131
+ bson_destroy(&out);
132
+ mc_RangeOpts_cleanup(&ro);
133
+ mongocrypt_status_destroy(status);
134
+ }
167
135
  }
168
136
 
169
- void
170
- _mongocrypt_tester_install_mc_RangeOpts (_mongocrypt_tester_t *tester)
171
- {
172
- INSTALL_TEST (test_mc_RangeOpts_parse);
173
- INSTALL_TEST (test_mc_RangeOpts_to_FLE2RangeInsertSpec);
137
+ void _mongocrypt_tester_install_mc_RangeOpts(_mongocrypt_tester_t *tester) {
138
+ INSTALL_TEST(test_mc_RangeOpts_parse);
139
+ INSTALL_TEST(test_mc_RangeOpts_to_FLE2RangeInsertSpec);
174
140
  }
@@ -18,234 +18,151 @@
18
18
  #include "test-mongocrypt-assert.h"
19
19
  #include "test-mongocrypt.h"
20
20
 
21
- static void
22
- _test_mc_reader (_mongocrypt_tester_t *tester)
23
- {
24
- _mongocrypt_buffer_t input_buf;
25
- _mongocrypt_buffer_copy_from_hex (&input_buf, "ABCD");
26
-
27
- mongocrypt_status_t *status;
28
- status = mongocrypt_status_new ();
29
-
30
- mc_reader_t reader;
31
- mc_reader_init_from_buffer (&reader, &input_buf, __FUNCTION__);
32
-
33
- uint8_t value;
34
- ASSERT_OK_STATUS (mc_reader_read_u8 (&reader, &value, status), status);
35
- ASSERT_CMPUINT (value, ==, 0xAB);
36
- ASSERT_CMPUINT64 (mc_reader_get_consumed_length (&reader), ==, 1);
37
- ASSERT_CMPUINT64 (mc_reader_get_remaining_length (&reader), ==, 1);
38
-
39
- ASSERT_OK_STATUS (mc_reader_read_u8 (&reader, &value, status), status);
40
- ASSERT_CMPUINT (value, ==, 0xCD);
41
- ASSERT_CMPUINT64 (mc_reader_get_consumed_length (&reader), ==, 2);
42
- ASSERT_CMPUINT64 (mc_reader_get_remaining_length (&reader), ==, 0);
43
-
44
- ASSERT_FAILS_STATUS (mc_reader_read_u8 (&reader, &value, status),
45
- status,
46
- "expected byte length >= 3 got: 2");
47
-
48
- _mongocrypt_buffer_cleanup (&input_buf);
49
- mongocrypt_status_destroy (status);
21
+ static void _test_mc_reader(_mongocrypt_tester_t *tester) {
22
+ _mongocrypt_buffer_t input_buf;
23
+ _mongocrypt_buffer_copy_from_hex(&input_buf, "ABCD");
24
+
25
+ mongocrypt_status_t *status;
26
+ status = mongocrypt_status_new();
27
+
28
+ mc_reader_t reader;
29
+ mc_reader_init_from_buffer(&reader, &input_buf, __FUNCTION__);
30
+
31
+ uint8_t value;
32
+ ASSERT_OK_STATUS(mc_reader_read_u8(&reader, &value, status), status);
33
+ ASSERT_CMPUINT(value, ==, 0xAB);
34
+ ASSERT_CMPUINT64(mc_reader_get_consumed_length(&reader), ==, 1);
35
+ ASSERT_CMPUINT64(mc_reader_get_remaining_length(&reader), ==, 1);
36
+
37
+ ASSERT_OK_STATUS(mc_reader_read_u8(&reader, &value, status), status);
38
+ ASSERT_CMPUINT(value, ==, 0xCD);
39
+ ASSERT_CMPUINT64(mc_reader_get_consumed_length(&reader), ==, 2);
40
+ ASSERT_CMPUINT64(mc_reader_get_remaining_length(&reader), ==, 0);
41
+
42
+ ASSERT_FAILS_STATUS(mc_reader_read_u8(&reader, &value, status), status, "expected byte length >= 3 got: 2");
43
+
44
+ _mongocrypt_buffer_cleanup(&input_buf);
45
+ mongocrypt_status_destroy(status);
50
46
  }
51
47
 
52
- static void
53
- _test_mc_reader_uuid (_mongocrypt_tester_t *tester)
54
- {
55
- const uint8_t expected_bytes[] = {0x12,
56
- 0x34,
57
- 0x56,
58
- 0x78,
59
- 0x90,
60
- 0x12,
61
- 0x34,
62
- 0x56,
63
- 0x78,
64
- 0x90,
65
- 0x12,
66
- 0x34,
67
- 0x56,
68
- 0x78,
69
- 0x90,
70
- 0x12};
71
- uint64_t expected_len = sizeof (expected_bytes);
72
-
73
- _mongocrypt_buffer_t input_buf;
74
- _mongocrypt_buffer_copy_from_hex (&input_buf,
75
- "12345678901234567890123456789012");
76
-
77
- mongocrypt_status_t *status;
78
- status = mongocrypt_status_new ();
79
-
80
- mc_reader_t reader;
81
- mc_reader_init_from_buffer (&reader, &input_buf, __FUNCTION__);
82
-
83
- _mongocrypt_buffer_t value;
84
- ASSERT_OK_STATUS (mc_reader_read_uuid_buffer (&reader, &value, status),
85
- status);
86
- ASSERT (value.subtype == BSON_SUBTYPE_UUID);
87
-
88
- ASSERT_CMPBYTES (
89
- expected_bytes, (size_t) expected_len, value.data, value.len);
90
-
91
-
92
- uint8_t ui;
93
- ASSERT_FAILS_STATUS (mc_reader_read_u8 (&reader, &ui, status),
94
- status,
95
- "expected byte length >= 17 got: 16");
96
-
97
- _mongocrypt_buffer_cleanup (&input_buf);
98
- _mongocrypt_buffer_cleanup (&value);
99
- mongocrypt_status_destroy (status);
48
+ static void _test_mc_reader_uuid(_mongocrypt_tester_t *tester) {
49
+ const uint8_t expected_bytes[] =
50
+ {0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12};
51
+ uint64_t expected_len = sizeof(expected_bytes);
52
+
53
+ _mongocrypt_buffer_t input_buf;
54
+ _mongocrypt_buffer_copy_from_hex(&input_buf, "12345678901234567890123456789012");
55
+
56
+ mongocrypt_status_t *status;
57
+ status = mongocrypt_status_new();
58
+
59
+ mc_reader_t reader;
60
+ mc_reader_init_from_buffer(&reader, &input_buf, __FUNCTION__);
61
+
62
+ _mongocrypt_buffer_t value;
63
+ ASSERT_OK_STATUS(mc_reader_read_uuid_buffer(&reader, &value, status), status);
64
+ ASSERT(value.subtype == BSON_SUBTYPE_UUID);
65
+
66
+ ASSERT_CMPBYTES(expected_bytes, (size_t)expected_len, value.data, value.len);
67
+
68
+ uint8_t ui;
69
+ ASSERT_FAILS_STATUS(mc_reader_read_u8(&reader, &ui, status), status, "expected byte length >= 17 got: 16");
70
+
71
+ _mongocrypt_buffer_cleanup(&input_buf);
72
+ _mongocrypt_buffer_cleanup(&value);
73
+ mongocrypt_status_destroy(status);
100
74
  }
101
75
 
102
- static void
103
- _test_mc_reader_prfblock (_mongocrypt_tester_t *tester)
104
- {
105
- const uint8_t expected_bytes[] = {0x12,
106
- 0x34,
107
- 0x56,
108
- 0x78, // 4
109
- 0x12,
110
- 0x34,
111
- 0x56,
112
- 0x78, // 8
113
- 0x12,
114
- 0x34,
115
- 0x56,
116
- 0x78,
117
- 0x12,
118
- 0x34,
119
- 0x56,
120
- 0x78, // 16
121
- 0x12,
122
- 0x34,
123
- 0x56,
124
- 0x78,
125
- 0x12,
126
- 0x34,
127
- 0x56,
128
- 0x78,
129
- 0x12,
130
- 0x34,
131
- 0x56,
132
- 0x78,
133
- 0x12,
134
- 0x34,
135
- 0x56,
136
- 0x78};
137
- uint64_t expected_len = sizeof (expected_bytes);
138
-
139
- _mongocrypt_buffer_t input_buf;
140
- _mongocrypt_buffer_copy_from_hex (&input_buf,
76
+ static void _test_mc_reader_prfblock(_mongocrypt_tester_t *tester) {
77
+ const uint8_t expected_bytes[] = {0x12, 0x34, 0x56,
78
+ 0x78, // 4
79
+ 0x12, 0x34, 0x56,
80
+ 0x78, // 8
81
+ 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56,
82
+ 0x78, // 16
83
+ 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
84
+ 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78};
85
+ uint64_t expected_len = sizeof(expected_bytes);
86
+
87
+ _mongocrypt_buffer_t input_buf;
88
+ _mongocrypt_buffer_copy_from_hex(&input_buf,
141
89
  "12345678123456781234567812345678"
142
90
  "12345678123456781234567812345678");
143
91
 
144
- mongocrypt_status_t *status;
145
- status = mongocrypt_status_new ();
146
-
147
- mc_reader_t reader;
148
- mc_reader_init_from_buffer (&reader, &input_buf, __FUNCTION__);
92
+ mongocrypt_status_t *status;
93
+ status = mongocrypt_status_new();
149
94
 
150
- _mongocrypt_buffer_t value;
151
- ASSERT_OK_STATUS (mc_reader_read_prfblock_buffer (&reader, &value, status),
152
- status);
153
- ASSERT (value.subtype == BSON_SUBTYPE_ENCRYPTED);
95
+ mc_reader_t reader;
96
+ mc_reader_init_from_buffer(&reader, &input_buf, __FUNCTION__);
154
97
 
155
- ASSERT_CMPBYTES (
156
- expected_bytes, (size_t) expected_len, value.data, value.len);
98
+ _mongocrypt_buffer_t value;
99
+ ASSERT_OK_STATUS(mc_reader_read_prfblock_buffer(&reader, &value, status), status);
100
+ ASSERT(value.subtype == BSON_SUBTYPE_ENCRYPTED);
157
101
 
102
+ ASSERT_CMPBYTES(expected_bytes, (size_t)expected_len, value.data, value.len);
158
103
 
159
- uint8_t ui;
160
- ASSERT_FAILS_STATUS (mc_reader_read_u8 (&reader, &ui, status),
161
- status,
162
- "expected byte length >= 33 got: 32");
104
+ uint8_t ui;
105
+ ASSERT_FAILS_STATUS(mc_reader_read_u8(&reader, &ui, status), status, "expected byte length >= 33 got: 32");
163
106
 
164
- _mongocrypt_buffer_cleanup (&input_buf);
165
- _mongocrypt_buffer_cleanup (&value);
166
- mongocrypt_status_destroy (status);
107
+ _mongocrypt_buffer_cleanup(&input_buf);
108
+ _mongocrypt_buffer_cleanup(&value);
109
+ mongocrypt_status_destroy(status);
167
110
  }
168
111
 
112
+ static void _test_mc_reader_ints(_mongocrypt_tester_t *tester) {
113
+ _mongocrypt_buffer_t input_buf;
114
+ _mongocrypt_buffer_copy_from_hex(&input_buf, "001122330011223344556677");
169
115
 
170
- static void
171
- _test_mc_reader_ints (_mongocrypt_tester_t *tester)
172
- {
173
- _mongocrypt_buffer_t input_buf;
174
- _mongocrypt_buffer_copy_from_hex (&input_buf, "001122330011223344556677");
116
+ mongocrypt_status_t *status;
117
+ status = mongocrypt_status_new();
175
118
 
176
- mongocrypt_status_t *status;
177
- status = mongocrypt_status_new ();
119
+ mc_reader_t reader;
120
+ mc_reader_init_from_buffer(&reader, &input_buf, __FUNCTION__);
178
121
 
179
- mc_reader_t reader;
180
- mc_reader_init_from_buffer (&reader, &input_buf, __FUNCTION__);
122
+ uint32_t u32;
123
+ ASSERT_OK_STATUS(mc_reader_read_u32(&reader, &u32, status), status);
124
+ ASSERT_CMPUINT32(u32, ==, 0x33221100);
181
125
 
182
- uint32_t u32;
183
- ASSERT_OK_STATUS (mc_reader_read_u32 (&reader, &u32, status), status);
184
- ASSERT_CMPUINT32 (u32, ==, 0x33221100);
126
+ uint64_t u64;
127
+ ASSERT_OK_STATUS(mc_reader_read_u64(&reader, &u64, status), status);
128
+ ASSERT_CMPUINT64(u64, ==, 0x7766554433221100ULL);
185
129
 
186
- uint64_t u64;
187
- ASSERT_OK_STATUS (mc_reader_read_u64 (&reader, &u64, status), status);
188
- ASSERT_CMPUINT64 (u64, ==, 0x7766554433221100ULL);
189
-
190
- _mongocrypt_buffer_cleanup (&input_buf);
191
- mongocrypt_status_destroy (status);
130
+ _mongocrypt_buffer_cleanup(&input_buf);
131
+ mongocrypt_status_destroy(status);
192
132
  }
193
133
 
194
- static void
195
- _test_mc_reader_bytes (_mongocrypt_tester_t *tester)
196
- {
197
- const uint8_t expected_bytes[] = {0x12,
198
- 0x34,
199
- 0x56,
200
- 0x78,
201
- 0x90,
202
- 0x12,
203
- 0x34,
204
- 0x56,
205
- 0x78,
206
- 0x90,
207
- 0x12,
208
- 0x34,
209
- 0x56,
210
- 0x78,
211
- 0x90,
212
- 0x12};
213
- uint64_t expected_len = sizeof (expected_bytes);
214
-
215
- _mongocrypt_buffer_t input_buf;
216
- _mongocrypt_buffer_copy_from_hex (&input_buf,
217
- "12345678901234567890123456789012");
218
-
219
- mongocrypt_status_t *status;
220
- status = mongocrypt_status_new ();
221
-
222
- mc_reader_t reader;
223
- mc_reader_init_from_buffer (&reader, &input_buf, __FUNCTION__);
224
-
225
- const uint8_t *ptr;
226
- const uint64_t len = 4;
227
- ASSERT_OK_STATUS (
228
- mc_reader_read_bytes (&reader, (const uint8_t **) &ptr, len, status),
229
- status);
230
- ASSERT_CMPBYTES (expected_bytes, 4, ptr, (size_t) len);
231
-
232
- _mongocrypt_buffer_t value_buf;
233
- ASSERT_OK_STATUS (mc_reader_read_buffer_to_end (&reader, &value_buf, status),
234
- status);
235
- ASSERT_CMPBYTES (
236
- expected_bytes + 4u, (size_t)expected_len - 4u, value_buf.data, value_buf.len);
237
-
238
- _mongocrypt_buffer_cleanup (&input_buf);
239
- _mongocrypt_buffer_cleanup (&value_buf);
240
- mongocrypt_status_destroy (status);
134
+ static void _test_mc_reader_bytes(_mongocrypt_tester_t *tester) {
135
+ const uint8_t expected_bytes[] =
136
+ {0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12};
137
+ uint64_t expected_len = sizeof(expected_bytes);
138
+
139
+ _mongocrypt_buffer_t input_buf;
140
+ _mongocrypt_buffer_copy_from_hex(&input_buf, "12345678901234567890123456789012");
141
+
142
+ mongocrypt_status_t *status;
143
+ status = mongocrypt_status_new();
144
+
145
+ mc_reader_t reader;
146
+ mc_reader_init_from_buffer(&reader, &input_buf, __FUNCTION__);
147
+
148
+ const uint8_t *ptr;
149
+ const uint64_t len = 4;
150
+ ASSERT_OK_STATUS(mc_reader_read_bytes(&reader, (const uint8_t **)&ptr, len, status), status);
151
+ ASSERT_CMPBYTES(expected_bytes, 4, ptr, (size_t)len);
152
+
153
+ _mongocrypt_buffer_t value_buf;
154
+ ASSERT_OK_STATUS(mc_reader_read_buffer_to_end(&reader, &value_buf, status), status);
155
+ ASSERT_CMPBYTES(expected_bytes + 4u, (size_t)expected_len - 4u, value_buf.data, value_buf.len);
156
+
157
+ _mongocrypt_buffer_cleanup(&input_buf);
158
+ _mongocrypt_buffer_cleanup(&value_buf);
159
+ mongocrypt_status_destroy(status);
241
160
  }
242
161
 
243
- void
244
- _mongocrypt_tester_install_mc_reader (_mongocrypt_tester_t *tester)
245
- {
246
- INSTALL_TEST (_test_mc_reader);
247
- INSTALL_TEST (_test_mc_reader_uuid);
248
- INSTALL_TEST (_test_mc_reader_prfblock);
249
- INSTALL_TEST (_test_mc_reader_ints);
250
- INSTALL_TEST (_test_mc_reader_bytes);
162
+ void _mongocrypt_tester_install_mc_reader(_mongocrypt_tester_t *tester) {
163
+ INSTALL_TEST(_test_mc_reader);
164
+ INSTALL_TEST(_test_mc_reader_uuid);
165
+ INSTALL_TEST(_test_mc_reader_prfblock);
166
+ INSTALL_TEST(_test_mc_reader_ints);
167
+ INSTALL_TEST(_test_mc_reader_bytes);
251
168
  }