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
@@ -15,68 +15,51 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
#include "mongocrypt-cache-private.h"
|
18
|
+
|
18
19
|
/* The collinfo cache.
|
19
20
|
*
|
20
21
|
* Attribute is a null terminated namespace.
|
21
22
|
* Value is a collection info doc (response to listCollections).
|
22
23
|
*/
|
23
24
|
|
25
|
+
static bool _cmp_attr(void *a, void *b, int *out) {
|
26
|
+
BSON_ASSERT_PARAM(a);
|
27
|
+
BSON_ASSERT_PARAM(b);
|
28
|
+
BSON_ASSERT_PARAM(out);
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
{
|
28
|
-
BSON_ASSERT_PARAM (a);
|
29
|
-
BSON_ASSERT_PARAM (b);
|
30
|
-
BSON_ASSERT_PARAM (out);
|
31
|
-
|
32
|
-
*out = strcmp ((char *) a, (char *) b);
|
33
|
-
return true;
|
30
|
+
*out = strcmp((char *)a, (char *)b);
|
31
|
+
return true;
|
34
32
|
}
|
35
33
|
|
34
|
+
static void *_copy_attr(void *ns) {
|
35
|
+
BSON_ASSERT_PARAM(ns);
|
36
36
|
|
37
|
-
|
38
|
-
_copy_attr (void *ns)
|
39
|
-
{
|
40
|
-
BSON_ASSERT_PARAM (ns);
|
41
|
-
|
42
|
-
return bson_strdup ((const char *) ns);
|
37
|
+
return bson_strdup((const char *)ns);
|
43
38
|
}
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
_destroy_attr (void *ns)
|
48
|
-
{
|
49
|
-
bson_free (ns);
|
40
|
+
static void _destroy_attr(void *ns) {
|
41
|
+
bson_free(ns);
|
50
42
|
}
|
51
43
|
|
44
|
+
static void *_copy_value(void *bson) {
|
45
|
+
BSON_ASSERT_PARAM(bson);
|
52
46
|
|
53
|
-
|
54
|
-
_copy_value (void *bson)
|
55
|
-
{
|
56
|
-
BSON_ASSERT_PARAM (bson);
|
57
|
-
|
58
|
-
return bson_copy (bson);
|
47
|
+
return bson_copy(bson);
|
59
48
|
}
|
60
49
|
|
61
|
-
|
62
|
-
|
63
|
-
_destroy_value (void *bson)
|
64
|
-
{
|
65
|
-
bson_destroy (bson);
|
50
|
+
static void _destroy_value(void *bson) {
|
51
|
+
bson_destroy(bson);
|
66
52
|
}
|
67
53
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
_mongocrypt_mutex_init (&cache->mutex);
|
80
|
-
cache->pair = NULL;
|
81
|
-
cache->expiration = CACHE_EXPIRATION_MS;
|
54
|
+
void _mongocrypt_cache_collinfo_init(_mongocrypt_cache_t *cache) {
|
55
|
+
BSON_ASSERT_PARAM(cache);
|
56
|
+
|
57
|
+
cache->cmp_attr = _cmp_attr;
|
58
|
+
cache->copy_attr = _copy_attr;
|
59
|
+
cache->destroy_attr = _destroy_attr;
|
60
|
+
cache->copy_value = _copy_value;
|
61
|
+
cache->destroy_value = _destroy_value;
|
62
|
+
_mongocrypt_mutex_init(&cache->mutex);
|
63
|
+
cache->pair = NULL;
|
64
|
+
cache->expiration = CACHE_EXPIRATION_MS;
|
82
65
|
}
|
@@ -25,31 +25,25 @@
|
|
25
25
|
#include "mongocrypt-status-private.h"
|
26
26
|
|
27
27
|
typedef struct {
|
28
|
-
|
29
|
-
|
28
|
+
_mongocrypt_key_doc_t *key_doc;
|
29
|
+
_mongocrypt_buffer_t decrypted_key_material;
|
30
30
|
} _mongocrypt_cache_key_value_t;
|
31
31
|
|
32
32
|
typedef struct {
|
33
|
-
|
34
|
-
|
33
|
+
_mongocrypt_buffer_t id; /* may be empty */
|
34
|
+
_mongocrypt_key_alt_name_t *alt_names; /* may be NULL */
|
35
35
|
} _mongocrypt_cache_key_attr_t;
|
36
36
|
|
37
|
-
void
|
38
|
-
_mongocrypt_cache_key_init (_mongocrypt_cache_t *cache);
|
37
|
+
void _mongocrypt_cache_key_init(_mongocrypt_cache_t *cache);
|
39
38
|
|
40
|
-
_mongocrypt_cache_key_attr_t *
|
41
|
-
|
42
|
-
_mongocrypt_key_alt_name_t *alt_names);
|
39
|
+
_mongocrypt_cache_key_attr_t *_mongocrypt_cache_key_attr_new(_mongocrypt_buffer_t *id,
|
40
|
+
_mongocrypt_key_alt_name_t *alt_names);
|
43
41
|
|
44
|
-
_mongocrypt_cache_key_value_t *
|
45
|
-
|
46
|
-
_mongocrypt_buffer_t *decrypted_key_material);
|
42
|
+
_mongocrypt_cache_key_value_t *_mongocrypt_cache_key_value_new(_mongocrypt_key_doc_t *key_doc,
|
43
|
+
_mongocrypt_buffer_t *decrypted_key_material);
|
47
44
|
|
48
|
-
void
|
49
|
-
_mongocrypt_cache_key_value_destroy (void *value);
|
50
|
-
|
51
|
-
void
|
52
|
-
_mongocrypt_cache_key_attr_destroy (_mongocrypt_cache_key_attr_t *attr);
|
45
|
+
void _mongocrypt_cache_key_value_destroy(void *value);
|
53
46
|
|
47
|
+
void _mongocrypt_cache_key_attr_destroy(_mongocrypt_cache_key_attr_t *attr);
|
54
48
|
|
55
49
|
#endif /* MONGOCRYPT_CACHE_KEY_PRIVATE_H */
|
@@ -15,176 +15,147 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
#include "mongocrypt-cache-key-private.h"
|
18
|
+
|
18
19
|
/* The key cache.
|
19
20
|
*
|
20
21
|
* Attribute is a UUID in the form of a _mongocrypt_buffer_t.
|
21
22
|
* Value contains a key document and decrypted key material.
|
22
23
|
*/
|
23
24
|
|
24
|
-
|
25
25
|
/* returns true on success. out is set to 0 if equal, non-zero otherwise. */
|
26
|
-
static bool
|
27
|
-
|
28
|
-
{
|
29
|
-
_mongocrypt_cache_key_attr_t *attr_a, *attr_b;
|
30
|
-
|
31
|
-
BSON_ASSERT_PARAM (a);
|
32
|
-
BSON_ASSERT_PARAM (b);
|
33
|
-
BSON_ASSERT_PARAM (out);
|
34
|
-
|
35
|
-
*out = 1;
|
36
|
-
attr_a = (_mongocrypt_cache_key_attr_t *) a;
|
37
|
-
attr_b = (_mongocrypt_cache_key_attr_t *) b;
|
38
|
-
|
39
|
-
if (!_mongocrypt_buffer_empty (&attr_a->id) &&
|
40
|
-
!_mongocrypt_buffer_empty (&attr_b->id)) {
|
41
|
-
if (0 == _mongocrypt_buffer_cmp (&attr_a->id, &attr_b->id)) {
|
42
|
-
*out = 0;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
if (_mongocrypt_key_alt_name_intersects (attr_a->alt_names,
|
47
|
-
attr_b->alt_names)) {
|
48
|
-
*out = 0;
|
49
|
-
}
|
50
|
-
|
51
|
-
/* No error. */
|
52
|
-
return true;
|
53
|
-
}
|
26
|
+
static bool _cmp_attr(void *a, void *b, int *out) {
|
27
|
+
_mongocrypt_cache_key_attr_t *attr_a, *attr_b;
|
54
28
|
|
29
|
+
BSON_ASSERT_PARAM(a);
|
30
|
+
BSON_ASSERT_PARAM(b);
|
31
|
+
BSON_ASSERT_PARAM(out);
|
55
32
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
_mongocrypt_cache_key_attr_t *src;
|
33
|
+
*out = 1;
|
34
|
+
attr_a = (_mongocrypt_cache_key_attr_t *)a;
|
35
|
+
attr_b = (_mongocrypt_cache_key_attr_t *)b;
|
60
36
|
|
61
|
-
|
37
|
+
if (!_mongocrypt_buffer_empty(&attr_a->id) && !_mongocrypt_buffer_empty(&attr_b->id)) {
|
38
|
+
if (0 == _mongocrypt_buffer_cmp(&attr_a->id, &attr_b->id)) {
|
39
|
+
*out = 0;
|
40
|
+
}
|
41
|
+
}
|
62
42
|
|
63
|
-
|
43
|
+
if (_mongocrypt_key_alt_name_intersects(attr_a->alt_names, attr_b->alt_names)) {
|
44
|
+
*out = 0;
|
45
|
+
}
|
64
46
|
|
65
|
-
|
47
|
+
/* No error. */
|
48
|
+
return true;
|
66
49
|
}
|
67
50
|
|
51
|
+
static void *_copy_attr(void *attr) {
|
52
|
+
_mongocrypt_cache_key_attr_t *src;
|
53
|
+
|
54
|
+
BSON_ASSERT_PARAM(attr);
|
55
|
+
|
56
|
+
src = (_mongocrypt_cache_key_attr_t *)attr;
|
68
57
|
|
69
|
-
|
70
|
-
_destroy_attr (void *attr)
|
71
|
-
{
|
72
|
-
_mongocrypt_cache_key_attr_destroy (attr);
|
58
|
+
return _mongocrypt_cache_key_attr_new(&src->id, src->alt_names);
|
73
59
|
}
|
74
60
|
|
61
|
+
static void _destroy_attr(void *attr) {
|
62
|
+
_mongocrypt_cache_key_attr_destroy(attr);
|
63
|
+
}
|
75
64
|
|
76
|
-
static void *
|
77
|
-
|
78
|
-
{
|
79
|
-
_mongocrypt_cache_key_value_t *key_value;
|
65
|
+
static void *_copy_contents(void *value) {
|
66
|
+
_mongocrypt_cache_key_value_t *key_value;
|
80
67
|
|
81
|
-
|
68
|
+
BSON_ASSERT_PARAM(value);
|
82
69
|
|
83
|
-
|
84
|
-
|
85
|
-
&key_value->decrypted_key_material);
|
70
|
+
key_value = (_mongocrypt_cache_key_value_t *)value;
|
71
|
+
return _mongocrypt_cache_key_value_new(key_value->key_doc, &key_value->decrypted_key_material);
|
86
72
|
}
|
87
73
|
|
88
|
-
static void
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
_mongocrypt_key_alt_name_t *altname;
|
93
|
-
char *hex;
|
94
|
-
|
95
|
-
BSON_ASSERT_PARAM (attr_in);
|
96
|
-
|
97
|
-
attr = (_mongocrypt_cache_key_attr_t *) attr_in;
|
98
|
-
hex = _mongocrypt_buffer_to_hex (&attr->id);
|
99
|
-
printf ("_id=%s,", hex);
|
100
|
-
printf ("keyAltNames=");
|
101
|
-
for (altname = attr->alt_names; NULL != altname; altname = altname->next) {
|
102
|
-
printf ("%s\n", _mongocrypt_key_alt_name_get_string (altname));
|
103
|
-
}
|
104
|
-
}
|
74
|
+
static void _dump_attr(void *attr_in) {
|
75
|
+
_mongocrypt_cache_key_attr_t *attr;
|
76
|
+
_mongocrypt_key_alt_name_t *altname;
|
77
|
+
char *hex;
|
105
78
|
|
79
|
+
BSON_ASSERT_PARAM(attr_in);
|
106
80
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
81
|
+
attr = (_mongocrypt_cache_key_attr_t *)attr_in;
|
82
|
+
hex = _mongocrypt_buffer_to_hex(&attr->id);
|
83
|
+
printf("_id=%s,", hex);
|
84
|
+
printf("keyAltNames=");
|
85
|
+
for (altname = attr->alt_names; NULL != altname; altname = altname->next) {
|
86
|
+
printf("%s\n", _mongocrypt_key_alt_name_get_string(altname));
|
87
|
+
}
|
88
|
+
}
|
112
89
|
|
113
|
-
|
114
|
-
|
90
|
+
_mongocrypt_cache_key_value_t *_mongocrypt_cache_key_value_new(_mongocrypt_key_doc_t *key_doc,
|
91
|
+
_mongocrypt_buffer_t *decrypted_key_material) {
|
92
|
+
_mongocrypt_cache_key_value_t *key_value;
|
115
93
|
|
116
|
-
|
117
|
-
|
94
|
+
BSON_ASSERT_PARAM(key_doc);
|
95
|
+
BSON_ASSERT_PARAM(decrypted_key_material);
|
118
96
|
|
119
|
-
|
120
|
-
|
97
|
+
key_value = bson_malloc0(sizeof(*key_value));
|
98
|
+
BSON_ASSERT(key_value);
|
121
99
|
|
122
|
-
|
123
|
-
_mongocrypt_key_doc_copy_to (key_doc, key_value->key_doc);
|
100
|
+
_mongocrypt_buffer_copy_to(decrypted_key_material, &key_value->decrypted_key_material);
|
124
101
|
|
125
|
-
|
126
|
-
|
102
|
+
key_value->key_doc = _mongocrypt_key_new();
|
103
|
+
_mongocrypt_key_doc_copy_to(key_doc, key_value->key_doc);
|
127
104
|
|
105
|
+
return key_value;
|
106
|
+
}
|
128
107
|
|
129
|
-
void
|
130
|
-
|
131
|
-
{
|
132
|
-
_mongocrypt_cache_key_value_t *key_value;
|
108
|
+
void _mongocrypt_cache_key_value_destroy(void *value) {
|
109
|
+
_mongocrypt_cache_key_value_t *key_value;
|
133
110
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
111
|
+
if (!value) {
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
key_value = (_mongocrypt_cache_key_value_t *)value;
|
115
|
+
_mongocrypt_key_destroy(key_value->key_doc);
|
116
|
+
_mongocrypt_buffer_cleanup(&key_value->decrypted_key_material);
|
117
|
+
bson_free(key_value);
|
141
118
|
}
|
142
119
|
|
143
|
-
void
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
cache->pair = NULL;
|
156
|
-
cache->expiration = CACHE_EXPIRATION_MS;
|
120
|
+
void _mongocrypt_cache_key_init(_mongocrypt_cache_t *cache) {
|
121
|
+
BSON_ASSERT_PARAM(cache);
|
122
|
+
|
123
|
+
cache->cmp_attr = _cmp_attr;
|
124
|
+
cache->copy_attr = _copy_attr;
|
125
|
+
cache->destroy_attr = _destroy_attr;
|
126
|
+
cache->copy_value = _copy_contents;
|
127
|
+
cache->destroy_value = _mongocrypt_cache_key_value_destroy;
|
128
|
+
cache->dump_attr = _dump_attr;
|
129
|
+
_mongocrypt_mutex_init(&cache->mutex);
|
130
|
+
cache->pair = NULL;
|
131
|
+
cache->expiration = CACHE_EXPIRATION_MS;
|
157
132
|
}
|
158
133
|
|
159
134
|
/* Since key cache may be looked up by either _id or keyAltName,
|
160
135
|
* "id" or "alt_names" may be NULL, but not both. Returns NULL on error. */
|
161
|
-
_mongocrypt_cache_key_attr_t *
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
attr->alt_names = _mongocrypt_key_alt_name_copy_all (alt_names);
|
178
|
-
return attr;
|
136
|
+
_mongocrypt_cache_key_attr_t *_mongocrypt_cache_key_attr_new(_mongocrypt_buffer_t *id,
|
137
|
+
_mongocrypt_key_alt_name_t *alt_names) {
|
138
|
+
_mongocrypt_cache_key_attr_t *attr;
|
139
|
+
|
140
|
+
if (NULL == id && NULL == alt_names) {
|
141
|
+
return NULL;
|
142
|
+
}
|
143
|
+
|
144
|
+
attr = bson_malloc0(sizeof(*attr));
|
145
|
+
BSON_ASSERT(attr);
|
146
|
+
|
147
|
+
if (id) {
|
148
|
+
_mongocrypt_buffer_copy_to(id, &attr->id);
|
149
|
+
}
|
150
|
+
attr->alt_names = _mongocrypt_key_alt_name_copy_all(alt_names);
|
151
|
+
return attr;
|
179
152
|
}
|
180
153
|
|
181
|
-
void
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
_mongocrypt_key_alt_name_destroy_all (attr->alt_names);
|
189
|
-
bson_free (attr);
|
154
|
+
void _mongocrypt_cache_key_attr_destroy(_mongocrypt_cache_key_attr_t *attr) {
|
155
|
+
if (!attr) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
_mongocrypt_buffer_cleanup(&attr->id);
|
159
|
+
_mongocrypt_key_alt_name_destroy_all(attr->alt_names);
|
160
|
+
bson_free(attr);
|
190
161
|
}
|
@@ -21,26 +21,20 @@
|
|
21
21
|
#include "mongocrypt-status-private.h"
|
22
22
|
|
23
23
|
typedef struct {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
bson_t *entry;
|
25
|
+
char *access_token;
|
26
|
+
int64_t expiration_time_us;
|
27
|
+
mongocrypt_mutex_t mutex; /* global lock of cache. */
|
28
28
|
} _mongocrypt_cache_oauth_t;
|
29
29
|
|
30
|
-
_mongocrypt_cache_oauth_t *
|
31
|
-
_mongocrypt_cache_oauth_new (void);
|
30
|
+
_mongocrypt_cache_oauth_t *_mongocrypt_cache_oauth_new(void);
|
32
31
|
|
33
|
-
void
|
34
|
-
_mongocrypt_cache_oauth_destroy (_mongocrypt_cache_oauth_t *cache);
|
32
|
+
void _mongocrypt_cache_oauth_destroy(_mongocrypt_cache_oauth_t *cache);
|
35
33
|
|
36
|
-
bool
|
37
|
-
_mongocrypt_cache_oauth_add (_mongocrypt_cache_oauth_t *cache,
|
38
|
-
bson_t *oauth_response,
|
39
|
-
mongocrypt_status_t *status);
|
34
|
+
bool _mongocrypt_cache_oauth_add(_mongocrypt_cache_oauth_t *cache, bson_t *oauth_response, mongocrypt_status_t *status);
|
40
35
|
|
41
36
|
/* Returns a copy of the base64 encoded oauth token, or NULL if nothing is
|
42
37
|
* cached. */
|
43
|
-
char *
|
44
|
-
_mongocrypt_cache_oauth_get (_mongocrypt_cache_oauth_t *cache);
|
38
|
+
char *_mongocrypt_cache_oauth_get(_mongocrypt_cache_oauth_t *cache);
|
45
39
|
|
46
40
|
#endif /* MONGOCRYPT_CACHE_OAUTH_PRIVATE_H */
|
@@ -24,103 +24,91 @@
|
|
24
24
|
*/
|
25
25
|
#define MONGOCRYPT_OAUTH_CACHE_EVICTION_PERIOD_US 5000 * 1000
|
26
26
|
|
27
|
-
_mongocrypt_cache_oauth_t *
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
_mongocrypt_mutex_init (&cache->mutex);
|
34
|
-
return cache;
|
27
|
+
_mongocrypt_cache_oauth_t *_mongocrypt_cache_oauth_new(void) {
|
28
|
+
_mongocrypt_cache_oauth_t *cache;
|
29
|
+
|
30
|
+
cache = bson_malloc0(sizeof(_mongocrypt_cache_oauth_t));
|
31
|
+
_mongocrypt_mutex_init(&cache->mutex);
|
32
|
+
return cache;
|
35
33
|
}
|
36
34
|
|
37
|
-
void
|
38
|
-
|
39
|
-
{
|
40
|
-
BSON_ASSERT_PARAM (cache);
|
35
|
+
void _mongocrypt_cache_oauth_destroy(_mongocrypt_cache_oauth_t *cache) {
|
36
|
+
BSON_ASSERT_PARAM(cache);
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
_mongocrypt_mutex_cleanup(&cache->mutex);
|
39
|
+
bson_destroy(cache->entry);
|
40
|
+
bson_free(cache->access_token);
|
41
|
+
bson_free(cache);
|
46
42
|
}
|
47
43
|
|
48
|
-
bool
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
89
|
-
|
90
|
-
|
91
|
-
cache->expiration_time_us = expiration_time_us;
|
92
|
-
bson_free (cache->access_token);
|
93
|
-
cache->access_token = bson_strdup (access_token);
|
94
|
-
}
|
95
|
-
_mongocrypt_mutex_unlock (&cache->mutex);
|
96
|
-
return true;
|
44
|
+
bool _mongocrypt_cache_oauth_add(_mongocrypt_cache_oauth_t *cache,
|
45
|
+
bson_t *oauth_response,
|
46
|
+
mongocrypt_status_t *status) {
|
47
|
+
bson_iter_t iter;
|
48
|
+
int64_t expiration_time_us;
|
49
|
+
int64_t cache_time_us;
|
50
|
+
int64_t expires_in_s;
|
51
|
+
int64_t expires_in_us;
|
52
|
+
const char *access_token;
|
53
|
+
|
54
|
+
BSON_ASSERT_PARAM(cache);
|
55
|
+
BSON_ASSERT_PARAM(oauth_response);
|
56
|
+
|
57
|
+
/* The OAuth spec strongly implies that the value of expires_in is positive,
|
58
|
+
* so the overflow checks in this function don't consider negative values. */
|
59
|
+
if (!bson_iter_init_find(&iter, oauth_response, "expires_in") || !BSON_ITER_HOLDS_INT(&iter)) {
|
60
|
+
CLIENT_ERR("OAuth response invalid, no 'expires_in' field.");
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
cache_time_us = bson_get_monotonic_time();
|
64
|
+
expires_in_s = bson_iter_as_int64(&iter);
|
65
|
+
BSON_ASSERT(expires_in_s <= INT64_MAX / 1000 / 1000);
|
66
|
+
expires_in_us = expires_in_s * 1000 * 1000;
|
67
|
+
BSON_ASSERT(expires_in_us <= INT64_MAX - cache_time_us
|
68
|
+
&& expires_in_us + cache_time_us > MONGOCRYPT_OAUTH_CACHE_EVICTION_PERIOD_US);
|
69
|
+
expiration_time_us = expires_in_us + cache_time_us - MONGOCRYPT_OAUTH_CACHE_EVICTION_PERIOD_US;
|
70
|
+
|
71
|
+
if (!bson_iter_init_find(&iter, oauth_response, "access_token") || !BSON_ITER_HOLDS_UTF8(&iter)) {
|
72
|
+
CLIENT_ERR("OAuth response invalid, no 'access_token' field.");
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
access_token = bson_iter_utf8(&iter, NULL);
|
76
|
+
|
77
|
+
_mongocrypt_mutex_lock(&cache->mutex);
|
78
|
+
if (expiration_time_us > cache->expiration_time_us) {
|
79
|
+
bson_destroy(cache->entry);
|
80
|
+
cache->entry = bson_copy(oauth_response);
|
81
|
+
cache->expiration_time_us = expiration_time_us;
|
82
|
+
bson_free(cache->access_token);
|
83
|
+
cache->access_token = bson_strdup(access_token);
|
84
|
+
}
|
85
|
+
_mongocrypt_mutex_unlock(&cache->mutex);
|
86
|
+
return true;
|
97
87
|
}
|
98
88
|
|
99
89
|
/* Returns a copy of the base64 encoded oauth token, or NULL if nothing is
|
100
90
|
* cached. */
|
101
|
-
char *
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
return access_token;
|
91
|
+
char *_mongocrypt_cache_oauth_get(_mongocrypt_cache_oauth_t *cache) {
|
92
|
+
char *access_token;
|
93
|
+
|
94
|
+
BSON_ASSERT_PARAM(cache);
|
95
|
+
|
96
|
+
_mongocrypt_mutex_lock(&cache->mutex);
|
97
|
+
if (!cache->entry) {
|
98
|
+
_mongocrypt_mutex_unlock(&cache->mutex);
|
99
|
+
return NULL;
|
100
|
+
}
|
101
|
+
|
102
|
+
if (bson_get_monotonic_time() >= cache->expiration_time_us) {
|
103
|
+
bson_destroy(cache->entry);
|
104
|
+
cache->entry = NULL;
|
105
|
+
cache->expiration_time_us = 0;
|
106
|
+
_mongocrypt_mutex_unlock(&cache->mutex);
|
107
|
+
return NULL;
|
108
|
+
}
|
109
|
+
|
110
|
+
access_token = bson_strdup(cache->access_token);
|
111
|
+
_mongocrypt_mutex_unlock(&cache->mutex);
|
112
|
+
|
113
|
+
return access_token;
|
126
114
|
}
|