libmongocrypt-helper 1.7.4.0.1002 → 1.8.0.0.1001
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +9 -7
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +17 -23
- data/ext/libmongocrypt/libmongocrypt/Earthfile +374 -0
- data/ext/libmongocrypt/libmongocrypt/README.md +7 -7
- data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClient.cs +25 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +25 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +3 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/cs.sln +79 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +6 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +134 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +3 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +203 -77
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +165 -43
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +12 -14
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/errors.js +75 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +34 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/azure.js +178 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/gcp.js +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/index.js +54 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/utils.js +39 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +9 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +4440 -5189
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +27 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +65 -38
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +4 -7
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +434 -42
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/common.test.js +94 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +1 -45
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/index.test.js +45 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/providers/credentialsProvider.test.js +551 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +10 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +23 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/chai-addons.js +8 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/types/index.test-d.ts +63 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +128 -238
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +0 -27
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +5 -21
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +5 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +14 -9
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +1 -10
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +5 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +4 -12
- data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +8 -6
- data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +2 -1
- data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -0
- data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +2 -2
- data/ext/libmongocrypt/libmongocrypt/etc/c6-vault.repo +39 -0
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_aead_generate_tests.py +15 -24
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
- data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
- data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
- data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -0
- data/ext/libmongocrypt/libmongocrypt/src/crypto/cng.c +381 -436
- data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +180 -248
- data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
- data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
- data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
- data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +7 -11
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +80 -92
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +59 -70
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +384 -439
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +88 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +24 -27
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +137 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +117 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +28 -36
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +294 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +476 -325
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +55 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +517 -580
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +36 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +57 -76
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +158 -189
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +36 -42
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +515 -558
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +155 -191
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +43 -53
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +170 -240
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +29 -34
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +289 -338
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +55 -49
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +109 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
- data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
- data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +444 -499
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +251 -334
- data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
- data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
- data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +3 -6
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +444 -565
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +103 -132
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +8 -14
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +78 -90
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1137 -1565
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +425 -472
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2394 -2697
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +166 -186
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +921 -1138
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +16 -24
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +37 -43
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +215 -253
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +73 -108
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +889 -1034
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +92 -120
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1397 -1612
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +30 -36
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1821 -1470
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +80 -108
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +354 -424
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +101 -117
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +96 -135
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +1092 -1320
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +130 -295
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +66 -78
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +60 -73
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
- data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +60 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/README.md +17 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +21 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +21 -0
- data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +278 -323
- data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +58 -73
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +89 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +172 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +346 -388
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +708 -825
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +417 -481
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +110 -144
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +223 -213
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +634 -807
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +1 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +34 -36
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +331 -445
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +670 -814
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +102 -135
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +54 -71
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +867 -1045
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +4349 -4713
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +991 -1178
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +342 -419
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +286 -370
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +656 -692
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +377 -451
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +48 -67
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +4 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +827 -918
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +111 -172
- data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +508 -559
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +735 -881
- data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
- data/lib/libmongocrypt_helper/version.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +154 -26
- metadata.gz.sig +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/test/data/aes-ctr.cstructs +0 -359
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/value-to-encrypt.json +0 -20
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
- /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
- /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/rangeopts.json +0 -0
- /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
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/rangeopts.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
@@ -1,6 +1,5 @@
|
|
1
1
|
// Turn on libc extensions so that we can use dladdr() on Unix-like systems
|
2
|
-
#if defined(__has_include) &&
|
3
|
-
!(defined(_GNU_SOURCE) || defined(_DARWIN_C_SOURCE))
|
2
|
+
#if defined(__has_include) && !(defined(_GNU_SOURCE) || defined(_DARWIN_C_SOURCE))
|
4
3
|
#if __has_include(<features.h>)
|
5
4
|
// We're using a glibc-compatible library
|
6
5
|
#define _GNU_SOURCE
|
@@ -20,42 +19,36 @@
|
|
20
19
|
#ifndef _WIN32
|
21
20
|
|
22
21
|
#include <assert.h>
|
23
|
-
#include <string.h>
|
24
22
|
#include <stdio.h>
|
23
|
+
#include <string.h>
|
25
24
|
|
26
25
|
#include <dlfcn.h>
|
27
26
|
|
28
|
-
mcr_dll
|
29
|
-
|
30
|
-
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
};
|
44
|
-
}
|
27
|
+
mcr_dll mcr_dll_open(const char *filepath) {
|
28
|
+
void *handle = dlopen(filepath, RTLD_LAZY | RTLD_LOCAL);
|
29
|
+
if (handle == NULL) {
|
30
|
+
// Failed to open. Return NULL and copy the error message
|
31
|
+
return (mcr_dll){
|
32
|
+
._native_handle = NULL,
|
33
|
+
.error_string = mstr_copy_cstr(dlerror()),
|
34
|
+
};
|
35
|
+
} else {
|
36
|
+
// Okay
|
37
|
+
return (mcr_dll){
|
38
|
+
._native_handle = handle,
|
39
|
+
.error_string = MSTR_NULL,
|
40
|
+
};
|
41
|
+
}
|
45
42
|
}
|
46
43
|
|
47
|
-
void
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
dlclose (dll._native_handle);
|
52
|
-
}
|
44
|
+
void mcr_dll_close_handle(mcr_dll dll) {
|
45
|
+
if (dll._native_handle) {
|
46
|
+
dlclose(dll._native_handle);
|
47
|
+
}
|
53
48
|
}
|
54
49
|
|
55
|
-
void *
|
56
|
-
|
57
|
-
{
|
58
|
-
return dlsym (dll._native_handle, sym);
|
50
|
+
void *mcr_dll_sym(mcr_dll dll, const char *sym) {
|
51
|
+
return dlsym(dll._native_handle, sym);
|
59
52
|
}
|
60
53
|
|
61
54
|
#endif
|
@@ -65,60 +58,55 @@ mcr_dll_sym (mcr_dll dll, const char *sym)
|
|
65
58
|
#include <mach-o/dyld.h>
|
66
59
|
#include <mach-o/nlist.h>
|
67
60
|
|
68
|
-
mcr_dll_path_result
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
return (mcr_dll_path_result){
|
105
|
-
.error_string = mstr_copy_cstr ("Handle not found in loaded modules")};
|
61
|
+
mcr_dll_path_result mcr_dll_path(mcr_dll dll) {
|
62
|
+
// Clear the three low bits of the module handle:
|
63
|
+
uintptr_t needle = ((uintptr_t)dll._native_handle & ~UINT64_C(0x3));
|
64
|
+
// Iterate each loaded dyld image
|
65
|
+
/// NOTE: Not thread safe. Is there a thread-safe way to do this?
|
66
|
+
for (uint32_t idx = 0; idx < _dyld_image_count(); ++idx) {
|
67
|
+
// Get the filepath:
|
68
|
+
/// NOTE: Between here and `dlopen`, `dyld_name` could be invalidated by
|
69
|
+
/// a concurrent call to `dlclose()`. Is there a better way?
|
70
|
+
const char *dyld_name = _dyld_get_image_name(idx);
|
71
|
+
// Try and open it. This will return an equivalent pointer to the original
|
72
|
+
// handle to the loaded image since they are deduplicated and reference
|
73
|
+
// counted.
|
74
|
+
void *try_handle = dlopen(dyld_name, RTLD_LAZY);
|
75
|
+
if (!dyld_name) {
|
76
|
+
// Ouch: `idx` was invalidated before we called _dyld_get_image_name.
|
77
|
+
// This will have caused `dlopen()` to return the default handle:
|
78
|
+
assert(try_handle == RTLD_DEFAULT);
|
79
|
+
continue;
|
80
|
+
}
|
81
|
+
// Copy the string before closing, to shrink the chance of `dyld_name`
|
82
|
+
// being used-after-freed.
|
83
|
+
mstr ret_name = mstr_copy_cstr(dyld_name);
|
84
|
+
// Mask off the mode bits:
|
85
|
+
uintptr_t cur = (uintptr_t)try_handle & ~UINT64_C(0x3);
|
86
|
+
// Close our reference to the image. We only care about the handle value.
|
87
|
+
dlclose(try_handle);
|
88
|
+
if (needle == cur) {
|
89
|
+
// We've found the handle
|
90
|
+
return (mcr_dll_path_result){.path = ret_name};
|
91
|
+
}
|
92
|
+
// Not this name.
|
93
|
+
mstr_free(ret_name);
|
94
|
+
}
|
95
|
+
return (mcr_dll_path_result){.error_string = mstr_copy_cstr("Handle not found in loaded modules")};
|
106
96
|
}
|
107
97
|
|
108
98
|
#elif defined(__linux__) || defined(__FreeBSD__)
|
109
99
|
|
110
100
|
#include <link.h>
|
111
101
|
|
112
|
-
mcr_dll_path_result
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
return (mcr_dll_path_result){.error_string = mstr_copy_cstr (dlerror ())};
|
121
|
-
}
|
102
|
+
mcr_dll_path_result mcr_dll_path(mcr_dll dll) {
|
103
|
+
struct link_map *map;
|
104
|
+
int rc = dlinfo(dll._native_handle, RTLD_DI_LINKMAP, &map);
|
105
|
+
if (rc == 0) {
|
106
|
+
return (mcr_dll_path_result){.path = mstr_copy_cstr(map->l_name)};
|
107
|
+
} else {
|
108
|
+
return (mcr_dll_path_result){.error_string = mstr_copy_cstr(dlerror())};
|
109
|
+
}
|
122
110
|
}
|
123
111
|
|
124
112
|
#elif defined(_WIN32)
|
@@ -18,40 +18,32 @@
|
|
18
18
|
|
19
19
|
#ifndef _WIN32
|
20
20
|
|
21
|
-
void
|
22
|
-
|
23
|
-
{
|
24
|
-
|
25
|
-
|
26
|
-
abort ();
|
27
|
-
}
|
21
|
+
void _mongocrypt_mutex_init(mongocrypt_mutex_t *mutex) {
|
22
|
+
int ret = pthread_mutex_init(mutex, NULL);
|
23
|
+
if (ret) {
|
24
|
+
abort();
|
25
|
+
}
|
28
26
|
}
|
29
27
|
|
30
|
-
void
|
31
|
-
|
32
|
-
{
|
33
|
-
|
34
|
-
|
35
|
-
abort ();
|
36
|
-
}
|
28
|
+
void _mongocrypt_mutex_cleanup(mongocrypt_mutex_t *mutex) {
|
29
|
+
int ret = pthread_mutex_destroy(mutex);
|
30
|
+
if (ret) {
|
31
|
+
abort();
|
32
|
+
}
|
37
33
|
}
|
38
34
|
|
39
|
-
void
|
40
|
-
|
41
|
-
{
|
42
|
-
|
43
|
-
|
44
|
-
abort ();
|
45
|
-
}
|
35
|
+
void _mongocrypt_mutex_lock(mongocrypt_mutex_t *mutex) {
|
36
|
+
int ret = pthread_mutex_lock(mutex);
|
37
|
+
if (ret) {
|
38
|
+
abort();
|
39
|
+
}
|
46
40
|
}
|
47
41
|
|
48
|
-
void
|
49
|
-
|
50
|
-
{
|
51
|
-
|
52
|
-
|
53
|
-
abort ();
|
54
|
-
}
|
42
|
+
void _mongocrypt_mutex_unlock(mongocrypt_mutex_t *mutex) {
|
43
|
+
int ret = pthread_mutex_unlock(mutex);
|
44
|
+
if (ret) {
|
45
|
+
abort();
|
46
|
+
}
|
55
47
|
}
|
56
48
|
|
57
49
|
#endif /* _WIN32 */
|
@@ -2,91 +2,78 @@
|
|
2
2
|
|
3
3
|
#ifdef _WIN32
|
4
4
|
|
5
|
-
#include <mlib/str.h>
|
6
|
-
#include <mlib/path.h>
|
7
5
|
#include <mlib/error.h>
|
6
|
+
#include <mlib/path.h>
|
7
|
+
#include <mlib/str.h>
|
8
8
|
|
9
|
-
#include <string.h>
|
10
9
|
#include <stdio.h>
|
10
|
+
#include <string.h>
|
11
11
|
|
12
12
|
#include <windows.h>
|
13
13
|
|
14
|
-
mcr_dll
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
if (lib == NULL) {
|
38
|
-
return (mcr_dll){._native_handle = NULL,
|
39
|
-
.error_string =
|
40
|
-
merror_system_error_string (GetLastError ())};
|
41
|
-
}
|
42
|
-
free (wide.wstring);
|
43
|
-
return (mcr_dll){.error_string = NULL, ._native_handle = lib};
|
14
|
+
mcr_dll mcr_dll_open(const char *filepath_) {
|
15
|
+
// Convert all slashes to the native Windows separator
|
16
|
+
mstr filepath = mpath_to_format(MPATH_WIN32, mstrv_view_cstr(filepath_), MPATH_WIN32);
|
17
|
+
// Check if the path is just a filename.
|
18
|
+
bool is_just_filename = mstr_eq(mpath_filename(filepath.view, MPATH_WIN32), filepath.view);
|
19
|
+
if (!is_just_filename) {
|
20
|
+
// If the path is only a filename, we'll allow LoadLibrary() to do a
|
21
|
+
// proper full DLL search. If the path is NOT just a filename, resolve the
|
22
|
+
// given path to a single unambiguous absolute path to suppress
|
23
|
+
// LoadLibrary()'s DLL search behavior.
|
24
|
+
mstr_assign(&filepath, mpath_absolute(filepath.view, MPATH_WIN32));
|
25
|
+
}
|
26
|
+
mstr_widen_result wide = mstr_win32_widen(filepath.view);
|
27
|
+
mstr_free(filepath);
|
28
|
+
if (wide.error) {
|
29
|
+
return (mcr_dll){._native_handle = NULL, .error_string = merror_system_error_string(wide.error)};
|
30
|
+
}
|
31
|
+
HMODULE lib = LoadLibraryW(wide.wstring);
|
32
|
+
if (lib == NULL) {
|
33
|
+
return (mcr_dll){._native_handle = NULL, .error_string = merror_system_error_string(GetLastError())};
|
34
|
+
}
|
35
|
+
free(wide.wstring);
|
36
|
+
return (mcr_dll){.error_string = NULL, ._native_handle = lib};
|
44
37
|
}
|
45
38
|
|
46
|
-
void
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
FreeLibrary (dll._native_handle);
|
51
|
-
}
|
39
|
+
void mcr_dll_close_handle(mcr_dll dll) {
|
40
|
+
if (dll._native_handle) {
|
41
|
+
FreeLibrary(dll._native_handle);
|
42
|
+
}
|
52
43
|
}
|
53
44
|
|
54
|
-
void *
|
55
|
-
|
56
|
-
{
|
57
|
-
return GetProcAddress (dll._native_handle, sym);
|
45
|
+
void *mcr_dll_sym(mcr_dll dll, const char *sym) {
|
46
|
+
return GetProcAddress(dll._native_handle, sym);
|
58
47
|
}
|
59
48
|
|
60
|
-
mcr_dll_path_result
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
.error_string = merror_system_error_string (ret_error),
|
89
|
-
};
|
49
|
+
mcr_dll_path_result mcr_dll_path(mcr_dll dll) {
|
50
|
+
mstr ret_str = MSTR_NULL;
|
51
|
+
int ret_error = 0;
|
52
|
+
DWORD acc_size = 512;
|
53
|
+
while (!ret_str.data && !ret_error) {
|
54
|
+
// Loop until we allocate a large enough buffer or get an error
|
55
|
+
wchar_t *path = calloc((size_t)acc_size + 1u, sizeof(wchar_t));
|
56
|
+
SetLastError(0);
|
57
|
+
GetModuleFileNameW(dll._native_handle, path, acc_size);
|
58
|
+
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
59
|
+
// Try again with more buffer
|
60
|
+
/* DWORD is a 32-bit unsigned integer */
|
61
|
+
assert(acc_size <= UINT32_MAX / 2u);
|
62
|
+
acc_size *= 2;
|
63
|
+
} else if (GetLastError() != 0) {
|
64
|
+
ret_error = GetLastError();
|
65
|
+
} else {
|
66
|
+
mstr_narrow_result narrow = mstr_win32_narrow(path);
|
67
|
+
// GetModuleFileNameW should never return invalid Unicode:
|
68
|
+
assert(narrow.error == 0);
|
69
|
+
ret_str = narrow.string;
|
70
|
+
}
|
71
|
+
free(path);
|
72
|
+
}
|
73
|
+
return (mcr_dll_path_result){
|
74
|
+
.path = ret_str,
|
75
|
+
.error_string = merror_system_error_string(ret_error),
|
76
|
+
};
|
90
77
|
}
|
91
78
|
|
92
79
|
#endif
|
@@ -18,28 +18,20 @@
|
|
18
18
|
|
19
19
|
#ifdef _WIN32
|
20
20
|
|
21
|
-
void
|
22
|
-
|
23
|
-
{
|
24
|
-
InitializeCriticalSection (mutex);
|
21
|
+
void _mongocrypt_mutex_init(mongocrypt_mutex_t *mutex) {
|
22
|
+
InitializeCriticalSection(mutex);
|
25
23
|
}
|
26
24
|
|
27
|
-
void
|
28
|
-
|
29
|
-
{
|
30
|
-
DeleteCriticalSection (mutex);
|
25
|
+
void _mongocrypt_mutex_cleanup(mongocrypt_mutex_t *mutex) {
|
26
|
+
DeleteCriticalSection(mutex);
|
31
27
|
}
|
32
28
|
|
33
|
-
void
|
34
|
-
|
35
|
-
{
|
36
|
-
EnterCriticalSection (mutex);
|
29
|
+
void _mongocrypt_mutex_lock(mongocrypt_mutex_t *mutex) {
|
30
|
+
EnterCriticalSection(mutex);
|
37
31
|
}
|
38
32
|
|
39
|
-
void
|
40
|
-
|
41
|
-
{
|
42
|
-
LeaveCriticalSection (mutex);
|
33
|
+
void _mongocrypt_mutex_unlock(mongocrypt_mutex_t *mutex) {
|
34
|
+
LeaveCriticalSection(mutex);
|
43
35
|
}
|
44
36
|
|
45
37
|
#endif /* _WIN32 */
|
@@ -10,7 +10,7 @@
|
|
10
10
|
#ifdef _WIN32
|
11
11
|
#define EXPORT_API __declspec(dllexport)
|
12
12
|
#else
|
13
|
-
#define EXPORT_API __attribute__
|
13
|
+
#define EXPORT_API __attribute__((visibility("default")))
|
14
14
|
#endif
|
15
15
|
|
16
16
|
#define MONGO_CRYPT_SUPPORT_COMPILING
|
@@ -19,137 +19,107 @@
|
|
19
19
|
|
20
20
|
#include <bson/bson.h>
|
21
21
|
|
22
|
-
#include <cstring>
|
23
22
|
#include <cinttypes>
|
23
|
+
#include <cstring>
|
24
24
|
|
25
25
|
#ifdef _WIN32
|
26
26
|
#define MONGO_API_CALL __cdecl
|
27
27
|
#define MONGO_API_EXPORT __declspec(dllexport)
|
28
28
|
#else
|
29
29
|
#define MONGO_API_CALL [[]]
|
30
|
-
#define MONGO_API_EXPORT __attribute__
|
30
|
+
#define MONGO_API_EXPORT __attribute__((used, visibility("default")))
|
31
31
|
#endif
|
32
32
|
|
33
|
-
struct mongo_crypt_v1_status {
|
34
|
-
};
|
33
|
+
struct mongo_crypt_v1_status {};
|
35
34
|
|
36
35
|
typedef mongo_crypt_v1_status status_t;
|
37
36
|
|
38
|
-
status_t *
|
39
|
-
|
40
|
-
{
|
41
|
-
return new status_t;
|
37
|
+
status_t *mongo_crypt_v1_status_create(void) {
|
38
|
+
return new status_t;
|
42
39
|
}
|
43
40
|
|
44
|
-
void
|
45
|
-
|
46
|
-
{
|
47
|
-
delete st;
|
41
|
+
void mongo_crypt_v1_status_destroy(status_t *st) {
|
42
|
+
delete st;
|
48
43
|
}
|
49
44
|
|
50
|
-
int
|
51
|
-
|
52
|
-
{
|
53
|
-
return 0;
|
45
|
+
int mongo_crypt_v1_status_get_error(const status_t *) {
|
46
|
+
return 0;
|
54
47
|
}
|
55
48
|
|
56
|
-
const char *
|
57
|
-
|
58
|
-
{
|
59
|
-
return "nothing here";
|
49
|
+
const char *mongo_crypt_v1_status_get_explanation(const status_t *) {
|
50
|
+
return "nothing here";
|
60
51
|
}
|
61
52
|
|
62
|
-
int
|
63
|
-
|
64
|
-
{
|
65
|
-
return 0;
|
53
|
+
int mongo_crypt_v1_status_get_code(const status_t *) {
|
54
|
+
return 0;
|
66
55
|
}
|
67
56
|
|
68
|
-
struct mongo_crypt_v1_lib {
|
69
|
-
};
|
57
|
+
struct mongo_crypt_v1_lib {};
|
70
58
|
|
71
59
|
typedef mongo_crypt_v1_lib lib_t;
|
72
60
|
|
73
|
-
lib_t *
|
74
|
-
|
75
|
-
{
|
76
|
-
return new lib_t;
|
61
|
+
lib_t *mongo_crypt_v1_lib_create(status_t *) {
|
62
|
+
return new lib_t;
|
77
63
|
}
|
78
64
|
|
79
|
-
int
|
80
|
-
|
81
|
-
|
82
|
-
delete lib;
|
83
|
-
return MONGO_CRYPT_V1_SUCCESS;
|
65
|
+
int mongo_crypt_v1_lib_destroy(lib_t *lib, status_t *) {
|
66
|
+
delete lib;
|
67
|
+
return MONGO_CRYPT_V1_SUCCESS;
|
84
68
|
}
|
85
69
|
|
86
|
-
uint64_t
|
87
|
-
mongo_crypt_v1_get_version (void)
|
88
|
-
{
|
70
|
+
uint64_t mongo_crypt_v1_get_version(void) {
|
89
71
|
#ifdef UINT64_C
|
90
|
-
|
72
|
+
return UINT64_C(0x000600020001000);
|
91
73
|
#else
|
92
|
-
|
74
|
+
return 0x000600020001000;
|
93
75
|
#endif
|
94
76
|
}
|
95
77
|
|
96
|
-
|
97
|
-
|
98
|
-
mongo_crypt_v1_get_version_str (void)
|
99
|
-
{
|
100
|
-
return "stubbed-crypt_shared";
|
78
|
+
const char *mongo_crypt_v1_get_version_str(void) {
|
79
|
+
return "stubbed-crypt_shared";
|
101
80
|
}
|
102
81
|
|
103
|
-
struct mongo_crypt_v1_query_analyzer {
|
104
|
-
};
|
82
|
+
struct mongo_crypt_v1_query_analyzer {};
|
105
83
|
|
106
84
|
typedef mongo_crypt_v1_query_analyzer query_analyzer_t;
|
107
85
|
|
108
|
-
query_analyzer_t *
|
109
|
-
|
110
|
-
{
|
111
|
-
return new query_analyzer_t;
|
86
|
+
query_analyzer_t *mongo_crypt_v1_query_analyzer_create(lib_t *, status_t *) {
|
87
|
+
return new query_analyzer_t;
|
112
88
|
}
|
113
89
|
|
114
|
-
void
|
115
|
-
|
116
|
-
{
|
117
|
-
delete qa;
|
90
|
+
void mongo_crypt_v1_query_analyzer_destroy(query_analyzer_t *qa) {
|
91
|
+
delete qa;
|
118
92
|
}
|
119
93
|
|
120
|
-
uint8_t *
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
&tmp_doc,
|
137
|
-
R"({
|
94
|
+
uint8_t *mongo_crypt_v1_analyze_query(query_analyzer_t *qa,
|
95
|
+
const uint8_t *doc_bson,
|
96
|
+
const char *ns_str,
|
97
|
+
uint32_t ns_len,
|
98
|
+
uint32_t *bson_len_out,
|
99
|
+
status_t *) {
|
100
|
+
std::uint32_t doc_len;
|
101
|
+
std::copy_n(doc_bson, sizeof doc_len, reinterpret_cast<char *>(&doc_len));
|
102
|
+
doc_len = BSON_UINT32_FROM_LE(doc_len);
|
103
|
+
bson_t *given = bson_new_from_data(doc_bson, doc_len);
|
104
|
+
bson_t doc = BSON_INITIALIZER;
|
105
|
+
BSON_APPEND_DOCUMENT(&doc, "originalCommand", given);
|
106
|
+
bson_t tmp_doc;
|
107
|
+
bson_init_from_json( //
|
108
|
+
&tmp_doc,
|
109
|
+
R"({
|
138
110
|
"markedDocument": true
|
139
111
|
})",
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
112
|
+
-1,
|
113
|
+
NULL);
|
114
|
+
BSON_APPEND_DOCUMENT(&doc, "result", &tmp_doc);
|
115
|
+
uint8_t *buf = new uint8_t[doc.len];
|
116
|
+
std::copy_n(bson_get_data(&doc), doc.len, buf);
|
117
|
+
*bson_len_out = doc.len;
|
118
|
+
bson_destroy(given);
|
119
|
+
bson_destroy(&tmp_doc);
|
120
|
+
return buf;
|
149
121
|
}
|
150
122
|
|
151
|
-
void
|
152
|
-
|
153
|
-
{
|
154
|
-
delete[] bson;
|
123
|
+
void mongo_crypt_v1_bson_free(uint8_t *bson) {
|
124
|
+
delete[] bson;
|
155
125
|
}
|