libmongocrypt-helper 1.13.2.0.1001 → 1.14.0.0.1001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +8 -0
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +5 -1
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +4 -1
  5. data/ext/libmongocrypt/libmongocrypt/Earthfile +18 -17
  6. data/ext/libmongocrypt/libmongocrypt/README.md +8 -8
  7. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +7 -0
  8. data/ext/libmongocrypt/libmongocrypt/bindings/python/CONTRIBUTING.md +34 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +6 -2
  10. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +18 -2
  11. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +9 -1
  12. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +14 -0
  13. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +6 -2
  14. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +1 -1
  15. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +8 -8
  16. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/libmongocrypt-version.txt +1 -0
  17. data/ext/libmongocrypt/libmongocrypt/bindings/python/{release.sh → scripts/release.sh} +9 -3
  18. data/ext/libmongocrypt/libmongocrypt/bindings/python/{synchro.py → scripts/synchro.py} +16 -9
  19. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.sh +8 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update-version.sh +27 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update_binding.py +78 -0
  22. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +15 -0
  23. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +25 -18
  24. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +39 -13
  25. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +1 -1
  26. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +2 -2
  27. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +1 -1
  28. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.c +5 -0
  29. data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.h +1 -1
  30. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_azure_request.c +1 -1
  31. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  32. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +4 -2
  33. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +1 -2
  34. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +5 -1
  35. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +1 -1
  36. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt.c +1 -1
  37. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -8
  38. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.h +9 -0
  39. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response_parser.c +0 -1
  40. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.c +7 -3
  41. data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.h +2 -0
  42. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +8 -1
  43. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +5 -4
  44. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +1 -1
  45. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +1 -1
  46. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_request.c +4 -0
  47. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response.c +3 -0
  48. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response_parser.c +4 -0
  49. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.c +1 -1
  50. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.h +1 -1
  51. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +39 -39
  52. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +235 -65
  53. data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +1 -1
  54. data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +4 -2
  55. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +2 -2
  56. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +2 -2
  57. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +1 -4
  58. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +9 -11
  59. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +1 -0
  60. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +10 -8
  61. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +167 -176
  62. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +6 -17
  63. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +6 -17
  64. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +1 -1
  65. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +25 -26
  66. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +2 -1
  67. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload-private.h +122 -0
  68. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload.c +477 -0
  69. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +1 -3
  70. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +28 -43
  71. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +6 -17
  72. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +6 -5
  73. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +13 -10
  74. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +3 -2
  75. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +7 -6
  76. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c +4 -3
  77. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +1 -1
  78. data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils-private.h +27 -0
  79. data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils.c +48 -0
  80. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +5 -5
  81. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +15 -20
  82. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +4 -6
  83. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +9 -18
  84. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +4 -5
  85. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +5 -9
  86. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +14 -19
  87. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +2 -4
  88. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +109 -119
  89. data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +2 -2
  90. data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +4 -2
  91. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker-private.h +0 -3
  92. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker.c +4 -14
  93. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets-private.h +1 -1
  94. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets.c +3 -3
  95. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode-private.h +8 -1
  96. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode.c +78 -2
  97. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +34 -16
  98. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +66 -74
  99. data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +1 -1
  100. data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +4 -2
  101. data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +1 -1
  102. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +12 -1
  103. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
  104. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +5 -5
  105. data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +2 -5
  106. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +65 -58
  107. data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +3 -3
  108. data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +1 -1
  109. data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +1 -1
  110. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -1
  111. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +4 -0
  112. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +1 -1
  113. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +4 -4
  114. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +29 -25
  115. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +3 -2
  116. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +6 -3
  117. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +48 -58
  118. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +12 -0
  119. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +5 -13
  120. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +19 -2
  121. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +9 -9
  122. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +3 -4
  123. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +285 -89
  124. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +0 -2
  125. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +0 -1
  126. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +1 -1
  127. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +4 -1
  128. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -31
  129. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +2 -0
  130. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +1 -1
  131. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +3 -1
  132. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +1 -1
  133. data/ext/libmongocrypt/libmongocrypt/src/unicode/case-fold-map.c +1 -1
  134. data/ext/libmongocrypt/libmongocrypt/src/unicode/diacritic-fold-map.c +1 -1
  135. data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.c +1 -1
  136. data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +0 -14
  137. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +6 -1
  138. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV2.json +8 -0
  139. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +1 -1
  140. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +6 -4
  141. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +1 -1
  142. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
  143. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +6 -4
  144. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +2 -2
  145. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +1 -1
  146. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +6 -4
  147. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +1 -1
  148. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +14 -6
  149. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +1 -1
  150. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +6 -4
  151. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +1 -1
  152. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +1 -1
  153. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +6 -4
  154. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +1 -1
  155. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +1 -1
  156. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +6 -4
  157. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +1 -1
  158. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +1 -1
  159. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
  160. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +1 -1
  161. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +1 -1
  162. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +1 -1
  163. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +6 -4
  164. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +1 -1
  165. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
  166. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +6 -4
  167. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +1 -1
  168. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +1 -1
  169. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +6 -4
  170. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +1 -1
  171. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +14 -6
  172. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +1 -1
  173. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +6 -4
  174. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +1 -1
  175. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +1 -1
  176. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +3 -3
  177. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +1 -1
  178. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +1 -1
  179. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +6 -4
  180. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +1 -1
  181. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +1 -1
  182. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
  183. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +1 -1
  184. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +1 -1
  185. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +8 -0
  186. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +8 -0
  187. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +5 -5
  188. data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +11 -5
  189. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +2 -2
  190. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +9 -11
  191. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c +18 -29
  192. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +1 -1
  193. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +2 -18
  194. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-text-payload.c +320 -0
  195. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +2 -17
  196. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +1 -1
  197. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +8 -5
  198. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +6 -10
  199. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +29 -33
  200. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +12 -20
  201. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +5 -20
  202. data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +5 -5
  203. data/ext/libmongocrypt/libmongocrypt/test/test-mc-text-search-str-encode.c +147 -18
  204. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +35 -14
  205. data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +10 -10
  206. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +3 -7
  207. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +36 -24
  208. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +4 -4
  209. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +2 -2
  210. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +13 -13
  211. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +49 -55
  212. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +64 -67
  213. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +18 -18
  214. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +4 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +4 -3
  216. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +13 -3
  217. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +31 -13
  218. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +35 -52
  219. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +28 -1
  220. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +50 -91
  221. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +1 -1
  222. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +7 -4
  223. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +1 -1
  224. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +1 -1
  225. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +3 -5
  226. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +2 -2
  227. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +1 -1
  228. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +2 -2
  229. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +527 -225
  230. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +1 -1
  231. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +45 -56
  232. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +12 -3
  233. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +11 -11
  234. data/ext/libmongocrypt/libmongocrypt/test/test-unicode-fold.c +6 -2
  235. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +1 -1
  236. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +1 -1
  237. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +5 -5
  238. data/ext/libmongocrypt/libmongocrypt/test/util/util.h +7 -6
  239. data/lib/libmongocrypt_helper/version.rb +2 -2
  240. metadata +17 -13
  241. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +0 -1
  242. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +0 -50
  243. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +0 -14
  244. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +0 -29
  245. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +0 -29
  246. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EqualityIndexedValueV2.json +0 -8
  247. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2RangeIndexedValueV2.json +0 -8
  248. /data/ext/libmongocrypt/libmongocrypt/bindings/python/{build-manylinux-wheel.sh → scripts/build-manylinux-wheel.sh} +0 -0
  249. /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges.json → FLE2InsertUpdatePayload-RangeV1.json} +0 -0
  250. /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges-V2.json → FLE2InsertUpdatePayloadV2-RangeV1.json} +0 -0
@@ -1,8 +1,5 @@
1
1
  #include "./path.h"
2
2
 
3
- #define CHECK(Expr) \
4
- ((Expr) ? 0 : ((fprintf(stderr, "%s:%d: Check '%s' failed\n", __FILE__, __LINE__, #Expr), abort()), 0))
5
-
6
3
  #define TEST_DECOMP(Part, Given, Expect) \
7
4
  MSTR_ASSERT_EQ(mpath_##Part(mstrv_view_cstr(Given), MPATH_NATIVE), mstrv_view_cstr(Expect))
8
5
 
@@ -12,7 +9,7 @@ static void test_make_absolute(mpath_format f, const char *part, const char *bas
12
9
  mstr_free(result);
13
10
  }
14
11
 
15
- int main() {
12
+ int main(void) {
16
13
  mstr s = mstr_copy_cstr("/foo/bar/baz.txt");
17
14
  MSTR_ASSERT_EQ(mpath_parent(s.view, MPATH_NATIVE), mstrv_lit("/foo/bar"));
18
15
  MSTR_ASSERT_EQ(mpath_parent(mpath_parent(s.view, MPATH_NATIVE), MPATH_NATIVE), mstrv_lit("/foo"));
@@ -67,4 +64,4 @@ int main() {
67
64
  mstr_assign(&s, mpath_absolute(mstrv_lit("Z:/foo"), MPATH_POSIX));
68
65
 
69
66
  mstr_free(s);
70
- }
67
+ }
@@ -17,6 +17,12 @@
17
17
  #include <strings.h> /* For strncasecmp. */
18
18
  #endif
19
19
 
20
+ // Deliberately using old-style casts for C and C++ compatibility.
21
+ #if defined(__cplusplus) && defined(__clang__)
22
+ _Pragma("clang diagnostic push");
23
+ _Pragma("clang diagnostic ignored \"-Wold-style-cast\"");
24
+ #endif
25
+
20
26
  MLIB_C_LINKAGE_BEGIN
21
27
 
22
28
  /**
@@ -70,28 +76,26 @@ typedef struct mstr_view {
70
76
  * relinquish ownership of that `mstr` to the callee/caller, respectively.
71
77
  * Passing or returning an `mstr_view` is non-owning.
72
78
  */
73
- typedef struct mstr {
74
- union {
75
- struct {
76
- /**
77
- * @brief Pointer to the beginning of the code unit array.
78
- *
79
- * @note DO NOT MODIFY
80
- */
81
- const char *data;
82
- /**
83
- * @brief Length of the pointed-to code unit array
84
- *
85
- * @note DO NOT MODIFY
86
- */
87
- size_t len;
88
- };
89
-
79
+ typedef union mstr {
80
+ struct {
90
81
  /**
91
- * @brief A non-owning `mstr_view` of the string
82
+ * @brief Pointer to the beginning of the code unit array.
83
+ *
84
+ * @note DO NOT MODIFY
92
85
  */
93
- mstr_view view;
94
- };
86
+ const char *data;
87
+ /**
88
+ * @brief Length of the pointed-to code unit array
89
+ *
90
+ * @note DO NOT MODIFY
91
+ */
92
+ size_t len;
93
+ } raw;
94
+
95
+ /**
96
+ * @brief A non-owning `mstr_view` of the string
97
+ */
98
+ mstr_view view;
95
99
  } mstr;
96
100
 
97
101
  /**
@@ -100,34 +104,32 @@ typedef struct mstr {
100
104
  * Returned by @ref mstr_new(). Once initialization is complete, the result can
101
105
  * be used as an @ref mstr by accessing the @ref mstr_mut::mstr member.
102
106
  */
103
- typedef struct mstr_mut {
104
- union {
105
- struct {
106
- /**
107
- * @brief Pointer to the beginning of the mutable code unit array.
108
- *
109
- * @note DO NOT MODIFY THE POINTER VALUE. Only modify the pointed-to
110
- * characters.
111
- */
112
- char *data;
113
- /**
114
- * @brief Length of the pointed-to code unit array.
115
- *
116
- * @note DO NOT MODIFY
117
- */
118
- size_t len;
119
- };
120
- /// Convert the mutable string to an immutable string
121
- struct mstr mstr;
122
- /// Convert the mutable string to an immutable string view
123
- mstr_view view;
124
- };
107
+ typedef union mstr_mut {
108
+ struct {
109
+ /**
110
+ * @brief Pointer to the beginning of the mutable code unit array.
111
+ *
112
+ * @note DO NOT MODIFY THE POINTER VALUE. Only modify the pointed-to
113
+ * characters.
114
+ */
115
+ char *data;
116
+ /**
117
+ * @brief Length of the pointed-to code unit array.
118
+ *
119
+ * @note DO NOT MODIFY
120
+ */
121
+ size_t len;
122
+ } raw;
123
+ /// Convert the mutable string to an immutable string
124
+ union mstr mstr;
125
+ /// Convert the mutable string to an immutable string view
126
+ mstr_view view;
125
127
  } mstr_mut;
126
128
 
127
129
  /**
128
130
  * @brief A null @ref mstr
129
131
  */
130
- #define MSTR_NULL (MLIB_INIT(mstr){{{NULL, 0}}})
132
+ #define MSTR_NULL (MLIB_INIT(mstr){{NULL, 0}})
131
133
  /**
132
134
  * @brief A null @ref mstr_view
133
135
  */
@@ -153,7 +155,7 @@ typedef struct mstr_mut {
153
155
  static inline mstr_mut mstr_new(size_t len) {
154
156
  #ifndef __clang_analyzer__
155
157
  assert(len < SIZE_MAX);
156
- return MLIB_INIT(mstr_mut){{{(char *)calloc(1, len + 1), len}}};
158
+ return MLIB_INIT(mstr_mut){{(char *)calloc(1, len + 1), len}};
157
159
  #else
158
160
  // Clang-analyzer is smart enough to see the calloc(), but not smart enough
159
161
  // to link it to the free() in mstr_free()
@@ -195,7 +197,7 @@ static inline mstr_view mstrv_view_cstr(const char *s) {
195
197
  */
196
198
  static inline mstr mstr_copy_data(const char *s, size_t len) {
197
199
  mstr_mut r = mstr_new(len);
198
- memcpy(r.data, s, len);
200
+ memcpy(r.raw.data, s, len);
199
201
  return r.mstr;
200
202
  }
201
203
 
@@ -225,7 +227,7 @@ static inline mstr mstr_copy(mstr_view s) {
225
227
  * @param s The string to free
226
228
  */
227
229
  static inline void mstr_free(mstr s) {
228
- free((char *)s.data);
230
+ free((char *)s.raw.data);
229
231
  }
230
232
 
231
233
  /**
@@ -236,21 +238,21 @@ static inline void mstr_free(mstr s) {
236
238
  * @param new_len The new length of the string
237
239
  */
238
240
  static inline void mstrm_resize(mstr_mut *s, size_t new_len) {
239
- if (new_len <= s->len) {
240
- s->len = new_len;
241
+ if (new_len <= s->raw.len) {
242
+ s->raw.len = new_len;
241
243
  } else {
242
- const size_t old_len = s->len;
244
+ const size_t old_len = s->raw.len;
243
245
  #ifndef __clang_analyzer__
244
246
  // Clang-analyzer is smart enough to see the calloc(), but not smart
245
247
  // enough to link it to the free() in mstr_free()
246
248
  assert(new_len < SIZE_MAX);
247
- s->data = (char *)realloc((char *)s->data, new_len + 1);
249
+ s->raw.data = (char *)realloc((char *)s->raw.data, new_len + 1);
248
250
  #endif
249
- s->len = new_len;
251
+ s->raw.len = new_len;
250
252
  assert(new_len >= old_len);
251
- memset(s->data + old_len, 0, new_len - old_len);
253
+ memset(s->raw.data + old_len, 0, new_len - old_len);
252
254
  }
253
- s->data[new_len] = (char)0;
255
+ s->raw.data[new_len] = (char)0;
254
256
  }
255
257
 
256
258
  /**
@@ -369,7 +371,7 @@ static inline mstr mstr_splice(mstr_view s, size_t at, size_t del_count, mstr_vi
369
371
  assert(s.len - del_count <= SIZE_MAX - insert.len);
370
372
  const size_t new_size = s.len - del_count + insert.len;
371
373
  mstr_mut ret = mstr_new(new_size);
372
- char *p = ret.data;
374
+ char *p = ret.raw.data;
373
375
  memcpy(p, s.data, at);
374
376
  p += at;
375
377
  if (insert.data) {
@@ -451,7 +453,7 @@ static inline mstr mstr_substr(mstr_view s, size_t at, size_t len) {
451
453
  len = remain;
452
454
  }
453
455
  mstr_mut r = mstr_new(len);
454
- memcpy(r.data, s.data + at, len);
456
+ memcpy(r.raw.data, s.data + at, len);
455
457
  return r.mstr;
456
458
  }
457
459
 
@@ -607,7 +609,7 @@ static inline void _mstr_assert_(mstr_view left,
607
609
  if (!B) {
608
610
  mstr_assign(&pstr, mstr_prepend(pstr.view, mstrv_lit("not ")));
609
611
  }
610
- _mstr_assert_fail_(left, pstr.data, right, file, line);
612
+ _mstr_assert_fail_(left, pstr.raw.data, right, file, line);
611
613
  }
612
614
  }
613
615
 
@@ -767,9 +769,9 @@ static inline mstr_narrow_result mstr_win32_narrow(const wchar_t *wstring) {
767
769
  wcflags,
768
770
  wstring,
769
771
  -1,
770
- ret.data,
772
+ ret.raw.data,
771
773
  // Plus one byte for the NUL
772
- (int)(ret.len + 1),
774
+ (int)(ret.raw.len + 1),
773
775
  NULL,
774
776
  NULL);
775
777
  assert(length == got_len);
@@ -906,4 +908,9 @@ static mlib_constexpr_fn size_t mlib_strnmcopy(char *dst, size_t dst_bufsize, co
906
908
 
907
909
  MLIB_C_LINKAGE_END
908
910
 
911
+ // Deliberately using old-style casts for C and C++ compatibility.
912
+ #if defined(__cplusplus) && defined(__clang__)
913
+ _Pragma("clang diagnostic pop");
914
+ #endif
915
+
909
916
  #endif // MONGOCRYPT_STR_PRIVATE_H
@@ -5,16 +5,16 @@
5
5
 
6
6
  #define test_predicate(Bool, Left, Pred, Right) MSTR_ASSERT(Bool, mstrv_lit(Left), Pred, mstrv_lit(Right))
7
7
 
8
- int main() {
8
+ int main(void) {
9
9
  // Test the null-initializers:
10
10
  mstr str = MSTR_NULL;
11
11
  mstr_view null_view = MSTRV_NULL;
12
12
  (void)null_view;
13
13
 
14
14
  str = mstr_copy_cstr("foo");
15
- CHECK(str.len == 3);
15
+ CHECK(str.raw.len == 3);
16
16
  MSTR_ASSERT_EQ(str.view, mstrv_lit("foo"));
17
- CHECK(strncmp(str.data, "foo", 3) == 0);
17
+ CHECK(strncmp(str.raw.data, "foo", 3) == 0);
18
18
 
19
19
  mstr_inplace_append(&str, mstrv_lit("bar"));
20
20
  MSTR_ASSERT_EQ(str.view, mstrv_lit("foobar"));
@@ -40,7 +40,7 @@ typedef struct mlib_once_flag {
40
40
  */
41
41
  typedef void (*mlib_init_once_fn_t)(void);
42
42
 
43
- #if _WIN32
43
+ #if defined(_WIN32)
44
44
  /**
45
45
  * An indirection layer for mlib_once on Windows platforms. Do not use directly.
46
46
  */
@@ -1,4 +1,4 @@
1
1
  #ifndef MLIB_USER
2
2
  #error \
3
3
  "The file being compiled transitively #include'd a mongo-mlib header, but is not a direct consumer of mlib, which is a private library for MongoDB C driver libraries"
4
- #endif
4
+ #endif
@@ -20,4 +20,4 @@
20
20
 
21
21
  void _mongocrypt_cache_collinfo_init(_mongocrypt_cache_t *cache);
22
22
 
23
- #endif /* MONGOCRYPT_CACHE_COLLINFO_PRIVATE_H */
23
+ #endif /* MONGOCRYPT_CACHE_COLLINFO_PRIVATE_H */
@@ -14,6 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ #include "mongocrypt-cache-collinfo-private.h"
18
+
19
+ //
20
+
17
21
  #include "mongocrypt-cache-private.h"
18
22
 
19
23
  /* The collinfo cache.
@@ -22,7 +22,7 @@
22
22
  #include "mongocrypt.h"
23
23
 
24
24
  /**
25
- * Produced by mongocrypt-marking.c from _mongocrypt_marking_t
25
+ * Produced by mongocrypt-marking.u.fle1.c from _mongocrypt_marking_t
26
26
  * as encrypted payloads for blob_subtypes:
27
27
  * FLE1DeterministicEncryptedValue(1)
28
28
  * FLE1RandomEncryptedValue(2)
@@ -77,18 +77,18 @@ typedef struct {
77
77
  // FLE1 algorithm: AES-256-CBC HMAC/SHA-512-256 (SHA-512 truncated to 256 bits)
78
78
  // Algorithm is documented in [FLE and
79
79
  // AEAD](https://docs.google.com/document/d/1D8xTXWo1B1dunO0bDZhPdolKTMbbD5fUIgsERubWRmY)
80
- const _mongocrypt_value_encryption_algorithm_t *_mcFLE1Algorithm();
80
+ const _mongocrypt_value_encryption_algorithm_t *_mcFLE1Algorithm(void);
81
81
 
82
82
  // FLE2 general algorithm: AES-256-CTR HMAC/SHA-256
83
83
  // Algorithm is documented in [AEAD with
84
84
  // CTR](https://docs.google.com/document/d/1eCU7R8Kjr-mdyz6eKvhNIDVmhyYQcAaLtTfHeK7a_vE/).
85
- const _mongocrypt_value_encryption_algorithm_t *_mcFLE2AEADAlgorithm();
85
+ const _mongocrypt_value_encryption_algorithm_t *_mcFLE2AEADAlgorithm(void);
86
86
 
87
87
  // FLE2 used with FLE2IndexedEncryptedValue: AES-256-CTR no HMAC
88
- const _mongocrypt_value_encryption_algorithm_t *_mcFLE2Algorithm();
88
+ const _mongocrypt_value_encryption_algorithm_t *_mcFLE2Algorithm(void);
89
89
 
90
90
  // FLE2AEAD general algorithm: AES-256-CBC HMAC/SHA-256
91
- const _mongocrypt_value_encryption_algorithm_t *_mcFLE2v2AEADAlgorithm();
91
+ const _mongocrypt_value_encryption_algorithm_t *_mcFLE2v2AEADAlgorithm(void);
92
92
 
93
93
  bool _mongocrypt_random(_mongocrypt_crypto_t *crypto,
94
94
  _mongocrypt_buffer_t *out,
@@ -305,9 +305,7 @@ bool _mongocrypt_hmac_sha_256(_mongocrypt_crypto_t *crypto,
305
305
  BSON_ASSERT_PARAM(out);
306
306
 
307
307
  if (key->len != MONGOCRYPT_MAC_KEY_LEN) {
308
- CLIENT_ERR("invalid hmac_sha_256 key length. Got %" PRIu32 ", expected: %" PRIu32,
309
- key->len,
310
- MONGOCRYPT_MAC_KEY_LEN);
308
+ CLIENT_ERR("invalid hmac_sha_256 key length. Got %" PRIu32 ", expected: %d", key->len, MONGOCRYPT_MAC_KEY_LEN);
311
309
  return false;
312
310
  }
313
311
 
@@ -501,12 +499,14 @@ static bool _encrypt_step(_mongocrypt_crypto_t *crypto,
501
499
  *bytes_written = 0;
502
500
 
503
501
  if (MONGOCRYPT_IV_LEN != iv->len) {
504
- CLIENT_ERR("IV should have length %d, but has length %d", MONGOCRYPT_IV_LEN, iv->len);
502
+ CLIENT_ERR("IV should have length %d, but has length %" PRIu32, MONGOCRYPT_IV_LEN, iv->len);
505
503
  return false;
506
504
  }
507
505
 
508
506
  if (MONGOCRYPT_ENC_KEY_LEN != enc_key->len) {
509
- CLIENT_ERR("Encryption key should have length %d, but has length %d", MONGOCRYPT_ENC_KEY_LEN, enc_key->len);
507
+ CLIENT_ERR("Encryption key should have length %d, but has length %" PRIu32,
508
+ MONGOCRYPT_ENC_KEY_LEN,
509
+ enc_key->len);
510
510
  return false;
511
511
  }
512
512
 
@@ -575,7 +575,9 @@ static bool _encrypt_step(_mongocrypt_crypto_t *crypto,
575
575
  }
576
576
 
577
577
  if (*bytes_written % MONGOCRYPT_BLOCK_SIZE != 0) {
578
- CLIENT_ERR("encryption failure, wrote %d bytes, not a multiple of %d", *bytes_written, MONGOCRYPT_BLOCK_SIZE);
578
+ CLIENT_ERR("encryption failure, wrote %" PRIu32 " bytes, not a multiple of %d",
579
+ *bytes_written,
580
+ MONGOCRYPT_BLOCK_SIZE);
579
581
  return false;
580
582
  }
581
583
 
@@ -628,12 +630,12 @@ static bool _hmac_step(_mongocrypt_crypto_t *crypto,
628
630
  _mongocrypt_buffer_init(&to_hmac);
629
631
 
630
632
  if (MONGOCRYPT_MAC_KEY_LEN != Km->len) {
631
- CLIENT_ERR("HMAC key wrong length: %d", Km->len);
633
+ CLIENT_ERR("HMAC key wrong length: %" PRIu32, Km->len);
632
634
  goto done;
633
635
  }
634
636
 
635
637
  if (out->len != MONGOCRYPT_HMAC_LEN) {
636
- CLIENT_ERR("out wrong length: %d", out->len);
638
+ CLIENT_ERR("out wrong length: %" PRIu32, out->len);
637
639
  goto done;
638
640
  }
639
641
 
@@ -761,18 +763,18 @@ static bool _mongocrypt_do_encryption(_mongocrypt_crypto_t *crypto,
761
763
  return false;
762
764
  }
763
765
  if (expect_ciphertext_len != ciphertext->len) {
764
- CLIENT_ERR("output ciphertext should have been allocated with %d bytes", expect_ciphertext_len);
766
+ CLIENT_ERR("output ciphertext should have been allocated with %" PRIu32 " bytes", expect_ciphertext_len);
765
767
  return false;
766
768
  }
767
769
 
768
770
  if (MONGOCRYPT_IV_LEN != iv->len) {
769
- CLIENT_ERR("IV should have length %d, but has length %d", MONGOCRYPT_IV_LEN, iv->len);
771
+ CLIENT_ERR("IV should have length %d, but has length %" PRIu32, MONGOCRYPT_IV_LEN, iv->len);
770
772
  return false;
771
773
  }
772
774
 
773
775
  const uint32_t expected_key_len = (key_format == KEY_FORMAT_FLE2) ? MONGOCRYPT_ENC_KEY_LEN : MONGOCRYPT_KEY_LEN;
774
776
  if (key->len != expected_key_len) {
775
- CLIENT_ERR("key should have length %d, but has length %d", expected_key_len, key->len);
777
+ CLIENT_ERR("key should have length %" PRIu32 ", but has length %" PRIu32, expected_key_len, key->len);
776
778
  return false;
777
779
  }
778
780
 
@@ -886,11 +888,13 @@ static bool _decrypt_step(_mongocrypt_crypto_t *crypto,
886
888
  *bytes_written = 0;
887
889
 
888
890
  if (MONGOCRYPT_IV_LEN != iv->len) {
889
- CLIENT_ERR("IV should have length %d, but has length %d", MONGOCRYPT_IV_LEN, iv->len);
891
+ CLIENT_ERR("IV should have length %d, but has length %" PRIu32, MONGOCRYPT_IV_LEN, iv->len);
890
892
  return false;
891
893
  }
892
894
  if (MONGOCRYPT_ENC_KEY_LEN != enc_key->len) {
893
- CLIENT_ERR("encryption key should have length %d, but has length %d", MONGOCRYPT_ENC_KEY_LEN, enc_key->len);
895
+ CLIENT_ERR("encryption key should have length %d, but has length %" PRIu32,
896
+ MONGOCRYPT_ENC_KEY_LEN,
897
+ enc_key->len);
894
898
  return false;
895
899
  }
896
900
 
@@ -986,8 +990,8 @@ static bool _mongocrypt_do_decryption(_mongocrypt_crypto_t *crypto,
986
990
  return false;
987
991
  }
988
992
  if (plaintext->len != expect_plaintext_len) {
989
- CLIENT_ERR("output plaintext should have been allocated with %d bytes, "
990
- "but has: %d",
993
+ CLIENT_ERR("output plaintext should have been allocated with %" PRIu32 " bytes, "
994
+ "but has: %" PRIu32,
991
995
  expect_plaintext_len,
992
996
  plaintext->len);
993
997
  return false;
@@ -1004,13 +1008,13 @@ static bool _mongocrypt_do_decryption(_mongocrypt_crypto_t *crypto,
1004
1008
 
1005
1009
  const uint32_t expected_key_len = (key_format == KEY_FORMAT_FLE2) ? MONGOCRYPT_ENC_KEY_LEN : MONGOCRYPT_KEY_LEN;
1006
1010
  if (expected_key_len != key->len) {
1007
- CLIENT_ERR("key should have length %d, but has length %d", expected_key_len, key->len);
1011
+ CLIENT_ERR("key should have length %" PRIu32 ", but has length %" PRIu32, expected_key_len, key->len);
1008
1012
  return false;
1009
1013
  }
1010
1014
 
1011
1015
  const uint32_t min_cipherlen = _mongocrypt_calculate_ciphertext_len(0, mode, hmac, NULL);
1012
1016
  if (ciphertext->len < min_cipherlen) {
1013
- CLIENT_ERR("corrupt ciphertext - must be >= %d bytes", min_cipherlen);
1017
+ CLIENT_ERR("corrupt ciphertext - must be >= %" PRIu32 " bytes", min_cipherlen);
1014
1018
  return false;
1015
1019
  }
1016
1020
 
@@ -1138,7 +1142,9 @@ static bool _mongocrypt_do_decryption(_mongocrypt_crypto_t *crypto,
1138
1142
  _mc_##name##_do_encryption, \
1139
1143
  _mc_##name##_do_decryption, \
1140
1144
  }; \
1141
- const _mongocrypt_value_encryption_algorithm_t *_mc##name##Algorithm() { return &_mc##name##Algorithm_definition; }
1145
+ const _mongocrypt_value_encryption_algorithm_t *_mc##name##Algorithm(void) { \
1146
+ return &_mc##name##Algorithm_definition; \
1147
+ }
1142
1148
 
1143
1149
  // FLE1 algorithm: AES-256-CBC HMAC/SHA-512-256 (SHA-512 truncated to 256 bits)
1144
1150
  DECLARE_ALGORITHM(FLE1, CBC, SHA_512_256)
@@ -1181,7 +1187,7 @@ bool _mongocrypt_random(_mongocrypt_crypto_t *crypto,
1181
1187
  BSON_ASSERT_PARAM(out);
1182
1188
 
1183
1189
  if (count != out->len) {
1184
- CLIENT_ERR("out should have length %d, but has length %d", count, out->len);
1190
+ CLIENT_ERR("out should have length %" PRIu32 ", but has length %" PRIu32, count, out->len);
1185
1191
  return false;
1186
1192
  }
1187
1193
 
@@ -1233,11 +1239,11 @@ bool _mongocrypt_calculate_deterministic_iv(_mongocrypt_crypto_t *crypto,
1233
1239
  BSON_ASSERT_PARAM(out);
1234
1240
 
1235
1241
  if (MONGOCRYPT_KEY_LEN != key->len) {
1236
- CLIENT_ERR("key should have length %d, but has length %d\n", MONGOCRYPT_KEY_LEN, key->len);
1242
+ CLIENT_ERR("key should have length %d, but has length %" PRIu32 "\n", MONGOCRYPT_KEY_LEN, key->len);
1237
1243
  goto done;
1238
1244
  }
1239
1245
  if (MONGOCRYPT_IV_LEN != out->len) {
1240
- CLIENT_ERR("out should have length %d, but has length %d\n", MONGOCRYPT_IV_LEN, out->len);
1246
+ CLIENT_ERR("out should have length %d, but has length %" PRIu32 "\n", MONGOCRYPT_IV_LEN, out->len);
1241
1247
  goto done;
1242
1248
  }
1243
1249
 
@@ -1300,7 +1306,7 @@ bool _mongocrypt_wrap_key(_mongocrypt_crypto_t *crypto,
1300
1306
  _mongocrypt_buffer_init(encrypted_dek);
1301
1307
 
1302
1308
  if (dek->len != MONGOCRYPT_KEY_LEN) {
1303
- CLIENT_ERR("data encryption key is incorrect length, expected: %" PRIu32 ", got: %" PRIu32,
1309
+ CLIENT_ERR("data encryption key is incorrect length, expected: %d, got: %" PRIu32,
1304
1310
  MONGOCRYPT_KEY_LEN,
1305
1311
  dek->len);
1306
1312
  goto done;
@@ -1348,9 +1354,7 @@ bool _mongocrypt_unwrap_key(_mongocrypt_crypto_t *crypto,
1348
1354
  dek->len = bytes_written;
1349
1355
 
1350
1356
  if (dek->len != MONGOCRYPT_KEY_LEN) {
1351
- CLIENT_ERR("decrypted key is incorrect length, expected: %" PRIu32 ", got: %" PRIu32,
1352
- MONGOCRYPT_KEY_LEN,
1353
- dek->len);
1357
+ CLIENT_ERR("decrypted key is incorrect length, expected: %d, got: %" PRIu32, MONGOCRYPT_KEY_LEN, dek->len);
1354
1358
  return false;
1355
1359
  }
1356
1360
  return true;
@@ -469,7 +469,8 @@ static bool _finalize(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *out) {
469
469
  if (!(_stmt)) { \
470
470
  bson_destroy(&key_doc); \
471
471
  return _mongocrypt_ctx_fail_w_msg(ctx, "unable to construct BSON doc"); \
472
- }
472
+ } else \
473
+ ((void)0)
473
474
 
474
475
  dkctx = (_mongocrypt_ctx_datakey_t *)ctx;
475
476
 
@@ -566,4 +567,4 @@ bool mongocrypt_ctx_datakey_init(mongocrypt_ctx_t *ctx) {
566
567
  ret = true;
567
568
  done:
568
569
  return ret;
569
- }
570
+ }
@@ -29,19 +29,22 @@
29
29
  #define CHECK_AND_RETURN(cond) \
30
30
  if (!(cond)) { \
31
31
  goto fail; \
32
- }
32
+ } else \
33
+ ((void)0)
33
34
 
34
35
  #define CHECK_AND_RETURN_STATUS(cond, msg) \
35
36
  if (!(cond)) { \
36
37
  CLIENT_ERR(msg); \
37
38
  goto fail; \
38
- }
39
+ } else \
40
+ ((void)0)
39
41
 
40
42
  #define CHECK_AND_RETURN_KB_STATUS(cond) \
41
43
  if (!(cond)) { \
42
44
  _mongocrypt_key_broker_status(kb, status); \
43
45
  goto fail; \
44
- }
46
+ } else \
47
+ ((void)0)
45
48
 
46
49
  static bool _replace_FLE2IndexedEncryptedValue_with_plaintext(void *ctx,
47
50
  _mongocrypt_buffer_t *in,